Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
SWDEV-383839 - fix oclperf test failures on MI300
Browse files Browse the repository at this point in the history
Change-Id: I789dad08f875d16eeb4d60dc60379d4ee4158904
  • Loading branch information
jujiang-del committed Feb 23, 2023
1 parent cc4b68b commit 821ca40
Show file tree
Hide file tree
Showing 19 changed files with 159 additions and 19 deletions.
13 changes: 13 additions & 0 deletions tests/ocltst/module/perf/OCLPerfImageCopyCorners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void OCLPerfImageCopyCorners::open(unsigned int test, char *units,
dstBuffer_ = 0;
srcImage_ = false;
dstImage_ = false;
skip_ = false;

error_ = _wrapper->clGetPlatformIDs(0, NULL, &numPlatforms);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetPlatformIDs failed");
Expand Down Expand Up @@ -172,6 +173,15 @@ void OCLPerfImageCopyCorners::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];
size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}

if (_openTest % NUM_SIZES) {
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH,
Expand Down Expand Up @@ -252,6 +262,9 @@ void OCLPerfImageCopyCorners::open(unsigned int test, char *units,
}

void OCLPerfImageCopyCorners::run(void) {
if (skip_) {
return;
}
size_t origin[3] = {0, 0, 0};
size_t region[3] = {bufSizeW_, bufSizeH_, 1};

Expand Down
1 change: 1 addition & 0 deletions tests/ocltst/module/perf/OCLPerfImageCopyCorners.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class OCLPerfImageCopyCorners : public OCLTestImp {
cl_mem srcBuffer_;
cl_mem dstBuffer_;
cl_int error_;
bool skip_;

unsigned int bufSizeW_;
unsigned int bufSizeH_;
Expand Down
15 changes: 13 additions & 2 deletions tests/ocltst/module/perf/OCLPerfImageCopySpeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void OCLPerfImageCopySpeed::open(unsigned int test, char *units,
dstBuffer_ = 0;
srcImage_ = false;
dstImage_ = false;

skip_ = false;
error_ = _wrapper->clGetPlatformIDs(0, NULL, &numPlatforms);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetPlatformIDs failed");
if (0 < numPlatforms) {
Expand Down Expand Up @@ -161,7 +161,15 @@ void OCLPerfImageCopySpeed::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand Down Expand Up @@ -229,6 +237,9 @@ void OCLPerfImageCopySpeed::open(unsigned int test, char *units,
}

void OCLPerfImageCopySpeed::run(void) {
if (skip_) {
return;
}
size_t origin[3] = {0, 0, 0};
size_t region[3] = {bufSize_, bufSize_, 1};

Expand Down
2 changes: 1 addition & 1 deletion tests/ocltst/module/perf/OCLPerfImageCopySpeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class OCLPerfImageCopySpeed : public OCLTestImp {
cl_mem srcBuffer_;
cl_mem dstBuffer_;
cl_int error_;

bool skip_;
unsigned int bufSize_;
unsigned int bufnum_;
bool srcImage_;
Expand Down
10 changes: 9 additions & 1 deletion tests/ocltst/module/perf/OCLPerfImageCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,15 @@ void OCLPerfImageCreate::open(unsigned int test, char *units,
return;
}
delete strVersion;

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
bufSize_ = Sizes[test % NUM_SIZES];
bufnum_ = (test / NUM_SIZES) % NUM_FORMATS;
memSize = bufSize_ * bufSize_ * formatSize[bufnum_];
Expand Down
14 changes: 13 additions & 1 deletion tests/ocltst/module/perf/OCLPerfImageMapUnmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void OCLPerfImageMapUnmap::open(unsigned int test, char *units,
conversion = 1.0f;
_deviceId = deviceId;
_openTest = test;

skip_ = false;
context_ = 0;
cmd_queue_ = 0;
srcBuffer_ = 0;
Expand Down Expand Up @@ -162,6 +162,15 @@ void OCLPerfImageMapUnmap::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];
size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}

bufSizeW_ = Sizes0[0];
bufSizeH_ = Sizes0[1];
Expand Down Expand Up @@ -249,6 +258,9 @@ void OCLPerfImageMapUnmap::open(unsigned int test, char *units,
}

void OCLPerfImageMapUnmap::run(void) {
if (skip_) {
return;
}
size_t origin[3] = {0, 0, 0};
size_t region[3] = {bufSizeW_, bufSizeH_, 1};

Expand Down
1 change: 1 addition & 0 deletions tests/ocltst/module/perf/OCLPerfImageMapUnmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class OCLPerfImageMapUnmap : public OCLTestImp {
cl_mem srcBuffer_;
cl_mem dstBuffer_;
cl_int error_;
bool skip_;

unsigned int bufSizeW_;
unsigned int bufSizeH_;
Expand Down
26 changes: 23 additions & 3 deletions tests/ocltst/module/perf/OCLPerfImageReadSpeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void OCLPerfImageReadSpeed::open(unsigned int test, char *units,
conversion = 1.0f;
_deviceId = deviceId;
_openTest = test;

skip_ = false;
context_ = 0;
cmd_queue_ = 0;
outBuffer_ = 0;
Expand Down Expand Up @@ -107,7 +107,15 @@ void OCLPerfImageReadSpeed::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand All @@ -123,6 +131,9 @@ void OCLPerfImageReadSpeed::open(unsigned int test, char *units,
}

void OCLPerfImageReadSpeed::run(void) {
if(skip_) {
return;
}
CPerfCounter timer;
size_t origin[3] = {0, 0, 0};
size_t region[3] = {bufSize_, bufSize_, 1};
Expand Down Expand Up @@ -203,6 +214,7 @@ void OCLPerfPinnedImageReadSpeed::open(unsigned int test, char *units,
cmd_queue_ = 0;
outBuffer_ = 0;
memptr = NULL;
skip_ = false;

error_ = _wrapper->clGetPlatformIDs(0, NULL, &numPlatforms);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetPlatformIDs failed");
Expand Down Expand Up @@ -238,7 +250,15 @@ void OCLPerfPinnedImageReadSpeed::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand Down
2 changes: 1 addition & 1 deletion tests/ocltst/module/perf/OCLPerfImageReadSpeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class OCLPerfImageReadSpeed : public OCLTestImp {
cl_command_queue cmd_queue_;
cl_mem outBuffer_;
cl_int error_;

bool skip_;
unsigned int bufSize_;
unsigned int bufnum_;
unsigned int numIter;
Expand Down
10 changes: 9 additions & 1 deletion tests/ocltst/module/perf/OCLPerfImageReadWrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ void OCLPerfImageReadWrite::open(unsigned int test, char *units,
return;
}
delete strVersion;

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
bufSize_ = Sizes[test % NUM_SIZES];
bufnum_ = (test / NUM_SIZES) % NUM_FORMATS;
memSize = bufSize_ * bufSize_ * formatSize[bufnum_];
Expand Down
10 changes: 9 additions & 1 deletion tests/ocltst/module/perf/OCLPerfImageReadsRGBA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@ void OCLPerfImageReadsRGBA::open(unsigned int test, char *units,
return;
}
delete strVersion;

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(devices_[_deviceId], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
bufSize_ = Sizes[test % NUM_SIZES];
bufnum_ = (test / NUM_SIZES) % NUM_FORMATS;
memSize = bufSize_ * bufSize_ * formatSize[bufnum_];
Expand Down
15 changes: 13 additions & 2 deletions tests/ocltst/module/perf/OCLPerfImageSampleRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void OCLPerfImageSampleRate::open(unsigned int test, char *units,
conversion = 1.0f;
_deviceId = deviceId;
_openTest = test;

skip_ = false;
context_ = 0;
cmd_queue_ = 0;
program_ = 0;
Expand Down Expand Up @@ -176,7 +176,15 @@ void OCLPerfImageSampleRate::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand Down Expand Up @@ -247,6 +255,9 @@ void OCLPerfImageSampleRate::open(unsigned int test, char *units,
}

void OCLPerfImageSampleRate::run(void) {
if (skip_) {
return;
}
int global = outBufSize_ / typeSizes[typeIdx_];
int local = 64;

Expand Down
1 change: 1 addition & 0 deletions tests/ocltst/module/perf/OCLPerfImageSampleRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class OCLPerfImageSampleRate : public OCLTestImp {
static const unsigned int MAX_ITERATIONS = 25;
unsigned int numBufs_;
unsigned int typeIdx_;
bool skip_;
};

#endif // _OCL_IMAGESAMPLERATE_H_
27 changes: 23 additions & 4 deletions tests/ocltst/module/perf/OCLPerfImageWriteSpeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void OCLPerfImageWriteSpeed::open(unsigned int test, char *units,
cmd_queue_ = 0;
outBuffer_ = 0;
memptr = NULL;

skip_ = false;
error_ = _wrapper->clGetPlatformIDs(0, NULL, &numPlatforms);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetPlatformIDs failed");
if (0 < numPlatforms) {
Expand Down Expand Up @@ -128,7 +128,15 @@ void OCLPerfImageWriteSpeed::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand All @@ -144,6 +152,9 @@ void OCLPerfImageWriteSpeed::open(unsigned int test, char *units,
}

void OCLPerfImageWriteSpeed::run(void) {
if (skip_) {
return;
}
CPerfCounter timer;
size_t origin[3] = {0, 0, 0};
size_t region[3] = {bufSize_, bufSize_, 1};
Expand Down Expand Up @@ -225,7 +236,7 @@ void OCLPerfPinnedImageWriteSpeed::open(unsigned int test, char *units,
cmd_queue_ = 0;
outBuffer_ = 0;
memptr = NULL;

skip_ = false;
error_ = _wrapper->clGetPlatformIDs(0, NULL, &numPlatforms);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetPlatformIDs failed");
if (0 < numPlatforms) {
Expand Down Expand Up @@ -260,7 +271,15 @@ void OCLPerfPinnedImageWriteSpeed::open(unsigned int test, char *units,

CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand Down
1 change: 1 addition & 0 deletions tests/ocltst/module/perf/OCLPerfImageWriteSpeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class OCLPerfImageWriteSpeed : public OCLTestImp {
unsigned int bufnum_;
unsigned int numIter;
char* memptr;
bool skip_;
};

class OCLPerfPinnedImageWriteSpeed : public OCLPerfImageWriteSpeed {
Expand Down
14 changes: 13 additions & 1 deletion tests/ocltst/module/perf/OCLPerfMapImageReadSpeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void OCLPerfMapImageReadSpeed::open(unsigned int test, char *units,
context_ = 0;
cmd_queue_ = 0;
outBuffer_ = 0;

skip_ = false;
error_ = _wrapper->clGetPlatformIDs(0, NULL, &numPlatforms);
CHECK_RESULT(error_ != CL_SUCCESS, "clGetPlatformIDs failed");
if (0 < numPlatforms) {
Expand Down Expand Up @@ -129,6 +129,15 @@ void OCLPerfMapImageReadSpeed::open(unsigned int test, char *units,
CHECK_RESULT(_deviceId >= num_devices, "Requested deviceID not available");
device = devices[_deviceId];

size_t size;
bool imageSupport_ = false;
error_ = _wrapper->clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport_), &imageSupport_, &size);
if (!imageSupport_) {
printf("\n%s\n", "Image not supported, skipping this test!");
skip_ = true;
return;
}
context_ = _wrapper->clCreateContext(NULL, 1, &device, notify_callback, NULL,
&error_);
CHECK_RESULT(context_ == 0, "clCreateContext failed");
Expand All @@ -143,6 +152,9 @@ void OCLPerfMapImageReadSpeed::open(unsigned int test, char *units,
}

void OCLPerfMapImageReadSpeed::run(void) {
if(skip_) {
return;
}
CPerfCounter timer;
void *mem;

Expand Down
Loading

0 comments on commit 821ca40

Please sign in to comment.