SWDEV-470698 - fix formatting, add format check workflow (#657)
This commit is contained in:
committed by
GitHub
parent
5840940caa
commit
f7338717ae
@@ -46,8 +46,7 @@ static unsigned int sizeList[] = {
|
||||
};
|
||||
|
||||
const static char* strKernel = {KERNEL_CODE(
|
||||
\n __kernel void parentKernel(__global uint* buf, int width, int offsetx,
|
||||
int offsety) {
|
||||
\n __kernel void parentKernel(__global uint* buf, int width, int offsetx, int offsety) {
|
||||
int x = get_global_id(0);
|
||||
int y = get_global_id(1);
|
||||
queue_t q = get_default_queue();
|
||||
@@ -80,8 +79,8 @@ OCLPerfDeviceEnqueueSier::OCLPerfDeviceEnqueueSier() {
|
||||
|
||||
OCLPerfDeviceEnqueueSier::~OCLPerfDeviceEnqueueSier() {}
|
||||
|
||||
void OCLPerfDeviceEnqueueSier::open(unsigned int test, char* units,
|
||||
double& conversion, unsigned int deviceId) {
|
||||
void OCLPerfDeviceEnqueueSier::open(unsigned int test, char* units, double& conversion,
|
||||
unsigned int deviceId) {
|
||||
if (type_ == CL_DEVICE_TYPE_CPU) {
|
||||
return;
|
||||
}
|
||||
@@ -92,12 +91,11 @@ void OCLPerfDeviceEnqueueSier::open(unsigned int test, char* units,
|
||||
|
||||
size_t param_size = 0;
|
||||
char* strVersion = 0;
|
||||
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_VERSION, 0,
|
||||
0, ¶m_size);
|
||||
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_VERSION, 0, 0, ¶m_size);
|
||||
CHECK_RESULT(error_ != CL_SUCCESS, "clGetDeviceInfo failed");
|
||||
strVersion = new char[param_size];
|
||||
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_VERSION,
|
||||
param_size, strVersion, 0);
|
||||
error_ =
|
||||
_wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_VERSION, param_size, strVersion, 0);
|
||||
CHECK_RESULT(error_ != CL_SUCCESS, "clGetDeviceInfo failed");
|
||||
if (strVersion[7] < '2') {
|
||||
failed_ = true;
|
||||
@@ -105,16 +103,14 @@ void OCLPerfDeviceEnqueueSier::open(unsigned int test, char* units,
|
||||
}
|
||||
delete strVersion;
|
||||
|
||||
program_ = _wrapper->clCreateProgramWithSource(context_, 1, &strKernel, NULL,
|
||||
&error_);
|
||||
program_ = _wrapper->clCreateProgramWithSource(context_, 1, &strKernel, NULL, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateProgramWithSource() failed");
|
||||
|
||||
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[deviceId],
|
||||
"-cl-std=CL2.0", NULL, NULL);
|
||||
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[deviceId], "-cl-std=CL2.0", NULL, NULL);
|
||||
if (error_ != CL_SUCCESS) {
|
||||
char programLog[1024];
|
||||
_wrapper->clGetProgramBuildInfo(program_, devices_[deviceId],
|
||||
CL_PROGRAM_BUILD_LOG, 1024, programLog, 0);
|
||||
_wrapper->clGetProgramBuildInfo(program_, devices_[deviceId], CL_PROGRAM_BUILD_LOG, 1024,
|
||||
programLog, 0);
|
||||
printf("\n%s\n", programLog);
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -125,8 +121,7 @@ void OCLPerfDeviceEnqueueSier::open(unsigned int test, char* units,
|
||||
|
||||
cl_mem buffer;
|
||||
|
||||
buffer = _wrapper->clCreateBuffer(context_, CL_MEM_ALLOC_HOST_PTR, 2048, NULL,
|
||||
&error_);
|
||||
buffer = _wrapper->clCreateBuffer(context_, CL_MEM_ALLOC_HOST_PTR, 2048, NULL, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateBuffer() failed");
|
||||
buffers_.push_back(buffer);
|
||||
|
||||
@@ -138,23 +133,19 @@ void OCLPerfDeviceEnqueueSier::open(unsigned int test, char* units,
|
||||
const cl_queue_properties cprops[] = {
|
||||
CL_QUEUE_PROPERTIES,
|
||||
static_cast<cl_queue_properties>(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
|
||||
CL_QUEUE_ON_DEVICE_DEFAULT |
|
||||
CL_QUEUE_ON_DEVICE),
|
||||
CL_QUEUE_ON_DEVICE_DEFAULT | CL_QUEUE_ON_DEVICE),
|
||||
CL_QUEUE_SIZE, queueSize, 0};
|
||||
deviceQueue_ = _wrapper->clCreateCommandQueueWithProperties(
|
||||
context_, devices_[deviceId], cprops, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS),
|
||||
"clCreateCommandQueueWithProperties() failed");
|
||||
deviceQueue_ =
|
||||
_wrapper->clCreateCommandQueueWithProperties(context_, devices_[deviceId], cprops, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateCommandQueueWithProperties() failed");
|
||||
#else
|
||||
skip_ = true;
|
||||
testDescString =
|
||||
"DeviceEnqueue NOT supported for < 2.0 builds. Test Skipped.";
|
||||
testDescString = "DeviceEnqueue NOT supported for < 2.0 builds. Test Skipped.";
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void CL_CALLBACK notify_callback(const char* errinfo,
|
||||
const void* private_info, size_t cb,
|
||||
static void CL_CALLBACK notify_callback(const char* errinfo, const void* private_info, size_t cb,
|
||||
void* user_data) {}
|
||||
|
||||
void OCLPerfDeviceEnqueueSier::run(void) {
|
||||
@@ -185,8 +176,8 @@ void OCLPerfDeviceEnqueueSier::run(void) {
|
||||
error_ |= _wrapper->clSetKernelArg(kernel_, 3, sizeof(int), (void*)&offsety);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clSetKernelArg() failed");
|
||||
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1,
|
||||
NULL, gws, 0, 0, NULL, NULL);
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1, NULL, gws, 0, 0,
|
||||
NULL, NULL);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueNDRangeKernel() failed");
|
||||
|
||||
_wrapper->clFinish(cmdQueues_[_deviceId]);
|
||||
@@ -198,9 +189,8 @@ void OCLPerfDeviceEnqueueSier::run(void) {
|
||||
timer.Reset();
|
||||
timer.Start();
|
||||
for (unsigned int i = 0; i < repeats; i++) {
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 2,
|
||||
NULL, global_work_size, 0, 0,
|
||||
NULL, NULL);
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 2, NULL,
|
||||
global_work_size, 0, 0, NULL, NULL);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueNDRangeKernel() failed");
|
||||
|
||||
_wrapper->clFinish(cmdQueues_[_deviceId]);
|
||||
@@ -212,8 +202,8 @@ void OCLPerfDeviceEnqueueSier::run(void) {
|
||||
unsigned int numOfKernels = (int)pow(8.0, log(image_size) / log(3) - 1);
|
||||
_perfInfo = (float)(numOfKernels * repeats) / (float)(sec * 1000000.);
|
||||
char buf[256];
|
||||
SNPRINTF(buf, sizeof(buf), "image_size = %5d, queue size %3dKB (Mdisp/s)",
|
||||
image_size, queueSize / 1024);
|
||||
SNPRINTF(buf, sizeof(buf), "image_size = %5d, queue size %3dKB (Mdisp/s)", image_size,
|
||||
queueSize / 1024);
|
||||
testDescString = buf;
|
||||
}
|
||||
|
||||
@@ -225,8 +215,7 @@ unsigned int OCLPerfDeviceEnqueueSier::close(void) {
|
||||
|
||||
if (deviceQueue_) {
|
||||
error_ = _wrapper->clReleaseCommandQueue(deviceQueue_);
|
||||
CHECK_RESULT_NO_RETURN(error_ != CL_SUCCESS,
|
||||
"clReleaseCommandQueue failed");
|
||||
CHECK_RESULT_NO_RETURN(error_ != CL_SUCCESS, "clReleaseCommandQueue failed");
|
||||
}
|
||||
|
||||
return OCLTestImp::close();
|
||||
|
||||
Reference in New Issue
Block a user