SWDEV-470698 - fix formatting, add format check workflow (#657)

Tento commit je obsažen v:
Danylo Lytovchenko
2025-08-20 16:28:06 +02:00
odevzdal GitHub
rodič 5840940caa
revize f7338717ae
1574 změnil soubory, kde provedl 162972 přidání a 199346 odebrání
+25 -35
Zobrazit soubor
@@ -79,8 +79,8 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
OCLTestImp::open(test, units, conversion, deviceId);
char strVersion[128];
error_ = _wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_VERSION,
sizeof(strVersion), strVersion, 0);
error_ = _wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_VERSION, sizeof(strVersion),
strVersion, 0);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetDeviceInfo failed");
if (test == 1 && strVersion[7] < '2') {
@@ -107,16 +107,14 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
}
CHECK_RESULT((error_ != CL_SUCCESS), "Error opening test");
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], options,
NULL, NULL);
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[deviceId], options, 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);
}
@@ -134,9 +132,8 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
CHECK_RESULT(((programInfoDevices != NULL) ? false : true), "malloc()");
// get an array of device Id's that relate to values order returned by
// 'clGetProgramInfo'
error_ = _wrapper->clGetProgramInfo(program_, CL_PROGRAM_DEVICES,
sizeof(cl_device_id) * deviceCount_,
programInfoDevices, NULL);
error_ = _wrapper->clGetProgramInfo(
program_, CL_PROGRAM_DEVICES, sizeof(cl_device_id) * deviceCount_, programInfoDevices, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clGetProgramInfo()");
// map between the class devices_ array and the programInfoDeviceId array
for (unsigned int i = 0; i < deviceCount_; i++) {
@@ -146,9 +143,8 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
}
delete[] programInfoDevices;
error_ =
_wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARY_SIZES,
sizeof(size_t) * deviceCount_, sizes, NULL);
error_ = _wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARY_SIZES,
sizeof(size_t) * deviceCount_, sizes, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clGetProgramInfo()");
unsigned char** binaries = new unsigned char*[deviceCount_];
@@ -164,8 +160,7 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
}
error_ = _wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARIES,
sizeof(unsigned char*) * deviceCount_,
binaries, NULL);
sizeof(unsigned char*) * deviceCount_, binaries, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clGetProgramInfo()");
error_ = _wrapper->clReleaseProgram(program_);
@@ -173,9 +168,9 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
const unsigned char* cBinary = binaries[programInfoDeviceIdIndex];
cl_int status;
program_ = _wrapper->clCreateProgramWithBinary(
context_, 1, &devices_[deviceId], &(sizes[programInfoDeviceIdIndex]),
&cBinary, &status, &error_);
program_ = _wrapper->clCreateProgramWithBinary(context_, 1, &devices_[deviceId],
&(sizes[programInfoDeviceIdIndex]), &cBinary,
&status, &error_);
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateProgramWithBinary()");
for (unsigned int i = 0; i < deviceCount_; i++) {
@@ -183,13 +178,11 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
}
delete[] binaries;
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[_deviceId], options0,
NULL, NULL);
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[_deviceId], options0, NULL, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clGetProgramInfo()");
error_ =
_wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARY_SIZES,
sizeof(size_t) * deviceCount_, sizes1, NULL);
error_ = _wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARY_SIZES,
sizeof(size_t) * deviceCount_, sizes1, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "1st clGetProgramInfo()");
kernel_ = _wrapper->clCreateKernel(program_, "foo", &error_);
@@ -198,21 +191,19 @@ void OCLKernelBinary::open(unsigned int test, char* units, double& conversion,
_wrapper->clReleaseKernel(kernel_);
CHECK_RESULT((error_ != CL_SUCCESS), "1st clReleaseKernel() failed");
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[_deviceId], options0,
NULL, NULL);
error_ = _wrapper->clBuildProgram(program_, 1, &devices_[_deviceId], options0, NULL, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clGetProgramInfo()");
error_ =
_wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARY_SIZES,
sizeof(size_t) * deviceCount_, sizes2, NULL);
error_ = _wrapper->clGetProgramInfo(program_, CL_PROGRAM_BINARY_SIZES,
sizeof(size_t) * deviceCount_, sizes2, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "2nd clGetProgramInfo()");
kernel_ = _wrapper->clCreateKernel(program_, "foo", &error_);
CHECK_RESULT((error_ != CL_SUCCESS), "2nd clCreateKernel() failed");
cl_mem buffer;
buffer = _wrapper->clCreateBuffer(context_, CL_MEM_READ_WRITE,
2 * sizeof(cl_uint), NULL, &error_);
buffer =
_wrapper->clCreateBuffer(context_, CL_MEM_READ_WRITE, 2 * sizeof(cl_uint), NULL, &error_);
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateBuffer() failed");
buffers_.push_back(buffer);
@@ -235,14 +226,13 @@ void OCLKernelBinary::run(void) {
CHECK_RESULT((error_ != CL_SUCCESS), "clSetKernelArg() failed");
size_t gws[1] = {2};
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1,
NULL, gws, NULL, 0, NULL, NULL);
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1, NULL, gws, NULL, 0,
NULL, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueNDRangeKernel() failed");
cl_uint outputV[2] = {0};
error_ = _wrapper->clEnqueueReadBuffer(cmdQueues_[_deviceId], buffer, true, 0,
2 * sizeof(cl_uint), outputV, 0, NULL,
NULL);
2 * sizeof(cl_uint), outputV, 0, NULL, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueReadBuffer() failed");
if (outputV[0] != 4) {
CHECK_RESULT(true, "Incorrect result of kernel execution!");