diff --git a/test_common/gl/setup_osx.cpp b/test_common/gl/setup_osx.cpp index 084703a7c7..298f1a92a3 100644 --- a/test_common/gl/setup_osx.cpp +++ b/test_common/gl/setup_osx.cpp @@ -19,21 +19,28 @@ class OSXGLEnvironment : public GLEnvironment { - public: - OSXGLEnvironment() - { - mCGLContext = NULL; - } +private: + bool mIsGlutInit; + +public: + OSXGLEnvironment() + { + mCGLContext = NULL; + mIsGlutInit = false; + } virtual int Init( int *argc, char **argv, int use_opengl_32 ) { if (!use_opengl_32) { - - // Create a GLUT window to render into - glutInit( argc, argv ); - glutInitWindowSize( 512, 512 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "OpenCL <-> OpenGL Test" ); + if (!mIsGlutInit) + { + // Create a GLUT window to render into + glutInit(argc, argv); + glutInitWindowSize(512, 512); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + glutCreateWindow("OpenCL <-> OpenGL Test"); + mIsGlutInit = true; + } } else { diff --git a/test_common/harness/compat.h b/test_common/harness/compat.h index a42f29172d..e8a3047e94 100644 --- a/test_common/harness/compat.h +++ b/test_common/harness/compat.h @@ -112,6 +112,8 @@ int feclearexcept(int excepts); #if defined(__INTEL_COMPILER) #include +#elif __cplusplus && defined(_MSC_VER) +#include #else #include #endif diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index c2e1e5256b..29d2278a8c 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -105,6 +105,12 @@ const char *IGetErrorString(int clErrorCode) case CL_INVALID_SPEC_ID: return "CL_INVALID_SPEC_ID"; case CL_MAX_SIZE_RESTRICTION_EXCEEDED: return "CL_MAX_SIZE_RESTRICTION_EXCEEDED"; + case CL_INCOMPATIBLE_COMMAND_QUEUE_KHR: + return "CL_INCOMPATIBLE_COMMAND_QUEUE_KHR"; + case CL_INVALID_SYNC_POINT_WAIT_LIST_KHR: + return "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR"; + case CL_INVALID_COMMAND_BUFFER_KHR: + return "CL_INVALID_COMMAND_BUFFER_KHR"; default: return "(unknown)"; } } @@ -190,6 +196,7 @@ const char *GetChannelTypeName(cl_channel_type type) case CL_UNORM_SHORT_565: return "CL_UNORM_SHORT_565"; case CL_UNORM_SHORT_555: return "CL_UNORM_SHORT_555"; case CL_UNORM_INT_101010: return "CL_UNORM_INT_101010"; + case CL_UNORM_INT_101010_2: return "CL_UNORM_INT_101010_2"; case CL_SIGNED_INT8: return "CL_SIGNED_INT8"; case CL_SIGNED_INT16: return "CL_SIGNED_INT16"; case CL_SIGNED_INT32: return "CL_SIGNED_INT32"; @@ -220,6 +227,7 @@ int IsChannelTypeSupported(cl_channel_type type) case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010_2: case CL_SIGNED_INT8: case CL_SIGNED_INT16: case CL_SIGNED_INT32: diff --git a/test_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index e13404b9a5..1ceb5ba743 100644 --- a/test_common/harness/imageHelpers.cpp +++ b/test_common/harness/imageHelpers.cpp @@ -99,7 +99,8 @@ uint32_t get_channel_data_type_size(cl_channel_type channelType) case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: return 2; - case CL_UNORM_INT_101010: return 4; + case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010_2: return 4; case CL_FLOAT: return sizeof(cl_float); @@ -170,6 +171,7 @@ cl_channel_type get_channel_type_from_name(const char *name) { CL_UNORM_SHORT_565, "CL_UNORM_SHORT_565" }, { CL_UNORM_SHORT_555, "CL_UNORM_SHORT_555" }, { CL_UNORM_INT_101010, "CL_UNORM_INT_101010" }, + { CL_UNORM_INT_101010_2, "CL_UNORM_INT_101010_2" }, { CL_SIGNED_INT8, "CL_SIGNED_INT8" }, { CL_SIGNED_INT16, "CL_SIGNED_INT16" }, { CL_SIGNED_INT32, "CL_SIGNED_INT32" }, @@ -934,6 +936,7 @@ float get_max_relative_error(const cl_image_format *format, case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010_2: // Maximum sampling error for round to zero normalization based on // multiplication by reciprocal (using reciprocal generated in // round to +inf mode, so that 1.0 matches spec) @@ -1017,7 +1020,8 @@ size_t get_format_max_int(const cl_image_format *format) case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: return 31; - case CL_UNORM_INT_101010: return 1023; + case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010_2: return 1023; case CL_HALF_FLOAT: return 1 << 10; @@ -1049,7 +1053,8 @@ int get_format_min_int(const cl_image_format *format) case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: - case CL_UNORM_INT_101010: return 0; + case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010_2: return 0; case CL_HALF_FLOAT: return -(1 << 10); @@ -1465,6 +1470,15 @@ void read_image_pixel_float(void *imageData, image_descriptor *imageInfo, int x, break; } + case CL_UNORM_INT_101010_2: { + cl_uint *dPtr = (cl_uint *)ptr; + tempData[0] = (float)((dPtr[0] >> 22) & 0x3ff) / (float)1023; + tempData[1] = (float)((dPtr[0] >> 12) & 0x3ff) / (float)1023; + tempData[2] = (float)(dPtr[0] >> 2 & 0x3ff) / (float)1023; + tempData[3] = (float)(dPtr[0] >> 0 & 3) / (float)3; + break; + } + case CL_FLOAT: { float *dPtr = (float *)ptr; for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; @@ -2730,6 +2744,15 @@ void pack_image_pixel(float *srcVector, const cl_image_format *imageFormat, | (((unsigned int)NORMALIZE(srcVector[2], 1023.f) & 1023) << 0); break; } + case CL_UNORM_INT_101010_2: { + cl_uint *ptr = (cl_uint *)outData; + ptr[0] = + (((unsigned int)NORMALIZE(srcVector[0], 1023.f) & 1023) << 22) + | (((unsigned int)NORMALIZE(srcVector[1], 1023.f) & 1023) << 12) + | (((unsigned int)NORMALIZE(srcVector[2], 1023.f) & 1023) << 2) + | (((unsigned int)NORMALIZE(srcVector[3], 3.f) & 3) << 0); + break; + } case CL_SIGNED_INT8: { cl_char *ptr = (cl_char *)outData; for (unsigned int i = 0; i < channelCount; i++) @@ -2892,6 +2915,20 @@ void pack_image_pixel_error(const float *srcVector, break; } + case CL_UNORM_INT_101010_2: { + const cl_uint *ptr = (const cl_uint *)results; + + errors[0] = ((ptr[0] >> 22) & 1023) + - NORMALIZE_UNROUNDED(srcVector[0], 1023.f); + errors[1] = ((ptr[0] >> 12) & 1023) + - NORMALIZE_UNROUNDED(srcVector[1], 1023.f); + errors[2] = ((ptr[0] >> 2) & 1023) + - NORMALIZE_UNROUNDED(srcVector[2], 1023.f); + errors[3] = + ((ptr[0] >> 0) & 3) - NORMALIZE_UNROUNDED(srcVector[3], 3.f); + + break; + } case CL_SIGNED_INT8: { const cl_char *ptr = (const cl_char *)results; diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index c307fca559..37de92c204 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -1319,7 +1319,8 @@ size_t get_pixel_bytes(const cl_image_format *fmt) case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: return 2; - case CL_UNORM_INT_101010: return 4; + case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010_2: return 4; case CL_SNORM_INT8: case CL_UNORM_INT8: diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 0e3c49e9a3..99aaf7c6a0 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -1294,6 +1294,43 @@ cl_platform_id getPlatformFromDevice(cl_device_id deviceID) return platform; } +/** + * Helper to return a string containing platform information + * for the specified platform info parameter. + */ +std::string get_platform_info_string(cl_platform_id platform, + cl_platform_info param_name) +{ + size_t size = 0; + int err; + + if ((err = clGetPlatformInfo(platform, param_name, 0, NULL, &size)) + != CL_SUCCESS + || size == 0) + { + throw std::runtime_error("clGetPlatformInfo failed\n"); + } + + std::vector info(size); + + if ((err = clGetPlatformInfo(platform, param_name, size, info.data(), NULL)) + != CL_SUCCESS) + { + throw std::runtime_error("clGetPlatformInfo failed\n"); + } + + /* The returned string does not include the null terminator. */ + return std::string(info.data(), size - 1); +} + +bool is_platform_extension_available(cl_platform_id platform, + const char *extensionName) +{ + std::string extString = + get_platform_info_string(platform, CL_PLATFORM_EXTENSIONS); + return extString.find(extensionName) != std::string::npos; +} + void PrintArch(void) { vlog("sizeof( void*) = %zu\n", sizeof(void *)); diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index b266db80f4..524e604791 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -185,6 +185,10 @@ extern int gHasLong; // This is set to 1 if the device suppots long and ulong extern bool gCoreILProgram; extern cl_platform_id getPlatformFromDevice(cl_device_id deviceID); +extern std::string get_platform_info_string(cl_platform_id platform, + cl_platform_info param_name); +extern bool is_platform_extension_available(cl_platform_id platform, + const char *extensionName); #if !defined(__APPLE__) void memset_pattern4(void *, const void *, size_t); diff --git a/test_conformance/basic/test_global_linear_id.cpp b/test_conformance/basic/test_global_linear_id.cpp index 046d12a1bf..ccd8ce27c8 100644 --- a/test_conformance/basic/test_global_linear_id.cpp +++ b/test_conformance/basic/test_global_linear_id.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -22,105 +22,93 @@ #include #include "harness/rounding_mode.h" +#include +#include + #include "procs.h" -static const char *global_linear_id_2d_code = -"__kernel void test_global_linear_id_2d(global int *dst)\n" -"{\n" -" int tid_x = get_global_id(0);\n" -" int tid_y = get_global_id(1);\n" -"\n" -" int linear_id = tid_y * get_global_size(0) + tid_x;\n" -" int result = (linear_id == (int)get_global_linear_id()) ? 0x1 : 0x0;\n" -" dst[linear_id] = result;\n" -"}\n"; - -static const char *global_linear_id_1d_code = -"__kernel void test_global_linear_id_1d(global int *dst)\n" -"{\n" -" int tid_x = get_global_id(0);\n" -"\n" -" int result = (tid_x == (int)get_global_linear_id()) ? 0x1 : 0x0;\n" -" dst[tid_x] = result;\n" -"}\n"; - - -static int -verify_global_linear_id(int *result, int n) +namespace { +const char *global_linear_id_2d_code = R"( +__kernel void test_global_linear_id_2d(global int *dst) { - int i; - for (i=0; i &result, int n) +{ + if (std::any_of(result.begin(), result.begin() + n, + [](cl_int value) { return 0 == value; })) { - if (result[i] == 0) - { - log_error("get_global_linear_id failed\n"); - return -1; - } + log_error("get_global_linear_id failed\n"); + return TEST_FAIL; } log_info("get_global_linear_id passed\n"); - return 0; + return TEST_PASS; +} } - -int -test_global_linear_id(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) +int test_global_linear_id(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements) { - cl_mem streams; - cl_program program[2]; - cl_kernel kernel[2]; - - int *output_ptr; - size_t threads[2]; - int err; - num_elements = (int)sqrt((float)num_elements); - int length = num_elements * num_elements; - - output_ptr = (int *)malloc(sizeof(int) * length); - - streams = clCreateBuffer(context, CL_MEM_READ_WRITE, length * sizeof(int), - NULL, &err); - test_error( err, "clCreateBuffer failed."); - - err = create_single_kernel_helper(context, &program[0], &kernel[0], 1, - &global_linear_id_1d_code, - "test_global_linear_id_1d"); - test_error( err, "create_single_kernel_helper failed"); - err = create_single_kernel_helper(context, &program[1], &kernel[1], 1, - &global_linear_id_2d_code, - "test_global_linear_id_2d"); - test_error( err, "create_single_kernel_helper failed"); - - err = clSetKernelArg(kernel[0], 0, sizeof streams, &streams); - test_error( err, "clSetKernelArgs failed."); - err = clSetKernelArg(kernel[1], 0, sizeof streams, &streams); - test_error( err, "clSetKernelArgs failed."); - - threads[0] = (size_t)num_elements; - threads[1] = (size_t)num_elements; - err = clEnqueueNDRangeKernel(queue, kernel[1], 2, NULL, threads, NULL, 0, NULL, NULL); - test_error( err, "clEnqueueNDRangeKernel failed."); - - err = clEnqueueReadBuffer(queue, streams, CL_TRUE, 0, length*sizeof(int), output_ptr, 0, NULL, NULL); - test_error( err, "clEnqueueReadBuffer failed."); - - err = verify_global_linear_id(output_ptr, length); - - threads[0] = (size_t)num_elements; - err = clEnqueueNDRangeKernel(queue, kernel[1], 1, NULL, threads, NULL, 0, NULL, NULL); - test_error( err, "clEnqueueNDRangeKernel failed."); - - err = clEnqueueReadBuffer(queue, streams, CL_TRUE, 0, num_elements*sizeof(int), output_ptr, 0, NULL, NULL); - test_error( err, "clEnqueueReadBuffer failed."); - - err = verify_global_linear_id(output_ptr, num_elements); - - // cleanup - clReleaseMemObject(streams); - clReleaseKernel(kernel[0]); - clReleaseKernel(kernel[1]); - clReleaseProgram(program[0]); - clReleaseProgram(program[1]); - free(output_ptr); + clProgramWrapper program[2]; + clKernelWrapper kernel[2]; + + const char *kernel_names[] = { "test_global_linear_id_1d", + "test_global_linear_id_2d" }; + const char *kernel_code[] = { global_linear_id_1d_code, + global_linear_id_2d_code }; + int err = CL_SUCCESS; + + num_elements = static_cast(sqrt(static_cast(num_elements))); + int length = 1; + size_t threads[] = { static_cast(num_elements), + static_cast(num_elements) }; + + for (int i = 0; i < ARRAY_SIZE(program) && !err; i++) + { + length *= num_elements; + + std::vector output(length); + + clMemWrapper streams = clCreateBuffer( + context, CL_MEM_READ_WRITE, length * sizeof(cl_int), nullptr, &err); + test_error(err, "clCreateBuffer failed."); + + err = create_single_kernel_helper(context, &program[i], &kernel[i], 1, + &kernel_code[i], kernel_names[i]); + test_error(err, "create_single_kernel_helper failed"); + + err = clSetKernelArg(kernel[i], 0, sizeof streams, &streams); + test_error(err, "clSetKernelArgs failed."); + + err = clEnqueueNDRangeKernel(queue, kernel[i], i + 1, nullptr, threads, + nullptr, 0, nullptr, nullptr); + test_error(err, "clEnqueueNDRangeKernel failed."); + + err = clEnqueueReadBuffer(queue, streams, CL_TRUE, 0, + length * sizeof(cl_int), output.data(), 0, + nullptr, nullptr); + test_error(err, "clEnqueueReadBuffer failed."); + + err = verify_global_linear_id(output, length); + } return err; } diff --git a/test_conformance/common/vulkan_wrapper/vulkan_utility.cpp b/test_conformance/common/vulkan_wrapper/vulkan_utility.cpp index f694954ef9..1c433a7176 100644 --- a/test_conformance/common/vulkan_wrapper/vulkan_utility.cpp +++ b/test_conformance/common/vulkan_wrapper/vulkan_utility.cpp @@ -50,7 +50,6 @@ const VulkanPhysicalDevice &getVulkanPhysicalDevice() cl_uint num_devices = 0; cl_uint device_no = 0; const size_t bufsize = BUFFERSIZE; - char buf[BUFFERSIZE]; const VulkanInstance &instance = getVulkanInstance(); const VulkanPhysicalDeviceList &physicalDeviceList = instance.getPhysicalDeviceList(); @@ -753,43 +752,37 @@ std::ostream &operator<<(std::ostream &os, VulkanFormat format) return os; } -static char *findFilePath(const std::string filename) +static std::string findFilePath(const std::string &filename, + const std::string &startdir) { const char *searchPath[] = { - "./", // Same dir - "./shaders/", // In shaders folder in same dir - "../test_conformance/vulkan/shaders/" // In src folder + "/shaders/", // shaders directory, for most builds + "/../shaders/", // one directory up, for multi-config builds }; for (unsigned int i = 0; i < sizeof(searchPath) / sizeof(char *); ++i) { - std::string path(searchPath[i]); + std::string path(startdir); + path += searchPath[i]; + path += filename; - path.append(filename); FILE *fp; fp = fopen(path.c_str(), "rb"); if (fp != NULL) { fclose(fp); - // File found - char *file_path = (char *)(malloc(path.length() + 1)); - strncpy(file_path, path.c_str(), path.length() + 1); - return file_path; - } - if (fp) - { - fclose(fp); + return path; } } // File not found - return 0; + return ""; } -std::vector readFile(const std::string &filename) +std::vector readFile(const std::string &filename, + const std::string &startdir = "") { - char *file_path = findFilePath(filename); - - std::ifstream file(file_path, std::ios::ate | std::ios::binary); + std::string filepath = findFilePath(filename, startdir); + std::ifstream file(filepath, std::ios::ate | std::ios::binary); if (!file.is_open()) { @@ -800,6 +793,6 @@ std::vector readFile(const std::string &filename) file.seekg(0); file.read(buffer.data(), fileSize); file.close(); - printf("filesize is %d", fileSize); + printf("filesize is %zu\n", fileSize); return buffer; } diff --git a/test_conformance/common/vulkan_wrapper/vulkan_utility.hpp b/test_conformance/common/vulkan_wrapper/vulkan_utility.hpp index b3cc7e44cc..d2f4b7bf91 100644 --- a/test_conformance/common/vulkan_wrapper/vulkan_utility.hpp +++ b/test_conformance/common/vulkan_wrapper/vulkan_utility.hpp @@ -72,5 +72,6 @@ operator<<(std::ostream& os, VulkanExternalSemaphoreHandleType externalSemaphoreHandleType); std::ostream& operator<<(std::ostream& os, VulkanFormat format); -std::vector readFile(const std::string& filename); +std::vector readFile(const std::string& filename, + const std::string& startdir); #endif // _vulkan_utility_hpp_ diff --git a/test_conformance/events/test_event_dependencies.cpp b/test_conformance/events/test_event_dependencies.cpp index 3cc183bd82..b40a69dd81 100644 --- a/test_conformance/events/test_event_dependencies.cpp +++ b/test_conformance/events/test_event_dependencies.cpp @@ -32,7 +32,7 @@ const char *write_kernels[] = { }; #define TEST_SIZE 10000 -#define TEST_COUNT 100 +#define TEST_COUNT 10 #define RANDOMIZE 1 #define DEBUG_OUT 0 @@ -447,6 +447,14 @@ int test_event_enqueue_wait_for_events_run_test( test_error(error, "clEnqueueReadBuffer failed"); + error = clFinish(queues[0]); + test_error(error, "clFinish(queues[0]) failed"); + if (two_queues) + { + error = clFinish(queues[1]); + test_error(error, "clFinish(queues[1]) failed"); + } + failed = 0; for (i = 0; i < (int)TEST_SIZE; i++) if (values[i] != expected_value) diff --git a/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.cpp b/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.cpp index 6c02f9f788..b3e0a93e74 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.cpp @@ -254,8 +254,8 @@ struct MixedCommandsTest : public BasicCommandBufferTest { const cl_int pattern = pattern_base + i; cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, in_mem, &pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, &pattern, + sizeof(cl_int), 0, data_size(), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillBufferKHR failed"); error = clCommandNDRangeKernelKHR( @@ -265,8 +265,8 @@ struct MixedCommandsTest : public BasicCommandBufferTest const size_t result_offset = i * sizeof(cl_int); error = clCommandCopyBufferKHR( - command_buffer, nullptr, out_mem, result_mem, 0, result_offset, - sizeof(cl_int), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, out_mem, result_mem, 0, + result_offset, sizeof(cl_int), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandCopyBufferKHR failed"); } diff --git a/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.h b/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.h index d08a11af2e..3981427c0c 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.h +++ b/test_conformance/extensions/cl_khr_command_buffer/basic_command_buffer.h @@ -87,8 +87,30 @@ template int MakeAndRunTest(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) { - CHECK_COMMAND_BUFFER_EXTENSION_AVAILABLE(device); + if (!is_extension_available(device, "cl_khr_command_buffer")) + { + log_info("Device does not support 'cl_khr_command_buffer'. Skipping " + "the test.\n"); + return TEST_SKIPPED_ITSELF; + } + + Version device_version = get_device_cl_version(device); + if ((device_version >= Version(3, 0)) + || is_extension_available(device, "cl_khr_extended_versioning")) + { + + cl_version extension_version = + get_extension_version(device, "cl_khr_command_buffer"); + if (extension_version < CL_MAKE_VERSION(0, 9, 5)) + { + + log_info("cl_khr_command_buffer version 0.9.5 or later is required " + "to run " + "the test, skipping.\n "); + return TEST_SKIPPED_ITSELF; + } + } try { auto test_fixture = T(device, context, queue); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp index b438751b05..e31205ee97 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp @@ -140,7 +140,7 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest cl_int Run() override { - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -165,8 +165,6 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest cl_mutable_dispatch_arg_khr arg{ 1, sizeof(dst_buf_1), &dst_buf_1 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -180,12 +178,13 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -271,7 +270,7 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest threads[0] = number_of_ints; local_threads[0] = 1; - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -292,8 +291,6 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest cl_mutable_dispatch_arg_khr args[] = { arg_1 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -306,15 +303,17 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; error = clFinish(queue); test_error(error, "clFinish failed."); - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = @@ -325,8 +324,8 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest for (size_t i = 0; i < number_of_ints; i++) if (constant_data[i] != result_data[i]) { - log_error("Data failed to verify: constant_data[%d]=%d != " - "result_data[%d]=%d\n", + log_error("Data failed to verify: constant_data[%zu]=%d != " + "result_data[%zu]=%d\n", i, constant_data[i], i, result_data[i]); return TEST_FAIL; } @@ -404,7 +403,7 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest threads[0] = number_of_ints; local_threads[0] = 1; - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -426,8 +425,6 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest cl_mutable_dispatch_arg_khr args[] = { arg_1 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -440,15 +437,17 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; error = clFinish(queue); test_error(error, "clFinish failed."); - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueReadBuffer(queue, stream, CL_TRUE, 0, size_to_allocate, @@ -458,8 +457,8 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest for (size_t i = 0; i < number_of_ints; i++) if (constant_data[i] != result_data[i]) { - log_error("Data failed to verify: constant_data[%d]=%d != " - "result_data[%d]=%d\n", + log_error("Data failed to verify: constant_data[%zu]=%d != " + "result_data[%zu]=%d\n", i, constant_data[i], i, result_data[i]); return TEST_FAIL; } @@ -534,7 +533,8 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest cl_int Run() override { - cl_ndrange_kernel_command_properties_khr props[] = { + + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -572,8 +572,6 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest // Modify and execute the command buffer cl_mutable_dispatch_arg_khr arg{ 0, sizeof(cl_mem), nullptr }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -587,12 +585,13 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -723,7 +722,7 @@ struct MutableDispatchSVMArguments : public MutableDispatchArgumentsTest sizeof(init_buffer), &init_buffer); test_error(error, "clSetKernelExecInfo failed for init_buffer"); - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR | CL_MUTABLE_DISPATCH_EXEC_INFO_KHR, @@ -773,19 +772,19 @@ struct MutableDispatchSVMArguments : public MutableDispatchArgumentsTest exec_info.param_value = &new_buffer; cl_mutable_dispatch_config_khr dispatch_config{}; - dispatch_config.type = CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR; dispatch_config.command = command; dispatch_config.num_svm_args = 1; dispatch_config.arg_svm_list = &arg_svm; dispatch_config.num_exec_infos = 1; dispatch_config.exec_info_list = &exec_info; - cl_mutable_base_config_khr mutable_config{}; - mutable_config.type = CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR; - mutable_config.num_mutable_dispatch = 1; - mutable_config.mutable_dispatch_list = &dispatch_config; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_basic.h b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_basic.h index eee6a76ece..51938dce02 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_basic.h +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_basic.h @@ -80,6 +80,22 @@ struct BasicMutableCommandBufferTest : BasicCommandBufferTest "cl_khr_command_buffer_mutable_dispatch") == true; + if (extension_avaliable) { + // API breaking changes occur at revision 0.9.2, check implementation + // matches tested API + Version device_version = get_device_cl_version(device); + if ((device_version >= Version(3, 0)) + || is_extension_available(device, "cl_khr_extended_versioning")) { + + cl_version extension_version = + get_extension_version(device, "cl_khr_command_buffer_mutable_dispatch"); + + if (extension_version < CL_MAKE_VERSION(0, 9, 2)) { + extension_avaliable = false; + } + } + } + cl_mutable_dispatch_fields_khr mutable_capabilities; bool mutable_support = diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp index 80865e524d..753cc3be06 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp @@ -69,7 +69,7 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest available_caps &= ~CL_MUTABLE_DISPATCH_EXEC_INFO_KHR; // require at least one mutable capabillity - return (available_caps == 0) && InfoMutableCommandBufferTest::Skip(); + return (available_caps == 0) || InfoMutableCommandBufferTest::Skip(); } // setup kernel program specific for command buffer with full mutable @@ -295,7 +295,7 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest // run command buffer with full mutable dispatch test cl_int Run() override { - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, available_caps, 0 }; @@ -336,8 +336,6 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest // Modify and execute the command buffer cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 0 /* num_args */, 0 /* num_svm_arg */, @@ -395,12 +393,13 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest dispatch_config.local_work_size = &group_size; } - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp index 80bc015a33..1c7061ff99 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp @@ -88,8 +88,6 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest test_error(error, "clFinish failed."); cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 0 /* num_args */, 0 /* num_svm_arg */, @@ -102,12 +100,14 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -137,7 +137,7 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest if (i < update_global_offset && 0 != resultData[i]) { log_error("Data failed to verify: update_global_offset != " - "resultData[%d]=%d\n", + "resultData[%zu]=%d\n", i, resultData[i]); return TEST_FAIL; } @@ -145,7 +145,7 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest && update_global_offset != resultData[i]) { log_error("Data failed to verify: update_global_offset != " - "resultData[%d]=%d\n", + "resultData[%zu]=%d\n", i, resultData[i]); return TEST_FAIL; } diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp index 091f0c8d30..946fa995b3 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp @@ -87,8 +87,6 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest test_error(error, "clFinish failed."); cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 0 /* num_args */, 0 /* num_svm_arg */, @@ -101,12 +99,14 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest &update_global_size /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -136,7 +136,7 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest if (i >= update_global_size && global_work_size != resultData[i]) { log_error("Data failed to verify: update_global_size != " - "resultData[%d]=%d\n", + "resultData[%zu]=%d\n", i, resultData[i]); return TEST_FAIL; } @@ -144,7 +144,7 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest && update_global_size != resultData[i]) { log_error("Data failed to verify: update_global_size != " - "resultData[%d]=%d\n", + "resultData[%zu]=%d\n", i, resultData[i]); return TEST_FAIL; } diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp index d8036e17dd..eb7cb266a6 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp @@ -131,7 +131,7 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest error = clSetKernelArg(kernel, 2, sizeof(cl_mem), &dst_image); test_error(error, "Unable to set indexed kernel arguments"); - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -162,8 +162,6 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr args[] = { arg_2 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -176,11 +174,14 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -198,8 +199,8 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest { if (imageValues_input[i] != outputData[i]) { - log_error("Data failed to verify: imageValues[%d]=%d != " - "outputData[%d]=%d\n", + log_error("Data failed to verify: imageValues[%zu]=%d != " + "outputData[%zu]=%d\n", i, imageValues_input[i], i, outputData[i]); return TEST_FAIL; @@ -330,7 +331,7 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest size_t globalDim[3] = { 4, 4, 1 }, localDim[3] = { 1, 1, 1 }; - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -360,8 +361,6 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr args[] = { arg_2 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -374,11 +373,14 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -397,8 +399,8 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest { if (imageValues_input[i] != outputData[i]) { - log_error("Data failed to verify: imageValues[%d]=%d != " - "outputData[%d]=%d\n", + log_error("Data failed to verify: imageValues[%zu]=%d != " + "outputData[%zu]=%d\n", i, imageValues_input[i], i, outputData[i]); return TEST_FAIL; } diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_info.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_info.cpp index 71b9017ec3..2b5b3b42e8 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_info.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_info.cpp @@ -34,7 +34,7 @@ // CL_DEVICE_MUTABLE_DISPATCH_CAPABILITIES_KHR // CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR // CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR -// CL_MUTABLE_DISPATCH_PROPERTIES_ARRAY_KHR +// CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR // CL_MUTABLE_DISPATCH_KERNEL_KHR // CL_MUTABLE_DISPATCH_DIMENSIONS_KHR // CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR @@ -117,9 +117,27 @@ struct PropertiesArray : public InfoMutableCommandBufferTest : InfoMutableCommandBufferTest(device, context, queue) {} + virtual bool Skip() override + { + Version device_version = get_device_cl_version(device); + if ((device_version >= Version(3, 0)) + || is_extension_available(device, "cl_khr_extended_versioning")) + { + + cl_version extension_version = get_extension_version( + device, "cl_khr_command_buffer_mutable_dispatch"); + + if (extension_version < CL_MAKE_VERSION(0, 9, 3)) + { + return true; + } + } + return InfoMutableCommandBufferTest::Skip(); + } + cl_int Run() override { - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -129,11 +147,11 @@ struct PropertiesArray : public InfoMutableCommandBufferTest &global_work_size, nullptr, 0, nullptr, nullptr, &command); test_error(error, "clCommandNDRangeKernelKHR failed"); - cl_ndrange_kernel_command_properties_khr test_props[] = { 0, 0, 0 }; + cl_command_properties_khr test_props[] = { 0, 0, 0 }; size_t size; error = clGetMutableCommandInfoKHR( - command, CL_MUTABLE_DISPATCH_PROPERTIES_ARRAY_KHR, + command, CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR, sizeof(test_props), test_props, &size); test_error(error, "clGetMutableCommandInfoKHR failed"); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp index dd6bf4c1f8..e7a8c03586 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp @@ -152,8 +152,6 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr args = { 0, sizeof(cl_int), &pattern_sec }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -167,12 +165,13 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); // update parameter of previous mutable dispatch by using the same @@ -181,7 +180,8 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest args.arg_size = sizeof(new_out_mem); args.arg_value = &new_out_mem; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueFillBuffer(queue, new_out_mem, &pattern_pri, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp index 22a9da6d5c..823517f582 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp @@ -90,8 +90,6 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest test_error(error, "clFinish failed."); cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 0 /* num_args */, 0 /* num_svm_arg */, @@ -104,12 +102,14 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest &update_global_size /* global_work_size */, &update_local_size /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -139,7 +139,7 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest if (i < update_global_size && update_local_size != resultData[i]) { log_error("Data failed to verify: update_local_size != " - "resultData[%d]=%d\n", + "resultData[%zu]=%d\n", i, resultData[i]); return TEST_FAIL; } @@ -147,7 +147,7 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest && local_work_size != resultData[i]) { log_error("Data failed to verify: update_local_size != " - "resultData[%d]=%d\n", + "resultData[%zu]=%d\n", i, resultData[i]); return TEST_FAIL; } diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp index 0911472003..5ea0772d1b 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp @@ -164,20 +164,20 @@ struct MultipleCommandsDispatch : BasicMutableCommandBufferTest // modify two mutable parameters, each one with separate handle cl_mutable_dispatch_config_khr dispatch_config[] = { - { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, - command_pri, 1, 0, 0, 0, args_pri, nullptr, nullptr, nullptr, + { command_pri, 1, 0, 0, 0, args_pri, nullptr, nullptr, nullptr, nullptr, nullptr }, - { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, - command_sec, 1, 0, 0, 0, args_sec, nullptr, nullptr, nullptr, + { command_sec, 1, 0, 0, 0, args_sec, nullptr, nullptr, nullptr, nullptr, nullptr }, }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, - dispatch_config + cl_uint num_configs = 2; + cl_command_buffer_update_type_khr config_types[2] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[2] = { &dispatch_config[0], &dispatch_config[1] }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); // repeat execution of modified command buffer diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp index 74b0c9f2ad..a3484e48e1 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp @@ -157,8 +157,6 @@ struct OverwriteUpdateDispatch : BasicMutableCommandBufferTest &unused_mem } }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 2 /* num_args */, 0 /* num_svm_arg */, @@ -172,19 +170,21 @@ struct OverwriteUpdateDispatch : BasicMutableCommandBufferTest nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + const void *configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); // overwrite previous update of mutable arguments args[0].arg_value = &pattern_sec; args[1].arg_value = &new_out_mem; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueFillBuffer(queue, new_out_mem, &pattern_pri, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp index 42dd90c74a..9f0d806b9d 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp @@ -170,14 +170,15 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest cl_sync_point_khr sync_points[2]; const cl_int pattern = pattern_pri; cl_int error = clCommandFillBufferKHR( - work_command_buffer, nullptr, in_mem, &pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, &sync_points[0], nullptr); + work_command_buffer, nullptr, nullptr, in_mem, &pattern, + sizeof(cl_int), 0, data_size(), 0, nullptr, &sync_points[0], + nullptr); test_error(error, "clCommandFillBufferKHR failed"); - error = clCommandFillBufferKHR(work_command_buffer, nullptr, out_mem, - &overwritten_pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, &sync_points[1], - nullptr); + error = clCommandFillBufferKHR(work_command_buffer, nullptr, nullptr, + out_mem, &overwritten_pattern, + sizeof(cl_int), 0, data_size(), 0, + nullptr, &sync_points[1], nullptr); test_error(error, "clCommandFillBufferKHR failed"); error = clCommandNDRangeKernelKHR( @@ -224,8 +225,6 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr args[] = { arg_1 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -238,13 +237,14 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; - error = - clUpdateMutableCommandsKHR(work_command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void* configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(work_command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); error = clEnqueueCommandBufferKHR(0, nullptr, work_command_buffer, 0, @@ -269,8 +269,8 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest cl_sync_point_khr sync_points[2]; // for both simultaneous passes this call will fill entire in_mem buffer cl_int error = clCommandFillBufferKHR( - work_command_buffer, nullptr, in_mem, &pattern_pri, sizeof(cl_int), - 0, data_size() * buffer_size_multiplier, 0, nullptr, + work_command_buffer, nullptr, nullptr, in_mem, &pattern_pri, + sizeof(cl_int), 0, data_size() * buffer_size_multiplier, 0, nullptr, &sync_points[0], nullptr); test_error(error, "clCommandFillBufferKHR failed"); @@ -343,8 +343,6 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr args[] = { arg_1 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 1 /* num_args */, 0 /* num_svm_arg */, @@ -357,13 +355,14 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; - error = - clUpdateMutableCommandsKHR(work_command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void* configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(work_command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); // command buffer execution must wait for two wait-events @@ -519,11 +518,11 @@ struct CrossQueueSimultaneousMutableDispatchTest // record command buffer cl_int pattern = 0; cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, out_mem, &pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillBufferKHR failed"); - cl_ndrange_kernel_command_properties_khr props[] = { + cl_command_properties_khr props[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0 }; @@ -552,8 +551,6 @@ struct CrossQueueSimultaneousMutableDispatchTest cl_mutable_dispatch_arg_khr args[] = { arg_0, arg_1 }; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 2 /* num_args */, 0 /* num_svm_arg */, @@ -566,12 +563,14 @@ struct CrossQueueSimultaneousMutableDispatchTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config - }; - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR + }; + const void* configs[1] = { &dispatch_config }; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); // enqueue command buffer to non-default queue diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_work_groups.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_work_groups.cpp index f9bad81569..aaf0caa4a8 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_work_groups.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_work_groups.cpp @@ -34,7 +34,7 @@ struct Configuration { const cl_command_buffer_properties_khr *command_buffer_properties; - const cl_ndrange_kernel_command_properties_khr *ndrange_properties; + const cl_command_properties_khr *ndrange_properties; }; // Define the command buffer properties for each configuration @@ -44,7 +44,7 @@ const cl_command_buffer_properties_khr command_buffer_properties[] = { }; // Define the ndrange properties -const cl_ndrange_kernel_command_properties_khr ndrange_properties[] = { +const cl_command_properties_khr ndrange_properties[] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR, CL_MUTABLE_DISPATCH_ASSERTS_KHR, CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR, 0 @@ -199,8 +199,6 @@ struct MutableDispatchWorkGroups : public BasicMutableCommandBufferTest { cl_int error; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command, 0, // num_args 0, // num_svm_arg @@ -214,13 +212,14 @@ struct MutableDispatchWorkGroups : public BasicMutableCommandBufferTest nullptr // local_work_size }; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR }; - + const void *configs[1] = { &dispatch_config }; error = - clUpdateMutableCommandsKHR(single_command_buffer, &mutable_config); + clUpdateMutableCommandsKHR(single_command_buffer, num_configs, + config_types, configs); test_error(error, "clUpdateMutableCommandsKHR failed"); clEventWrapper events[2]; diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_out_of_order.cpp b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_out_of_order.cpp index 9e142bf20a..e6cea2278e 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_out_of_order.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_out_of_order.cpp @@ -161,14 +161,14 @@ struct OutOfOrderTest : public BasicCommandBufferTest { cl_sync_point_khr sync_points[2]; const cl_int pattern = pattern_pri; - cl_int error = - clCommandFillBufferKHR(out_of_order_command_buffer, nullptr, in_mem, - &pattern, sizeof(cl_int), 0, data_size(), 0, - nullptr, &sync_points[0], nullptr); + cl_int error = clCommandFillBufferKHR( + out_of_order_command_buffer, nullptr, nullptr, in_mem, &pattern, + sizeof(cl_int), 0, data_size(), 0, nullptr, &sync_points[0], + nullptr); test_error(error, "clCommandFillBufferKHR failed"); error = clCommandFillBufferKHR(out_of_order_command_buffer, nullptr, - out_mem, &overwritten_pattern, + nullptr, out_mem, &overwritten_pattern, sizeof(cl_int), 0, data_size(), 0, nullptr, &sync_points[1], nullptr); test_error(error, "clCommandFillBufferKHR failed"); @@ -214,7 +214,7 @@ struct OutOfOrderTest : public BasicCommandBufferTest cl_sync_point_khr sync_points[2]; // for both simultaneous passes this call will fill entire in_mem buffer cl_int error = clCommandFillBufferKHR( - out_of_order_command_buffer, nullptr, in_mem, &pattern_pri, + out_of_order_command_buffer, nullptr, nullptr, in_mem, &pattern_pri, sizeof(cl_int), 0, data_size() * buffer_size_multiplier, 0, nullptr, &sync_points[0], nullptr); test_error(error, "clCommandFillBufferKHR failed"); diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_barrier.cpp b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_barrier.cpp index 82ff16f0ec..72c5fcfb23 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_barrier.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_barrier.cpp @@ -40,22 +40,22 @@ struct BarrierWithWaitListKHR : public BasicCommandBufferTest cl_int Run() override { - cl_int error = - clCommandFillBufferKHR(out_of_order_command_buffer, nullptr, in_mem, - &pattern, sizeof(cl_int), 0, data_size(), 0, - nullptr, &sync_points[0], nullptr); + cl_int error = clCommandFillBufferKHR( + out_of_order_command_buffer, nullptr, nullptr, in_mem, &pattern, + sizeof(cl_int), 0, data_size(), 0, nullptr, &sync_points[0], + nullptr); test_error(error, "clCommandFillBufferKHR failed"); const cl_int overwritten_pattern = 0xACDC; error = clCommandFillBufferKHR(out_of_order_command_buffer, nullptr, - out_mem, &overwritten_pattern, + nullptr, out_mem, &overwritten_pattern, sizeof(cl_int), 0, data_size(), 0, nullptr, &sync_points[1], nullptr); test_error(error, "clCommandFillBufferKHR failed"); error = clCommandBarrierWithWaitListKHR(out_of_order_command_buffer, - nullptr, 2, sync_points, - nullptr, nullptr); + nullptr, nullptr, 2, + sync_points, nullptr, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); error = clCommandNDRangeKernelKHR( diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_base.h b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_base.h index 48abe25d70..dc44264125 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_base.h +++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_base.h @@ -161,17 +161,4 @@ class clCommandBufferWrapper { operator cl_command_buffer_khr() const { return object; } }; - -#define CHECK_COMMAND_BUFFER_EXTENSION_AVAILABLE(device) \ - { \ - if (!is_extension_available(device, "cl_khr_command_buffer")) \ - { \ - log_info( \ - "Device does not support 'cl_khr_command_buffer'. Skipping " \ - "the test.\n"); \ - return TEST_SKIPPED_ITSELF; \ - } \ - } - - #endif // CL_KHR_COMMAND_BUFFER_TEST_BASE_H diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_copy.cpp b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_copy.cpp index 0a30e76b22..c49974c873 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_copy.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_copy.cpp @@ -38,15 +38,15 @@ struct CopyImageKHR : public BasicCommandBufferTest cl_int Run() override { - cl_int error = clCommandFillImageKHR(command_buffer, nullptr, src_image, - fill_color_1, origin, region, 0, - nullptr, nullptr, nullptr); + cl_int error = clCommandFillImageKHR( + command_buffer, nullptr, nullptr, src_image, fill_color_1, origin, + region, 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillImageKHR failed"); - error = clCommandCopyImageKHR(command_buffer, nullptr, src_image, - dst_image, origin, origin, region, 0, 0, - nullptr, nullptr); + error = clCommandCopyImageKHR(command_buffer, nullptr, nullptr, + src_image, dst_image, origin, origin, + region, 0, 0, nullptr, nullptr); test_error(error, "clCommandCopyImageKHR failed"); @@ -141,13 +141,13 @@ struct CopyBufferKHR : public BasicCommandBufferTest cl_int Run() override { cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, in_mem, &pattern_1, sizeof(cl_char), 0, - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, &pattern_1, + sizeof(cl_char), 0, data_size(), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillBufferKHR failed"); - error = clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, out_mem, - 0, 0, data_size(), 0, nullptr, nullptr, - nullptr); + error = clCommandCopyBufferKHR(command_buffer, nullptr, nullptr, in_mem, + out_mem, 0, 0, data_size(), 0, nullptr, + nullptr, nullptr); test_error(error, "clCommandCopyBufferKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); @@ -204,14 +204,15 @@ struct CopySVMBufferKHR : public BasicSVMCommandBufferTest cl_int Run() override { + cl_int error = clCommandSVMMemFillKHR( - command_buffer, nullptr, svm_in_mem(), &pattern_1, sizeof(cl_char), - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandSVMMemFillKHR failed"); - error = clCommandSVMMemcpyKHR(command_buffer, nullptr, svm_out_mem(), - svm_in_mem(), data_size(), 0, nullptr, - nullptr, nullptr); + error = clCommandSVMMemcpyKHR(command_buffer, nullptr, nullptr, + svm_out_mem(), svm_in_mem(), data_size(), + 0, nullptr, nullptr, nullptr); test_error(error, "clCommandSVMMemcpyKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); @@ -273,15 +274,13 @@ struct CopyBufferToImageKHR : public BasicCommandBufferTest cl_int Run() override { cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, buffer, &pattern_1, sizeof(cl_char), 0, - data_size, 0, nullptr, nullptr, nullptr); - + command_buffer, nullptr, nullptr, buffer, &pattern_1, + sizeof(cl_char), 0, data_size, 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillBufferKHR failed"); - error = clCommandCopyBufferToImageKHR(command_buffer, nullptr, buffer, - image, 0, origin, region, 0, 0, - nullptr, nullptr); - + error = clCommandCopyBufferToImageKHR(command_buffer, nullptr, nullptr, + buffer, image, 0, origin, region, + 0, 0, nullptr, nullptr); test_error(error, "clCommandCopyBufferToImageKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); @@ -379,16 +378,14 @@ struct CopyImageToBufferKHR : public BasicCommandBufferTest cl_int Run() override { - cl_int error = - clCommandFillImageKHR(command_buffer, nullptr, image, fill_color_1, - origin, region, 0, nullptr, nullptr, nullptr); - + cl_int error = clCommandFillImageKHR( + command_buffer, nullptr, nullptr, image, fill_color_1, origin, + region, 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillImageKHR failed"); - error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, image, - buffer, origin, region, 0, 0, - nullptr, nullptr, nullptr); - + error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, nullptr, + image, buffer, origin, region, 0, + 0, nullptr, nullptr, nullptr); test_error(error, "clCommandCopyImageToBufferKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); @@ -484,14 +481,13 @@ struct CopyBufferRectKHR : public BasicCommandBufferTest cl_int Run() override { cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, in_mem, &pattern_1, sizeof(cl_char), 0, - data_size, 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, &pattern_1, + sizeof(cl_char), 0, data_size, 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillBufferKHR failed"); error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 0, nullptr, nullptr, nullptr); - + command_buffer, nullptr, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); test_error(error, "clCommandCopyBufferRectKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_fill.cpp b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_fill.cpp index 67809cfb91..d0311a6532 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_fill.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_test_fill.cpp @@ -35,10 +35,9 @@ struct FillImageKHR : public BasicCommandBufferTest cl_int Run() override { - cl_int error = - clCommandFillImageKHR(command_buffer, nullptr, image, fill_color_1, - origin, region, 0, nullptr, nullptr, nullptr); - + cl_int error = clCommandFillImageKHR( + command_buffer, nullptr, nullptr, image, fill_color_1, origin, + region, 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillImageKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); @@ -124,9 +123,8 @@ struct FillBufferKHR : public BasicCommandBufferTest cl_int Run() override { cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, in_mem, &pattern_1, sizeof(cl_char), 0, - data_size(), 0, nullptr, nullptr, nullptr); - + command_buffer, nullptr, nullptr, in_mem, &pattern_1, + sizeof(cl_char), 0, data_size(), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandFillBufferKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); @@ -179,8 +177,8 @@ struct FillSVMBufferKHR : public BasicSVMCommandBufferTest cl_int Run() override { cl_int error = clCommandSVMMemFillKHR( - command_buffer, nullptr, svm_in_mem(), &pattern_1, sizeof(cl_char), - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 0, nullptr, nullptr, nullptr); test_error(error, "clCommandSVMMemFillKHR failed"); error = clFinalizeCommandBufferKHR(command_buffer); diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_barrier.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_barrier.cpp index 6e682aa381..ae0dc69df5 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_barrier.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_barrier.cpp @@ -28,7 +28,7 @@ struct CommandBufferBarrierNotNullQueue : public BasicCommandBufferTest cl_int Run() override { cl_int error = clCommandBarrierWithWaitListKHR( - command_buffer, queue, 0, nullptr, nullptr, nullptr); + command_buffer, queue, nullptr, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandBarrierWithWaitListKHR should return " @@ -55,7 +55,7 @@ struct CommandBufferBarrierInvalidCommandBuffer : public BasicCommandBufferTest cl_int Run() override { cl_int error = clCommandBarrierWithWaitListKHR( - nullptr, queue, 0, nullptr, nullptr, nullptr); + nullptr, queue, nullptr, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandBarrierWithWaitListKHR should return " @@ -76,9 +76,8 @@ struct CommandBufferBarrierBufferFinalized : public BasicCommandBufferTest cl_int error = clFinalizeCommandBufferKHR(command_buffer); test_error(error, "clFinalizeCommandBufferKHR failed"); - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, nullptr, nullptr); - + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandBarrierWithWaitListKHR should return " "CL_INVALID_OPERATION", @@ -97,9 +96,9 @@ struct CommandBufferBarrierMutableHandleNotNull : public BasicCommandBufferTest { cl_mutable_command_khr mutable_handle; - cl_int error = clCommandBarrierWithWaitListKHR( - command_buffer, nullptr, 0, nullptr, nullptr, &mutable_handle); - + cl_int error = + clCommandBarrierWithWaitListKHR(command_buffer, nullptr, nullptr, 0, + nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandBarrierWithWaitListKHR should return " "CL_INVALID_VALUE", @@ -122,8 +121,9 @@ struct CommandBufferBarrierSyncPointsNullOrNumZero { cl_sync_point_khr invalid_point = 0; - cl_int error = clCommandBarrierWithWaitListKHR( - command_buffer, nullptr, 1, &invalid_point, nullptr, nullptr); + cl_int error = + clCommandBarrierWithWaitListKHR(command_buffer, nullptr, nullptr, 1, + &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandBarrierWithWaitListKHR should return " @@ -131,8 +131,8 @@ struct CommandBufferBarrierSyncPointsNullOrNumZero TEST_FAIL); - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 1, - nullptr, nullptr, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandBarrierWithWaitListKHR should return " @@ -141,13 +141,13 @@ struct CommandBufferBarrierSyncPointsNullOrNumZero cl_sync_point_khr point; - error = - clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, out_mem, 0, - 0, data_size(), 0, nullptr, &point, nullptr); + error = clCommandCopyBufferKHR(command_buffer, nullptr, nullptr, in_mem, + out_mem, 0, 0, data_size(), 0, nullptr, + &point, nullptr); test_error(error, "clCommandCopyBufferKHR failed"); - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - &point, nullptr, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandBarrierWithWaitListKHR should return " diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy.cpp index 211ffc4d63..20087b93b3 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy.cpp @@ -95,9 +95,9 @@ struct CommandBufferCopyBufferQueueNotNull cl_int Run() override { - cl_int error = - clCommandCopyBufferKHR(command_buffer, queue, in_mem, out_mem, 0, 0, - data_size, 0, nullptr, nullptr, nullptr); + cl_int error = clCommandCopyBufferKHR(command_buffer, queue, nullptr, + in_mem, out_mem, 0, 0, data_size, + 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandCopyBufferKHR should return " @@ -105,8 +105,8 @@ struct CommandBufferCopyBufferQueueNotNull TEST_FAIL); error = clCommandCopyBufferRectKHR( - command_buffer, queue, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 0, nullptr, nullptr, nullptr); + command_buffer, queue, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandCopyBufferRectKHR should return " @@ -126,8 +126,8 @@ struct CommandBufferCopyImageQueueNotNull cl_int Run() override { cl_int error = clCommandCopyImageToBufferKHR( - command_buffer, queue, image, buffer, origin, region, 0, 0, nullptr, - nullptr, nullptr); + command_buffer, queue, nullptr, image, buffer, origin, region, 0, 0, + nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandCopyImageToBufferKHR should return " @@ -167,8 +167,8 @@ struct CommandBufferCopyBufferDifferentContexts cl_int Run() override { cl_int error = clCommandCopyBufferKHR( - command_buffer, nullptr, in_mem_ctx, out_mem, 0, 0, data_size, 0, - nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem_ctx, out_mem, 0, 0, + data_size, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyBufferKHR should return " @@ -177,16 +177,15 @@ struct CommandBufferCopyBufferDifferentContexts error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem_ctx, out_mem, origin, origin, - region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem_ctx, out_mem, origin, + origin, region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyBufferRectKHR should return " "CL_INVALID_CONTEXT", TEST_FAIL); - - error = clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, + error = clCommandCopyBufferKHR(command_buffer, nullptr, nullptr, in_mem, out_mem_ctx, 0, 0, data_size, 0, nullptr, nullptr, nullptr); @@ -196,8 +195,8 @@ struct CommandBufferCopyBufferDifferentContexts TEST_FAIL); error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem_ctx, origin, origin, - region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, out_mem_ctx, origin, + origin, region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyBufferRectKHR should return " @@ -242,18 +241,17 @@ struct CommandBufferCopyImageDifferentContexts cl_int Run() override { cl_int error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, image_ctx, buffer, origin, region, 0, 0, - nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, image_ctx, buffer, origin, region, + 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageToBufferKHR should return " "CL_INVALID_CONTEXT", TEST_FAIL); - - error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, image, - buffer_ctx, origin, region, 0, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, nullptr, + image, buffer_ctx, origin, region, + 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageToBufferKHR should return " @@ -282,9 +280,9 @@ struct CommandBufferCopyBufferSyncPointsNullOrNumZero { cl_sync_point_khr invalid_point = 0; - cl_int error = clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, - out_mem, 0, 0, data_size, 1, - &invalid_point, nullptr, nullptr); + cl_int error = clCommandCopyBufferKHR( + command_buffer, nullptr, nullptr, in_mem, out_mem, 0, 0, data_size, + 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyBufferKHR should return " @@ -292,8 +290,8 @@ struct CommandBufferCopyBufferSyncPointsNullOrNumZero TEST_FAIL); error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 1, &invalid_point, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyBufferRectKHR should return " @@ -301,9 +299,9 @@ struct CommandBufferCopyBufferSyncPointsNullOrNumZero TEST_FAIL); - error = - clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, out_mem, 0, - 0, data_size, 1, nullptr, nullptr, nullptr); + error = clCommandCopyBufferKHR(command_buffer, nullptr, nullptr, in_mem, + out_mem, 0, 0, data_size, 1, nullptr, + nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyBufferKHR should return " @@ -312,8 +310,8 @@ struct CommandBufferCopyBufferSyncPointsNullOrNumZero error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 1, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyBufferRectKHR should return " @@ -322,13 +320,13 @@ struct CommandBufferCopyBufferSyncPointsNullOrNumZero cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); - error = - clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, out_mem, 0, - 0, data_size, 0, &point, nullptr, nullptr); + error = clCommandCopyBufferKHR(command_buffer, nullptr, nullptr, in_mem, + out_mem, 0, 0, data_size, 0, &point, + nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyBufferKHR should return " @@ -336,8 +334,8 @@ struct CommandBufferCopyBufferSyncPointsNullOrNumZero TEST_FAIL); error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 0, &point, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyBufferRectKHR should return " @@ -363,8 +361,8 @@ struct CommandBufferCopyImageSyncPointsNullOrNumZero cl_sync_point_khr invalid_point = 0; cl_int error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, image, buffer, origin, region, 0, 1, - &invalid_point, nullptr, nullptr); + command_buffer, nullptr, nullptr, image, buffer, origin, region, 0, + 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageToBufferKHR should return " @@ -372,9 +370,9 @@ struct CommandBufferCopyImageSyncPointsNullOrNumZero TEST_FAIL); - error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, image, - buffer, origin, region, 0, 1, - nullptr, nullptr, nullptr); + error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, nullptr, + image, buffer, origin, region, 0, + 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageToBufferKHR should return " @@ -383,13 +381,13 @@ struct CommandBufferCopyImageSyncPointsNullOrNumZero cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); - error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, image, - buffer, origin, region, 0, 0, - &point, nullptr, nullptr); + error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, nullptr, + image, buffer, origin, region, 0, + 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageToBufferKHR should return " @@ -409,18 +407,18 @@ struct CommandBufferCopyBufferInvalidCommandBuffer cl_int Run() override { - cl_int error = - clCommandCopyBufferKHR(nullptr, nullptr, in_mem, out_mem, 0, 0, - data_size, 0, nullptr, nullptr, nullptr); + cl_int error = clCommandCopyBufferKHR(nullptr, nullptr, nullptr, in_mem, + out_mem, 0, 0, data_size, 0, + nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandCopyBufferKHR should return " "CL_INVALID_COMMAND_BUFFER_KHR", TEST_FAIL); - error = clCommandCopyBufferRectKHR(nullptr, nullptr, in_mem, out_mem, - origin, origin, region, 0, 0, 0, 0, - 0, nullptr, nullptr, nullptr); + error = clCommandCopyBufferRectKHR( + nullptr, nullptr, nullptr, in_mem, out_mem, origin, origin, region, + 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandCopyBufferRectKHR should return " @@ -441,8 +439,8 @@ struct CommandBufferCopyImageInvalidCommandBuffer cl_int Run() override { cl_int error = clCommandCopyImageToBufferKHR( - nullptr, nullptr, image, buffer, origin, region, 0, 0, nullptr, - nullptr, nullptr); + nullptr, nullptr, nullptr, image, buffer, origin, region, 0, 0, + nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandCopyImageToBufferKHR should return " @@ -464,9 +462,9 @@ struct CommandBufferCopyBufferFinalizedCommandBuffer cl_int error = clFinalizeCommandBufferKHR(command_buffer); test_error(error, "clFinalizeCommandBufferKHR failed"); - error = - clCommandCopyBufferKHR(command_buffer, nullptr, in_mem, out_mem, 0, - 0, data_size, 0, nullptr, nullptr, nullptr); + error = clCommandCopyBufferKHR(command_buffer, nullptr, nullptr, in_mem, + out_mem, 0, 0, data_size, 0, nullptr, + nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandCopyBufferKHR should return " @@ -475,8 +473,8 @@ struct CommandBufferCopyBufferFinalizedCommandBuffer error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandCopyBufferRectKHR should return " @@ -499,9 +497,9 @@ struct CommandBufferCopyImageFinalizedCommandBuffer test_error(error, "clFinalizeCommandBufferKHR failed"); - error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, image, - buffer, origin, region, 0, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageToBufferKHR(command_buffer, nullptr, nullptr, + image, buffer, origin, region, 0, + 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandCopyImageToBufferKHR should return " @@ -523,8 +521,8 @@ struct CommandBufferCopyBufferMutableHandleNotNull cl_mutable_command_khr mutable_handle; cl_int error = clCommandCopyBufferKHR( - command_buffer, nullptr, in_mem, out_mem, 0, 0, data_size, 0, - nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, in_mem, out_mem, 0, 0, data_size, + 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandCopyBufferKHR should return " @@ -533,8 +531,8 @@ struct CommandBufferCopyBufferMutableHandleNotNull error = clCommandCopyBufferRectKHR( - command_buffer, nullptr, in_mem, out_mem, origin, origin, region, 0, - 0, 0, 0, 0, nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, in_mem, out_mem, origin, origin, + region, 0, 0, 0, 0, 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandCopyBufferRectKHR should return " @@ -557,8 +555,8 @@ struct CommandBufferCopyImageMutableHandleNotNull cl_mutable_command_khr mutable_handle; cl_int error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, image, buffer, origin, region, 0, 0, - nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, image, buffer, origin, region, 0, + 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandCopyImageToBufferKHR should return " diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy_image.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy_image.cpp index 80bb3b0245..a6e5af2cdf 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy_image.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_copy_image.cpp @@ -76,18 +76,19 @@ struct CommandBufferCopyImageQueueNotNull : public CommandCopyBaseTest cl_int Run() override { - cl_int error = clCommandCopyImageKHR(command_buffer, queue, src_image, - dst_image, origin, origin, region, - 0, nullptr, nullptr, nullptr); + cl_int error = clCommandCopyImageKHR( + command_buffer, queue, nullptr, src_image, dst_image, origin, + origin, region, 0, nullptr, nullptr, nullptr); + test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandCopyImageKHR should return " "CL_INVALID_COMMAND_QUEUE", TEST_FAIL); - error = clCommandCopyImageToBufferKHR(command_buffer, queue, src_image, - out_mem, origin, region, 0, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageToBufferKHR( + command_buffer, queue, nullptr, src_image, out_mem, origin, region, + 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandCopyImageToBufferKHR should return " @@ -115,8 +116,8 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest cl_int Run() override { cl_int error = clCommandCopyImageKHR( - command_buffer, nullptr, src_image_ctx, dst_image, origin, origin, - region, 0, 0, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image_ctx, dst_image, origin, + origin, region, 0, 0, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageKHR should return " @@ -124,17 +125,17 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image_ctx, out_mem, origin, region, 0, - 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image_ctx, out_mem, origin, + region, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageToBufferKHR should return " "CL_INVALID_CONTEXT", TEST_FAIL); - error = clCommandCopyImageKHR(command_buffer, nullptr, src_image, - dst_image_ctx, origin, origin, region, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageKHR(command_buffer, nullptr, nullptr, + src_image, dst_image_ctx, origin, origin, + region, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageKHR should return " @@ -142,8 +143,8 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, dst_image_ctx, origin, region, - 0, 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, dst_image_ctx, origin, + region, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageToBufferKHR should return " @@ -154,9 +155,9 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest command_buffer = clCreateCommandBufferKHR(1, &queue1, 0, &error); test_error(error, "clCreateCommandBufferKHR failed"); - error = clCommandCopyImageKHR(command_buffer, nullptr, src_image, - dst_image, origin, origin, region, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageKHR(command_buffer, nullptr, nullptr, + src_image, dst_image, origin, origin, + region, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageKHR should return " @@ -164,8 +165,8 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0, - nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, out_mem, origin, + region, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandCopyImageToBufferKHR should return " @@ -216,8 +217,8 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest cl_sync_point_khr invalid_point = 0; cl_int error = clCommandCopyImageKHR( - command_buffer, nullptr, src_image, dst_image, origin, origin, - region, 1, &invalid_point, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, dst_image, origin, + origin, region, 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageKHR should return " @@ -225,18 +226,17 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, out_mem, origin, region, 0, 1, - &invalid_point, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, out_mem, origin, + region, 0, 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageToBufferKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", TEST_FAIL); - - error = clCommandCopyImageKHR(command_buffer, nullptr, src_image, - dst_image, origin, origin, region, 1, - nullptr, nullptr, nullptr); + error = clCommandCopyImageKHR(command_buffer, nullptr, nullptr, + src_image, dst_image, origin, origin, + region, 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageKHR should return " @@ -244,8 +244,8 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, out_mem, origin, region, 0, 1, - nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, out_mem, origin, + region, 0, 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageToBufferKHR should return " @@ -254,13 +254,13 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); - error = clCommandCopyImageKHR(command_buffer, nullptr, src_image, - dst_image, origin, origin, region, 0, - &point, nullptr, nullptr); + error = clCommandCopyImageKHR(command_buffer, nullptr, nullptr, + src_image, dst_image, origin, origin, + region, 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageKHR should return " @@ -268,8 +268,8 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0, - &point, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, out_mem, origin, + region, 0, 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandCopyImageToBufferKHR should return " @@ -289,18 +289,18 @@ struct CommandBufferCopyImageInvalidCommandBuffer : public CommandCopyBaseTest cl_int Run() override { - cl_int error = clCommandCopyImageKHR(nullptr, nullptr, src_image, - dst_image, origin, origin, region, - 0, nullptr, nullptr, nullptr); + cl_int error = clCommandCopyImageKHR( + nullptr, nullptr, nullptr, src_image, dst_image, origin, origin, + region, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandCopyImageKHR should return " "CL_INVALID_COMMAND_BUFFER_KHR", TEST_FAIL); - error = clCommandCopyImageToBufferKHR(nullptr, nullptr, src_image, - out_mem, origin, region, 0, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageToBufferKHR( + nullptr, nullptr, nullptr, src_image, out_mem, origin, region, 0, 0, + nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandCopyImageToBufferKHR should return " @@ -322,9 +322,9 @@ struct CommandBufferCopyImageFinalizedCommandBuffer : public CommandCopyBaseTest cl_int error = clFinalizeCommandBufferKHR(command_buffer); test_error(error, "clFinalizeCommandBufferKHR failed"); - error = clCommandCopyImageKHR(command_buffer, nullptr, src_image, - dst_image, origin, origin, region, 0, - nullptr, nullptr, nullptr); + error = clCommandCopyImageKHR(command_buffer, nullptr, nullptr, + src_image, dst_image, origin, origin, + region, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandCopyImageKHR should return " @@ -332,8 +332,8 @@ struct CommandBufferCopyImageFinalizedCommandBuffer : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0, - nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, src_image, out_mem, origin, + region, 0, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandCopyImageToBufferKHR should return " @@ -354,8 +354,8 @@ struct CommandBufferCopyImageMutableHandleNotNull : public CommandCopyBaseTest { cl_mutable_command_khr mutable_handle; cl_int error = clCommandCopyImageKHR( - command_buffer, nullptr, src_image, dst_image, origin, origin, - region, 0, nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, src_image, dst_image, origin, + origin, region, 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandCopyImageKHR should return " @@ -363,8 +363,8 @@ struct CommandBufferCopyImageMutableHandleNotNull : public CommandCopyBaseTest TEST_FAIL); error = clCommandCopyImageToBufferKHR( - command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0, - nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, src_image, out_mem, origin, + region, 0, 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandCopyImageToBufferKHR should return " diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_fill.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_fill.cpp index d8e54c22a9..23c282f060 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_fill.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_fill.cpp @@ -82,8 +82,8 @@ struct CommandBufferCommandFillBufferQueueNotNull cl_int Run() override { cl_int error = clCommandFillBufferKHR( - command_buffer, queue, out_mem, &pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, queue, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandFillBufferKHR should return " @@ -109,9 +109,9 @@ struct CommandBufferCommandFillImageQueueNotNull cl_int Run() override { - cl_int error = clCommandFillImageKHR(command_buffer, queue, src_image, - fill_color_1, origin, region, 0, - nullptr, nullptr, nullptr); + cl_int error = clCommandFillImageKHR( + command_buffer, queue, nullptr, src_image, fill_color_1, origin, + region, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE, "clCommandFillImageKHR should return " @@ -139,8 +139,8 @@ struct CommandBufferCommandFillBufferContextNotSame cl_int Run() override { cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, out_mem_ctx, &pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, out_mem_ctx, &pattern, + sizeof(cl_int), 0, data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandFillBufferKHR should return " @@ -181,8 +181,8 @@ struct CommandBufferCommandFillImageContextNotSame cl_int Run() override { cl_int error = clCommandFillImageKHR( - command_buffer, nullptr, dst_image_ctx, fill_color_1, origin, - region, 0, nullptr, nullptr, nullptr); + command_buffer, nullptr, nullptr, dst_image_ctx, fill_color_1, + origin, region, 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_CONTEXT, "clCommandFillImageKHR should return " @@ -225,8 +225,8 @@ struct CommandBufferCommandFillBufferSyncPointsNullOrNumZero cl_sync_point_khr invalid_point = 0; cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, out_mem, &pattern, sizeof(cl_int), 0, - data_size(), 1, &invalid_point, nullptr, nullptr); + command_buffer, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandFillBufferKHR should return " @@ -234,9 +234,9 @@ struct CommandBufferCommandFillBufferSyncPointsNullOrNumZero TEST_FAIL); - error = clCommandFillBufferKHR(command_buffer, nullptr, out_mem, - &pattern, sizeof(cl_int), 0, data_size(), - 1, nullptr, nullptr, nullptr); + error = clCommandFillBufferKHR( + command_buffer, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandFillBufferKHR should return " @@ -245,13 +245,13 @@ struct CommandBufferCommandFillBufferSyncPointsNullOrNumZero cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); - error = clCommandFillBufferKHR(command_buffer, nullptr, out_mem, - &pattern, sizeof(cl_int), 0, data_size(), - 0, &point, nullptr, nullptr); + error = clCommandFillBufferKHR( + command_buffer, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandFillBufferKHR should return " @@ -276,9 +276,9 @@ struct CommandBufferCommandFillImageSyncPointsNullOrNumZero { cl_sync_point_khr invalid_point = 0; - cl_int error = clCommandFillImageKHR(command_buffer, nullptr, dst_image, - fill_color_1, origin, region, 1, - &invalid_point, nullptr, nullptr); + cl_int error = clCommandFillImageKHR( + command_buffer, nullptr, nullptr, dst_image, fill_color_1, origin, + region, 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandFillImageKHR should return " @@ -286,9 +286,9 @@ struct CommandBufferCommandFillImageSyncPointsNullOrNumZero TEST_FAIL); - error = clCommandFillImageKHR(command_buffer, nullptr, dst_image, - fill_color_1, origin, region, 1, nullptr, - nullptr, nullptr); + error = clCommandFillImageKHR(command_buffer, nullptr, nullptr, + dst_image, fill_color_1, origin, region, + 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandFillImageKHR should return " @@ -296,14 +296,14 @@ struct CommandBufferCommandFillImageSyncPointsNullOrNumZero TEST_FAIL); cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); - error = clCommandFillImageKHR(command_buffer, nullptr, dst_image, - fill_color_1, origin, region, 0, &point, - nullptr, nullptr); + error = clCommandFillImageKHR(command_buffer, nullptr, nullptr, + dst_image, fill_color_1, origin, region, + 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandFillImageKHR should return " @@ -326,8 +326,8 @@ struct CommandBufferCommandFillBufferInvalidCommandBuffer cl_int Run() override { cl_int error = clCommandFillBufferKHR( - nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), 0, data_size(), - 0, nullptr, nullptr, nullptr); + nullptr, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), 0, + data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandFillBufferKHR should return " @@ -347,9 +347,9 @@ struct CommandBufferCommandFillImageInvalidCommandBuffer cl_int Run() override { - cl_int error = - clCommandFillImageKHR(nullptr, nullptr, dst_image, fill_color_1, - origin, region, 0, nullptr, nullptr, nullptr); + cl_int error = clCommandFillImageKHR( + nullptr, nullptr, nullptr, dst_image, fill_color_1, origin, region, + 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandFillImageKHR should return " @@ -371,9 +371,9 @@ struct CommandBufferCommandFillBufferFinalizedCommandBuffer cl_int error = clFinalizeCommandBufferKHR(command_buffer); test_error(error, "clFinalizeCommandBufferKHR failed"); - error = clCommandFillBufferKHR(command_buffer, nullptr, out_mem, - &pattern, sizeof(cl_int), 0, data_size(), - 0, nullptr, nullptr, nullptr); + error = clCommandFillBufferKHR( + command_buffer, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandFillBufferKHR should return " @@ -397,9 +397,9 @@ struct CommandBufferCommandFillImageFinalizedCommandBuffer test_error(error, "clFinalizeCommandBufferKHR failed"); - error = clCommandFillImageKHR(command_buffer, nullptr, dst_image, - fill_color_1, origin, region, 0, nullptr, - nullptr, nullptr); + error = clCommandFillImageKHR(command_buffer, nullptr, nullptr, + dst_image, fill_color_1, origin, region, + 0, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_OPERATION, "clCommandFillImageKHR should return " @@ -421,8 +421,8 @@ struct CommandBufferCommandFillBufferMutableHandleNotNull cl_mutable_command_khr mutable_handle; cl_int error = clCommandFillBufferKHR( - command_buffer, nullptr, out_mem, &pattern, sizeof(cl_int), 0, - data_size(), 0, nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, out_mem, &pattern, sizeof(cl_int), + 0, data_size(), 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandFillBufferKHR should return " @@ -444,9 +444,9 @@ struct CommandBufferCommandFillImageMutableHandleNotNull { cl_mutable_command_khr mutable_handle; - cl_int error = clCommandFillImageKHR(command_buffer, nullptr, dst_image, - fill_color_1, origin, region, 0, - nullptr, nullptr, &mutable_handle); + cl_int error = clCommandFillImageKHR( + command_buffer, nullptr, nullptr, dst_image, fill_color_1, origin, + region, 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret(error, CL_INVALID_VALUE, "clCommandFillImageKHR should return " diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_svm_mem.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_svm_mem.cpp index b5d2355b2a..26f1c2577c 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_svm_mem.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_svm_mem.cpp @@ -29,17 +29,17 @@ struct CommandBufferCommandSVMQueueNotNull : public BasicSVMCommandBufferTest cl_int Run() override { cl_int error = clCommandSVMMemcpyKHR( - command_buffer, queue, svm_out_mem(), svm_in_mem(), data_size(), 0, - nullptr, nullptr, nullptr); + command_buffer, queue, nullptr, svm_out_mem(), svm_in_mem(), + data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret( error, CL_INVALID_COMMAND_QUEUE, "clCommandSVMMemcpyKHR should return CL_INVALID_COMMAND_QUEUE", TEST_FAIL); - error = clCommandSVMMemFillKHR(command_buffer, queue, svm_in_mem(), - &pattern_1, sizeof(cl_char), data_size(), - 0, nullptr, nullptr, nullptr); + error = clCommandSVMMemFillKHR( + command_buffer, queue, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret( error, CL_INVALID_COMMAND_QUEUE, @@ -73,37 +73,33 @@ struct CommandBufferCommandSVMSyncPointsNullOrNumZero cl_sync_point_khr invalid_point = 0; cl_int error = clCommandSVMMemcpyKHR( - command_buffer, nullptr, svm_out_mem(), svm_in_mem(), data_size(), - 1, &invalid_point, nullptr, nullptr); - + command_buffer, nullptr, nullptr, svm_out_mem(), svm_in_mem(), + data_size(), 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandSVMMemcpyKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", TEST_FAIL); - error = clCommandSVMMemFillKHR(command_buffer, nullptr, svm_in_mem(), - &pattern_1, sizeof(cl_char), data_size(), - 1, &invalid_point, nullptr, nullptr); - + error = clCommandSVMMemFillKHR( + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 1, &invalid_point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandSVMMemFillKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", TEST_FAIL); - - error = clCommandSVMMemcpyKHR(command_buffer, nullptr, svm_out_mem(), - svm_in_mem(), data_size(), 1, nullptr, - nullptr, nullptr); + error = clCommandSVMMemcpyKHR(command_buffer, nullptr, nullptr, + svm_out_mem(), svm_in_mem(), data_size(), + 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandSVMMemcpyKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", TEST_FAIL); - error = clCommandSVMMemFillKHR(command_buffer, nullptr, svm_in_mem(), - &pattern_1, sizeof(cl_char), data_size(), - 1, nullptr, nullptr, nullptr); - + error = clCommandSVMMemFillKHR( + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 1, nullptr, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandSVMMemFillKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", @@ -111,23 +107,22 @@ struct CommandBufferCommandSVMSyncPointsNullOrNumZero cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); - error = clCommandSVMMemcpyKHR(command_buffer, nullptr, svm_out_mem(), - svm_in_mem(), data_size(), 0, &point, - nullptr, nullptr); + error = clCommandSVMMemcpyKHR(command_buffer, nullptr, nullptr, + svm_out_mem(), svm_in_mem(), data_size(), + 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandSVMMemcpyKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", TEST_FAIL); - error = clCommandSVMMemFillKHR(command_buffer, nullptr, svm_in_mem(), - &pattern_1, sizeof(cl_char), data_size(), - 0, &point, nullptr, nullptr); - + error = clCommandSVMMemFillKHR( + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 0, &point, nullptr, nullptr); test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR, "clCommandSVMMemFillKHR should return " "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", @@ -149,16 +144,16 @@ struct CommandBufferCommandSVMInvalidCommandBuffer cl_int Run() override { - cl_int error = - clCommandSVMMemcpyKHR(nullptr, nullptr, svm_out_mem(), svm_in_mem(), - data_size(), 0, nullptr, nullptr, nullptr); + cl_int error = clCommandSVMMemcpyKHR( + nullptr, nullptr, nullptr, svm_out_mem(), svm_in_mem(), data_size(), + 0, nullptr, nullptr, nullptr); test_failure_error_ret( error, CL_INVALID_COMMAND_BUFFER_KHR, "clCommandSVMMemcpyKHR should return CL_INVALID_COMMAND_BUFFER_KHR", TEST_FAIL); - error = clCommandSVMMemFillKHR(nullptr, nullptr, svm_in_mem(), + error = clCommandSVMMemFillKHR(nullptr, nullptr, nullptr, svm_in_mem(), &pattern_1, sizeof(cl_char), data_size(), 0, nullptr, nullptr, nullptr); @@ -184,19 +179,17 @@ struct CommandBufferCommandSVMFinalizedCommandBuffer cl_int error = clFinalizeCommandBufferKHR(command_buffer); test_error(error, "clFinalizeCommandBufferKHR failed"); - error = clCommandSVMMemcpyKHR(command_buffer, nullptr, svm_out_mem(), - svm_in_mem(), data_size(), 0, nullptr, - nullptr, nullptr); - + error = clCommandSVMMemcpyKHR(command_buffer, nullptr, nullptr, + svm_out_mem(), svm_in_mem(), data_size(), + 0, nullptr, nullptr, nullptr); test_failure_error_ret( error, CL_INVALID_OPERATION, "clCommandSVMMemcpyKHR should return CL_INVALID_OPERATION", TEST_FAIL); - error = clCommandSVMMemFillKHR(command_buffer, nullptr, svm_in_mem(), - &pattern_1, sizeof(cl_char), data_size(), - 0, nullptr, nullptr, nullptr); - + error = clCommandSVMMemFillKHR( + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 0, nullptr, nullptr, nullptr); test_failure_error_ret( error, CL_INVALID_OPERATION, "clCommandSVMMemFillKHR should return CL_INVALID_OPERATION", @@ -219,16 +212,16 @@ struct CommandBufferCommandSVMMutableHandleNotNull cl_mutable_command_khr mutable_handle; cl_int error = clCommandSVMMemcpyKHR( - command_buffer, nullptr, svm_out_mem(), svm_in_mem(), data_size(), - 0, nullptr, nullptr, &mutable_handle); + command_buffer, nullptr, nullptr, svm_out_mem(), svm_in_mem(), + data_size(), 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret( error, CL_INVALID_VALUE, "clCommandSVMMemcpyKHR should return CL_INVALID_VALUE", TEST_FAIL); - error = clCommandSVMMemFillKHR(command_buffer, nullptr, svm_in_mem(), - &pattern_1, sizeof(cl_char), data_size(), - 0, nullptr, nullptr, &mutable_handle); + error = clCommandSVMMemFillKHR( + command_buffer, nullptr, nullptr, svm_in_mem(), &pattern_1, + sizeof(cl_char), data_size(), 0, nullptr, nullptr, &mutable_handle); test_failure_error_ret( error, CL_INVALID_VALUE, diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_nd_range_kernel.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_nd_range_kernel.cpp index ccbefd85f8..2d5327717c 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_nd_range_kernel.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_nd_range_kernel.cpp @@ -133,10 +133,9 @@ struct CommandNDRangeKerneSyncPointsNullOrNumZero "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR", TEST_FAIL); - cl_sync_point_khr point; - error = clCommandBarrierWithWaitListKHR(command_buffer, nullptr, 0, - nullptr, &point, nullptr); + error = clCommandBarrierWithWaitListKHR( + command_buffer, nullptr, nullptr, 0, nullptr, &point, nullptr); test_error(error, "clCommandBarrierWithWaitListKHR failed"); cl_sync_point_khr* sync_points[] = { &point }; @@ -182,8 +181,8 @@ struct CommandNDRangeKernelInvalidProperties : public BasicCommandBufferTest cl_int Run() override { - cl_ndrange_kernel_command_properties_khr empty_properties = - ~cl_ndrange_kernel_command_properties_khr(0); + cl_command_properties_khr empty_properties = + ~cl_command_properties_khr(0); cl_int error = clCommandNDRangeKernelKHR( command_buffer, nullptr, &empty_properties, kernel, 1, nullptr, @@ -194,7 +193,7 @@ struct CommandNDRangeKernelInvalidProperties : public BasicCommandBufferTest "CL_INVALID_VALUE", TEST_FAIL); - cl_ndrange_kernel_command_properties_khr props_invalid[3] = { + cl_command_properties_khr props_invalid[3] = { CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, CL_MEM_USE_CACHED_CPU_MEMORY_IMG, 1 }; diff --git a/test_conformance/extensions/cl_khr_semaphore/CMakeLists.txt b/test_conformance/extensions/cl_khr_semaphore/CMakeLists.txt index aa0e80d512..5f408cdbef 100644 --- a/test_conformance/extensions/cl_khr_semaphore/CMakeLists.txt +++ b/test_conformance/extensions/cl_khr_semaphore/CMakeLists.txt @@ -3,11 +3,11 @@ set(MODULE_NAME CL_KHR_SEMAPHORE) set(${MODULE_NAME}_SOURCES main.cpp test_semaphores.cpp - test_semaphores_queries.cpp + test_semaphores_negative_wait_signal.cpp test_semaphores_negative_release_retain.cpp test_semaphores_negative_getinfo.cpp - test_semaphores_negative_wait.cpp test_semaphores_negative_create.cpp + test_semaphores_queries.cpp semaphore_base.h ) diff --git a/test_conformance/extensions/cl_khr_semaphore/main.cpp b/test_conformance/extensions/cl_khr_semaphore/main.cpp index 716b9c960a..44897dd7b6 100644 --- a/test_conformance/extensions/cl_khr_semaphore/main.cpp +++ b/test_conformance/extensions/cl_khr_semaphore/main.cpp @@ -60,6 +60,16 @@ test_definition test_list[] = { Version(1, 2)), ADD_TEST_VERSION(semaphores_negative_wait_invalid_event_status, Version(1, 2)), + ADD_TEST_VERSION(semaphores_negative_signal_invalid_command_queue, + Version(1, 2)), + ADD_TEST_VERSION(semaphores_negative_signal_invalid_value, Version(1, 2)), + ADD_TEST_VERSION(semaphores_negative_signal_invalid_semaphore, + Version(1, 2)), + ADD_TEST_VERSION(semaphores_negative_signal_invalid_context, Version(1, 2)), + ADD_TEST_VERSION(semaphores_negative_signal_invalid_event_wait_list, + Version(1, 2)), + ADD_TEST_VERSION(semaphores_negative_signal_invalid_event_status, + Version(1, 2)), ADD_TEST_VERSION(semaphores_negative_release, Version(1, 2)), ADD_TEST_VERSION(semaphores_negative_retain, Version(1, 2)), }; diff --git a/test_conformance/extensions/cl_khr_semaphore/procs.h b/test_conformance/extensions/cl_khr_semaphore/procs.h index 52ce6cdf35..06e0c4f993 100644 --- a/test_conformance/extensions/cl_khr_semaphore/procs.h +++ b/test_conformance/extensions/cl_khr_semaphore/procs.h @@ -103,6 +103,25 @@ extern int test_semaphores_negative_wait_invalid_event_wait_list( extern int test_semaphores_negative_wait_invalid_event_status( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); +extern int test_semaphores_negative_signal_invalid_command_queue( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements); +extern int test_semaphores_negative_signal_invalid_value(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements); +extern int test_semaphores_negative_signal_invalid_semaphore( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements); +extern int test_semaphores_negative_signal_invalid_context( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements); +extern int test_semaphores_negative_signal_invalid_event_wait_list( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements); +extern int test_semaphores_negative_signal_invalid_event_status( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements); extern int test_semaphores_negative_release(cl_device_id device, cl_context context, cl_command_queue queue, diff --git a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_wait.cpp b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_wait.cpp deleted file mode 100644 index dab28d96cc..0000000000 --- a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_wait.cpp +++ /dev/null @@ -1,395 +0,0 @@ -// -// Copyright (c) 2024 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#include "semaphore_base.h" - -#include "harness/errorHelpers.h" -#include -#include -#include -#include - -namespace { - -// the device associated with command_queue is not same as one of the devices -// specified by CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR at the time of creating one -// or more of sema_objects. - -struct WaitInvalidCommandQueue : public SemaphoreTestBase -{ - WaitInvalidCommandQueue(cl_device_id device, cl_context context, - cl_command_queue queue) - : SemaphoreTestBase(device, context, queue) - {} - - cl_int Run() override - { - // Create semaphore - cl_semaphore_properties_khr sema_props[] = { - static_cast(CL_SEMAPHORE_TYPE_KHR), - static_cast( - CL_SEMAPHORE_TYPE_BINARY_KHR), - static_cast( - CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR), - (cl_semaphore_properties_khr)device, - CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR, - 0 - }; - - cl_int err = CL_SUCCESS; - semaphore = - clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); - test_error(err, "Could not create semaphore"); - - // find other device - cl_platform_id platform_id = 0; - // find out what platform the harness is using. - err = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, - sizeof(cl_platform_id), &platform_id, nullptr); - test_error(err, "clGetDeviceInfo failed"); - - cl_uint num_platforms = 0; - err = clGetPlatformIDs(16, nullptr, &num_platforms); - test_error(err, "clGetPlatformIDs failed"); - - std::vector platforms(num_platforms); - - err = clGetPlatformIDs(num_platforms, platforms.data(), &num_platforms); - test_error(err, "clGetPlatformIDs failed"); - - cl_device_id device_sec = nullptr; - cl_uint num_devices = 0; - for (int p = 0; p < (int)num_platforms; p++) - { - if (platform_id == platforms[p]) continue; - - err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, 0, nullptr, - &num_devices); - test_error(err, "clGetDeviceIDs failed"); - - std::vector devices(num_devices); - err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, num_devices, - devices.data(), nullptr); - test_error(err, "clGetDeviceIDs failed"); - - device_sec = devices.front(); - break; - } - - if (device_sec == nullptr) - { - log_info("Can't find needed resources. Skipping the test.\n"); - return TEST_SKIPPED_ITSELF; - } - - // Create secondary context - clContextWrapper context_sec = - clCreateContext(0, 1, &device_sec, nullptr, nullptr, &err); - test_error(err, "Failed to create context"); - - // Create secondary queue - clCommandQueueWrapper queue_sec = - clCreateCommandQueue(context_sec, device_sec, 0, &err); - test_error(err, "Could not create command queue"); - - // Signal semaphore - err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, - nullptr, nullptr); - test_error(err, "Could not signal semaphore"); - - // Wait semaphore - err = clEnqueueWaitSemaphoresKHR(queue_sec, 1, semaphore, nullptr, 0, - nullptr, nullptr); - test_failure_error(err, CL_INVALID_COMMAND_QUEUE, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - return TEST_PASS; - } -}; - - -// num_sema_objects is 0. - -struct WaitInvalidValue : public SemaphoreTestBase -{ - WaitInvalidValue(cl_device_id device, cl_context context, - cl_command_queue queue) - : SemaphoreTestBase(device, context, queue) - {} - - cl_int Run() override - { - // Wait semaphore - cl_int err = CL_SUCCESS; - err = clEnqueueWaitSemaphoresKHR(queue, 0, semaphore, nullptr, 0, - nullptr, nullptr); - test_failure_error(err, CL_INVALID_VALUE, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - return CL_SUCCESS; - } -}; - -// any of the semaphore objects specified by sema_objects is not valid. - -struct WaitInvalidSemaphore : public SemaphoreTestBase -{ - WaitInvalidSemaphore(cl_device_id device, cl_context context, - cl_command_queue queue) - : SemaphoreTestBase(device, context, queue) - {} - - cl_int Run() override - { - // Wait semaphore - cl_semaphore_khr sema_objects[] = { nullptr, nullptr, nullptr }; - cl_int err = CL_SUCCESS; - err = clEnqueueWaitSemaphoresKHR( - queue, sizeof(sema_objects) / sizeof(sema_objects[0]), sema_objects, - nullptr, 0, nullptr, nullptr); - test_failure_error(err, CL_INVALID_SEMAPHORE_KHR, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - return CL_SUCCESS; - } -}; - -// 1) the context associated with command_queue and any of the semaphore objects -// in sema_objects are not the same, or -// 2) the context associated with command_queue and that associated with events -// in event_wait_list are not the same. - -struct WaitInvalidContext : public SemaphoreTestBase -{ - WaitInvalidContext(cl_device_id device, cl_context context, - cl_command_queue queue) - : SemaphoreTestBase(device, context, queue) - {} - - cl_int Run() override - { - // Create semaphore - cl_semaphore_properties_khr sema_props[] = { - static_cast(CL_SEMAPHORE_TYPE_KHR), - static_cast( - CL_SEMAPHORE_TYPE_BINARY_KHR), - 0 - }; - - cl_int err = CL_SUCCESS; - semaphore = - clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); - test_error(err, "Could not create semaphore"); - - // Create secondary context - clContextWrapper context_sec = - clCreateContext(0, 1, &device, nullptr, nullptr, &err); - test_error(err, "Failed to create context"); - - // Create secondary queue - clCommandQueueWrapper queue_sec = - clCreateCommandQueue(context_sec, device, 0, &err); - test_error(err, "Could not create command queue"); - - // Signal semaphore - err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, - nullptr, nullptr); - test_error(err, "Could not signal semaphore"); - - // (1) Wait semaphore - err = clEnqueueWaitSemaphoresKHR(queue_sec, 1, semaphore, nullptr, 0, - nullptr, nullptr); - test_failure_error(err, CL_INVALID_CONTEXT, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - // Create user event - clEventWrapper user_event = clCreateUserEvent(context_sec, &err); - test_error(err, "Could not create user event"); - - // (2) Wait semaphore - err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 1, - &user_event, nullptr); - - cl_int signal_error = clSetUserEventStatus(user_event, CL_COMPLETE); - test_error(signal_error, "clSetUserEventStatus failed"); - - test_failure_error(err, CL_INVALID_CONTEXT, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - return TEST_PASS; - } -}; - -// (1) event_wait_list is NULL and num_events_in_wait_list is not 0, or -// (2) event_wait_list is not NULL and num_events_in_wait_list is 0, or -// (3) event objects in event_wait_list are not valid events. - -struct WaitInvalidEventWaitList : public SemaphoreTestBase -{ - WaitInvalidEventWaitList(cl_device_id device, cl_context context, - cl_command_queue queue) - : SemaphoreTestBase(device, context, queue) - {} - - cl_int Run() override - { - // Create semaphore - cl_semaphore_properties_khr sema_props[] = { - static_cast(CL_SEMAPHORE_TYPE_KHR), - static_cast( - CL_SEMAPHORE_TYPE_BINARY_KHR), - 0 - }; - - cl_int err = CL_SUCCESS; - semaphore = - clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); - test_error(err, "Could not create semaphore"); - - - // Signal semaphore - err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, - nullptr, nullptr); - test_error(err, "Could not signal semaphore"); - - // (1) Wait semaphore - err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 1, - nullptr, nullptr); - test_failure_error(err, CL_INVALID_EVENT_WAIT_LIST, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - // Create user event - clEventWrapper user_event = clCreateUserEvent(context, &err); - test_error(err, "Could not create user event"); - - // (2) Wait semaphore - err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 0, - &user_event, nullptr); - - cl_int signal_error = clSetUserEventStatus(user_event, CL_COMPLETE); - test_error(signal_error, "clSetUserEventStatus failed"); - - test_failure_error(err, CL_INVALID_EVENT_WAIT_LIST, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - // (3) Wait semaphore - cl_event wait_list[] = { nullptr, nullptr, nullptr }; - err = clEnqueueWaitSemaphoresKHR( - queue, 1, semaphore, nullptr, - sizeof(wait_list) / sizeof(wait_list[0]), wait_list, nullptr); - test_failure_error(err, CL_INVALID_EVENT_WAIT_LIST, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - return CL_SUCCESS; - } -}; - -// the execution status of any of the events in event_wait_list is a negative -// integer value. - -struct WaitInvalidEventStatus : public SemaphoreTestBase -{ - WaitInvalidEventStatus(cl_device_id device, cl_context context, - cl_command_queue queue) - : SemaphoreTestBase(device, context, queue) - {} - - cl_int Run() override - { - // Create semaphore - cl_semaphore_properties_khr sema_props[] = { - static_cast(CL_SEMAPHORE_TYPE_KHR), - static_cast( - CL_SEMAPHORE_TYPE_BINARY_KHR), - 0 - }; - - cl_int err = CL_SUCCESS; - semaphore = - clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); - test_error(err, "Could not create semaphore"); - - // Signal semaphore - err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, - nullptr, nullptr); - test_error(err, "Could not signal semaphore"); - - // Create user event - clEventWrapper user_event = clCreateUserEvent(context, &err); - test_error(err, "Could not create user event"); - - // Now release the user event, which will allow our actual action to run - err = clSetUserEventStatus(user_event, -1); - test_error(err, "Unable to set event status"); - - // Wait semaphore - err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 1, - &user_event, nullptr); - test_failure_error(err, CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST, - "Unexpected clEnqueueWaitSemaphoresKHR return"); - - return CL_SUCCESS; - } -}; - -} - -int test_semaphores_negative_wait_invalid_command_queue(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) -{ - return MakeAndRunTest(device, context, queue); -} - -int test_semaphores_negative_wait_invalid_value(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) -{ - return MakeAndRunTest(device, context, queue); -} - -int test_semaphores_negative_wait_invalid_semaphore(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) -{ - return MakeAndRunTest(device, context, queue); -} - -int test_semaphores_negative_wait_invalid_context(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) -{ - return MakeAndRunTest(device, context, queue); -} - -int test_semaphores_negative_wait_invalid_event_wait_list( - cl_device_id device, cl_context context, cl_command_queue queue, - int num_elements) -{ - return MakeAndRunTest(device, context, queue); -} - -int test_semaphores_negative_wait_invalid_event_status(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) -{ - return MakeAndRunTest(device, context, queue); -} diff --git a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_wait_signal.cpp b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_wait_signal.cpp new file mode 100644 index 0000000000..95dcb30a13 --- /dev/null +++ b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_wait_signal.cpp @@ -0,0 +1,599 @@ +// +// Copyright (c) 2024 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "semaphore_base.h" + +#include "harness/errorHelpers.h" +#include +#include +#include +#include + +namespace { + +enum class RunMode +{ + RM_WAIT = 0, + RM_SIGNAL +}; + +// scope guard helper to ensure proper releasing of sub devices +struct SubDevicesScopeGuarded +{ + SubDevicesScopeGuarded(const cl_int dev_count) + { + sub_devices.resize(dev_count); + } + ~SubDevicesScopeGuarded() + { + for (auto& device : sub_devices) + { + cl_int err = clReleaseDevice(device); + if (err != CL_SUCCESS) + log_error("\n Releasing sub-device failed \n"); + } + } + + std::vector sub_devices; +}; + +// the device associated with command_queue is not same as one of the devices +// specified by CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR at the time of creating one +// or more of sema_objects. + +template struct InvalidCommandQueue : public SemaphoreTestBase +{ + InvalidCommandQueue(cl_device_id device, cl_context context, + cl_command_queue queue) + : SemaphoreTestBase(device, context, queue) + {} + + cl_int Run() override + { + cl_int err = CL_SUCCESS; + + // Below test makes sense only if semaphore and command queue share the + // same context, otherwise CL_INVALID_CONTEXT could be the result. Thus, + // multi device context must be created, then semaphore and command + // queue with the same associated context but different devices. + + // partition device and create new context if possible + cl_uint maxComputeUnits = 0; + err = clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, + sizeof(maxComputeUnits), &maxComputeUnits, NULL); + test_error(err, "Unable to get maximal number of compute units"); + + cl_uint maxSubDevices = 0; + err = clGetDeviceInfo(device, CL_DEVICE_PARTITION_MAX_SUB_DEVICES, + sizeof(maxSubDevices), &maxSubDevices, NULL); + test_error(err, "Unable to get maximal number of sub-devices"); + + if (maxSubDevices < 2) + { + log_info("Can't partition device, test not supported\n"); + return TEST_SKIPPED_ITSELF; + } + + cl_device_partition_property partitionProp[] = { + CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0 + }; + + cl_uint deviceCount = 0; + // how many sub-devices can we create? + err = + clCreateSubDevices(device, partitionProp, 0, nullptr, &deviceCount); + if (err != CL_SUCCESS) + { + log_info("Can't partition device, test not supported\n"); + return TEST_SKIPPED_ITSELF; + } + + if (deviceCount < 2) + test_error_ret( + CL_INVALID_VALUE, + "Multi context test for CL_INVALID_COMMAND_QUEUE not supported", + TEST_SKIPPED_ITSELF); + + // get the list of subDevices + SubDevicesScopeGuarded scope_guard(deviceCount); + err = clCreateSubDevices(device, partitionProp, deviceCount, + scope_guard.sub_devices.data(), &deviceCount); + if (err != CL_SUCCESS) + { + log_info("Can't partition device, test not supported\n"); + return TEST_SKIPPED_ITSELF; + } + + /* Create a multi device context */ + clContextWrapper multi_device_context = clCreateContext( + NULL, (cl_uint)deviceCount, scope_guard.sub_devices.data(), nullptr, + nullptr, &err); + test_error_ret(err, "Unable to create testing context", CL_SUCCESS); + + // Create semaphore + cl_semaphore_properties_khr sema_props[] = { + static_cast(CL_SEMAPHORE_TYPE_KHR), + static_cast( + CL_SEMAPHORE_TYPE_BINARY_KHR), + static_cast( + CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR), + (cl_semaphore_properties_khr)scope_guard.sub_devices.front(), + CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR, + 0 + }; + + semaphore = clCreateSemaphoreWithPropertiesKHR(multi_device_context, + sema_props, &err); + test_error(err, "Could not create semaphore"); + + // Create secondary queue associated with device not the same as one + // associated with semaphore + clCommandQueueWrapper queue_sec = clCreateCommandQueue( + multi_device_context, scope_guard.sub_devices.back(), 0, &err); + test_error(err, "Could not create command queue"); + + if (mode == RunMode::RM_SIGNAL) + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR(queue_sec, 1, semaphore, nullptr, + 0, nullptr, nullptr); + test_failure_error( + err, CL_INVALID_COMMAND_QUEUE, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + } + else + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, + nullptr, nullptr); + test_error(err, "Could not signal semaphore"); + + // Wait semaphore + err = clEnqueueWaitSemaphoresKHR(queue_sec, 1, semaphore, nullptr, + 0, nullptr, nullptr); + test_failure_error(err, CL_INVALID_COMMAND_QUEUE, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + } + + return TEST_PASS; + } +}; + + +// num_sema_objects is 0. + +template struct InvalidValue : public SemaphoreTestBase +{ + InvalidValue(cl_device_id device, cl_context context, + cl_command_queue queue) + : SemaphoreTestBase(device, context, queue) + {} + + cl_int Run() override + { + if (mode == RunMode::RM_SIGNAL) + { + // Signal semaphore + cl_int err = CL_SUCCESS; + err = clEnqueueSignalSemaphoresKHR(queue, 0, semaphore, nullptr, 0, + nullptr, nullptr); + test_failure_error( + err, CL_INVALID_VALUE, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + } + else + { + // Wait semaphore + cl_int err = CL_SUCCESS; + err = clEnqueueWaitSemaphoresKHR(queue, 0, semaphore, nullptr, 0, + nullptr, nullptr); + test_failure_error(err, CL_INVALID_VALUE, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + } + + return CL_SUCCESS; + } +}; + +// any of the semaphore objects specified by sema_objects is not valid. + +template struct InvalidSemaphore : public SemaphoreTestBase +{ + InvalidSemaphore(cl_device_id device, cl_context context, + cl_command_queue queue) + : SemaphoreTestBase(device, context, queue) + {} + + cl_int Run() override + { + cl_semaphore_khr sema_objects[] = { nullptr, nullptr, nullptr }; + cl_int err = CL_SUCCESS; + + if (mode == RunMode::RM_SIGNAL) + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR( + queue, sizeof(sema_objects) / sizeof(sema_objects[0]), + sema_objects, nullptr, 0, nullptr, nullptr); + test_failure_error( + err, CL_INVALID_SEMAPHORE_KHR, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + } + else + { + // Wait semaphore + err = clEnqueueWaitSemaphoresKHR( + queue, sizeof(sema_objects) / sizeof(sema_objects[0]), + sema_objects, nullptr, 0, nullptr, nullptr); + test_failure_error(err, CL_INVALID_SEMAPHORE_KHR, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + } + + return CL_SUCCESS; + } +}; + +// (1) the context associated with command_queue and any of the semaphore +// objects in sema_objects are not the same, or (2) the context associated with +// command_queue and that associated with events in event_wait_list are not the +// same. + +template struct InvalidContext : public SemaphoreTestBase +{ + InvalidContext(cl_device_id device, cl_context context, + cl_command_queue queue) + : SemaphoreTestBase(device, context, queue) + {} + + cl_int Run() override + { + // Create semaphore + cl_semaphore_properties_khr sema_props[] = { + static_cast(CL_SEMAPHORE_TYPE_KHR), + static_cast( + CL_SEMAPHORE_TYPE_BINARY_KHR), + 0 + }; + + cl_int err = CL_SUCCESS; + semaphore = + clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); + test_error(err, "Could not create semaphore"); + + // Create secondary context + clContextWrapper context_sec = + clCreateContext(0, 1, &device, nullptr, nullptr, &err); + test_error(err, "Failed to create context"); + + // Create secondary queue + clCommandQueueWrapper queue_sec = + clCreateCommandQueue(context_sec, device, 0, &err); + test_error(err, "Could not create command queue"); + + // Create user event + clEventWrapper user_event = clCreateUserEvent(context_sec, &err); + test_error(err, "Could not create user event"); + + if (mode == RunMode::RM_SIGNAL) + { + // (1) + err = clEnqueueSignalSemaphoresKHR(queue_sec, 1, semaphore, nullptr, + 0, nullptr, nullptr); + test_failure_error( + err, CL_INVALID_CONTEXT, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + + // (2) + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 1, + &user_event, nullptr); + + cl_int signal_error = clSetUserEventStatus(user_event, CL_COMPLETE); + test_error(signal_error, "clSetUserEventStatus failed"); + + test_failure_error( + err, CL_INVALID_CONTEXT, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + } + else + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, + nullptr, nullptr); + test_error(err, "Could not signal semaphore"); + + // (1) + err = clEnqueueWaitSemaphoresKHR(queue_sec, 1, semaphore, nullptr, + 0, nullptr, nullptr); + test_failure_error(err, CL_INVALID_CONTEXT, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + + // (2) + err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 1, + &user_event, nullptr); + + cl_int signal_error = clSetUserEventStatus(user_event, CL_COMPLETE); + test_error(signal_error, "clSetUserEventStatus failed"); + + test_failure_error(err, CL_INVALID_CONTEXT, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + } + + return TEST_PASS; + } +}; + +// (1) event_wait_list is NULL and num_events_in_wait_list is not 0, or +// (2) event_wait_list is not NULL and num_events_in_wait_list is 0, or +// (3) event objects in event_wait_list are not valid events. + +template struct InvalidEventWaitList : public SemaphoreTestBase +{ + InvalidEventWaitList(cl_device_id device, cl_context context, + cl_command_queue queue) + : SemaphoreTestBase(device, context, queue) + {} + + cl_int Run() override + { + // Create semaphore + cl_semaphore_properties_khr sema_props[] = { + static_cast(CL_SEMAPHORE_TYPE_KHR), + static_cast( + CL_SEMAPHORE_TYPE_BINARY_KHR), + 0 + }; + + cl_int err = CL_SUCCESS; + semaphore = + clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); + test_error(err, "Could not create semaphore"); + + // Create user event + clEventWrapper user_event = clCreateUserEvent(context, &err); + test_error(err, "Could not create user event"); + + cl_event wait_list[] = { nullptr, nullptr, nullptr }; + + if (mode == RunMode::RM_SIGNAL) + { + // (1) + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 1, + nullptr, nullptr); + test_failure_error( + err, CL_INVALID_EVENT_WAIT_LIST, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + + // (2) + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, + &user_event, nullptr); + + cl_int signal_error = clSetUserEventStatus(user_event, CL_COMPLETE); + test_error(signal_error, "clSetUserEventStatus failed"); + + test_failure_error( + err, CL_INVALID_EVENT_WAIT_LIST, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + + // (3) + err = clEnqueueSignalSemaphoresKHR( + queue, 1, semaphore, nullptr, + sizeof(wait_list) / sizeof(wait_list[0]), wait_list, nullptr); + test_failure_error( + err, CL_INVALID_EVENT_WAIT_LIST, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + } + else + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, + nullptr, nullptr); + test_error(err, "Could not signal semaphore"); + + // (1) + err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 1, + nullptr, nullptr); + test_failure_error(err, CL_INVALID_EVENT_WAIT_LIST, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + + // (2) + err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 0, + &user_event, nullptr); + + cl_int signal_error = clSetUserEventStatus(user_event, CL_COMPLETE); + test_error(signal_error, "clSetUserEventStatus failed"); + + test_failure_error(err, CL_INVALID_EVENT_WAIT_LIST, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + + // (3) + err = clEnqueueWaitSemaphoresKHR( + queue, 1, semaphore, nullptr, + sizeof(wait_list) / sizeof(wait_list[0]), wait_list, nullptr); + test_failure_error(err, CL_INVALID_EVENT_WAIT_LIST, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + } + + return CL_SUCCESS; + } +}; + +// the execution status of any of the events in event_wait_list is a negative +// integer value. + +template struct InvalidEventStatus : public SemaphoreTestBase +{ + InvalidEventStatus(cl_device_id device, cl_context context, + cl_command_queue queue) + : SemaphoreTestBase(device, context, queue) + {} + + cl_int Run() override + { + // Create semaphore + cl_semaphore_properties_khr sema_props[] = { + static_cast(CL_SEMAPHORE_TYPE_KHR), + static_cast( + CL_SEMAPHORE_TYPE_BINARY_KHR), + 0 + }; + + cl_int err = CL_SUCCESS; + semaphore = + clCreateSemaphoreWithPropertiesKHR(context, sema_props, &err); + test_error(err, "Could not create semaphore"); + + // Create user event + clEventWrapper user_event = clCreateUserEvent(context, &err); + test_error(err, "Could not create user event"); + + // set the negative integer value status of the event in event_wait_list + err = clSetUserEventStatus(user_event, -1); + test_error(err, "Unable to set event status"); + + if (mode == RunMode::RM_SIGNAL) + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 1, + &user_event, nullptr); + test_failure_error( + err, CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST, + "Unexpected clEnqueueSignalSemaphoresKHR return"); + } + else + { + // Signal semaphore + err = clEnqueueSignalSemaphoresKHR(queue, 1, semaphore, nullptr, 0, + nullptr, nullptr); + test_error(err, "Could not signal semaphore"); + + // Wait semaphore + err = clEnqueueWaitSemaphoresKHR(queue, 1, semaphore, nullptr, 1, + &user_event, nullptr); + test_failure_error(err, + CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST, + "Unexpected clEnqueueWaitSemaphoresKHR return"); + } + + return CL_SUCCESS; + } +}; + +} + +int test_semaphores_negative_wait_invalid_command_queue(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>( + device, context, queue); +} + +int test_semaphores_negative_wait_invalid_value(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_wait_invalid_semaphore(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_wait_invalid_context(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_wait_invalid_event_wait_list( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>( + device, context, queue); +} + +int test_semaphores_negative_wait_invalid_event_status(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_signal_invalid_command_queue( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>( + device, context, queue); +} + +int test_semaphores_negative_signal_invalid_value(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_signal_invalid_semaphore(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_signal_invalid_context(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>(device, context, + queue); +} + +int test_semaphores_negative_signal_invalid_event_wait_list( + cl_device_id device, cl_context context, cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>( + device, context, queue); +} + +int test_semaphores_negative_signal_invalid_event_status(cl_device_id device, + cl_context context, + cl_command_queue queue, + int num_elements) +{ + return MakeAndRunTest>( + device, context, queue); +} diff --git a/test_conformance/images/common.cpp b/test_conformance/images/common.cpp index 0b2c956cc6..1d7174545b 100644 --- a/test_conformance/images/common.cpp +++ b/test_conformance/images/common.cpp @@ -16,12 +16,14 @@ #include "common.h" cl_channel_type floatFormats[] = { - CL_UNORM_SHORT_565, CL_UNORM_SHORT_555, CL_UNORM_INT_101010, + CL_UNORM_SHORT_565, CL_UNORM_SHORT_555, CL_UNORM_INT_101010, + CL_UNORM_INT_101010_2, #ifdef CL_SFIXED14_APPLE CL_SFIXED14_APPLE, #endif - CL_UNORM_INT8, CL_SNORM_INT8, CL_UNORM_INT16, CL_SNORM_INT16, - CL_FLOAT, CL_HALF_FLOAT, (cl_channel_type)-1, + CL_UNORM_INT8, CL_SNORM_INT8, CL_UNORM_INT16, + CL_SNORM_INT16, CL_FLOAT, CL_HALF_FLOAT, + (cl_channel_type)-1, }; cl_channel_type intFormats[] = { diff --git a/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp b/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp index 1885cbd63e..5430f873df 100644 --- a/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp @@ -67,9 +67,7 @@ static int test_get_1Dimage_buffer_info_single(cl_context context, if (gDebugTrace) log_info(" - Creating 1D image %d ...\n", (int)imageInfo->width); - buffer = clCreateBuffer( - context, flags, imageInfo->width * get_pixel_size(imageInfo->format), - NULL, &error); + buffer = clCreateBuffer(context, flags, imageInfo->rowPitch, NULL, &error); if (error != CL_SUCCESS) { log_error("ERROR: Unable to create buffer for 1D image buffer of size " diff --git a/test_conformance/images/kernel_read_write/test_common.cpp b/test_conformance/images/kernel_read_write/test_common.cpp index 9b2bfe9246..6be4c7ca58 100644 --- a/test_conformance/images/kernel_read_write/test_common.cpp +++ b/test_conformance/images/kernel_read_write/test_common.cpp @@ -2144,6 +2144,8 @@ int filter_rounding_errors(int forceCorrectlyRoundedWrites, if (0 == forceCorrectlyRoundedWrites && (imageInfo->format->image_channel_data_type == CL_UNORM_INT8 || imageInfo->format->image_channel_data_type == CL_UNORM_INT_101010 + || imageInfo->format->image_channel_data_type + == CL_UNORM_INT_101010_2 || imageInfo->format->image_channel_data_type == CL_UNORM_INT16 || imageInfo->format->image_channel_data_type == CL_SNORM_INT8 || imageInfo->format->image_channel_data_type == CL_SNORM_INT16 diff --git a/test_conformance/images/kernel_read_write/test_loops.cpp b/test_conformance/images/kernel_read_write/test_loops.cpp index ea1e1c7c0a..60144e056d 100644 --- a/test_conformance/images/kernel_read_write/test_loops.cpp +++ b/test_conformance/images/kernel_read_write/test_loops.cpp @@ -175,6 +175,18 @@ int test_read_image_formats(cl_device_id device, cl_context context, bool flipFlop[2] = { false, true }; int normalizedIdx, floatCoordIdx; + if (gTestMipmaps) + { + if (0 == is_extension_available(device, "cl_khr_mipmap_image")) + { + log_info("-----------------------------------------------------\n"); + log_info("This device does not support " + "cl_khr_mipmap_image.\nSkipping mipmapped image test. \n"); + log_info( + "-----------------------------------------------------\n\n"); + return 0; + } + } // Use this run if we were told to only run a certain filter mode if (gFilterModeToUse != (cl_filter_mode)-1 diff --git a/test_conformance/math_brute_force/CMakeLists.txt b/test_conformance/math_brute_force/CMakeLists.txt index d53911e433..35d4e0b3ab 100644 --- a/test_conformance/math_brute_force/CMakeLists.txt +++ b/test_conformance/math_brute_force/CMakeLists.txt @@ -54,10 +54,6 @@ set(${MODULE_NAME}_SOURCES utility.h ) -# math_brute_force compiles cleanly with -Wall (except for a few remaining -# warnings), but other tests not (yet); so enable -Wall locally. -set_gnulike_module_compile_flags("-Wall -Wno-strict-aliasing -Wno-unknown-pragmas") - add_cxx_flag_if_supported(-ffp-contract=off) include(../CMakeCommon.txt) diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index 3bab4057b8..deea1ce969 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -201,7 +201,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fptr func = job->f->func; int ftz = job->ftz; bool relaxedMode = job->relaxedMode; - float ulps = getAllowedUlpError(job->f, relaxedMode); + float ulps = getAllowedUlpError(job->f, kfloat, relaxedMode); MTdata d = tinfo->d; cl_int error; std::vector overflow(buffer_elements, false); diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index 741c396ca8..6f5a364521 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -197,7 +197,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fptr func = job->f->func; int ftz = job->ftz; bool relaxedMode = job->relaxedMode; - float ulps = getAllowedUlpError(job->f, relaxedMode); + float ulps = getAllowedUlpError(job->f, kfloat, relaxedMode); MTdata d = tinfo->d; cl_int error; std::vector overflow(buffer_elements, false); diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index cd93d3c972..7d1f6cdafc 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -88,7 +88,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fptr func = job->f->func; const char *fname = job->f->name; bool relaxedMode = job->relaxedMode; - float ulps = getAllowedUlpError(job->f, relaxedMode); + float ulps = getAllowedUlpError(job->f, kfloat, relaxedMode); if (relaxedMode) { func = job->f->rfunc; diff --git a/test_conformance/math_brute_force/unary_two_results_float.cpp b/test_conformance/math_brute_force/unary_two_results_float.cpp index 8a5d3000a6..3fd16cd3ff 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -57,7 +57,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) logFunctionInfo(f->name, sizeof(cl_float), relaxedMode); - float float_ulps = getAllowedUlpError(f, relaxedMode); + float float_ulps = getAllowedUlpError(f, kfloat, relaxedMode); // Init the kernels BuildKernelInfo build_info{ 1, kernels, programs, f->nameInCode, relaxedMode }; diff --git a/test_conformance/math_brute_force/utility.cpp b/test_conformance/math_brute_force/utility.cpp index 9b0191ab36..53dd928c0e 100644 --- a/test_conformance/math_brute_force/utility.cpp +++ b/test_conformance/math_brute_force/utility.cpp @@ -15,6 +15,9 @@ // #include "utility.h" + +#include + #include "function_list.h" #if defined(__PPC__) @@ -161,32 +164,42 @@ void logFunctionInfo(const char *fname, unsigned int float_size, vlog("%15s %4s %4s", fname, fpSizeStr, fpFastRelaxedStr); } -float getAllowedUlpError(const Func *f, const bool relaxed) +float getAllowedUlpError(const Func *f, Type t, const bool relaxed) { - float ulp; - - if (relaxed) + switch (t) { - if (gIsEmbedded) - { - ulp = f->relaxed_embedded_error; - } - else - { - ulp = f->relaxed_error; - } + case kfloat: + if (relaxed) + { + if (gIsEmbedded) + { + return f->relaxed_embedded_error; + } + else + { + return f->relaxed_error; + } + } + else + { + if (gIsEmbedded) + { + return f->float_embedded_ulps; + } + else + { + return f->float_ulps; + } + } + case kdouble: + // TODO: distinguish between embedded and full profile. + return f->double_ulps; + case khalf: + // TODO: distinguish between embedded and full profile. + return f->half_ulps; + default: + assert(false && "unsupported type in getAllowedUlpError"); + // Return a negative value which will make any test fail. + return -1.f; } - else - { - if (gIsEmbedded) - { - ulp = f->float_embedded_ulps; - } - else - { - ulp = f->float_ulps; - } - } - - return ulp; } diff --git a/test_conformance/math_brute_force/utility.h b/test_conformance/math_brute_force/utility.h index 8e9b3a1ad9..c321fcb15a 100644 --- a/test_conformance/math_brute_force/utility.h +++ b/test_conformance/math_brute_force/utility.h @@ -257,7 +257,7 @@ int compareDoubles(double x, double y); void logFunctionInfo(const char *fname, unsigned int float_size, unsigned int isFastRelaxed); -float getAllowedUlpError(const Func *f, const bool relaxed); +float getAllowedUlpError(const Func *f, Type t, const bool relaxed); inline cl_uint getTestScale(size_t typeSize) { diff --git a/test_conformance/printf/test_printf.cpp b/test_conformance/printf/test_printf.cpp index d59e06825b..73f0e20512 100644 --- a/test_conformance/printf/test_printf.cpp +++ b/test_conformance/printf/test_printf.cpp @@ -698,6 +698,12 @@ int doTest(cl_command_queue queue, cl_context context, return TEST_SKIPPED_ITSELF; } + if ((allTestCase[testId]->_type == TYPE_LONG) && !isLongSupported(device)) + { + log_info("Skipping long because long is not supported.\n"); + return TEST_SKIPPED_ITSELF; + } + if ((allTestCase[testId]->_type == TYPE_DOUBLE || allTestCase[testId]->_type == TYPE_DOUBLE_LIMITS) && !is_extension_available(device, "cl_khr_fp64")) @@ -927,6 +933,12 @@ int test_int(cl_device_id deviceID, cl_context context, cl_command_queue queue, return doTest(gQueue, gContext, TYPE_INT, deviceID); } +int test_long(cl_device_id deviceID, cl_context context, cl_command_queue queue, + int num_elements) +{ + return doTest(gQueue, gContext, TYPE_LONG, deviceID); +} + int test_half(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { @@ -1043,23 +1055,15 @@ int test_buffer_size(cl_device_id deviceID, cl_context context, } test_definition test_list[] = { - ADD_TEST(int), - ADD_TEST(half), - ADD_TEST(half_limits), - ADD_TEST(float), - ADD_TEST(float_limits), - ADD_TEST(double), - ADD_TEST(double_limits), - ADD_TEST(octal), - ADD_TEST(unsigned), - ADD_TEST(hexadecimal), - ADD_TEST(char), - ADD_TEST(string), - ADD_TEST(format_string), - ADD_TEST(vector), - ADD_TEST(address_space), - ADD_TEST(buffer_size), - ADD_TEST(mixed_format_random), + ADD_TEST(int), ADD_TEST(long), + ADD_TEST(half), ADD_TEST(half_limits), + ADD_TEST(float), ADD_TEST(float_limits), + ADD_TEST(double), ADD_TEST(double_limits), + ADD_TEST(octal), ADD_TEST(unsigned), + ADD_TEST(hexadecimal), ADD_TEST(char), + ADD_TEST(string), ADD_TEST(format_string), + ADD_TEST(vector), ADD_TEST(address_space), + ADD_TEST(buffer_size), ADD_TEST(mixed_format_random), }; const int test_num = ARRAY_SIZE( test_list ); diff --git a/test_conformance/printf/test_printf.h b/test_conformance/printf/test_printf.h index 51f351170f..7e5156a22c 100644 --- a/test_conformance/printf/test_printf.h +++ b/test_conformance/printf/test_printf.h @@ -46,6 +46,7 @@ enum PrintfTestType { TYPE_INT, + TYPE_LONG, TYPE_HALF, TYPE_HALF_LIMITS, TYPE_FLOAT, @@ -80,6 +81,7 @@ struct printDataGenParameters // Reference results - filled out at run-time static std::vector correctBufferInt; +static std::vector correctBufferLong; static std::vector correctBufferHalf; static std::vector correctBufferFloat; static std::vector correctBufferDouble; diff --git a/test_conformance/printf/util_printf.cpp b/test_conformance/printf/util_printf.cpp index 5b96e8683d..82183edb14 100644 --- a/test_conformance/printf/util_printf.cpp +++ b/test_conformance/printf/util_printf.cpp @@ -23,6 +23,7 @@ // Helpers for generating runtime reference results static void intRefBuilder(printDataGenParameters&, char*, const size_t); +static void longRefBuilder(printDataGenParameters&, char*, const size_t); static void halfRefBuilder(printDataGenParameters&, char* rResult, const size_t); static void floatRefBuilder(printDataGenParameters&, char* rResult, const size_t); @@ -111,6 +112,73 @@ testCase testCaseInt = { }; +//================================== + +// long + +//================================== + +//------------------------------------------------------ + +// [string] format | [string] int-data representation | + +//------------------------------------------------------ + +std::vector printLongGenParameters = { + + //(Minimum) fifteen-wide,default(right)-justified + + { { "%5ld" }, "10000000000L" }, + + //(Minimum) fifteen-wide,left-justified + + { { "%-15ld" }, "-10000000000L" }, + + //(Minimum) fifteen-wide,default(right)-justified,zero-filled + + { { "%015ld" }, "10000000000L" }, + + //(Minimum) fifteen-wide,default(right)-justified,with sign + + { { "%+15ld" }, "-10000000000L" }, + + //(Minimum) fifteen-wide ,left-justified,with sign + + { { "%-+15ld" }, "10000000000L" }, + + //(Minimum) fifteen-digit(zero-filled in absent + // digits),default(right)-justified + + { { "%.15li" }, "10000000000L" }, + + //(Minimum)Sixteen-wide, fifteen-digit(zero-filled in absent + // digits),default(right)-justified + + { { "%-+16.15li" }, "-10000000000L" }, + +}; + +//----------------------------------------------- + +// test case for long | + +//----------------------------------------------- + +testCase testCaseLong = { + + TYPE_LONG, + + correctBufferLong, + + printLongGenParameters, + + longRefBuilder, + + klong + +}; + + //============================================== // half @@ -1179,7 +1247,7 @@ std::vector printVectorGenParameters = { // Four component vector in hexadecimal floating point, lowercase format - { { "" }, "(0.25f,0.5f,1.f,1.5f)", "%", "hla", "float", "4" }, + { { "" }, "(0.25f,0.5f,1.f,1.5f)", "%.1", "hla", "float", "4" }, // Eight component vector in the shortest float representation @@ -1231,7 +1299,7 @@ std::vector correctBufferVector = { "1.23e+03,9.88e+05,5.00e-04", - "0x1p-2,0x1p-1,0x1p+0,0x1.8p+0", + "0x1.0p-2,0x1.0p-1,0x1.0p+0,0x1.8p+0", "1,2,3,4,1.5,3.14,2.5,3.5", @@ -1404,12 +1472,12 @@ testCase testCaseMixedFormat = { TYPE_MIXED_FORMAT_RANDOM, //------------------------------------------------------------------------------- std::vector allTestCase = { - &testCaseInt, &testCaseHalf, &testCaseHalfLimits, - &testCaseFloat, &testCaseFloatLimits, &testCaseDouble, - &testCaseDoubleLimits, &testCaseOctal, &testCaseUnsigned, - &testCaseHexadecimal, &testCaseChar, &testCaseString, - &testCaseFormatString, &testCaseVector, &testCaseAddrSpace, - &testCaseMixedFormat + &testCaseInt, &testCaseLong, &testCaseHalf, + &testCaseHalfLimits, &testCaseFloat, &testCaseFloatLimits, + &testCaseDouble, &testCaseDoubleLimits, &testCaseOctal, + &testCaseUnsigned, &testCaseHexadecimal, &testCaseChar, + &testCaseString, &testCaseFormatString, &testCaseVector, + &testCaseAddrSpace, &testCaseMixedFormat }; //----------------------------------------- @@ -1526,6 +1594,13 @@ static void intRefBuilder(printDataGenParameters& params, char* refResult, const atoi(params.dataRepresentation)); } +static void longRefBuilder(printDataGenParameters& params, char* refResult, + const size_t refSize) +{ + snprintf(refResult, refSize, params.genericFormats.front().c_str(), + atoll(params.dataRepresentation)); +} + static void halfRefBuilder(printDataGenParameters& params, char* refResult, const size_t refSize) { diff --git a/test_conformance/vulkan/CMakeLists.txt b/test_conformance/vulkan/CMakeLists.txt index c970a77e38..61a6014923 100644 --- a/test_conformance/vulkan/CMakeLists.txt +++ b/test_conformance/vulkan/CMakeLists.txt @@ -25,20 +25,8 @@ set (${MODULE_NAME}_SOURCES test_vulkan_api_consistency_for_1dimages.cpp test_vulkan_platform_device_info.cpp vulkan_interop_common.cpp - ../../test_common/harness/genericThread.cpp - ../../test_common/harness/errorHelpers.cpp - ../../test_common/harness/testHarness.cpp - ../../test_common/harness/kernelHelpers.cpp - ../../test_common/harness/mt19937.cpp - ../../test_common/harness/msvc9.c - ../../test_common/harness/parseParameters.cpp - ../../test_common/harness/deviceInfo.cpp - ../../test_common/harness/crc32.cpp ) -set_source_files_properties( - ${${MODULE_NAME}_SOURCES} - PROPERTIES LANGUAGE CXX) include_directories("../common/vulkan_wrapper") add_subdirectory(shaders) diff --git a/test_conformance/vulkan/shaders/CMakeLists.txt b/test_conformance/vulkan/shaders/CMakeLists.txt index 881b3f20d6..950774c04b 100644 --- a/test_conformance/vulkan/shaders/CMakeLists.txt +++ b/test_conformance/vulkan/shaders/CMakeLists.txt @@ -25,7 +25,7 @@ else() string(REPLACE "GLSL_TYPE_PREFIX" "${GLSL_TYPE_PREFIX}" IMAGE2D_SHADER_CONTENT "${IMAGE2D_SHADER_CONTENT}") file(WRITE ${IMAGE2D_SHADER_TMP_OUT_FILE} "${IMAGE2D_SHADER_CONTENT}") execute_process( - COMMAND ${Vulkan_glslang_binary} --target-env vulkan1.0 -o image2D_${GLSL_FORMAT}.spv ${IMAGE2D_SHADER_TMP_OUT_FILE} + COMMAND ${Vulkan_glslang_binary} --target-env vulkan1.0 -o ${CMAKE_CURRENT_BINARY_DIR}/image2D_${GLSL_FORMAT}.spv ${IMAGE2D_SHADER_TMP_OUT_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE commandStatus OUTPUT_QUIET) @@ -34,7 +34,7 @@ else() endif() endforeach(IMAGE2D_FORMAT) execute_process( - COMMAND ${Vulkan_glslang_binary} --target-env vulkan1.0 -o ${BUFFER_SHADER_IN_FILE}.spv ${BUFFER_SHADER_IN_FILE}.comp + COMMAND ${Vulkan_glslang_binary} --target-env vulkan1.0 -o ${CMAKE_CURRENT_BINARY_DIR}/${BUFFER_SHADER_IN_FILE}.spv ${BUFFER_SHADER_IN_FILE}.comp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE commandStatus OUTPUT_QUIET) diff --git a/test_conformance/vulkan/test_vulkan_api_consistency.cpp b/test_conformance/vulkan/test_vulkan_api_consistency.cpp index fe06052e10..09e02981a6 100644 --- a/test_conformance/vulkan/test_vulkan_api_consistency.cpp +++ b/test_conformance/vulkan/test_vulkan_api_consistency.cpp @@ -517,9 +517,10 @@ int test_consistency_external_semaphore(cl_device_id deviceID, // Pass invalid object to release call errNum = clReleaseSemaphoreKHRptr(NULL); - test_failure_error(errNum, CL_INVALID_VALUE, - "clReleaseSemaphoreKHRptr fails with " - "CL_INVALID_VALUE when NULL semaphore object is passed"); + test_failure_error( + errNum, CL_INVALID_SEMAPHORE_KHR, + "clReleaseSemaphoreKHRptr fails with " + "CL_INVALID_SEMAPHORE_KHR when NULL semaphore object is passed"); // Release both semaphore objects errNum = clReleaseSemaphoreKHRptr(clVk2Clsemaphore); diff --git a/test_conformance/vulkan/test_vulkan_interop_buffer.cpp b/test_conformance/vulkan/test_vulkan_interop_buffer.cpp index de350f7022..222dde8aba 100644 --- a/test_conformance/vulkan/test_vulkan_interop_buffer.cpp +++ b/test_conformance/vulkan/test_vulkan_interop_buffer.cpp @@ -23,6 +23,7 @@ #include #include #include "harness/errorHelpers.h" +#include "harness/os_helpers.h" #include "deviceInfo.h" #define MAX_BUFFERS 5 @@ -115,7 +116,7 @@ int run_test_with_two_queue( VulkanQueue &vkQueue = vkDevice.getQueue(); - std::vector vkBufferShader = readFile("buffer.spv"); + std::vector vkBufferShader = readFile("buffer.spv", exe_dir()); VulkanShaderModule vkBufferShaderModule(vkDevice, vkBufferShader); VulkanDescriptorSetLayoutBindingList vkDescriptorSetLayoutBindingList; @@ -447,7 +448,8 @@ int run_test_with_one_queue( VulkanQueue &vkQueue = vkDevice.getQueue(); - std::vector vkBufferShader = readFile("buffer.spv"); + std::vector vkBufferShader = readFile("buffer.spv", exe_dir()); + VulkanShaderModule vkBufferShaderModule(vkDevice, vkBufferShader); VulkanDescriptorSetLayoutBindingList vkDescriptorSetLayoutBindingList; vkDescriptorSetLayoutBindingList.addBinding( @@ -749,7 +751,7 @@ int run_test_with_multi_import_same_ctx( VulkanQueue &vkQueue = vkDevice.getQueue(); - std::vector vkBufferShader = readFile("buffer.spv"); + std::vector vkBufferShader = readFile("buffer.spv", exe_dir()); VulkanShaderModule vkBufferShaderModule(vkDevice, vkBufferShader); VulkanDescriptorSetLayoutBindingList vkDescriptorSetLayoutBindingList; @@ -1097,7 +1099,7 @@ int run_test_with_multi_import_diff_ctx( VulkanQueue &vkQueue = vkDevice.getQueue(); - std::vector vkBufferShader = readFile("buffer.spv"); + std::vector vkBufferShader = readFile("buffer.spv", exe_dir()); VulkanShaderModule vkBufferShaderModule(vkDevice, vkBufferShader); VulkanDescriptorSetLayoutBindingList vkDescriptorSetLayoutBindingList( @@ -1380,7 +1382,7 @@ int run_test_with_multi_import_diff_ctx( "Failed to set kernel arg"); err = clEnqueueAcquireExternalMemObjectsKHRptr( - cmd_queue1, 1, &buffers2[i][launchIter], 0, + cmd_queue2, 1, &buffers2[i][launchIter], 0, nullptr, nullptr); test_error_and_cleanup(err, CLEANUP, "Failed to acquire buffers"); @@ -1400,7 +1402,7 @@ int run_test_with_multi_import_diff_ctx( for (int i = 0; i < numBuffers; i++) { err = clEnqueueReleaseExternalMemObjectsKHRptr( - cmd_queue1, 1, &buffers2[i][launchIter], 0, + cmd_queue2, 1, &buffers2[i][launchIter], 0, nullptr, nullptr); test_error_and_cleanup(err, CLEANUP, "Failed to release buffers"); diff --git a/test_conformance/vulkan/test_vulkan_interop_image.cpp b/test_conformance/vulkan/test_vulkan_interop_image.cpp index 4c5d44a024..a3c8de993c 100644 --- a/test_conformance/vulkan/test_vulkan_interop_image.cpp +++ b/test_conformance/vulkan/test_vulkan_interop_image.cpp @@ -17,6 +17,7 @@ #include #include #include "harness/errorHelpers.h" +#include "harness/os_helpers.h" #include #include "deviceInfo.h" @@ -272,8 +273,8 @@ int run_test_with_two_queue( std::string fileName = "image2D_" + std::string(getVulkanFormatGLSLFormat(vkFormat)) + ".spv"; - log_info("Load %s file", fileName.c_str()); - vkImage2DShader = readFile(fileName); + log_info("Load file: %s\n", fileName.c_str()); + vkImage2DShader = readFile(fileName, exe_dir()); VulkanShaderModule vkImage2DShaderModule(vkDevice, vkImage2DShader); VulkanComputePipeline vkComputePipeline(vkDevice, vkPipelineLayout, @@ -884,8 +885,8 @@ int run_test_with_one_queue( std::string fileName = "image2D_" + std::string(getVulkanFormatGLSLFormat(vkFormat)) + ".spv"; - log_info("Load %s file", fileName.c_str()); - vkImage2DShader = readFile(fileName); + log_info("Load file: %s\n", fileName.c_str()); + vkImage2DShader = readFile(fileName, exe_dir()); VulkanShaderModule vkImage2DShaderModule(vkDevice, vkImage2DShader); VulkanComputePipeline vkComputePipeline(vkDevice, vkPipelineLayout, @@ -1474,7 +1475,7 @@ int test_image_common(cl_device_id device_, cl_context context_, err = setMaxImageDimensions(deviceId, max_width, max_height); test_error_and_cleanup(err, CLEANUP, "error setting max image dimensions"); - log_info("Set max_width to %lu and max_height to %lu\n", max_width, + log_info("Set max_width to %zu and max_height to %zu\n", max_width, max_height); context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_GPU, NULL, NULL, &err); diff --git a/test_conformance/vulkan/test_vulkan_platform_device_info.cpp b/test_conformance/vulkan/test_vulkan_platform_device_info.cpp index 12f373b5c5..1c25c0f58a 100644 --- a/test_conformance/vulkan/test_vulkan_platform_device_info.cpp +++ b/test_conformance/vulkan/test_vulkan_platform_device_info.cpp @@ -16,9 +16,11 @@ #include #include +#include "harness/deviceInfo.h" #include "harness/testHarness.h" #include #include +#include typedef struct { @@ -51,62 +53,81 @@ _info device_info_table[] = { int test_platform_info(cl_device_id deviceID, cl_context _context, cl_command_queue _queue, int num_elements) { - cl_uint num_platforms; - cl_uint i, j; - cl_platform_id *platforms; + cl_uint i; + cl_platform_id platform = getPlatformFromDevice(deviceID); cl_int errNum; cl_uint *handle_type; size_t handle_type_size = 0; cl_uint num_handles = 0; + cl_bool external_mem_extn_available = + is_platform_extension_available(platform, "cl_khr_external_semaphore"); + cl_bool external_sema_extn_available = + is_platform_extension_available(platform, "cl_khr_external_memory"); + cl_bool supports_atleast_one_sema_query = false; - // get total # of platforms - errNum = clGetPlatformIDs(0, NULL, &num_platforms); - test_error(errNum, "clGetPlatformIDs (getting count) failed"); - - platforms = - (cl_platform_id *)malloc(num_platforms * sizeof(cl_platform_id)); - if (!platforms) + if (!external_mem_extn_available && !external_sema_extn_available) { - printf("error allocating memory\n"); - exit(1); + log_info("Platform does not support 'cl_khr_external_semaphore' " + "and 'cl_khr_external_memory'. Skipping the test.\n"); + return TEST_SKIPPED_ITSELF; } - log_info("%d platforms available\n", num_platforms); - errNum = clGetPlatformIDs(num_platforms, platforms, NULL); - test_error(errNum, "clGetPlatformIDs (getting IDs) failed"); - for (i = 0; i < num_platforms; i++) + log_info("Platform (id %lu) info:\n", (unsigned long)platform); + + for (i = 0; + i < sizeof(platform_info_table) / sizeof(platform_info_table[0]); i++) { - log_info("Platform%d (id %lu) info:\n", i, (unsigned long)platforms[i]); - for (j = 0; - j < sizeof(platform_info_table) / sizeof(platform_info_table[0]); - j++) + errNum = clGetPlatformInfo(platform, platform_info_table[i].info, 0, + NULL, &handle_type_size); + test_error(errNum, "clGetPlatformInfo failed"); + + if (handle_type_size == 0) { - errNum = - clGetPlatformInfo(platforms[i], platform_info_table[j].info, 0, - NULL, &handle_type_size); - test_error(errNum, "clGetPlatformInfo failed"); - num_handles = handle_type_size / sizeof(cl_uint); - handle_type = (cl_uint *)malloc(handle_type_size); - errNum = - clGetPlatformInfo(platforms[i], platform_info_table[j].info, - handle_type_size, handle_type, NULL); - test_error(errNum, "clGetPlatformInfo failed"); - - log_info("%s: \n", platform_info_table[j].name); - while (num_handles--) - { - log_info("%x \n", handle_type[num_handles]); - } - if (handle_type) + if (platform_info_table[i].info + == CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR + && external_mem_extn_available) { - free(handle_type); + test_fail( + "External memory import handle types should be reported if " + "cl_khr_external_memory is available.\n"); } + log_info("%s not supported. Skipping the query.\n", + platform_info_table[i].name); + continue; + } + + if ((platform_info_table[i].info + == CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR) + || (platform_info_table[i].info + == CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR)) + { + supports_atleast_one_sema_query = true; + } + + num_handles = handle_type_size / sizeof(cl_uint); + handle_type = (cl_uint *)malloc(handle_type_size); + errNum = clGetPlatformInfo(platform, platform_info_table[i].info, + handle_type_size, handle_type, NULL); + test_error(errNum, "clGetPlatformInfo failed"); + + log_info("%s: \n", platform_info_table[i].name); + while (num_handles--) + { + log_info("%x \n", handle_type[num_handles]); + } + if (handle_type) + { + free(handle_type); } } - if (platforms) + + if (external_sema_extn_available && !supports_atleast_one_sema_query) { - free(platforms); + log_info("External semaphore import/export or both should be supported " + "if cl_khr_external_semaphore is available.\n"); + return TEST_FAIL; } + return TEST_PASS; } @@ -118,6 +139,19 @@ int test_device_info(cl_device_id deviceID, cl_context _context, size_t handle_type_size = 0; cl_uint num_handles = 0; cl_int errNum = CL_SUCCESS; + cl_bool external_mem_extn_available = + is_extension_available(deviceID, "cl_khr_external_memory"); + cl_bool external_sema_extn_available = + is_extension_available(deviceID, "cl_khr_external_semaphore"); + cl_bool supports_atleast_one_sema_query = false; + + if (!external_mem_extn_available && !external_sema_extn_available) + { + log_info("Device does not support 'cl_khr_external_semaphore' " + "and 'cl_khr_external_memory'. Skipping the test.\n"); + return TEST_SKIPPED_ITSELF; + } + for (j = 0; j < sizeof(device_info_table) / sizeof(device_info_table[0]); j++) { @@ -125,6 +159,29 @@ int test_device_info(cl_device_id deviceID, cl_context _context, &handle_type_size); test_error(errNum, "clGetDeviceInfo failed"); + if (handle_type_size == 0) + { + if (device_info_table[j].info + == CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR + && external_mem_extn_available) + { + test_fail( + "External memory import handle types should be reported if " + "cl_khr_external_memory is available.\n"); + } + log_info("%s not supported. Skipping the query.\n", + device_info_table[j].name); + continue; + } + + if ((device_info_table[j].info + == CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR) + || (device_info_table[j].info + == CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR)) + { + supports_atleast_one_sema_query = true; + } + num_handles = handle_type_size / sizeof(cl_uint); handle_type = (cl_uint *)malloc(handle_type_size); @@ -142,5 +199,13 @@ int test_device_info(cl_device_id deviceID, cl_context _context, free(handle_type); } } + + if (external_sema_extn_available && !supports_atleast_one_sema_query) + { + log_info("External semaphore import/export or both should be supported " + "if cl_khr_external_semaphore is available.\n"); + return TEST_FAIL; + } + return TEST_PASS; }