From ccd943ba320fb45023f2290993a461b46a1fb23e Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Thu, 20 Nov 2025 17:34:43 -0800 Subject: [PATCH 1/5] add tracing for cl_ext_image_unsigned_10x6_12x4_14x2 --- intercept/src/cli_ext.h | 20 +++++++++++++++----- intercept/src/enummap.cpp | 8 ++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/intercept/src/cli_ext.h b/intercept/src/cli_ext.h index 9e21a7f5..60ece277 100644 --- a/intercept/src/cli_ext.h +++ b/intercept/src/cli_ext.h @@ -1122,11 +1122,6 @@ cl_int CL_API_CALL clSetKernelArgDevicePointerEXT( #define CL_PARTITION_BY_COUNTS_LIST_END_EXT 0x0 #define CL_PARTITION_BY_NAMES_LIST_END_EXT -1 -/////////////////////////////////////////////////////////////////////////////// -// cl_ext_immutable_memory_objects - -#define CL_MEM_IMMUTABLE_EXT (1 << 6) - /////////////////////////////////////////////////////////////////////////////// // cl_ext_float_atomics @@ -1173,6 +1168,21 @@ cl_int CL_API_CALL clGetImageRequirementsInfoEXT( void* param_value, size_t* param_value_size_ret); +/////////////////////////////////////////////////////////////////////////////// +// cl_ext_image_unsigned_10x6_12x4_14x2 + +#define CL_UNSIGNED_INT10X6_EXT 0x10E6 +#define CL_UNSIGNED_INT12X4_EXT 0x10E7 +#define CL_UNSIGNED_INT14X2_EXT 0x10E8 +#define CL_UNORM_INT10X6_EXT 0x10E1 +#define CL_UNORM_INT12X4_EXT 0x10E9 +#define CL_UNORM_INT14X2_EXT 0x10EA + +/////////////////////////////////////////////////////////////////////////////// +// cl_ext_immutable_memory_objects + +#define CL_MEM_IMMUTABLE_EXT (1 << 6) + /////////////////////////////////////////////////////////////////////////////// // cl_altera_compiler_mode diff --git a/intercept/src/enummap.cpp b/intercept/src/enummap.cpp index 80ecacce..8fa3d9b8 100644 --- a/intercept/src/enummap.cpp +++ b/intercept/src/enummap.cpp @@ -947,6 +947,14 @@ CEnumNameMap::CEnumNameMap() ADD_ENUM_NAME( m_cl_int, CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT ); ADD_ENUM_NAME( m_cl_int, CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT ); + // cl_ext_image_unsigned_10x6_12x4_14x2 + ADD_ENUM_NAME( m_cl_int, CL_UNSIGNED_INT10X6_EXT ); + ADD_ENUM_NAME( m_cl_int, CL_UNSIGNED_INT12X4_EXT ); + ADD_ENUM_NAME( m_cl_int, CL_UNSIGNED_INT14X2_EXT ); + ADD_ENUM_NAME( m_cl_int, CL_UNORM_INT10X6_EXT ); + ADD_ENUM_NAME( m_cl_int, CL_UNORM_INT12X4_EXT ); + ADD_ENUM_NAME( m_cl_int, CL_UNORM_INT14X2_EXT ); + // cl_ext_immutable_memory_objects ADD_ENUM_NAME( m_cl_mem_flags, CL_MEM_IMMUTABLE_EXT ); From 44ec4ce92c7fb45eae0a040f53ccf3030332a5e1 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Thu, 20 Nov 2025 17:51:49 -0800 Subject: [PATCH 2/5] add tracing for cl_img_safety_mechanisms --- intercept/src/cli_ext.h | 15 +++++++++++++++ intercept/src/enummap.cpp | 11 +++++++++++ intercept/src/intercept.cpp | 11 ++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/intercept/src/cli_ext.h b/intercept/src/cli_ext.h index 60ece277..d89f2669 100644 --- a/intercept/src/cli_ext.h +++ b/intercept/src/cli_ext.h @@ -1313,6 +1313,21 @@ cl_int CL_API_CALL clGetImageRequirementsInfoEXT( #define CL_DEVICE_MEMORY_CAPABILITIES_IMG 0x40D8 +/////////////////////////////////////////////////////////////////////////////// +// cl_img_safety_mechanisms + +#define CL_CONTEXT_SAFETY_PROPERTIES_IMG 0x40D9 + +#define CL_DEVICE_WORKGROUP_PROTECTION_SVM_CAPABILITIES_IMG 0x40DA +#define CL_DEVICE_WORKGROUP_PROTECTION_DEVICE_ENQUEUE_CAPABILITIES_IMG 0x40DB +#define CL_DEVICE_SAFETY_MEM_SIZE_IMG 0x40DC + +#define CL_ECC_RECOVERED_IMG 0x40DD +#define CL_PAGE_FAULT_IMG -1127 +#define CL_SAFETY_FAULT_IMG -1128 +#define CL_GENERAL_FAULT_IMG -1129 +#define CL_ECC_UNRECOVERED_IMG -1130 + /////////////////////////////////////////////////////////////////////////////// // cl_img_yuv_image diff --git a/intercept/src/enummap.cpp b/intercept/src/enummap.cpp index 8fa3d9b8..0b01441d 100644 --- a/intercept/src/enummap.cpp +++ b/intercept/src/enummap.cpp @@ -1045,6 +1045,17 @@ CEnumNameMap::CEnumNameMap() ADD_ENUM_NAME( m_cl_int, CL_MEM_ALLOC_FLAGS_IMG ); ADD_ENUM_NAME( m_cl_int, CL_DEVICE_MEMORY_CAPABILITIES_IMG ); + // cl_img_safety_mechanisms + ADD_ENUM_NAME( m_cl_int, CL_CONTEXT_SAFETY_PROPERTIES_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_DEVICE_WORKGROUP_PROTECTION_SVM_CAPABILITIES_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_DEVICE_WORKGROUP_PROTECTION_DEVICE_ENQUEUE_CAPABILITIES_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_DEVICE_SAFETY_MEM_SIZE_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_ECC_RECOVERED_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_PAGE_FAULT_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_SAFETY_FAULT_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_GENERAL_FAULT_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_ECC_UNRECOVERED_IMG ); + // cl_img_yuv_image ADD_ENUM_NAME( m_cl_int, CL_NV21_IMG ); ADD_ENUM_NAME( m_cl_int, CL_YV12_IMG ); diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index 50bab880..c31286d6 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -2289,9 +2289,14 @@ void CLIntercept::getContextPropertiesString( str += s; } break; - case CL_CONTEXT_MEMORY_INITIALIZE_KHR: - // TODO: this is a cl_context_memory_initialize_khr bitfield. - // Fall through for now. + case CL_CONTEXT_MEMORY_INITIALIZE_KHR: // cl_context_memory_initialize_khr + case CL_CONTEXT_SAFETY_PROPERTIES_IMG: // cl_context_safety_properties_img + { + const cl_ulong* pu = (const cl_ulong*)( properties + 1); + CLI_SPRINTF( s, 256, "0x%" PRIx64, pu[0] ); + str += s; + } + break; default: { CLI_SPRINTF( s, 256, "", (cl_uint)property ); From 0be348a70aeb2c1a61632cafa53f7e0f6261e247 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Mon, 24 Nov 2025 16:08:03 -0800 Subject: [PATCH 3/5] add support for a few more extensions cl_img_unified_svm_external_memory_dma_buf cl_qcom_perf_hint --- intercept/src/cli_ext.h | 21 +++++++++++++++++++ intercept/src/dispatch.cpp | 37 ++++++++++++++++++++++++++++++++++ intercept/src/dispatch.h | 5 +++++ intercept/src/enummap.cpp | 10 ++++++++++ intercept/src/intercept.cpp | 40 ++++++++++++++++++++++++++++++------- 5 files changed, 106 insertions(+), 7 deletions(-) diff --git a/intercept/src/cli_ext.h b/intercept/src/cli_ext.h index d89f2669..39a415c6 100644 --- a/intercept/src/cli_ext.h +++ b/intercept/src/cli_ext.h @@ -1328,6 +1328,12 @@ cl_int CL_API_CALL clGetImageRequirementsInfoEXT( #define CL_GENERAL_FAULT_IMG -1129 #define CL_ECC_UNRECOVERED_IMG -1130 +/////////////////////////////////////////////////////////////////////////////// +// cl_img_unified_svm_external_memory_dma_buf + +#define CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG 0x4220 +#define CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG 0x4221 + /////////////////////////////////////////////////////////////////////////////// // cl_img_yuv_image @@ -1970,6 +1976,21 @@ cl_mem CL_API_CALL clCreateBufferNV( #define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 +/////////////////////////////////////////////////////////////////////////////// +// cl_qcom_perf_hint + +#define CL_PERF_HINT_HIGH_QCOM 0x40C3 +#define CL_PERF_HINT_NORMAL_QCOM 0x40C4 +#define CL_PERF_HINT_LOW_QCOM 0x40C5 +#define CL_CONTEXT_PERF_HINT_QCOM 0x40C2 + +typedef cl_uint cl_perf_hint_qcom; + +extern CL_API_ENTRY +cl_int CL_API_CALL clSetPerfHintQCOM( + cl_context context, + cl_perf_hint_qcom perf_hint) ; + /////////////////////////////////////////////////////////////////////////////// // Unofficial MDAPI extension: diff --git a/intercept/src/dispatch.cpp b/intercept/src/dispatch.cpp index fa59fcb1..7530f7c6 100644 --- a/intercept/src/dispatch.cpp +++ b/intercept/src/dispatch.cpp @@ -8779,6 +8779,43 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9ObjectsINTEL( } #endif +/////////////////////////////////////////////////////////////////////////////// +// +// cl_qcom_perf_hint +CL_API_ENTRY cl_int CL_API_CALL clSetPerfHintQCOM( + cl_context context, + cl_perf_hint_qcom perf_hint) +{ + CLIntercept* pIntercept = GetIntercept(); + + if( pIntercept ) + { + const auto& dispatchX = pIntercept->dispatchX(context); + if( dispatchX.clSetPerfHintQCOM ) + { + GET_ENQUEUE_COUNTER(); + + CALL_LOGGING_ENTER( "context = %p, perf_hint = %s (%llX)", + context, + pIntercept->enumName().name( perf_hint ), + perf_hint ); + HOST_PERFORMANCE_TIMING_START(); + + cl_int retVal = dispatchX.clSetPerfHintQCOM( + context, + perf_hint ); + + HOST_PERFORMANCE_TIMING_END(); + CHECK_ERROR( retVal ); + CALL_LOGGING_EXIT( retVal ); + + return retVal; + } + } + + NULL_FUNCTION_POINTER_RETURN_ERROR(CL_INVALID_CONTEXT); +} + /////////////////////////////////////////////////////////////////////////////// // // Unofficial MDAPI extension: diff --git a/intercept/src/dispatch.h b/intercept/src/dispatch.h index 40c808d5..f201a3c6 100644 --- a/intercept/src/dispatch.h +++ b/intercept/src/dispatch.h @@ -539,6 +539,11 @@ struct CLdispatchX void* param_value, size_t* param_value_size_ret); + // cl_qcom_perf_hint + cl_int (CL_API_CALL *clSetPerfHintQCOM) ( + cl_context context, + cl_perf_hint_qcom perf_hint); + // Unofficial MDAPI extension: cl_command_queue (CL_API_CALL *clCreatePerfCountersCommandQueueINTEL) ( cl_context context, diff --git a/intercept/src/enummap.cpp b/intercept/src/enummap.cpp index 0b01441d..e7990007 100644 --- a/intercept/src/enummap.cpp +++ b/intercept/src/enummap.cpp @@ -1056,6 +1056,10 @@ CEnumNameMap::CEnumNameMap() ADD_ENUM_NAME( m_cl_int, CL_GENERAL_FAULT_IMG ); ADD_ENUM_NAME( m_cl_int, CL_ECC_UNRECOVERED_IMG ); + // cl_img_unified_svm_external_memory_dma_buf + ADD_ENUM_NAME( m_cl_int, CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG ); + ADD_ENUM_NAME( m_cl_int, CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG ); + // cl_img_yuv_image ADD_ENUM_NAME( m_cl_int, CL_NV21_IMG ); ADD_ENUM_NAME( m_cl_int, CL_YV12_IMG ); @@ -1300,6 +1304,12 @@ CEnumNameMap::CEnumNameMap() // cl_qcom_ion_host_ptr extension ADD_ENUM_NAME( m_cl_int, CL_MEM_ION_HOST_PTR_QCOM ); + // cl_qcom_perf_hint + ADD_ENUM_NAME( m_cl_int, CL_PERF_HINT_HIGH_QCOM ); + ADD_ENUM_NAME( m_cl_int, CL_PERF_HINT_NORMAL_QCOM ); + ADD_ENUM_NAME( m_cl_int, CL_PERF_HINT_LOW_QCOM ); + ADD_ENUM_NAME( m_cl_int, CL_CONTEXT_PERF_HINT_QCOM ); + // Unofficial MDAPI extension: ADD_ENUM_NAME( m_cl_int, CL_QUEUE_MDAPI_PROPERTIES_INTEL ); ADD_ENUM_NAME( m_cl_int, CL_QUEUE_MDAPI_CONFIGURATION_INTEL ); diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index c31286d6..7ba17d1a 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -2281,6 +2281,14 @@ void CLIntercept::getContextPropertiesString( str += enumName().name_bool( value ); } break; + case CL_CONTEXT_MEMORY_INITIALIZE_KHR: // cl_context_memory_initialize_khr + case CL_CONTEXT_SAFETY_PROPERTIES_IMG: // cl_context_safety_properties_img + { + const cl_ulong* pu = (const cl_ulong*)( properties + 1); + CLI_SPRINTF( s, 256, "0x%" PRIx64, pu[0] ); + str += s; + } + break; case CL_PRINTF_BUFFERSIZE_ARM: { const size_t* psz = (const size_t*)( properties + 1); @@ -2289,12 +2297,11 @@ void CLIntercept::getContextPropertiesString( str += s; } break; - case CL_CONTEXT_MEMORY_INITIALIZE_KHR: // cl_context_memory_initialize_khr - case CL_CONTEXT_SAFETY_PROPERTIES_IMG: // cl_context_safety_properties_img + case CL_CONTEXT_PERF_HINT_QCOM: { - const cl_ulong* pu = (const cl_ulong*)( properties + 1); - CLI_SPRINTF( s, 256, "0x%" PRIx64, pu[0] ); - str += s; + const cl_uint* pu = (const cl_uint*)( properties + 1); + cl_uint value = pu[0]; + str += enumName().name( value ); } break; default: @@ -2618,6 +2625,22 @@ void CLIntercept::getSVMAllocPropertiesString( properties += 2; } break; + case CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG: + { + auto pptr = (const void**)( properties + 1); + CLI_SPRINTF( s, 256, "%p", pptr[0] ); + str += s; + properties += 2; + } + break; + case CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG: + { + auto pfd = (const int*)( properties + 1); + CLI_SPRINTF( s, 256, "%d", pfd[0] ); + str += s; + properties += 2; + } + break; default: { CLI_SPRINTF( s, 256, "", (cl_uint)property ); @@ -2791,8 +2814,8 @@ void CLIntercept::getSemaphorePropertiesString( case CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR: case CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR: { - auto pfd = (const void**)( properties + 1); - CLI_SPRINTF( s, 256, "%p", pfd[0] ); + auto ph = (const void**)( properties + 1); + CLI_SPRINTF( s, 256, "%p", ph[0] ); str += s; properties += 2; } @@ -13714,6 +13737,9 @@ void* CLIntercept::getExtensionFunctionAddress( // cl_ext_image_requirements_info CHECK_RETURN_EXTENSION_FUNCTION( clGetImageRequirementsInfoEXT ); + // cl_qcom_perf_hint + CHECK_RETURN_EXTENSION_FUNCTION( clSetPerfHintQCOM ); + // Unofficial MDAPI extension: CHECK_RETURN_EXTENSION_FUNCTION( clCreatePerfCountersCommandQueueINTEL ); CHECK_RETURN_EXTENSION_FUNCTION( clSetPerformanceConfigurationINTEL ); From 4f25abc7a6fe5963bab3d4293be1d78b87442f8b Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Mon, 24 Nov 2025 16:20:26 -0800 Subject: [PATCH 4/5] remove trailing whitespace --- intercept/src/dispatch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intercept/src/dispatch.cpp b/intercept/src/dispatch.cpp index 7530f7c6..4532219f 100644 --- a/intercept/src/dispatch.cpp +++ b/intercept/src/dispatch.cpp @@ -8784,7 +8784,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9ObjectsINTEL( // cl_qcom_perf_hint CL_API_ENTRY cl_int CL_API_CALL clSetPerfHintQCOM( cl_context context, - cl_perf_hint_qcom perf_hint) + cl_perf_hint_qcom perf_hint) { CLIntercept* pIntercept = GetIntercept(); From 27cc7124c0b916d66845ccbb581c07637eb94679 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Mon, 24 Nov 2025 16:28:35 -0800 Subject: [PATCH 5/5] fix call logging string --- intercept/src/dispatch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intercept/src/dispatch.cpp b/intercept/src/dispatch.cpp index 4532219f..e84ad7e7 100644 --- a/intercept/src/dispatch.cpp +++ b/intercept/src/dispatch.cpp @@ -8797,7 +8797,7 @@ CL_API_ENTRY cl_int CL_API_CALL clSetPerfHintQCOM( CALL_LOGGING_ENTER( "context = %p, perf_hint = %s (%llX)", context, - pIntercept->enumName().name( perf_hint ), + pIntercept->enumName().name( perf_hint ).c_str(), perf_hint ); HOST_PERFORMANCE_TIMING_START();