From aece761fa8cc23099c07403390ad049f153c29dc Mon Sep 17 00:00:00 2001 From: Todd tiantuo Li Date: Tue, 6 Dec 2022 05:31:52 -0800 Subject: [PATCH] SWDEV-354868 - skip subtest when number of RT CUs is less than granularity Change-Id: Ibe0b8a2d462e9a0178a12c224b0192454618cb7c [ROCm/clr commit: a284f9328fe26d99388262a070a9b5e734b1ed3a] --- .../tests/ocltst/module/runtime/OCLRTQueue.cpp | 12 ++++++++++++ .../opencl/tests/ocltst/module/runtime/OCLRTQueue.h | 1 + 2 files changed, 13 insertions(+) diff --git a/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.cpp b/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.cpp index 2409616fa3..afec4d9187 100644 --- a/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.cpp +++ b/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.cpp @@ -80,6 +80,7 @@ void OCLRTQueue::open(unsigned int test, char* units, double& conversion, cl_uint rtQueues; #define CL_DEVICE_MAX_REAL_TIME_COMPUTE_QUEUES_AMD 0x404D #define CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_AMD 0x404E +#define CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_GRANULARITY_AMD 0x403A error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_MAX_REAL_TIME_COMPUTE_QUEUES_AMD, sizeof(rtQueues), &rtQueues, 0); @@ -99,6 +100,11 @@ void OCLRTQueue::open(unsigned int test, char* units, double& conversion, sizeof(maxCUs_), &maxCUs_, 0); CHECK_RESULT(error_ != CL_SUCCESS, "clGetDeviceInfo failed"); + error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], + CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_GRANULARITY_AMD, + sizeof(rtCUsGranularity_), &rtCUsGranularity_, 0); + CHECK_RESULT(error_ != CL_SUCCESS, "clGetDeviceInfo failed"); + program_ = _wrapper->clCreateProgramWithSource(context_, 1, &strKernel, NULL, &error_); CHECK_RESULT((error_ != CL_SUCCESS), "clCreateProgramWithSource() failed"); @@ -147,6 +153,12 @@ void OCLRTQueue::run(void) { } else { cu_ = rtCUs_; } + + if (cu_ < rtCUsGranularity_) { + printf("The num of CUs is less than granularity, skipping...\n"); + return; + } + // Create a real time queue #define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f const cl_queue_properties cprops[] = { diff --git a/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.h b/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.h index cf8e39525d..ee4988c676 100644 --- a/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.h +++ b/projects/clr/opencl/tests/ocltst/module/runtime/OCLRTQueue.h @@ -43,6 +43,7 @@ class OCLRTQueue : public OCLTestImp { cl_uint cu_; cl_uint maxCUs_; cl_uint rtCUs_; + cl_uint rtCUsGranularity_; }; #endif // _OCL_RT_QUEUE_H_