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

This commit is contained in:
Danylo Lytovchenko
2025-08-20 16:28:06 +02:00
کامیت شده توسط GitHub
والد 5840940caa
کامیت f7338717ae
1574فایلهای تغییر یافته به همراه162972 افزوده شده و 199346 حذف شده
@@ -44,8 +44,8 @@ void OCLMemoryInfo::open(unsigned int test, char* units, double& conversion,
CHECK_RESULT((error_ != CL_SUCCESS), "Error opening test");
cl_device_type deviceType;
error_ = _wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_TYPE,
sizeof(deviceType), &deviceType, NULL);
error_ = _wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_TYPE, sizeof(deviceType),
&deviceType, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "CL_DEVICE_TYPE failed");
if (!(deviceType & CL_DEVICE_TYPE_GPU)) {
@@ -56,8 +56,7 @@ void OCLMemoryInfo::open(unsigned int test, char* units, double& conversion,
char name[1024] = {0};
size_t size = 0;
_wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_EXTENSIONS, 1024,
name, &size);
_wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_EXTENSIONS, 1024, name, &size);
if (!strstr(name, "cl_amd_device_attribute_query")) {
printf("AMD device attribute extension is required for this test!\n");
failed_ = true;
@@ -66,8 +65,8 @@ void OCLMemoryInfo::open(unsigned int test, char* units, double& conversion,
// Observed failures with APUs on GSL path due to incorrect available memory,
// reported for visible heap
cl_bool is_apu = false;
error_ = clGetDeviceInfo(devices_[deviceId], CL_DEVICE_HOST_UNIFIED_MEMORY,
sizeof(cl_bool), &is_apu, nullptr);
error_ = clGetDeviceInfo(devices_[deviceId], CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof(cl_bool),
&is_apu, nullptr);
if (is_apu) {
printf("Test not supported for apus, skipping...\n");
failed_ = true;
@@ -75,8 +74,7 @@ void OCLMemoryInfo::open(unsigned int test, char* units, double& conversion,
}
}
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 OCLMemoryInfo::run(void) {
@@ -92,13 +90,11 @@ void OCLMemoryInfo::run(void) {
for (int i = 0; i < 5 && !done; i++) {
cl_mem buffer;
size_t memoryInfo[2];
_wrapper->clGetDeviceInfo(devices_[_deviceId],
CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
_wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
2 * sizeof(size_t), memoryInfo, NULL);
buffer =
_wrapper->clCreateBuffer(context_, CL_MEM_WRITE_ONLY,
BufSize * sizeof(cl_int4), NULL, &error_);
buffer = _wrapper->clCreateBuffer(context_, CL_MEM_WRITE_ONLY, BufSize * sizeof(cl_int4),
NULL, &error_);
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateBuffer() failed");
buffers_.push_back(buffer);
@@ -107,22 +103,18 @@ void OCLMemoryInfo::run(void) {
#if !EMU_ENV
// Clear destination buffer
memset(values, 0, BufSize * sizeof(cl_int4));
error_ = _wrapper->clEnqueueWriteBuffer(
cmdQueues_[_deviceId], buffer, CL_TRUE, 0, BufSize * sizeof(cl_int4),
values, 0, NULL, NULL);
error_ = _wrapper->clEnqueueWriteBuffer(cmdQueues_[_deviceId], buffer, CL_TRUE, 0,
BufSize * sizeof(cl_int4), values, 0, NULL, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueWriteBuffer() failed");
#endif
size_t memoryInfo2[2];
_wrapper->clGetDeviceInfo(devices_[_deviceId],
CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
_wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
2 * sizeof(size_t), memoryInfo2, NULL);
size_t dif = memoryInfo[0] - memoryInfo2[0];
if (dif == 0) { // the buffer memory may come from the cached memory pool
BufSize *= 2; // double the size and try again
} else if ((dif >=
(static_cast<size_t>(BufSize * sizeof(cl_int4) * 1.5f) /
1024)) ||
} else if ((dif >= (static_cast<size_t>(BufSize * sizeof(cl_int4) * 1.5f) / 1024)) ||
(dif <= ((BufSize * sizeof(cl_int4) / 2) / 1024))) {
done = true;
} else {
@@ -136,8 +128,7 @@ void OCLMemoryInfo::run(void) {
int i = 0;
size_t sizeAll;
size_t memoryInfo[2];
_wrapper->clGetDeviceInfo(devices_[_deviceId],
CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
_wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
2 * sizeof(size_t), memoryInfo, NULL);
unsigned int* values;
values = reinterpret_cast<unsigned int*>(new cl_int4[BufSize]);
@@ -148,22 +139,19 @@ void OCLMemoryInfo::run(void) {
while (true) {
cl_mem buffer;
buffer =
_wrapper->clCreateBuffer(context_, CL_MEM_WRITE_ONLY,
BufSize * sizeof(cl_int4), NULL, &error_);
buffer = _wrapper->clCreateBuffer(context_, CL_MEM_WRITE_ONLY, BufSize * sizeof(cl_int4),
NULL, &error_);
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateBuffer() failed");
buffers_.push_back(buffer);
#if !EMU_ENV
// Clear destination buffer
error_ = _wrapper->clEnqueueWriteBuffer(
cmdQueues_[_deviceId], buffer, CL_TRUE, 0,
BufSize * sizeof(cl_int4), values, 0, NULL, NULL);
error_ = _wrapper->clEnqueueWriteBuffer(cmdQueues_[_deviceId], buffer, CL_TRUE, 0,
BufSize * sizeof(cl_int4), values, 0, NULL, NULL);
CHECK_RESULT((error_ != CL_SUCCESS), "clEnqueueWriteBuffer() failed");
#endif
sizeAll += BufSize * sizeof(cl_int4) / 1024;
size_t memoryInfo2[2];
_wrapper->clGetDeviceInfo(devices_[_deviceId],
CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
_wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_GLOBAL_FREE_MEMORY_AMD,
2 * sizeof(size_t), memoryInfo2, NULL);
if (memoryInfo2[0] < (0x50000 + (BufSize * sizeof(cl_int4) / 1024))) {
break;
@@ -182,8 +170,7 @@ void OCLMemoryInfo::run(void) {
}
for (auto& it : buffers()) {
error_ = _wrapper->clReleaseMemObject(it);
CHECK_RESULT_NO_RETURN((error_ != CL_SUCCESS),
"clReleaseMemObject() failed");
CHECK_RESULT_NO_RETURN((error_ != CL_SUCCESS), "clReleaseMemObject() failed");
}
buffers_.clear();
if (!succeed) {