Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions intercept/src/dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,10 +2491,19 @@ CL_API_ENTRY cl_int CL_API_CALL CLIRN(clSetProgramSpecializationConstant)(
if( pIntercept && pIntercept->dispatch().clSetProgramSpecializationConstant )
{
GET_ENQUEUE_COUNTER();
CALL_LOGGING_ENTER( "program = %p, spec_id = %u, spec_size = %zu",
std::string specConstString;
if( pIntercept->config().CallLogging )
{
pIntercept->getSpecConstantString(
spec_size,
spec_value,
specConstString );
}
CALL_LOGGING_ENTER( "program = %p, spec_id = %u, spec_size = %zu%s",
program,
spec_id,
spec_size );
spec_size,
specConstString.c_str() );
HOST_PERFORMANCE_TIMING_START();

cl_int retVal = pIntercept->dispatch().clSetProgramSpecializationConstant(
Expand Down
38 changes: 38 additions & 0 deletions intercept/src/intercept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,44 @@ void CLIntercept::getCreateSubBufferArgsString(
str = ss.str();
}

///////////////////////////////////////////////////////////////////////////////
//
void CLIntercept::getSpecConstantString(
size_t spec_size,
const void* spec_value,
std::string& str ) const
{
if( spec_value != NULL )
{
char s[256];

if( spec_size == sizeof(cl_uchar) )
{
cl_uchar* pData = (cl_uchar*)spec_value;
CLI_SPRINTF( s, 256, ", spec_value = 0x%x",
pData[0] );
}
else if( spec_size == sizeof(cl_uint) )
{
cl_uint* pData = (cl_uint*)spec_value;
CLI_SPRINTF( s, 256, ", spec_value = 0x%x",
pData[0] );
}
else if( spec_size == sizeof(cl_ulong) )
{
cl_ulong* pData = (cl_ulong*)spec_value;
CLI_SPRINTF( s, 256, ", spec_value = 0x%" PRIx64,
pData[0] );
}

str = s;
}
else
{
str = ", spec_value = NULL";
}
}

///////////////////////////////////////////////////////////////////////////////
//
void CLIntercept::logCLInfo()
Expand Down
4 changes: 4 additions & 0 deletions intercept/src/intercept.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ class CLIntercept
cl_buffer_create_type createType,
const void *createInfo,
std::string& str ) const;
void getSpecConstantString(
size_t spec_size,
const void* spec_value,
std::string& str ) const;

void logCLInfo();
void logBuild(
Expand Down
Loading