From 5fc1485c8f45e72c1e2b69fc955b79af6985a3ce Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 16 Sep 2015 17:29:07 -0400 Subject: [PATCH] P4 to Git Change 1191432 by yaxunl@yaxunl_stg_win50 on 2015/09/16 17:16:06 ECR #354633 - SPIR-V: Rename clCreateProgramWithIL as clCreateProgramWithILKHR and define it as an extension API. Add API to OCL 1.2/2.1. Add cl_khr_il_program extension. Fix SPIR-V conformance and ocltst. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/amdocl.def.in#15 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/amdocl.map.in#18 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#44 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_icd.cpp#24 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_icd_amd.h#17 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_program.cpp#37 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h#9 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl.h#21 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#16 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl.h#3 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/icd/OpenCL.def.in#12 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/icd/icd_dispatch.c#28 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/icd/icd_dispatch.h#23 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/icd/icd_exports.map.in#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpusettings.cpp#30 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#252 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsasettings.cpp#37 edit ... //depot/stg/opencl/drivers/opencl/tests/conformance/devel/2.0/test_conformance/spirv/main.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/tests/conformance/devel/2.0/test_conformance/spirv/run_services.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/spir/SPIRVBasic.cpp#3 edit [ROCm/clr commit: e5b97964604045f3355840e1a579acebb52e110d] --- .../opencl/api/opencl/amdocl/amdocl.def.in | 5 ++- .../opencl/api/opencl/amdocl/amdocl.map.in | 8 +++- .../opencl/api/opencl/amdocl/cl_context.cpp | 3 ++ .../clr/opencl/api/opencl/amdocl/cl_icd.cpp | 2 +- .../clr/opencl/api/opencl/amdocl/cl_icd_amd.h | 8 ++-- .../opencl/api/opencl/amdocl/cl_program.cpp | 2 +- .../khronos/headers/opencl1.2/CL/cl_ext.h | 19 +++++++++ .../opencl/khronos/headers/opencl2.0/CL/cl.h | 6 --- .../khronos/headers/opencl2.0/CL/cl_ext.h | 19 +++++++++ .../opencl/khronos/headers/opencl2.1/CL/cl.h | 8 +++- .../api/opencl/khronos/icd/icd_dispatch.c | 41 ++++++++++++------- .../api/opencl/khronos/icd/icd_dispatch.h | 6 ++- 12 files changed, 95 insertions(+), 32 deletions(-) diff --git a/projects/clr/opencl/api/opencl/amdocl/amdocl.def.in b/projects/clr/opencl/api/opencl/amdocl/amdocl.def.in index 7d789d68fc..d44410c802 100644 --- a/projects/clr/opencl/api/opencl/amdocl/amdocl.def.in +++ b/projects/clr/opencl/api/opencl/amdocl/amdocl.def.in @@ -103,7 +103,6 @@ clUnloadPlatformCompiler #endif #if (OPENCL_MAJOR >= 2) -clCreateProgramWithIL clCreateCommandQueueWithProperties clCreateSamplerWithProperties clCreatePipe @@ -157,6 +156,8 @@ aclDisassemble aclInsertKernelStatistics aclGetDeviceBinary aclDumpBinary - +#if (OPENCL_MAJOR > 2) || (OPENCL_MAJOR == 2 && OPENCL_MINOR >= 1) +clCreateProgramWithIL +#endif #if !defined(OPENCL_MAINLINE) #endif diff --git a/projects/clr/opencl/api/opencl/amdocl/amdocl.map.in b/projects/clr/opencl/api/opencl/amdocl/amdocl.map.in index db2dda51f7..8861832f92 100644 --- a/projects/clr/opencl/api/opencl/amdocl/amdocl.map.in +++ b/projects/clr/opencl/api/opencl/amdocl/amdocl.map.in @@ -142,7 +142,6 @@ global: #if (OPENCL_MAJOR >= 2) OPENCL_2.0 { global: - clCreateProgramWithIL; clCreateCommandQueueWithProperties; clCreateSamplerWithProperties; clCreatePipe; @@ -159,6 +158,13 @@ global: } OPENCL_1.2; #endif +#if (OPENCL_MAJOR > 2) || (OPENCL_MAJOR == 2 && OPENCL_MINOR >= 1) +OPENCL_2.1 { +global: + clCreateProgramWithIL; +} OPENCL_2.1; +#endif + ACL_0.8 { global: aclCompilerInit; diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp index 3aa4c324d4..3f8859886e 100644 --- a/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp +++ b/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp @@ -509,6 +509,9 @@ clGetExtensionFunctionAddress(const char* func_name) CL_EXTENSION_ENTRYPOINT_CHECK(clCreateKeyAMD); CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD); CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD); +#if cl_khr_il_program + CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithILKHR); +#endif // cl_khr_il_program break; case 'D': break; diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp index f844b32030..daebc970a1 100644 --- a/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp +++ b/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp @@ -205,7 +205,7 @@ amd::ICDDispatchedObject::icdVendorDispatch_[] = {{ clGetKernelSubGroupInfoKHR, clTerminateContextKHR, - clCreateProgramWithIL + clCreateProgramWithILKHR }}; CL_API_ENTRY cl_int CL_API_CALL diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_icd_amd.h b/projects/clr/opencl/api/opencl/amdocl/cl_icd_amd.h index a41807f8c4..c18bb91854 100644 --- a/projects/clr/opencl/api/opencl/amdocl/cl_icd_amd.h +++ b/projects/clr/opencl/api/opencl/amdocl/cl_icd_amd.h @@ -210,11 +210,11 @@ typedef cl_program (CL_API_CALL * clCreateProgramWithSource_fn)( const size_t * /* lengths */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; -typedef cl_program (CL_API_CALL * clCreateProgramWithIL_fn)( +typedef cl_program (CL_API_CALL * clCreateProgramWithILKHR_fn)( cl_context /* context */, const void * /* il */, size_t /* length */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; typedef cl_program (CL_API_CALL * clCreateProgramWithBinary_fn)( cl_context /* context */, @@ -979,8 +979,8 @@ typedef struct _cl_icd_dispatch_table clGetKernelSubGroupInfoKHR_fn GetKernelSubGroupInfoKHR; clTerminateContextKHR_fn TerminateContextKHR; - /* cl_khr_spirv */ - clCreateProgramWithIL_fn CreateProgramWithIL; + /* cl_khr_il_program */ + clCreateProgramWithILKHR_fn CreateProgramWithILKHR; } cl_icd_dispatch_table; #ifdef __cplusplus diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp index b68dca5299..aaf0726329 100644 --- a/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp +++ b/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp @@ -194,7 +194,7 @@ RUNTIME_EXIT * * \version 1.0r33 */ -RUNTIME_ENTRY_RET(cl_program, clCreateProgramWithIL, ( +RUNTIME_ENTRY_RET(cl_program, clCreateProgramWithILKHR, ( cl_context context, const void *il, size_t length, diff --git a/projects/clr/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h b/projects/clr/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h index 0c07213657..d3568c4195 100644 --- a/projects/clr/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h +++ b/projects/clr/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h @@ -480,6 +480,25 @@ typedef struct _cl_mem_ion_host_ptr const cl_event * /*event_list*/, cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2; +#endif /* CL_VERSION_1_2 */ +#ifdef CL_VERSION_1_2 +/********************************* +* cl_khr_il_program extension +*********************************/ +#define cl_khr_il_program 1 + +extern CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithILKHR(cl_context /* context */, + const void * /* strings */, + size_t /* lengths */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_program + ( CL_API_CALL * clCreateProgramWithILKHR_fn)(cl_context /* context */, + const void * /* strings */, + size_t /* lengths */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2; + #endif /* CL_VERSION_1_2 */ #ifdef __cplusplus diff --git a/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl.h b/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl.h index 983a620052..87fd6d7781 100644 --- a/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl.h +++ b/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl.h @@ -835,12 +835,6 @@ clCreateProgramWithSource(cl_context /* context */, const size_t * /* lengths */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; -extern CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithIL(cl_context /* context */, - const void * /* strings */, - size_t /* lengths */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - extern CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context /* context */, cl_uint /* num_devices */, diff --git a/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h b/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h index b866f561bb..141fbfafc2 100644 --- a/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h +++ b/projects/clr/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h @@ -482,6 +482,25 @@ typedef CL_API_ENTRY cl_int void* /*param_value*/, size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0; #endif /* CL_VERSION_2_0 */ +#ifdef CL_VERSION_2_0 +/********************************* +* cl_khr_il_program extension +*********************************/ +#define cl_khr_il_program 1 + +extern CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithILKHR(cl_context /* context */, + const void * /* strings */, + size_t /* lengths */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_2_0; + +typedef CL_API_ENTRY cl_program + ( CL_API_CALL * clCreateProgramWithILKHR_fn)(cl_context /* context */, + const void * /* strings */, + size_t /* lengths */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ #ifdef __cplusplus } diff --git a/projects/clr/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl.h b/projects/clr/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl.h index a95878e05c..3c74d2eb48 100644 --- a/projects/clr/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl.h +++ b/projects/clr/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl.h @@ -844,7 +844,13 @@ clCreateProgramWithSource(cl_context /* context */, const char ** /* strings */, const size_t * /* lengths */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - + +extern CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithIL(cl_context /* context */, + const void * /* strings */, + size_t /* lengths */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_1; + extern CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context /* context */, cl_uint /* num_devices */, diff --git a/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.c b/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.c index 96cf4898b8..3edb469b67 100644 --- a/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.c +++ b/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.c @@ -470,20 +470,6 @@ clCreateProgramWithSource(cl_context context, errcode_ret); } -CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithIL(cl_context context, - const void * il, - size_t length, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 -{ - KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); - return context->dispatch->clCreateProgramWithIL( - context, - il, - length, - errcode_ret); -} - CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context context, cl_uint num_devices, @@ -1641,6 +1627,9 @@ clGetExtensionFunctionAddress(const char *function_name) CL_EXT_SUFFIX__VERSION_ CL_COMMON_EXTENSION_ENTRYPOINT_ADD(clTerminateContextKHR); + /* cl_khr_il_program */ + CL_COMMON_EXTENSION_ENTRYPOINT_ADD(clCreateProgramWithILKHR); + // fall back to vendor extension detection for (vendor = khrIcdState.vendors; vendor; vendor = vendor->next) { @@ -2563,3 +2552,27 @@ clTerminateContextKHR( return context->dispatch->clTerminateContextKHR(context); } +CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithILKHR(cl_context context, + const void * il, + size_t length, + cl_int * errcode_ret) CL_EXT_SUFFIX__VERSION_1_2 +{ + KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); + return context->dispatch->clCreateProgramWithIL(context, il, length, + errcode_ret); +} + +//ToDo: change CL_API_SUFFIX__VERSION_2_0 to CL_API_SUFFIX__VERSION_2_1 +// after switching to OpenCL 2.1 +CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithIL(cl_context context, + const void * il, + size_t length, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0 +{ + KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); + return context->dispatch->clCreateProgramWithIL(context, il, length, + errcode_ret); +} + diff --git a/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.h b/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.h index d670a62ac7..c3523209eb 100644 --- a/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.h +++ b/projects/clr/opencl/api/opencl/khronos/icd/icd_dispatch.h @@ -272,11 +272,13 @@ typedef CL_API_ENTRY cl_program (CL_API_CALL *KHRpfn_clCreateProgramWithSource)( const size_t * lengths, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; +//ToDo: Change CL_API_SUFFIX__VERSION_2_0 to CL_API_SUFFIX__VERSION_2_1 +// after switching to OpenCL 2.1. typedef CL_API_ENTRY cl_program (CL_API_CALL *KHRpfn_clCreateProgramWithIL)( cl_context context, const void * il, size_t length, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; typedef CL_API_ENTRY cl_program (CL_API_CALL *KHRpfn_clCreateProgramWithBinary)( cl_context context, @@ -1418,7 +1420,7 @@ struct KHRicdVendorDispatchRec KHRpfn_clTerminateContextKHR clTerminateContextKHR; - /* cl_khr_spirv */ + /* OpenCL 2.1 */ KHRpfn_clCreateProgramWithIL clCreateProgramWithIL; };