From 75dfd356d70f8cf6113d2065537625183ddc360e Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Fri, 3 Apr 2020 13:39:05 +0200 Subject: [PATCH] Review fixes - add clCreateProgramWithILKHR in linkage and op_opaque tests --- test_conformance/spirv_new/test_linkage.cpp | 21 +++++++++++++++-- test_conformance/spirv_new/test_op_opaque.cpp | 23 +++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/test_conformance/spirv_new/test_linkage.cpp b/test_conformance/spirv_new/test_linkage.cpp index 93972c93..43e6d6f9 100644 --- a/test_conformance/spirv_new/test_linkage.cpp +++ b/test_conformance/spirv_new/test_linkage.cpp @@ -33,8 +33,25 @@ static int test_linkage_compile(cl_device_id deviceID, } unsigned char *buffer = &buffer_vec[0]; - prog = clCreateProgramWithIL(context, buffer, file_bytes, &err); - SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL"); + if (gCoreILProgram) { + prog = clCreateProgramWithIL(context, buffer, file_bytes, &err); + SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL"); + } + else { + cl_platform_id platform; + err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL); + SPIRV_CHECK_ERROR(err, "Failed to get platform info with clGetDeviceInfo"); + clCreateProgramWithILKHR_fn clCreateProgramWithILKHR = NULL; + + clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)clGetExtensionFunctionAddressForPlatform(platform, "clCreateProgramWithILKHR"); + if (clCreateProgramWithILKHR == NULL) + { + log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed\n"); + return -1; + } + prog = clCreateProgramWithILKHR(context, buffer, file_bytes, &err); + SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithILKHR"); + } err = clCompileProgram(prog, 1, &deviceID, NULL, // options diff --git a/test_conformance/spirv_new/test_op_opaque.cpp b/test_conformance/spirv_new/test_op_opaque.cpp index 930e26dc..2ea04343 100644 --- a/test_conformance/spirv_new/test_op_opaque.cpp +++ b/test_conformance/spirv_new/test_op_opaque.cpp @@ -28,8 +28,27 @@ TEST_SPIRV_FUNC(op_type_opaque_simple) } unsigned char *buffer = &buffer_vec[0]; - clProgramWrapper prog = clCreateProgramWithIL(context, buffer, file_bytes, &err); - SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL"); + clProgramWrapper prog; + + if (gCoreILProgram) { + prog = clCreateProgramWithIL(context, buffer, file_bytes, &err); + SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL"); + } + else { + cl_platform_id platform; + err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL); + SPIRV_CHECK_ERROR(err, "Failed to get platform info with clGetDeviceInfo"); + clCreateProgramWithILKHR_fn clCreateProgramWithILKHR = NULL; + + clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)clGetExtensionFunctionAddressForPlatform(platform, "clCreateProgramWithILKHR"); + if (clCreateProgramWithILKHR == NULL) + { + log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed\n"); + return -1; + } + prog = clCreateProgramWithILKHR(context, buffer, file_bytes, &err); + SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithILKHR"); + } err = clCompileProgram(prog, 1, &deviceID, NULL, // options