SWDEV-470698 - fix formatting, add format check workflow (#657)
Цей коміт міститься в:
1 джерело
5840940caa
коміт
f7338717ae
1574 files changed
+162903
-199277
No files matched your search
@@ -56,8 +56,7 @@ static unsigned int levelList[] = {
|
||||
};
|
||||
|
||||
const static char* strKernel = {KERNEL_CODE(
|
||||
\n __kernel void childKernel(__global uint* buf, uint level,
|
||||
clk_event_t wait_evt) {
|
||||
\n __kernel void childKernel(__global uint* buf, uint level, clk_event_t wait_evt) {
|
||||
int idx = get_global_id(0);
|
||||
if (idx < 0) {
|
||||
buf[idx] = 0;
|
||||
@@ -108,8 +107,7 @@ OCLPerfDeviceEnqueueEvent::OCLPerfDeviceEnqueueEvent() {
|
||||
|
||||
OCLPerfDeviceEnqueueEvent::~OCLPerfDeviceEnqueueEvent() {}
|
||||
|
||||
void OCLPerfDeviceEnqueueEvent::open(unsigned int test, char* units,
|
||||
double& conversion,
|
||||
void OCLPerfDeviceEnqueueEvent::open(unsigned int test, char* units, double& conversion,
|
||||
unsigned int deviceId) {
|
||||
if (type_ == CL_DEVICE_TYPE_CPU) {
|
||||
return;
|
||||
@@ -127,12 +125,11 @@ void OCLPerfDeviceEnqueueEvent::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;
|
||||
@@ -140,16 +137,14 @@ void OCLPerfDeviceEnqueueEvent::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);
|
||||
}
|
||||
@@ -163,8 +158,7 @@ void OCLPerfDeviceEnqueueEvent::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);
|
||||
|
||||
@@ -172,23 +166,19 @@ void OCLPerfDeviceEnqueueEvent::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 OCLPerfDeviceEnqueueEvent::run(void) {
|
||||
@@ -216,8 +206,8 @@ void OCLPerfDeviceEnqueueEvent::run(void) {
|
||||
error_ = _wrapper->clSetKernelArg(kernel_, 1, sizeof(unsigned int), &level);
|
||||
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]);
|
||||
@@ -229,8 +219,8 @@ void OCLPerfDeviceEnqueueEvent::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]);
|
||||
@@ -241,10 +231,9 @@ void OCLPerfDeviceEnqueueEvent::run(void) {
|
||||
|
||||
_perfInfo = (float)(threads * repeats * level) / (float)(sec * 1000000.);
|
||||
char buf[256];
|
||||
SNPRINTF(
|
||||
buf, sizeof(buf),
|
||||
"%5d threads spawning %2d threads, queue size %3dKB (Mdisp/s), level=%2d",
|
||||
threads, lws_value, queueSize / 1024, level);
|
||||
SNPRINTF(buf, sizeof(buf),
|
||||
"%5d threads spawning %2d threads, queue size %3dKB (Mdisp/s), level=%2d", threads,
|
||||
lws_value, queueSize / 1024, level);
|
||||
testDescString = buf;
|
||||
}
|
||||
|
||||
@@ -256,8 +245,7 @@ unsigned int OCLPerfDeviceEnqueueEvent::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");
|
||||
}
|
||||
if (kernel2_) {
|
||||
error_ = _wrapper->clReleaseKernel(kernel2_);
|
||||
|
||||
Reference in new issue
Заблокувати користувача