SWDEV-470698 - fix formatting, add format check workflow (#657)
This commit is contained in:
1 orang tua
5840940caa
melakukan
f7338717ae
1574 files changed
+162903
-199277
No files matched your search
@@ -72,8 +72,8 @@ OCLPerfDeviceEnqueue::OCLPerfDeviceEnqueue() {
|
||||
|
||||
OCLPerfDeviceEnqueue::~OCLPerfDeviceEnqueue() {}
|
||||
|
||||
void OCLPerfDeviceEnqueue::open(unsigned int test, char* units,
|
||||
double& conversion, unsigned int deviceId) {
|
||||
void OCLPerfDeviceEnqueue::open(unsigned int test, char* units, double& conversion,
|
||||
unsigned int deviceId) {
|
||||
if (type_ == CL_DEVICE_TYPE_CPU) {
|
||||
return;
|
||||
}
|
||||
@@ -85,12 +85,11 @@ void OCLPerfDeviceEnqueue::open(unsigned int test, char* units,
|
||||
threads = testList[testID_ % testListSize].threads;
|
||||
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;
|
||||
@@ -99,22 +98,19 @@ void OCLPerfDeviceEnqueue::open(unsigned int test, char* units,
|
||||
delete strVersion;
|
||||
cl_uint maxDevQSize = 0;
|
||||
#if defined(CL_VERSION_2_0)
|
||||
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId],
|
||||
CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE,
|
||||
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE,
|
||||
sizeof(cl_uint), &maxDevQSize, 0);
|
||||
CHECK_RESULT(error_ != CL_SUCCESS, "clGetDeviceInfo failed");
|
||||
#endif
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -128,8 +124,7 @@ void OCLPerfDeviceEnqueue::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);
|
||||
|
||||
@@ -147,18 +142,15 @@ void OCLPerfDeviceEnqueue::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");
|
||||
#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 OCLPerfDeviceEnqueue::run(void) {
|
||||
@@ -181,8 +173,8 @@ void OCLPerfDeviceEnqueue::run(void) {
|
||||
error_ = _wrapper->clSetKernelArg(kernel_, 0, sizeof(cl_mem), &buffer);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clSetKernelArg() failed");
|
||||
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1,
|
||||
NULL, gws, lws, 0, NULL, NULL);
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1, NULL, gws, lws, 0,
|
||||
NULL, NULL);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueNDRangeKernel() failed");
|
||||
|
||||
_wrapper->clFinish(cmdQueues_[_deviceId]);
|
||||
@@ -193,8 +185,8 @@ void OCLPerfDeviceEnqueue::run(void) {
|
||||
timer.Reset();
|
||||
timer.Start();
|
||||
for (unsigned int i = 0; i < repeats; i++) {
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1,
|
||||
NULL, gws, lws, 0, NULL, NULL);
|
||||
error_ = _wrapper->clEnqueueNDRangeKernel(cmdQueues_[_deviceId], kernel_, 1, NULL, gws, lws, 0,
|
||||
NULL, NULL);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueNDRangeKernel() failed");
|
||||
|
||||
_wrapper->clFinish(cmdQueues_[_deviceId]);
|
||||
@@ -205,9 +197,8 @@ void OCLPerfDeviceEnqueue::run(void) {
|
||||
|
||||
_perfInfo = (float)(threads * repeats) / (float)(sec * 1000000.);
|
||||
char buf[256];
|
||||
SNPRINTF(buf, sizeof(buf),
|
||||
"%7d threads spawning 64 threads, queue size %5dKB (Mdisp/s)",
|
||||
threads, queueSize / 1024);
|
||||
SNPRINTF(buf, sizeof(buf), "%7d threads spawning 64 threads, queue size %5dKB (Mdisp/s)", threads,
|
||||
queueSize / 1024);
|
||||
testDescString = buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user