diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index c051c6a334..9b7566d0ed 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -139,12 +139,14 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint numEntries, CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint numEntries, cl_platform_id *platforms, cl_uint *numPlatforms) { + TRACING_ENTER(ClIcdGetPlatformIDsKHR, &numEntries, &platforms, &numPlatforms); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("numEntries", numEntries, "platforms", platforms, "numPlatforms", numPlatforms); retVal = clGetPlatformIDs(numEntries, platforms, numPlatforms); + TRACING_EXIT(ClIcdGetPlatformIDsKHR, &retVal); return retVal; } @@ -723,6 +725,8 @@ cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context, size_t size, void *hostPtr, cl_int *errcodeRet) { + + TRACING_ENTER(ClCreateBufferWithProperties, &context, &properties, &flags, &size, &hostPtr, &errcodeRet); if (debugManager.flags.ForceExtendedBufferSize.get() >= 1) { size += (MemoryConstants::pageSize * debugManager.flags.ForceExtendedBufferSize.get()); } @@ -741,6 +745,7 @@ cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context, ErrorCodeHelper{errcodeRet, retVal}; DBG_LOG_INPUTS("buffer", buffer); + TRACING_EXIT(ClCreateBufferWithProperties, &buffer); return buffer; } @@ -750,6 +755,8 @@ cl_mem CL_API_CALL clCreateBufferWithPropertiesINTEL(cl_context context, size_t size, void *hostPtr, cl_int *errcodeRet) { + + TRACING_ENTER(ClCreateBufferWithPropertiesINTEL, &context, &properties, &flags, &size, &hostPtr, &errcodeRet); if (debugManager.flags.ForceExtendedBufferSize.get() >= 1) { size += (MemoryConstants::pageSize * debugManager.flags.ForceExtendedBufferSize.get()); } @@ -768,6 +775,7 @@ cl_mem CL_API_CALL clCreateBufferWithPropertiesINTEL(cl_context context, ErrorCodeHelper{errcodeRet, retVal}; DBG_LOG_INPUTS("buffer", buffer); + TRACING_EXIT(ClCreateBufferWithPropertiesINTEL, &buffer); return buffer; } @@ -924,6 +932,7 @@ cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context, void *hostPtr, cl_int *errcodeRet) { + TRACING_ENTER(ClCreateImageWithProperties, &context, &properties, &flags, &imageFormat, &imageDesc, &hostPtr, &errcodeRet); DBG_LOG_INPUTS("cl_context", context, "cl_mem_properties", properties, "cl_mem_flags", flags, @@ -950,6 +959,7 @@ cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context, ErrorCodeHelper{errcodeRet, retVal}; DBG_LOG_INPUTS("image", image); + TRACING_EXIT(ClCreateImageWithProperties, &image); return image; } @@ -961,6 +971,7 @@ cl_mem CL_API_CALL clCreateImageWithPropertiesINTEL(cl_context context, void *hostPtr, cl_int *errcodeRet) { + TRACING_ENTER(ClCreateImageWithPropertiesINTEL, &context, &properties, &flags, &imageFormat, &imageDesc, &hostPtr, &errcodeRet); DBG_LOG_INPUTS("cl_context", context, "cl_mem_properties_intel", properties, "cl_mem_flags", flags, @@ -981,6 +992,7 @@ cl_mem CL_API_CALL clCreateImageWithPropertiesINTEL(cl_context context, ErrorCodeHelper{errcodeRet, retVal}; DBG_LOG_INPUTS("image", image); + TRACING_EXIT(ClCreateImageWithPropertiesINTEL, &image); return image; } @@ -1217,6 +1229,8 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context, const cl_image_desc *imageDesc, size_t *imageRowPitch, size_t *imageSlicePitch) { + + TRACING_ENTER(ClGetImageParamsINTEL, &context, &imageFormat, &imageDesc, &imageRowPitch, &imageSlicePitch); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("context", context, @@ -1247,6 +1261,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context, if (CL_SUCCESS == retVal) { retVal = Image::getImageParams(pContext, memFlags, surfaceFormat, imageDesc, imageRowPitch, imageSlicePitch); } + TRACING_EXIT(ClGetImageParamsINTEL, &retVal); return retVal; } @@ -3802,6 +3817,8 @@ clCreatePerfCountersCommandQueueINTEL( cl_command_queue_properties properties, cl_uint configuration, cl_int *errcodeRet) { + + TRACING_ENTER(ClCreatePerfCountersCommandQueueINTEL, &context, &device, &properties, &configuration, &errcodeRet); API_ENTER(nullptr); DBG_LOG_INPUTS("context", context, @@ -3816,29 +3833,35 @@ clCreatePerfCountersCommandQueueINTEL( withCastToInternal(device, &pDevice); if (pDevice == nullptr) { err.set(CL_INVALID_DEVICE); + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } if (!pDevice->getHardwareInfo().capabilityTable.instrumentationEnabled) { err.set(CL_INVALID_DEVICE); + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } if ((properties & CL_QUEUE_PROFILING_ENABLE) == 0) { err.set(CL_INVALID_QUEUE_PROPERTIES); + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } if ((properties & CL_QUEUE_ON_DEVICE) != 0) { err.set(CL_INVALID_QUEUE_PROPERTIES); + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } if ((properties & CL_QUEUE_ON_DEVICE_DEFAULT) != 0) { err.set(CL_INVALID_QUEUE_PROPERTIES); + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } if (configuration != 0) { err.set(CL_INVALID_OPERATION); + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } @@ -3852,6 +3875,7 @@ clCreatePerfCountersCommandQueueINTEL( err.set(CL_OUT_OF_RESOURCES); } } + TRACING_EXIT(ClCreatePerfCountersCommandQueueINTEL, &commandQueue); return commandQueue; } @@ -3871,6 +3895,8 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL( size_t size, cl_uint alignment, cl_int *errcodeRet) { + + TRACING_ENTER(ClHostMemAllocINTEL, &context, &properties, &size, &alignment, &errcodeRet); if (debugManager.flags.ForceExtendedUSMBufferSize.get() >= 1) { size += (MemoryConstants::pageSize * debugManager.flags.ForceExtendedUSMBufferSize.get()); } @@ -3882,6 +3908,7 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL( if (retVal != CL_SUCCESS) { err.set(retVal); + TRACING_EXIT(ClHostMemAllocINTEL, nullptr); return nullptr; } @@ -3894,21 +3921,26 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL( allocflags, ClMemoryPropertiesHelper::ObjType::unknown, *neoContext)) { err.set(CL_INVALID_VALUE); + TRACING_EXIT(ClHostMemAllocINTEL, nullptr); return nullptr; } if (size == 0 || (size > neoContext->getDevice(0u)->getSharedDeviceInfo().maxMemAllocSize && !unifiedMemoryProperties.allocationFlags.flags.allowUnrestrictedSize)) { err.set(CL_INVALID_BUFFER_SIZE); + TRACING_EXIT(ClHostMemAllocINTEL, nullptr); return nullptr; } auto allocationFromPool = neoContext->getHostMemAllocPool().createUnifiedMemoryAllocation(size, unifiedMemoryProperties); if (allocationFromPool) { + TRACING_EXIT(ClHostMemAllocINTEL, &allocationFromPool); return allocationFromPool; } - return neoContext->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); + auto ptr = neoContext->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); + TRACING_EXIT(ClHostMemAllocINTEL, &ptr); + return ptr; } CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( @@ -3918,6 +3950,8 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( size_t size, cl_uint alignment, cl_int *errcodeRet) { + + TRACING_ENTER(ClDeviceMemAllocINTEL, &context, &device, &properties, &size, &alignment, &errcodeRet); if (debugManager.flags.ForceExtendedUSMBufferSize.get() >= 1) { size += (MemoryConstants::pageSize * debugManager.flags.ForceExtendedUSMBufferSize.get()); } @@ -3930,6 +3964,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( if (retVal != CL_SUCCESS) { err.set(retVal); + TRACING_EXIT(ClDeviceMemAllocINTEL, nullptr); return nullptr; } @@ -3945,6 +3980,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( allocflags, ClMemoryPropertiesHelper::ObjType::unknown, *neoContext)) { err.set(CL_INVALID_VALUE); + TRACING_EXIT(ClDeviceMemAllocINTEL, nullptr); return nullptr; } @@ -3952,6 +3988,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( (size > neoDevice->getDevice().getDeviceInfo().maxMemAllocSize && !unifiedMemoryProperties.allocationFlags.flags.allowUnrestrictedSize)) { err.set(CL_INVALID_BUFFER_SIZE); + TRACING_EXIT(ClDeviceMemAllocINTEL, nullptr); return nullptr; } @@ -3959,10 +3996,13 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( auto allocationFromPool = neoContext->getDeviceMemAllocPool().createUnifiedMemoryAllocation(size, unifiedMemoryProperties); if (allocationFromPool) { + TRACING_EXIT(ClDeviceMemAllocINTEL, &allocationFromPool); return allocationFromPool; } - return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); + auto ptr = neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); + TRACING_EXIT(ClDeviceMemAllocINTEL, &ptr); + return ptr; } CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( @@ -3972,6 +4012,8 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( size_t size, cl_uint alignment, cl_int *errcodeRet) { + + TRACING_ENTER(ClSharedMemAllocINTEL, &context, &device, &properties, &size, &alignment, &errcodeRet); if (debugManager.flags.ForceExtendedUSMBufferSize.get() >= 1) { size += (MemoryConstants::pageSize * debugManager.flags.ForceExtendedUSMBufferSize.get()); } @@ -3983,6 +4025,7 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( if (retVal != CL_SUCCESS) { err.set(retVal); + TRACING_EXIT(ClSharedMemAllocINTEL, nullptr); return nullptr; } @@ -3995,6 +4038,7 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( if (neoDevice) { if (!neoContext->isDeviceAssociated(*neoDevice)) { err.set(CL_INVALID_DEVICE); + TRACING_EXIT(ClSharedMemAllocINTEL, nullptr); return nullptr; } unifiedMemoryPropertiesDevice = &neoDevice->getDevice(); @@ -4008,6 +4052,7 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( allocflags, ClMemoryPropertiesHelper::ObjType::unknown, *neoContext)) { err.set(CL_INVALID_VALUE); + TRACING_EXIT(ClSharedMemAllocINTEL, nullptr); return nullptr; } @@ -4015,13 +4060,14 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( (size > neoDevice->getSharedDeviceInfo().maxMemAllocSize && !unifiedMemoryProperties.allocationFlags.flags.allowUnrestrictedSize)) { err.set(CL_INVALID_BUFFER_SIZE); + TRACING_EXIT(ClSharedMemAllocINTEL, nullptr); return nullptr; } auto ptr = neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext->getSpecialQueue(neoDevice->getRootDeviceIndex())); if (!ptr) { err.set(CL_OUT_OF_RESOURCES); } - + TRACING_EXIT(ClSharedMemAllocINTEL, &ptr); return ptr; } @@ -4057,13 +4103,23 @@ CL_API_ENTRY cl_int CL_API_CALL clMemFreeCommon(cl_context context, CL_API_ENTRY cl_int CL_API_CALL clMemFreeINTEL( cl_context context, void *ptr) { - return clMemFreeCommon(context, ptr, false); + TRACING_ENTER(ClMemFreeINTEL, &context, &ptr); + auto retVal = clMemFreeCommon(context, + ptr, + false); + TRACING_EXIT(ClMemFreeINTEL, &retVal); + return retVal; } CL_API_ENTRY cl_int CL_API_CALL clMemBlockingFreeINTEL( cl_context context, void *ptr) { - return clMemFreeCommon(context, ptr, true); + TRACING_ENTER(ClMemBlockingFreeINTEL, &context, &ptr); + auto retVal = clMemFreeCommon(context, + ptr, + true); + TRACING_EXIT(ClMemBlockingFreeINTEL, &retVal); + return retVal; } CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL( @@ -4073,17 +4129,21 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL( size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) { + + TRACING_ENTER(ClGetMemAllocInfoINTEL, &context, &ptr, ¶mName, ¶mValueSize, ¶mValue, ¶mValueSizeRet); Context *pContext = nullptr; cl_int retVal = CL_SUCCESS; retVal = validateObject(withCastToInternal(context, &pContext)); - if (!pContext) { + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); return retVal; } auto allocationsManager = pContext->getSVMAllocsManager(); if (!allocationsManager) { - return CL_INVALID_VALUE; + retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } GetInfoHelper info(paramValue, paramValueSize, paramValueSizeRet); @@ -4093,69 +4153,104 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL( case CL_MEM_ALLOC_TYPE_INTEL: { if (!unifiedMemoryAllocation) { retVal = changeGetInfoStatusToCLResultType(info.set(CL_MEM_TYPE_UNKNOWN_INTEL)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); return retVal; } else if (unifiedMemoryAllocation->memoryType == InternalMemoryType::hostUnifiedMemory) { retVal = changeGetInfoStatusToCLResultType(info.set(CL_MEM_TYPE_HOST_INTEL)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); return retVal; } else if (unifiedMemoryAllocation->memoryType == InternalMemoryType::deviceUnifiedMemory) { retVal = changeGetInfoStatusToCLResultType(info.set(CL_MEM_TYPE_DEVICE_INTEL)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); return retVal; } else { retVal = changeGetInfoStatusToCLResultType(info.set(CL_MEM_TYPE_SHARED_INTEL)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); return retVal; } break; } case CL_MEM_ALLOC_BASE_PTR_INTEL: { if (!unifiedMemoryAllocation) { - return changeGetInfoStatusToCLResultType(info.set(nullptr)); + retVal = changeGetInfoStatusToCLResultType(info.set(nullptr)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } if (auto basePtrFromDevicePool = pContext->getDeviceMemAllocPool().getPooledAllocationBasePtr(ptr)) { - return changeGetInfoStatusToCLResultType(info.set(castToUint64(basePtrFromDevicePool))); + retVal = changeGetInfoStatusToCLResultType(info.set(castToUint64(basePtrFromDevicePool))); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } if (auto basePtrFromHostPool = pContext->getHostMemAllocPool().getPooledAllocationBasePtr(ptr)) { - return changeGetInfoStatusToCLResultType(info.set(castToUint64(basePtrFromHostPool))); + retVal = changeGetInfoStatusToCLResultType(info.set(castToUint64(basePtrFromHostPool))); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } - return changeGetInfoStatusToCLResultType(info.set(unifiedMemoryAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress())); + retVal = changeGetInfoStatusToCLResultType(info.set(unifiedMemoryAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress())); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } case CL_MEM_ALLOC_SIZE_INTEL: { if (!unifiedMemoryAllocation) { - return changeGetInfoStatusToCLResultType(info.set(0u)); + retVal = changeGetInfoStatusToCLResultType(info.set(0u)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } if (auto sizeFromDevicePool = pContext->getDeviceMemAllocPool().getPooledAllocationSize(ptr)) { - return changeGetInfoStatusToCLResultType(info.set(sizeFromDevicePool)); + retVal = changeGetInfoStatusToCLResultType(info.set(sizeFromDevicePool)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } if (auto sizeFromHostPool = pContext->getHostMemAllocPool().getPooledAllocationSize(ptr)) { - return changeGetInfoStatusToCLResultType(info.set(sizeFromHostPool)); + retVal = changeGetInfoStatusToCLResultType(info.set(sizeFromHostPool)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } - return changeGetInfoStatusToCLResultType(info.set(unifiedMemoryAllocation->size)); + retVal = changeGetInfoStatusToCLResultType(info.set(unifiedMemoryAllocation->size)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } case CL_MEM_ALLOC_FLAGS_INTEL: { if (!unifiedMemoryAllocation) { - return changeGetInfoStatusToCLResultType(info.set(0u)); + retVal = changeGetInfoStatusToCLResultType(info.set(0u)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } - return changeGetInfoStatusToCLResultType(info.set(unifiedMemoryAllocation->allocationFlagsProperty.allAllocFlags)); + retVal = changeGetInfoStatusToCLResultType(info.set(unifiedMemoryAllocation->allocationFlagsProperty.allAllocFlags)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } case CL_MEM_ALLOC_DEVICE_INTEL: { if (!unifiedMemoryAllocation) { - return changeGetInfoStatusToCLResultType(info.set(static_cast(nullptr))); + retVal = changeGetInfoStatusToCLResultType(info.set(static_cast(nullptr))); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } auto device = unifiedMemoryAllocation->device ? unifiedMemoryAllocation->device->getSpecializedDevice() : nullptr; - return changeGetInfoStatusToCLResultType(info.set(device)); + retVal = changeGetInfoStatusToCLResultType(info.set(device)); + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } default: { } } - return CL_INVALID_VALUE; + retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal); + return retVal; } CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgMemPointerINTEL( cl_kernel kernel, cl_uint argIndex, const void *argValue) { - return clSetKernelArgSVMPointer(kernel, argIndex, argValue); + TRACING_ENTER(ClSetKernelArgMemPointerINTEL, &kernel, &argIndex, &argValue); + auto retVal = clSetKernelArgSVMPointer(kernel, + argIndex, + argValue); + TRACING_EXIT(ClSetKernelArgMemPointerINTEL, &retVal); + return retVal; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemsetINTEL( @@ -4166,6 +4261,8 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemsetINTEL( cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { + + TRACING_ENTER(ClEnqueueMemsetINTEL, &commandQueue, &dstPtr, &value, &size, &numEventsInWaitList, &eventWaitList, &event); auto retVal = clEnqueueSVMMemFill(commandQueue, dstPtr, &value, @@ -4178,7 +4275,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemsetINTEL( auto pEvent = castToObjectOrAbort(*event); pEvent->setCmdType(CL_COMMAND_MEMSET_INTEL); } - + TRACING_EXIT(ClEnqueueMemsetINTEL, &retVal); return retVal; } @@ -4192,6 +4289,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemFillINTEL( const cl_event *eventWaitList, cl_event *event) { + TRACING_ENTER(ClEnqueueMemFillINTEL, &commandQueue, &dstPtr, &pattern, &patternSize, &size, &numEventsInWaitList, &eventWaitList, &event); auto retVal = clEnqueueSVMMemFill(commandQueue, dstPtr, pattern, @@ -4204,7 +4302,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemFillINTEL( auto pEvent = castToObjectOrAbort(*event); pEvent->setCmdType(CL_COMMAND_MEMFILL_INTEL); } - + TRACING_EXIT(ClEnqueueMemFillINTEL, &retVal); return retVal; } @@ -4217,6 +4315,8 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemcpyINTEL( cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { + + TRACING_ENTER(ClEnqueueMemcpyINTEL, &commandQueue, &blocking, &dstPtr, &srcPtr, &size, &numEventsInWaitList, &eventWaitList, &event); auto retVal = clEnqueueSVMMemcpy(commandQueue, blocking, dstPtr, @@ -4229,7 +4329,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemcpyINTEL( auto pEvent = castToObjectOrAbort(*event); pEvent->setCmdType(CL_COMMAND_MEMCPY_INTEL); } - + TRACING_EXIT(ClEnqueueMemcpyINTEL, &retVal); return retVal; } @@ -4241,6 +4341,8 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemINTEL( cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { + + TRACING_ENTER(ClEnqueueMigrateMemINTEL, &commandQueue, &ptr, &size, &flags, &numEventsInWaitList, &eventWaitList, &event); cl_int retVal = CL_SUCCESS; CommandQueue *pCommandQueue = nullptr; @@ -4264,7 +4366,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemINTEL( } } } - + TRACING_EXIT(ClEnqueueMigrateMemINTEL, &retVal); return retVal; } @@ -4276,6 +4378,8 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemAdviseINTEL( cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { + + TRACING_ENTER(ClEnqueueMemAdviseINTEL, &commandQueue, &ptr, &size, &advice, &numEventsInWaitList, &eventWaitList, &event); cl_int retVal = CL_SUCCESS; CommandQueue *pCommandQueue = nullptr; @@ -4289,7 +4393,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueMemAdviseINTEL( pEvent->setCmdType(CL_COMMAND_MEMADVISE_INTEL); } } - + TRACING_EXIT(ClEnqueueMemAdviseINTEL, &retVal); return retVal; } @@ -4298,12 +4402,17 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithPropertiesKHR(cl_context co const cl_queue_properties_khr *properties, cl_int *errcodeRet) { + TRACING_ENTER(ClCreateCommandQueueWithPropertiesKHR, &context, &device, &properties, &errcodeRet); API_ENTER(errcodeRet); DBG_LOG_INPUTS("context", context, "device", device, "properties", properties); - - return clCreateCommandQueueWithProperties(context, device, properties, errcodeRet); + auto retVal = clCreateCommandQueueWithProperties(context, + device, + properties, + errcodeRet); + TRACING_EXIT(ClCreateCommandQueueWithPropertiesKHR, &retVal); + return retVal; } cl_accelerator_intel CL_API_CALL clCreateAcceleratorINTEL( @@ -4312,6 +4421,8 @@ cl_accelerator_intel CL_API_CALL clCreateAcceleratorINTEL( size_t descriptorSize, const void *descriptor, cl_int *errcodeRet) { + + TRACING_ENTER(ClCreateAcceleratorINTEL, &context, &acceleratorType, &descriptorSize, &descriptor, &errcodeRet); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("context", context, @@ -4351,11 +4462,14 @@ cl_accelerator_intel CL_API_CALL clCreateAcceleratorINTEL( *errcodeRet = retVal; } + TRACING_EXIT(ClCreateAcceleratorINTEL, &accelerator); return accelerator; } cl_int CL_API_CALL clRetainAcceleratorINTEL( cl_accelerator_intel accelerator) { + + TRACING_ENTER(ClRetainAcceleratorINTEL, &accelerator); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("accelerator", accelerator); @@ -4373,6 +4487,7 @@ cl_int CL_API_CALL clRetainAcceleratorINTEL( pAccelerator->retain(); } while (false); + TRACING_EXIT(ClRetainAcceleratorINTEL, &retVal); return retVal; } @@ -4382,6 +4497,8 @@ cl_int CL_API_CALL clGetAcceleratorInfoINTEL( size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) { + + TRACING_ENTER(ClGetAcceleratorInfoINTEL, &accelerator, ¶mName, ¶mValueSize, ¶mValue, ¶mValueSizeRet); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("accelerator", accelerator, @@ -4404,11 +4521,14 @@ cl_int CL_API_CALL clGetAcceleratorInfoINTEL( } while (false); + TRACING_EXIT(ClGetAcceleratorInfoINTEL, &retVal); return retVal; } cl_int CL_API_CALL clReleaseAcceleratorINTEL( cl_accelerator_intel accelerator) { + + TRACING_ENTER(ClReleaseAcceleratorINTEL, &accelerator); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("accelerator", accelerator); @@ -4426,6 +4546,7 @@ cl_int CL_API_CALL clReleaseAcceleratorINTEL( pAccelerator->release(); } while (false); + TRACING_EXIT(ClReleaseAcceleratorINTEL, &retVal); return retVal; } @@ -4433,6 +4554,8 @@ cl_program CL_API_CALL clCreateProgramWithILKHR(cl_context context, const void *il, size_t length, cl_int *errcodeRet) { + + TRACING_ENTER(ClCreateProgramWithILKHR, &context, &il, &length, &errcodeRet); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("context", context, @@ -4454,6 +4577,7 @@ cl_program CL_API_CALL clCreateProgramWithILKHR(cl_context context, *errcodeRet = retVal; } + TRACING_EXIT(ClCreateProgramWithILKHR, &program); return program; } @@ -4463,12 +4587,16 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeKHR(cl_command_queue command const size_t *globalWorkOffset, const size_t *globalWorkSize, size_t *suggestedLocalWorkSize) { - return clGetKernelSuggestedLocalWorkSizeINTEL(commandQueue, - kernel, - workDim, - globalWorkOffset, - globalWorkSize, - suggestedLocalWorkSize); + + TRACING_ENTER(ClGetKernelSuggestedLocalWorkSizeKHR, &commandQueue, &kernel, &workDim, &globalWorkOffset, &globalWorkSize, &suggestedLocalWorkSize); + auto retVal = clGetKernelSuggestedLocalWorkSizeINTEL(commandQueue, + kernel, + workDim, + globalWorkOffset, + globalWorkSize, + suggestedLocalWorkSize); + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeKHR, &retVal); + return retVal; } #define RETURN_FUNC_PTR_IF_EXIST(name) \ @@ -5510,6 +5638,8 @@ cl_int CL_API_CALL clGetKernelSubGroupInfoKHR(cl_kernel kernel, size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) { + + TRACING_ENTER(ClGetKernelSubGroupInfoKHR, &kernel, &device, ¶mName, &inputValueSize, &inputValue, ¶mValueSize, ¶mValue, ¶mValueSizeRet); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("kernel", kernel, @@ -5534,6 +5664,7 @@ cl_int CL_API_CALL clGetKernelSubGroupInfoKHR(cl_kernel kernel, } if (CL_SUCCESS != retVal) { + TRACING_EXIT(ClGetKernelSubGroupInfoKHR, &retVal); return retVal; } auto pKernel = pMultiDeviceKernel->getKernel(pClDevice->getRootDeviceIndex()); @@ -5542,12 +5673,15 @@ cl_int CL_API_CALL clGetKernelSubGroupInfoKHR(cl_kernel kernel, case CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE: case CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE: case CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL: - return pKernel->getSubGroupInfo(paramName, - inputValueSize, inputValue, - paramValueSize, paramValue, - paramValueSizeRet); + retVal = pKernel->getSubGroupInfo(paramName, + inputValueSize, inputValue, + paramValueSize, paramValue, + paramValueSizeRet); + TRACING_EXIT(ClGetKernelSubGroupInfoKHR, &retVal); + return retVal; default: { retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClGetKernelSubGroupInfoKHR, &retVal); return retVal; } } @@ -5810,6 +5944,8 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueVerifyMemoryINTEL(cl_command_queue comm const void *expectedData, size_t sizeOfComparison, cl_uint comparisonMode) { + + TRACING_ENTER(ClEnqueueVerifyMemoryINTEL, &commandQueue, &allocationPtr, &expectedData, &sizeOfComparison, &comparisonMode); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("commandQueue", commandQueue, @@ -5820,12 +5956,14 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueVerifyMemoryINTEL(cl_command_queue comm if (sizeOfComparison == 0 || expectedData == nullptr || allocationPtr == nullptr) { retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClEnqueueVerifyMemoryINTEL, &retVal); return retVal; } CommandQueue *pCommandQueue = nullptr; retVal = validateObjects(withCastToInternal(commandQueue, &pCommandQueue)); if (retVal != CL_SUCCESS) { + TRACING_EXIT(ClEnqueueVerifyMemoryINTEL, &retVal); return retVal; } @@ -5838,10 +5976,14 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueVerifyMemoryINTEL(cl_command_queue comm auto &csr = pCommandQueue->getGpgpuCommandStreamReceiver(); auto status = csr.expectMemory(allocationPtr, expectedData, sizeOfComparison, comparisonMode); - return status ? CL_SUCCESS : CL_INVALID_VALUE; + retVal = status ? CL_SUCCESS : CL_INVALID_VALUE; + TRACING_EXIT(ClEnqueueVerifyMemoryINTEL, &retVal); + return retVal; } cl_int CL_API_CALL clAddCommentINTEL(cl_device_id device, const char *comment) { + + TRACING_ENTER(ClAddCommentINTEL, &device, &comment); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("device", device, "comment", comment); @@ -5849,6 +5991,7 @@ cl_int CL_API_CALL clAddCommentINTEL(cl_device_id device, const char *comment) { ClDevice *pDevice = nullptr; retVal = validateObjects(withCastToInternal(device, &pDevice)); if (retVal != CL_SUCCESS) { + TRACING_EXIT(ClAddCommentINTEL, &retVal); return retVal; } auto aubCenter = pDevice->getRootDeviceEnvironment().aubCenter.get(); @@ -5861,6 +6004,7 @@ cl_int CL_API_CALL clAddCommentINTEL(cl_device_id device, const char *comment) { aubCenter->getAubManager()->addComment(comment); } + TRACING_EXIT(ClAddCommentINTEL, &retVal); return retVal; } @@ -5870,6 +6014,7 @@ cl_int CL_API_CALL clGetDeviceGlobalVariablePointerINTEL( const char *globalVariableName, size_t *globalVariableSizeRet, void **globalVariablePointerRet) { + TRACING_ENTER(ClGetDeviceGlobalVariablePointerINTEL, &device, &program, &globalVariableName, &globalVariableSizeRet, &globalVariablePointerRet); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("device", device, "program", program, @@ -5895,6 +6040,7 @@ cl_int CL_API_CALL clGetDeviceGlobalVariablePointerINTEL( } } + TRACING_EXIT(ClGetDeviceGlobalVariablePointerINTEL, &retVal); return retVal; } @@ -5903,6 +6049,8 @@ cl_int CL_API_CALL clGetDeviceFunctionPointerINTEL( cl_program program, const char *functionName, cl_ulong *functionPointerRet) { + + TRACING_ENTER(ClGetDeviceFunctionPointerINTEL, &device, &program, &functionName, &functionPointerRet); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("device", device, "program", program, @@ -5926,12 +6074,15 @@ cl_int CL_API_CALL clGetDeviceFunctionPointerINTEL( } } + TRACING_EXIT(ClGetDeviceFunctionPointerINTEL, &retVal); return retVal; } cl_int CL_API_CALL clSetProgramReleaseCallback(cl_program program, void(CL_CALLBACK *pfnNotify)(cl_program /* program */, void * /* user_data */), void *userData) { + + TRACING_ENTER(ClSetProgramReleaseCallback, &program, &pfnNotify, &userData); DBG_LOG_INPUTS("program", program, "pfnNotify", reinterpret_cast(pfnNotify), "userData", userData); @@ -5947,10 +6098,13 @@ cl_int CL_API_CALL clSetProgramReleaseCallback(cl_program program, retVal = CL_INVALID_OPERATION; } + TRACING_EXIT(ClSetProgramReleaseCallback, &retVal); return retVal; } cl_int CL_API_CALL clSetProgramSpecializationConstant(cl_program program, cl_uint specId, size_t specSize, const void *specValue) { + + TRACING_ENTER(ClSetProgramSpecializationConstant, &program, &specId, &specSize, &specValue); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("program", program, @@ -5965,6 +6119,7 @@ cl_int CL_API_CALL clSetProgramSpecializationConstant(cl_program program, cl_uin retVal = pProgram->setProgramSpecializationConstant(specId, specSize, specValue); } + TRACING_EXIT(ClSetProgramSpecializationConstant, &retVal); return retVal; } @@ -5974,6 +6129,8 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeINTEL(cl_command_queue comma const size_t *globalWorkOffset, const size_t *globalWorkSize, size_t *suggestedLocalWorkSize) { + + TRACING_ENTER(ClGetKernelSuggestedLocalWorkSizeINTEL, &commandQueue, &kernel, &workDim, &globalWorkOffset, &globalWorkSize, &suggestedLocalWorkSize); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("commandQueue", commandQueue, "cl_kernel", kernel, @@ -5988,11 +6145,13 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeINTEL(cl_command_queue comma retVal = validateObjects(withCastToInternal(commandQueue, &pCommandQueue), withCastToInternal(kernel, &pMultiDeviceKernel)); if (CL_SUCCESS != retVal) { + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeINTEL, &retVal); return retVal; } if ((workDim == 0) || (workDim > 3)) { retVal = CL_INVALID_WORK_DIMENSION; + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeINTEL, &retVal); return retVal; } @@ -6001,22 +6160,26 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeINTEL(cl_command_queue comma (workDim > 1 && globalWorkSize[1] == 0) || (workDim > 2 && globalWorkSize[2] == 0)) { retVal = CL_INVALID_GLOBAL_WORK_SIZE; + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeINTEL, &retVal); return retVal; } auto pKernel = pMultiDeviceKernel->getKernel(pCommandQueue->getDevice().getRootDeviceIndex()); if (!pKernel->isPatched()) { retVal = CL_INVALID_KERNEL; + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeINTEL, &retVal); return retVal; } if (suggestedLocalWorkSize == nullptr) { retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeINTEL, &retVal); return retVal; } pKernel->getSuggestedLocalWorkSize(workDim, globalWorkSize, globalWorkOffset, suggestedLocalWorkSize); + TRACING_EXIT(ClGetKernelSuggestedLocalWorkSizeINTEL, &retVal); return retVal; } @@ -6026,7 +6189,7 @@ cl_int CL_API_CALL clGetKernelMaxConcurrentWorkGroupCountINTEL(cl_command_queue const size_t *globalWorkOffset, const size_t *localWorkSize, size_t *suggestedWorkGroupCount) { - + TRACING_ENTER(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &commandQueue, &kernel, &workDim, &globalWorkOffset, &localWorkSize, &suggestedWorkGroupCount); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("commandQueue", commandQueue, "cl_kernel", kernel, @@ -6042,39 +6205,47 @@ cl_int CL_API_CALL clGetKernelMaxConcurrentWorkGroupCountINTEL(cl_command_queue retVal = validateObjects(withCastToInternal(commandQueue, &pCommandQueue), withCastToInternal(kernel, &pMultiDeviceKernel)); if (CL_SUCCESS != retVal) { + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); return retVal; } if ((workDim == 0) || (workDim > 3)) { retVal = CL_INVALID_WORK_DIMENSION; + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); return retVal; } if (localWorkSize == nullptr) { retVal = CL_INVALID_WORK_GROUP_SIZE; + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); return retVal; } auto pKernel = pMultiDeviceKernel->getKernel(pCommandQueue->getDevice().getRootDeviceIndex()); if (!pKernel->isPatched()) { retVal = CL_INVALID_KERNEL; + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); return retVal; } if (suggestedWorkGroupCount == nullptr) { retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); return retVal; } for (size_t i = 0; i < workDim; i++) { if (localWorkSize[i] == 0) { - return CL_INVALID_WORK_GROUP_SIZE; + retVal = CL_INVALID_WORK_GROUP_SIZE; + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); + return retVal; } } withCastToInternal(commandQueue, &pCommandQueue); *suggestedWorkGroupCount = pKernel->getMaxWorkGroupCount(workDim, localWorkSize, pCommandQueue); + TRACING_EXIT(ClGetKernelMaxConcurrentWorkGroupCountINTEL, &retVal); return retVal; } @@ -6087,6 +6258,8 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { + + TRACING_ENTER(ClEnqueueNDCountKernelINTEL, &commandQueue, &kernel, &workDim, &globalWorkOffset, &workgroupCount, &localWorkSize, &numEventsInWaitList, &eventWaitList, &event); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("commandQueue", commandQueue, "cl_kernel", kernel, @@ -6109,6 +6282,7 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, EventWaitList(numEventsInWaitList, eventWaitList)); if (CL_SUCCESS != retVal) { + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); return retVal; } @@ -6119,7 +6293,9 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, size_t globalWorkSize[3]; for (size_t i = 0; i < workDim; i++) { if (localWorkSize[i] == 0) { - return CL_INVALID_WORK_GROUP_SIZE; + retVal = CL_INVALID_WORK_GROUP_SIZE; + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); + return retVal; } globalWorkSize[i] = workgroupCount[i] * localWorkSize[i]; } @@ -6127,6 +6303,7 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, if (pKernel->usesSyncBuffer()) { if (pKernel->getExecutionType() != KernelExecutionType::concurrent) { retVal = CL_INVALID_KERNEL; + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); return retVal; } @@ -6136,6 +6313,7 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, pCommandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, device.getRootDeviceEnvironment())) { retVal = CL_INVALID_COMMAND_QUEUE; + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); return retVal; } } @@ -6148,12 +6326,14 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, size_t maximalNumberOfWorkgroupsAllowed = pKernel->getMaxWorkGroupCount(workDim, localWorkSize, pCommandQueue); if (requestedNumberOfWorkgroups > maximalNumberOfWorkgroupsAllowed) { retVal = CL_INVALID_VALUE; + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); return retVal; } } if (!pCommandQueue->validateCapabilityForOperation(CL_QUEUE_CAPABILITY_KERNEL_INTEL, numEventsInWaitList, eventWaitList, event)) { retVal = CL_INVALID_OPERATION; + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); return retVal; } @@ -6177,12 +6357,15 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, event); DBG_LOG_INPUTS("event", getClFileLogger().getEvents(reinterpret_cast(event), 1u)); + TRACING_EXIT(ClEnqueueNDCountKernelINTEL, &retVal); return retVal; } cl_int CL_API_CALL clSetContextDestructorCallback(cl_context context, void(CL_CALLBACK *pfnNotify)(cl_context /* context */, void * /* user_data */), void *userData) { + + TRACING_ENTER(ClSetContextDestructorCallback, &context, &pfnNotify, &userData); DBG_LOG_INPUTS("program", context, "pfnNotify", reinterpret_cast(pfnNotify), "userData", userData); @@ -6198,6 +6381,7 @@ cl_int CL_API_CALL clSetContextDestructorCallback(cl_context context, retVal = pContext->setDestructorCallback(pfnNotify, userData); } + TRACING_EXIT(ClSetContextDestructorCallback, &retVal); return retVal; } @@ -6209,6 +6393,7 @@ cl_int CL_API_CALL clEnqueueExternalMemObjectsKHR( const cl_event *eventWaitList, cl_event *event) { + TRACING_ENTER(ClEnqueueExternalMemObjectsKHR, &commandQueue, &numMemObjects, &memObjects, &numEventsInWaitList, &eventWaitList, &event); cl_int retVal = CL_SUCCESS; API_ENTER(&retVal); DBG_LOG_INPUTS("commandQueue", commandQueue, @@ -6223,6 +6408,7 @@ cl_int CL_API_CALL clEnqueueExternalMemObjectsKHR( EventWaitList(numEventsInWaitList, eventWaitList)); if (retVal != CL_SUCCESS) { + TRACING_EXIT(ClEnqueueExternalMemObjectsKHR, &retVal); return retVal; } @@ -6230,12 +6416,14 @@ cl_int CL_API_CALL clEnqueueExternalMemObjectsKHR( auto pEvent = castToObject(eventWaitList[num]); if (pEvent->peekExecutionStatus() < CL_COMPLETE) { retVal = CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST; + TRACING_EXIT(ClEnqueueExternalMemObjectsKHR, &retVal); return retVal; } } retVal = pCommandQueue->enqueueMarkerWithWaitList(numEventsInWaitList, eventWaitList, event); + TRACING_EXIT(ClEnqueueExternalMemObjectsKHR, &retVal); return retVal; } @@ -6247,7 +6435,15 @@ cl_int CL_API_CALL clEnqueueAcquireExternalMemObjectsKHR( const cl_event *eventWaitList, cl_event *event) { - return clEnqueueExternalMemObjectsKHR(commandQueue, numMemObjects, memObjects, numEventsInWaitList, eventWaitList, event); + TRACING_ENTER(ClEnqueueAcquireExternalMemObjectsKHR, &commandQueue, &numMemObjects, &memObjects, &numEventsInWaitList, &eventWaitList, &event); + auto retVal = clEnqueueExternalMemObjectsKHR(commandQueue, + numMemObjects, + memObjects, + numEventsInWaitList, + eventWaitList, + event); + TRACING_EXIT(ClEnqueueAcquireExternalMemObjectsKHR, &retVal); + return retVal; } cl_int CL_API_CALL clEnqueueReleaseExternalMemObjectsKHR( @@ -6258,5 +6454,13 @@ cl_int CL_API_CALL clEnqueueReleaseExternalMemObjectsKHR( const cl_event *eventWaitList, cl_event *event) { - return clEnqueueExternalMemObjectsKHR(commandQueue, numMemObjects, memObjects, numEventsInWaitList, eventWaitList, event); + TRACING_ENTER(ClEnqueueReleaseExternalMemObjectsKHR, &commandQueue, &numMemObjects, &memObjects, &numEventsInWaitList, &eventWaitList, &event); + auto retVal = clEnqueueExternalMemObjectsKHR(commandQueue, + numMemObjects, + memObjects, + numEventsInWaitList, + eventWaitList, + event); + TRACING_EXIT(ClEnqueueReleaseExternalMemObjectsKHR, &retVal); + return retVal; } diff --git a/opencl/source/tracing/tracing_notify.h b/opencl/source/tracing/tracing_notify.h index 4af3070b43..a28b3b8bdf 100644 --- a/opencl/source/tracing/tracing_notify.h +++ b/opencl/source/tracing/tracing_notify.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -644,6 +644,2776 @@ class ClCreateContextFromTypeTracer { TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; }; +class ClMemFreeINTELTracer { + public: + ClMemFreeINTELTracer() {} + + void enter(cl_context *context, + void **ptr) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.ptr = ptr; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clMemFreeINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clMemFreeINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clMemFreeINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clMemFreeINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clMemFreeINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClMemFreeINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clMemFreeINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClIcdGetPlatformIDsKHRTracer { + public: + ClIcdGetPlatformIDsKHRTracer() {} + + void enter(cl_uint *numEntries, + cl_platform_id **platforms, + cl_uint **numPlatforms) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.numEntries = numEntries; + params.platforms = platforms; + params.numPlatforms = numPlatforms; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clIcdGetPlatformIDsKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clIcdGetPlatformIDsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clIcdGetPlatformIDsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clIcdGetPlatformIDsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clIcdGetPlatformIDsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClIcdGetPlatformIDsKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clIcdGetPlatformIDsKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateBufferWithPropertiesINTELTracer { + public: + ClCreateBufferWithPropertiesINTELTracer() {} + + void enter(cl_context *context, + const cl_mem_properties **properties, + cl_mem_flags *flags, + size_t *size, + void **hostPtr, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.properties = properties; + params.flags = flags; + params.size = size; + params.hostPtr = hostPtr; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateBufferWithPropertiesINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateBufferWithPropertiesINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateBufferWithPropertiesINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_mem *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateBufferWithPropertiesINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateBufferWithPropertiesINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateBufferWithPropertiesINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateBufferWithPropertiesINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateBufferWithPropertiesTracer { + public: + ClCreateBufferWithPropertiesTracer() {} + + void enter(cl_context *context, + const cl_mem_properties **properties, + cl_mem_flags *flags, + size_t *size, + void **hostPtr, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.properties = properties; + params.flags = flags; + params.size = size; + params.hostPtr = hostPtr; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateBufferWithProperties"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateBufferWithProperties)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateBufferWithProperties, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_mem *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateBufferWithProperties)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateBufferWithProperties, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateBufferWithPropertiesTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateBufferWithProperties params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateImageWithPropertiesTracer { + public: + ClCreateImageWithPropertiesTracer() {} + + void enter(cl_context *context, + const cl_mem_properties_intel **properties, + cl_mem_flags *flags, + const cl_image_format **imageFormat, + const cl_image_desc **imageDesc, + void **hostPtr, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.properties = properties; + params.flags = flags; + params.imageFormat = imageFormat; + params.imageDesc = imageDesc; + params.hostPtr = hostPtr; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateImageWithProperties"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateImageWithProperties)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateImageWithProperties, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_mem *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateImageWithProperties)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateImageWithProperties, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateImageWithPropertiesTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateImageWithProperties params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateImageWithPropertiesINTELTracer { + public: + ClCreateImageWithPropertiesINTELTracer() {} + + void enter(cl_context *context, + const cl_mem_properties_intel **properties, + cl_mem_flags *flags, + const cl_image_format **imageFormat, + const cl_image_desc **imageDesc, + void **hostPtr, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.properties = properties; + params.flags = flags; + params.imageFormat = imageFormat; + params.imageDesc = imageDesc; + params.hostPtr = hostPtr; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateImageWithPropertiesINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateImageWithPropertiesINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateImageWithPropertiesINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_mem *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateImageWithPropertiesINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateImageWithPropertiesINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateImageWithPropertiesINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateImageWithPropertiesINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetImageParamsINTELTracer { + public: + ClGetImageParamsINTELTracer() {} + + void enter(cl_context *context, + const cl_image_format **imageFormat, + const cl_image_desc **imageDesc, + size_t **imageRowPitch, + size_t **imageSlicePitch) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.imageFormat = imageFormat; + params.imageDesc = imageDesc; + params.imageRowPitch = imageRowPitch; + params.imageSlicePitch = imageSlicePitch; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetImageParamsINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetImageParamsINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetImageParamsINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetImageParamsINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetImageParamsINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetImageParamsINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetImageParamsINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreatePerfCountersCommandQueueINTELTracer { + public: + ClCreatePerfCountersCommandQueueINTELTracer() {} + + void enter(cl_context *context, + cl_device_id *device, + cl_command_queue_properties *properties, + cl_uint *configuration, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.device = device; + params.properties = properties; + params.configuration = configuration; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreatePerfCountersCommandQueueINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreatePerfCountersCommandQueueINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreatePerfCountersCommandQueueINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_command_queue *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreatePerfCountersCommandQueueINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreatePerfCountersCommandQueueINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreatePerfCountersCommandQueueINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreatePerfCountersCommandQueueINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClHostMemAllocINTELTracer { + public: + ClHostMemAllocINTELTracer() {} + + void enter(cl_context *context, + const cl_mem_properties_intel **properties, + size_t *size, + cl_uint *alignment, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.properties = properties; + params.size = size; + params.alignment = alignment; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clHostMemAllocINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clHostMemAllocINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clHostMemAllocINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(void **retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clHostMemAllocINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clHostMemAllocINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClHostMemAllocINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clHostMemAllocINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClDeviceMemAllocINTELTracer { + public: + ClDeviceMemAllocINTELTracer() {} + + void enter(cl_context *context, + cl_device_id *device, + const cl_mem_properties_intel **properties, + size_t *size, + cl_uint *alignment, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.device = device; + params.properties = properties; + params.size = size; + params.alignment = alignment; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clDeviceMemAllocINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clDeviceMemAllocINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clDeviceMemAllocINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(void **retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clDeviceMemAllocINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clDeviceMemAllocINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClDeviceMemAllocINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clDeviceMemAllocINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClSharedMemAllocINTELTracer { + public: + ClSharedMemAllocINTELTracer() {} + + void enter(cl_context *context, + cl_device_id *device, + const cl_mem_properties_intel **properties, + size_t *size, + cl_uint *alignment, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.device = device; + params.properties = properties; + params.size = size; + params.alignment = alignment; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clSharedMemAllocINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSharedMemAllocINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSharedMemAllocINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(void **retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSharedMemAllocINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSharedMemAllocINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClSharedMemAllocINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clSharedMemAllocINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClMemBlockingFreeINTELTracer { + public: + ClMemBlockingFreeINTELTracer() {} + + void enter(cl_context *context, + void **ptr) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.ptr = ptr; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clMemBlockingFreeINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clMemBlockingFreeINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clMemBlockingFreeINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clMemBlockingFreeINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clMemBlockingFreeINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClMemBlockingFreeINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clMemBlockingFreeINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetMemAllocInfoINTELTracer { + public: + ClGetMemAllocInfoINTELTracer() {} + + void enter(cl_context *context, + const void **ptr, + cl_mem_info_intel *paramName, + size_t *paramValueSize, + void **paramValue, + size_t **paramValueSizeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.ptr = ptr; + params.paramName = paramName; + params.paramValueSize = paramValueSize; + params.paramValue = paramValue; + params.paramValueSizeRet = paramValueSizeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetMemAllocInfoINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetMemAllocInfoINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetMemAllocInfoINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetMemAllocInfoINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetMemAllocInfoINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetMemAllocInfoINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetMemAllocInfoINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClSetKernelArgMemPointerINTELTracer { + public: + ClSetKernelArgMemPointerINTELTracer() {} + + void enter(cl_kernel *kernel, + cl_uint *argIndex, + const void **argValue) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.kernel = kernel; + params.argIndex = argIndex; + params.argValue = argValue; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clSetKernelArgMemPointerINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetKernelArgMemPointerINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetKernelArgMemPointerINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetKernelArgMemPointerINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetKernelArgMemPointerINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClSetKernelArgMemPointerINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clSetKernelArgMemPointerINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueMemsetINTELTracer { + public: + ClEnqueueMemsetINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + void **dstPtr, + cl_int *value, + size_t *size, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.dstPtr = dstPtr; + params.value = value; + params.size = size; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueMemsetINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemsetINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemsetINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemsetINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemsetINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueMemsetINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueMemsetINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueMemFillINTELTracer { + public: + ClEnqueueMemFillINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + void **dstPtr, + const void **pattern, + size_t *patternSize, + size_t *size, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.dstPtr = dstPtr; + params.pattern = pattern; + params.patternSize = patternSize; + params.size = size; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueMemFillINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemFillINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemFillINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemFillINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemFillINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueMemFillINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueMemFillINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueMemcpyINTELTracer { + public: + ClEnqueueMemcpyINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_bool *blocking, + void **dstPtr, + const void **srcPtr, + size_t *size, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.blocking = blocking; + params.dstPtr = dstPtr; + params.srcPtr = srcPtr; + params.size = size; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueMemcpyINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemcpyINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemcpyINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemcpyINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemcpyINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueMemcpyINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueMemcpyINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueMigrateMemINTELTracer { + public: + ClEnqueueMigrateMemINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + const void **ptr, + size_t *size, + cl_mem_migration_flags *flags, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.ptr = ptr; + params.size = size; + params.flags = flags; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueMigrateMemINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMigrateMemINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMigrateMemINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMigrateMemINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMigrateMemINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueMigrateMemINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueMigrateMemINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueMemAdviseINTELTracer { + public: + ClEnqueueMemAdviseINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + const void **ptr, + size_t *size, + cl_mem_advice_intel *advice, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.ptr = ptr; + params.size = size; + params.advice = advice; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueMemAdviseINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemAdviseINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemAdviseINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueMemAdviseINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueMemAdviseINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueMemAdviseINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueMemAdviseINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateCommandQueueWithPropertiesKHRTracer { + public: + ClCreateCommandQueueWithPropertiesKHRTracer() {} + + void enter(cl_context *context, + cl_device_id *device, + const cl_queue_properties_khr **properties, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.device = device; + params.properties = properties; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateCommandQueueWithPropertiesKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateCommandQueueWithPropertiesKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateCommandQueueWithPropertiesKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_command_queue *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateCommandQueueWithPropertiesKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateCommandQueueWithPropertiesKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateCommandQueueWithPropertiesKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateCommandQueueWithPropertiesKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateAcceleratorINTELTracer { + public: + ClCreateAcceleratorINTELTracer() {} + + void enter(cl_context *context, + cl_accelerator_type_intel *acceleratorType, + size_t *descriptorSize, + const void **descriptor, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.acceleratorType = acceleratorType; + params.descriptorSize = descriptorSize; + params.descriptor = descriptor; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateAcceleratorINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateAcceleratorINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateAcceleratorINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_accelerator_intel *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateAcceleratorINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateAcceleratorINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateAcceleratorINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateAcceleratorINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClRetainAcceleratorINTELTracer { + public: + ClRetainAcceleratorINTELTracer() {} + + void enter(cl_accelerator_intel *accelerator) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.accelerator = accelerator; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clRetainAcceleratorINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clRetainAcceleratorINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clRetainAcceleratorINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clRetainAcceleratorINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clRetainAcceleratorINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClRetainAcceleratorINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clRetainAcceleratorINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetAcceleratorInfoINTELTracer { + public: + ClGetAcceleratorInfoINTELTracer() {} + + void enter(cl_accelerator_intel *accelerator, + cl_accelerator_info_intel *paramName, + size_t *paramValueSize, + void **paramValue, + size_t **paramValueSizeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.accelerator = accelerator; + params.paramName = paramName; + params.paramValueSize = paramValueSize; + params.paramValue = paramValue; + params.paramValueSizeRet = paramValueSizeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetAcceleratorInfoINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetAcceleratorInfoINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetAcceleratorInfoINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetAcceleratorInfoINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetAcceleratorInfoINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetAcceleratorInfoINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetAcceleratorInfoINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClReleaseAcceleratorINTELTracer { + public: + ClReleaseAcceleratorINTELTracer() {} + + void enter(cl_accelerator_intel *accelerator) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.accelerator = accelerator; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clReleaseAcceleratorINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clReleaseAcceleratorINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clReleaseAcceleratorINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clReleaseAcceleratorINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clReleaseAcceleratorINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClReleaseAcceleratorINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clReleaseAcceleratorINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClCreateProgramWithILKHRTracer { + public: + ClCreateProgramWithILKHRTracer() {} + + void enter(cl_context *context, + const void **il, + size_t *length, + cl_int **errcodeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.il = il; + params.length = length; + params.errcodeRet = errcodeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clCreateProgramWithILKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateProgramWithILKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateProgramWithILKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_program *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clCreateProgramWithILKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clCreateProgramWithILKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClCreateProgramWithILKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clCreateProgramWithILKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetKernelSuggestedLocalWorkSizeKHRTracer { + public: + ClGetKernelSuggestedLocalWorkSizeKHRTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_kernel *kernel, + cl_uint *workDim, + const size_t **globalWorkOffset, + const size_t **globalWorkSize, + size_t **suggestedLocalWorkSize) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.kernel = kernel; + params.workDim = workDim; + params.globalWorkOffset = globalWorkOffset; + params.globalWorkSize = globalWorkSize; + params.suggestedLocalWorkSize = suggestedLocalWorkSize; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetKernelSuggestedLocalWorkSizeKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetKernelSuggestedLocalWorkSizeKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetKernelSuggestedLocalWorkSizeKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetKernelSubGroupInfoKHRTracer { + public: + ClGetKernelSubGroupInfoKHRTracer() {} + + void enter(cl_kernel *kernel, + cl_device_id *device, + cl_kernel_sub_group_info *paramName, + size_t *inputValueSize, + const void **inputValue, + size_t *paramValueSize, + void **paramValue, + size_t **paramValueSizeRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.kernel = kernel; + params.device = device; + params.paramName = paramName; + params.inputValueSize = inputValueSize; + params.inputValue = inputValue; + params.paramValueSize = paramValueSize; + params.paramValue = paramValue; + params.paramValueSizeRet = paramValueSizeRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetKernelSubGroupInfoKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelSubGroupInfoKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelSubGroupInfoKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelSubGroupInfoKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelSubGroupInfoKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetKernelSubGroupInfoKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetKernelSubGroupInfoKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueVerifyMemoryINTELTracer { + public: + ClEnqueueVerifyMemoryINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + const void **allocationPtr, + const void **expectedData, + size_t *sizeOfComparison, + cl_uint *comparisonMode) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.allocationPtr = allocationPtr; + params.expectedData = expectedData; + params.sizeOfComparison = sizeOfComparison; + params.comparisonMode = comparisonMode; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueVerifyMemoryINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueVerifyMemoryINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueVerifyMemoryINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueVerifyMemoryINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueVerifyMemoryINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueVerifyMemoryINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueVerifyMemoryINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClAddCommentINTELTracer { + public: + ClAddCommentINTELTracer() {} + + void enter(cl_device_id *device, + const char **comment) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.device = device; + params.comment = comment; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clAddCommentINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clAddCommentINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clAddCommentINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clAddCommentINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clAddCommentINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClAddCommentINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clAddCommentINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetDeviceGlobalVariablePointerINTELTracer { + public: + ClGetDeviceGlobalVariablePointerINTELTracer() {} + + void enter(cl_device_id *device, + cl_program *program, + const char **globalVariableName, + size_t **globalVariableSizeRet, + void ***globalVariablePointerRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.device = device; + params.program = program; + params.globalVariableName = globalVariableName; + params.globalVariableSizeRet = globalVariableSizeRet; + params.globalVariablePointerRet = globalVariablePointerRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetDeviceGlobalVariablePointerINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetDeviceGlobalVariablePointerINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetDeviceGlobalVariablePointerINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetDeviceGlobalVariablePointerINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetDeviceGlobalVariablePointerINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetDeviceGlobalVariablePointerINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetDeviceGlobalVariablePointerINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetDeviceFunctionPointerINTELTracer { + public: + ClGetDeviceFunctionPointerINTELTracer() {} + + void enter(cl_device_id *device, + cl_program *program, + const char **functionName, + cl_ulong **functionPointerRet) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.device = device; + params.program = program; + params.functionName = functionName; + params.functionPointerRet = functionPointerRet; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetDeviceFunctionPointerINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetDeviceFunctionPointerINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetDeviceFunctionPointerINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetDeviceFunctionPointerINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetDeviceFunctionPointerINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetDeviceFunctionPointerINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetDeviceFunctionPointerINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClSetProgramReleaseCallbackTracer { + public: + ClSetProgramReleaseCallbackTracer() {} + + void enter(cl_program *program, + void(CL_CALLBACK **pfnNotify)(cl_program, void *), + void **userData) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.program = program; + params.pfnNotify = pfnNotify; + params.userData = userData; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clSetProgramReleaseCallback"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetProgramReleaseCallback)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetProgramReleaseCallback, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetProgramReleaseCallback)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetProgramReleaseCallback, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClSetProgramReleaseCallbackTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clSetProgramReleaseCallback params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClSetProgramSpecializationConstantTracer { + public: + ClSetProgramSpecializationConstantTracer() {} + + void enter(cl_program *program, + cl_uint *specId, + size_t *specSize, + const void **specValue) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.program = program; + params.specId = specId; + params.specSize = specSize; + params.specValue = specValue; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clSetProgramSpecializationConstant"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetProgramSpecializationConstant)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetProgramSpecializationConstant, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetProgramSpecializationConstant)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetProgramSpecializationConstant, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClSetProgramSpecializationConstantTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clSetProgramSpecializationConstant params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetKernelSuggestedLocalWorkSizeINTELTracer { + public: + ClGetKernelSuggestedLocalWorkSizeINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_kernel *kernel, + cl_uint *workDim, + const size_t **globalWorkOffset, + const size_t **globalWorkSize, + size_t **suggestedLocalWorkSize) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.kernel = kernel; + params.workDim = workDim; + params.globalWorkOffset = globalWorkOffset; + params.globalWorkSize = globalWorkSize; + params.suggestedLocalWorkSize = suggestedLocalWorkSize; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetKernelSuggestedLocalWorkSizeINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetKernelSuggestedLocalWorkSizeINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetKernelSuggestedLocalWorkSizeINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClGetKernelMaxConcurrentWorkGroupCountINTELTracer { + public: + ClGetKernelMaxConcurrentWorkGroupCountINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_kernel *kernel, + cl_uint *workDim, + const size_t **globalWorkOffset, + const size_t **localWorkSize, + size_t **suggestedWorkGroupCount) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.kernel = kernel; + params.workDim = workDim; + params.globalWorkOffset = globalWorkOffset; + params.localWorkSize = localWorkSize; + params.suggestedWorkGroupCount = suggestedWorkGroupCount; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clGetKernelMaxConcurrentWorkGroupCountINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelMaxConcurrentWorkGroupCountINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelMaxConcurrentWorkGroupCountINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clGetKernelMaxConcurrentWorkGroupCountINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clGetKernelMaxConcurrentWorkGroupCountINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClGetKernelMaxConcurrentWorkGroupCountINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clGetKernelMaxConcurrentWorkGroupCountINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueNDCountKernelINTELTracer { + public: + ClEnqueueNDCountKernelINTELTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_kernel *kernel, + cl_uint *workDim, + const size_t **globalWorkOffset, + const size_t **workgroupCount, + const size_t **localWorkSize, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.kernel = kernel; + params.workDim = workDim; + params.globalWorkOffset = globalWorkOffset; + params.workgroupCount = workgroupCount; + params.localWorkSize = localWorkSize; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueNDCountKernelINTEL"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueNDCountKernelINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueNDCountKernelINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueNDCountKernelINTEL)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueNDCountKernelINTEL, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueNDCountKernelINTELTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueNDCountKernelINTEL params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClSetContextDestructorCallbackTracer { + public: + ClSetContextDestructorCallbackTracer() {} + + void enter(cl_context *context, + void(CL_CALLBACK **pfnNotify)(cl_context, void *), + void **userData) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.context = context; + params.pfnNotify = pfnNotify; + params.userData = userData; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clSetContextDestructorCallback"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetContextDestructorCallback)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetContextDestructorCallback, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clSetContextDestructorCallback)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clSetContextDestructorCallback, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClSetContextDestructorCallbackTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clSetContextDestructorCallback params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueExternalMemObjectsKHRTracer { + public: + ClEnqueueExternalMemObjectsKHRTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_uint *numMemObjects, + const cl_mem **memObjects, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.numMemObjects = numMemObjects; + params.memObjects = memObjects; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueExternalMemObjectsKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueExternalMemObjectsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueExternalMemObjectsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueExternalMemObjectsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueExternalMemObjectsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueExternalMemObjectsKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueExternalMemObjectsKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueAcquireExternalMemObjectsKHRTracer { + public: + ClEnqueueAcquireExternalMemObjectsKHRTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_uint *numMemObjects, + const cl_mem **memObjects, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.numMemObjects = numMemObjects; + params.memObjects = memObjects; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueAcquireExternalMemObjectsKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueAcquireExternalMemObjectsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueAcquireExternalMemObjectsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueAcquireExternalMemObjectsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueAcquireExternalMemObjectsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueAcquireExternalMemObjectsKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueAcquireExternalMemObjectsKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + +class ClEnqueueReleaseExternalMemObjectsKHRTracer { + public: + ClEnqueueReleaseExternalMemObjectsKHRTracer() {} + + void enter(cl_command_queue *commandQueue, + cl_uint *numMemObjects, + const cl_mem **memObjects, + cl_uint *numEventsInWaitList, + const cl_event **eventWaitList, + cl_event **event) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_NOTHING_CALLED); + + params.commandQueue = commandQueue; + params.numMemObjects = numMemObjects; + params.memObjects = memObjects; + params.numEventsInWaitList = numEventsInWaitList; + params.eventWaitList = eventWaitList; + params.event = event; + + data.site = CL_CALLBACK_SITE_ENTER; + data.correlationId = tracingCorrelationId.fetch_add(1, std::memory_order_acq_rel); + data.functionName = "clEnqueueReleaseExternalMemObjectsKHR"; + data.functionParams = static_cast(¶ms); + data.functionReturnValue = nullptr; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueReleaseExternalMemObjectsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueReleaseExternalMemObjectsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_ENTER_CALLED; + } + + void exit(cl_int *retVal) { + DEBUG_BREAK_IF(state != TRACING_NOTIFY_STATE_ENTER_CALLED); + data.site = CL_CALLBACK_SITE_EXIT; + data.functionReturnValue = retVal; + + size_t i = 0; + DEBUG_BREAK_IF(tracingHandle[0] == nullptr); + while (i < tracingMaxHandleCount && tracingHandle[i] != nullptr) { + TracingHandle *handle = tracingHandle[i]; + DEBUG_BREAK_IF(handle == nullptr); + if (handle->getTracingPoint(CL_FUNCTION_clEnqueueReleaseExternalMemObjectsKHR)) { + data.correlationData = correlationData + i; + handle->call(CL_FUNCTION_clEnqueueReleaseExternalMemObjectsKHR, &data); + } + ++i; + } + + state = TRACING_NOTIFY_STATE_EXIT_CALLED; + } + + ~ClEnqueueReleaseExternalMemObjectsKHRTracer() { + DEBUG_BREAK_IF(state == TRACING_NOTIFY_STATE_ENTER_CALLED); + } + + private: + cl_params_clEnqueueReleaseExternalMemObjectsKHR params{}; + cl_callback_data data{}; + uint64_t correlationData[tracingMaxHandleCount]; + TracingNotifyState state = TRACING_NOTIFY_STATE_NOTHING_CALLED; +}; + class ClCreateImageTracer { public: ClCreateImageTracer() {} diff --git a/opencl/source/tracing/tracing_types.h b/opencl/source/tracing/tracing_types.h index 1e41b4a68d..d14466685e 100644 --- a/opencl/source/tracing/tracing_types.h +++ b/opencl/source/tracing/tracing_types.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "CL/cl.h" #include "CL/cl_gl.h" +#include struct _cl_tracing_handle; typedef _cl_tracing_handle *cl_tracing_handle; @@ -164,7 +165,47 @@ enum ClFunctionId { CL_FUNCTION_clUnloadCompiler = 115, CL_FUNCTION_clUnloadPlatformCompiler = 116, CL_FUNCTION_clWaitForEvents = 117, - CL_FUNCTION_COUNT = 118, + CL_FUNCTION_clMemFreeINTEL = 118, + CL_FUNCTION_clIcdGetPlatformIDsKHR = 119, + CL_FUNCTION_clCreateBufferWithProperties = 120, + CL_FUNCTION_clCreateBufferWithPropertiesINTEL = 121, + CL_FUNCTION_clCreateImageWithProperties = 122, + CL_FUNCTION_clCreateImageWithPropertiesINTEL = 123, + CL_FUNCTION_clGetImageParamsINTEL = 124, + CL_FUNCTION_clCreatePerfCountersCommandQueueINTEL = 125, + CL_FUNCTION_clHostMemAllocINTEL = 126, + CL_FUNCTION_clDeviceMemAllocINTEL = 127, + CL_FUNCTION_clSharedMemAllocINTEL = 128, + CL_FUNCTION_clMemBlockingFreeINTEL = 129, + CL_FUNCTION_clGetMemAllocInfoINTEL = 130, + CL_FUNCTION_clSetKernelArgMemPointerINTEL = 131, + CL_FUNCTION_clEnqueueMemsetINTEL = 132, + CL_FUNCTION_clEnqueueMemFillINTEL = 133, + CL_FUNCTION_clEnqueueMemcpyINTEL = 134, + CL_FUNCTION_clEnqueueMigrateMemINTEL = 135, + CL_FUNCTION_clEnqueueMemAdviseINTEL = 136, + CL_FUNCTION_clCreateCommandQueueWithPropertiesKHR = 137, + CL_FUNCTION_clCreateAcceleratorINTEL = 138, + CL_FUNCTION_clRetainAcceleratorINTEL = 149, + CL_FUNCTION_clGetAcceleratorInfoINTEL = 140, + CL_FUNCTION_clReleaseAcceleratorINTEL = 141, + CL_FUNCTION_clCreateProgramWithILKHR = 142, + CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeKHR = 143, + CL_FUNCTION_clGetKernelSubGroupInfoKHR = 144, + CL_FUNCTION_clEnqueueVerifyMemoryINTEL = 145, + CL_FUNCTION_clAddCommentINTEL = 146, + CL_FUNCTION_clGetDeviceGlobalVariablePointerINTEL = 147, + CL_FUNCTION_clGetDeviceFunctionPointerINTEL = 148, + CL_FUNCTION_clSetProgramReleaseCallback = 149, + CL_FUNCTION_clSetProgramSpecializationConstant = 150, + CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeINTEL = 151, + CL_FUNCTION_clGetKernelMaxConcurrentWorkGroupCountINTEL = 152, + CL_FUNCTION_clEnqueueNDCountKernelINTEL = 153, + CL_FUNCTION_clSetContextDestructorCallback = 154, + CL_FUNCTION_clEnqueueExternalMemObjectsKHR = 155, + CL_FUNCTION_clEnqueueAcquireExternalMemObjectsKHR = 156, + CL_FUNCTION_clEnqueueReleaseExternalMemObjectsKHR = 157, + CL_FUNCTION_COUNT = 158 }; /*! @@ -244,6 +285,331 @@ typedef struct _cl_params_clCreateContextFromType { cl_int **errcodeRet; } cl_params_clCreateContextFromType; +typedef struct _cl_params_clMemFreeINTEL { + cl_context *context; + void **ptr; +} cl_params_clMemFreeINTEL; + +typedef struct _clIcdGetPlatformIDsKHR { + cl_uint *numEntries; + cl_platform_id **platforms; + cl_uint **numPlatforms; +} cl_params_clIcdGetPlatformIDsKHR; + +typedef struct _clCreateBufferWithPropertiesINTEL { + cl_context *context; + const cl_mem_properties_intel **properties; + cl_mem_flags *flags; + size_t *size; + void **hostPtr; + cl_int **errcodeRet; +} cl_params_clCreateBufferWithPropertiesINTEL; + +typedef struct _clCreateImageWithProperties { + cl_context *context; + const cl_mem_properties **properties; + cl_mem_flags *flags; + const cl_image_format **imageFormat; + const cl_image_desc **imageDesc; + void **hostPtr; + cl_int **errcodeRet; +} cl_params_clCreateImageWithProperties; + +typedef struct _clCreateImageWithPropertiesINTEL { + cl_context *context; + const cl_mem_properties_intel **properties; + cl_mem_flags *flags; + const cl_image_format **imageFormat; + const cl_image_desc **imageDesc; + void **hostPtr; + cl_int **errcodeRet; +} cl_params_clCreateImageWithPropertiesINTEL; + +typedef struct _clGetImageParamsINTEL { + cl_context *context; + const cl_image_format **imageFormat; + const cl_image_desc **imageDesc; + size_t **imageRowPitch; + size_t **imageSlicePitch; +} cl_params_clGetImageParamsINTEL; + +typedef struct _clCreatePerfCountersCommandQueueINTEL { + cl_context *context; + cl_device_id *device; + cl_command_queue_properties *properties; + cl_uint *configuration; + cl_int **errcodeRet; +} cl_params_clCreatePerfCountersCommandQueueINTEL; + +typedef struct _clHostMemAllocINTEL { + cl_context *context; + const cl_mem_properties_intel **properties; + size_t *size; + cl_uint *alignment; + cl_int **errcodeRet; +} cl_params_clHostMemAllocINTEL; + +typedef struct _clDeviceMemAllocINTEL { + cl_context *context; + cl_device_id *device; + const cl_mem_properties_intel **properties; + size_t *size; + cl_uint *alignment; + cl_int **errcodeRet; +} cl_params_clDeviceMemAllocINTEL; + +typedef struct _clSharedMemAllocINTEL { + cl_context *context; + cl_device_id *device; + const cl_mem_properties_intel **properties; + size_t *size; + cl_uint *alignment; + cl_int **errcodeRet; +} cl_params_clSharedMemAllocINTEL; + +typedef struct _clMemBlockingFreeINTEL { + cl_context *context; + void **ptr; +} cl_params_clMemBlockingFreeINTEL; + +typedef struct _clGetMemAllocInfoINTEL { + cl_context *context; + const void **ptr; + cl_mem_info_intel *paramName; + size_t *paramValueSize; + void **paramValue; + size_t **paramValueSizeRet; +} cl_params_clGetMemAllocInfoINTEL; + +typedef struct _clSetKernelArgMemPointerINTEL { + cl_kernel *kernel; + cl_uint *argIndex; + const void **argValue; +} cl_params_clSetKernelArgMemPointerINTEL; + +typedef struct _clEnqueueMemsetINTEL { + cl_command_queue *commandQueue; + void **dstPtr; + cl_int *value; + size_t *size; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueMemsetINTEL; + +typedef struct _clEnqueueMemFillINTEL { + cl_command_queue *commandQueue; + void **dstPtr; + const void **pattern; + size_t *patternSize; + size_t *size; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueMemFillINTEL; + +typedef struct _clEnqueueMemcpyINTEL { + cl_command_queue *commandQueue; + cl_bool *blocking; + void **dstPtr; + const void **srcPtr; + size_t *size; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueMemcpyINTEL; + +typedef struct _clEnqueueMigrateMemINTEL { + cl_command_queue *commandQueue; + const void **ptr; + size_t *size; + cl_mem_migration_flags *flags; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueMigrateMemINTEL; + +typedef struct _clEnqueueMemAdviseINTEL { + cl_command_queue *commandQueue; + const void **ptr; + size_t *size; + cl_mem_advice_intel *advice; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueMemAdviseINTEL; + +typedef struct _clCreateCommandQueueWithPropertiesKHR { + cl_context *context; + cl_device_id *device; + const cl_queue_properties_khr **properties; + cl_int **errcodeRet; +} cl_params_clCreateCommandQueueWithPropertiesKHR; + +typedef struct _clCreateAcceleratorINTEL { + cl_context *context; + cl_accelerator_type_intel *acceleratorType; + size_t *descriptorSize; + const void **descriptor; + cl_int **errcodeRet; +} cl_params_clCreateAcceleratorINTEL; + +typedef struct _clRetainAcceleratorINTEL { + cl_accelerator_intel *accelerator; +} cl_params_clRetainAcceleratorINTEL; + +typedef struct _clGetAcceleratorInfoINTEL { + cl_accelerator_intel *accelerator; + cl_accelerator_info_intel *paramName; + size_t *paramValueSize; + void **paramValue; + size_t **paramValueSizeRet; +} cl_params_clGetAcceleratorInfoINTEL; + +typedef struct _clReleaseAcceleratorINTEL { + cl_accelerator_intel *accelerator; +} cl_params_clReleaseAcceleratorINTEL; + +typedef struct _clCreateProgramWithILKHR { + cl_context *context; + const void *il; + size_t *length; + cl_int **errcodeRet; +} cl_params_clCreateProgramWithILKHR; + +typedef struct _clGetKernelSuggestedLocalWorkSizeKHR { + cl_command_queue *commandQueue; + cl_kernel *kernel; + cl_uint *workDim; + const size_t **globalWorkOffset; + const size_t **globalWorkSize; + size_t **suggestedLocalWorkSize; +} cl_params_clGetKernelSuggestedLocalWorkSizeKHR; + +typedef struct _clGetKernelSubGroupInfoKHR { + cl_kernel *kernel; + cl_device_id *device; + cl_kernel_sub_group_info *paramName; + size_t *inputValueSize; + const void **inputValue; + size_t *paramValueSize; + void **paramValue; + size_t **paramValueSizeRet; +} cl_params_clGetKernelSubGroupInfoKHR; + +typedef struct _clEnqueueVerifyMemoryINTEL { + cl_command_queue *commandQueue; + const void **allocationPtr; + const void **expectedData; + size_t *sizeOfComparison; + cl_uint *comparisonMode; +} cl_params_clEnqueueVerifyMemoryINTEL; + +typedef struct _clAddCommentINTEL { + cl_device_id *device; + const char **comment; +} cl_params_clAddCommentINTEL; + +typedef struct _clGetDeviceGlobalVariablePointerINTEL { + cl_device_id *device; + cl_program *program; + const char **globalVariableName; + size_t **globalVariableSizeRet; + void ***globalVariablePointerRet; +} cl_params_clGetDeviceGlobalVariablePointerINTEL; + +typedef struct _clGetDeviceFunctionPointerINTEL { + cl_device_id *device; + cl_program *program; + const char **functionName; + cl_ulong **functionPointerRet; +} cl_params_clGetDeviceFunctionPointerINTEL; + +typedef struct _clSetProgramReleaseCallback { + cl_program *program; + void(CL_CALLBACK **pfnNotify)(cl_program, void *); + void **userData; +} cl_params_clSetProgramReleaseCallback; + +typedef struct _clSetProgramSpecializationConstant { + cl_program *program; + cl_uint *specId; + size_t *specSize; + const void **specValue; +} cl_params_clSetProgramSpecializationConstant; + +typedef struct _clGetKernelSuggestedLocalWorkSizeINTEL { + cl_command_queue *commandQueue; + cl_kernel *kernel; + cl_uint *workDim; + const size_t **globalWorkOffset; + const size_t **globalWorkSize; + size_t **suggestedLocalWorkSize; +} cl_params_clGetKernelSuggestedLocalWorkSizeINTEL; + +typedef struct _clGetKernelMaxConcurrentWorkGroupCountINTEL { + cl_command_queue *commandQueue; + cl_kernel *kernel; + cl_uint *workDim; + const size_t **globalWorkOffset; + const size_t **localWorkSize; + size_t **suggestedWorkGroupCount; +} cl_params_clGetKernelMaxConcurrentWorkGroupCountINTEL; + +typedef struct _clEnqueueNDCountKernelINTEL { + cl_command_queue *commandQueue; + cl_kernel *kernel; + cl_uint *workDim; + const size_t **globalWorkOffset; + const size_t **workgroupCount; + const size_t **localWorkSize; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueNDCountKernelINTEL; + +typedef struct _clSetContextDestructorCallback { + cl_context *context; + void(CL_CALLBACK **pfnNotify)(cl_context, void *); + void **userData; +} cl_params_clSetContextDestructorCallback; + +typedef struct _clEnqueueExternalMemObjectsKHR { + cl_command_queue *commandQueue; + cl_uint *numMemObjects; + const cl_mem **memObjects; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueExternalMemObjectsKHR; + +typedef struct _clEnqueueAcquireExternalMemObjectsKHR { + cl_command_queue *commandQueue; + cl_uint *numMemObjects; + const cl_mem **memObjects; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueAcquireExternalMemObjectsKHR; + +typedef struct _clEnqueueReleaseExternalMemObjectsKHR { + cl_command_queue *commandQueue; + cl_uint *numMemObjects; + const cl_mem **memObjects; + cl_uint *numEventsInWaitList; + const cl_event **eventWaitList; + cl_event **event; +} cl_params_clEnqueueReleaseExternalMemObjectsKHR; + +typedef struct _clCreateBufferWithProperties { + cl_context *context; + const cl_mem_properties **properties; + cl_mem_flags *flags; + size_t *size; + void **hostPtr; + cl_int **errcodeRet; +} cl_params_clCreateBufferWithProperties; + typedef struct _cl_params_clCreateFromGLBuffer { cl_context *context; cl_mem_flags *flags; diff --git a/opencl/test/unit_test/api/cl_intel_tracing_tests.inl b/opencl/test/unit_test/api/cl_intel_tracing_tests.inl index 28db49701a..a343ef3e34 100644 --- a/opencl/test/unit_test/api/cl_intel_tracing_tests.inl +++ b/opencl/test/unit_test/api/cl_intel_tracing_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -701,6 +701,166 @@ struct IntelAllTracingTest : public IntelTracingTest { functionId = CL_FUNCTION_clWaitForEvents; clWaitForEvents(0, 0); + ++count; + functionId = CL_FUNCTION_clMemFreeINTEL; + clMemFreeINTEL(0, 0); + + ++count; + functionId = CL_FUNCTION_clIcdGetPlatformIDsKHR; + clIcdGetPlatformIDsKHR(0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreateBufferWithProperties; + clCreateBufferWithProperties(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreateBufferWithPropertiesINTEL; + clCreateBufferWithPropertiesINTEL(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreateImageWithProperties; + clCreateImageWithProperties(0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreateImageWithPropertiesINTEL; + clCreateImageWithPropertiesINTEL(0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clGetImageParamsINTEL; + clGetImageParamsINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreatePerfCountersCommandQueueINTEL; + clCreatePerfCountersCommandQueueINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clHostMemAllocINTEL; + clHostMemAllocINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clDeviceMemAllocINTEL; + clDeviceMemAllocINTEL(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clSharedMemAllocINTEL; + clSharedMemAllocINTEL(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clMemBlockingFreeINTEL; + clMemBlockingFreeINTEL(0, 0); + + ++count; + functionId = CL_FUNCTION_clGetMemAllocInfoINTEL; + clGetMemAllocInfoINTEL(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clSetKernelArgMemPointerINTEL; + clSetKernelArgMemPointerINTEL(0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueMemsetINTEL; + clEnqueueMemsetINTEL(0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueMemFillINTEL; + clEnqueueMemFillINTEL(0, 0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueMemcpyINTEL; + clEnqueueMemcpyINTEL(0, 0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueMigrateMemINTEL; + clEnqueueMigrateMemINTEL(0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueMemAdviseINTEL; + clEnqueueMemAdviseINTEL(0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreateCommandQueueWithPropertiesKHR; + clCreateCommandQueueWithPropertiesKHR(0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clCreateAcceleratorINTEL; + clCreateAcceleratorINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clRetainAcceleratorINTEL; + clRetainAcceleratorINTEL(0); + + ++count; + functionId = CL_FUNCTION_clGetAcceleratorInfoINTEL; + clGetAcceleratorInfoINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clReleaseAcceleratorINTEL; + clReleaseAcceleratorINTEL(0); + + ++count; + functionId = CL_FUNCTION_clCreateProgramWithILKHR; + clCreateProgramWithILKHR(0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeKHR; + clGetKernelSuggestedLocalWorkSizeKHR(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clGetKernelSubGroupInfoKHR; + clGetKernelSubGroupInfoKHR(0, 0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueVerifyMemoryINTEL; + clEnqueueVerifyMemoryINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clAddCommentINTEL; + clAddCommentINTEL(0, 0); + + ++count; + functionId = CL_FUNCTION_clGetDeviceGlobalVariablePointerINTEL; + clGetDeviceGlobalVariablePointerINTEL(0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clGetDeviceFunctionPointerINTEL; + clGetDeviceFunctionPointerINTEL(0, 0, "test", 0); + + ++count; + functionId = CL_FUNCTION_clSetProgramReleaseCallback; + clSetProgramReleaseCallback(0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clSetProgramSpecializationConstant; + clSetProgramSpecializationConstant(0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clGetKernelSuggestedLocalWorkSizeINTEL; + clGetKernelSuggestedLocalWorkSizeINTEL(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clGetKernelMaxConcurrentWorkGroupCountINTEL; + clGetKernelMaxConcurrentWorkGroupCountINTEL(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueNDCountKernelINTEL; + clEnqueueNDCountKernelINTEL(0, 0, 0, 0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clSetContextDestructorCallback; + clSetContextDestructorCallback(0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueExternalMemObjectsKHR; + clEnqueueExternalMemObjectsKHR(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueAcquireExternalMemObjectsKHR; + clEnqueueAcquireExternalMemObjectsKHR(0, 0, 0, 0, 0, 0); + + ++count; + functionId = CL_FUNCTION_clEnqueueReleaseExternalMemObjectsKHR; + clEnqueueReleaseExternalMemObjectsKHR(0, 0, 0, 0, 0, 0); + return count; }