SWDEV-373395 - Check CL_DEVICE_IMAGE_SUPPORT for ocltst image related tests

Change-Id: Iffa2be3d2ddeeb9baad108530dcaf69c4cbd984b
This commit is contained in:
jatang
2023-01-25 17:43:06 -05:00
parent 73f913be51
commit 49c76fa04f
10 changed files with 51 additions and 30 deletions
@@ -80,6 +80,16 @@ void OCLBufferFromImage::open(unsigned int test, char *units,
return;
}
cl_bool imageSupport;
size_t size;
_wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport), &imageSupport, &size);
if (!imageSupport) {
testDescString = "Image not supported, skipping this test! ";
done = true;
return;
}
clCreateBufferFromImageAMD =
(clCreateBufferFromImageAMD_fn)clGetExtensionFunctionAddressForPlatform(
platform_, "clCreateBufferFromImageAMD");
@@ -83,7 +83,7 @@ const static char *strKernel =
OCLCreateImage::OCLCreateImage() {
_numSubTests = MaxSubTests;
failed_ = false;
done_ = false;
ImageSizeX = ImageSize;
ImageSizeY = ImageSize;
ImageSizeZ = ImageSize;
@@ -103,7 +103,8 @@ void OCLCreateImage::open(unsigned int test, char *units, double &conversion,
_wrapper->clGetDeviceInfo(devices_[i], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport), &imageSupport, &size);
if (!imageSupport) {
failed_ = true;
testDescString = "Image not supported, skipping this test! ";
done_ = true;
return;
}
}
@@ -461,11 +462,7 @@ static void CL_CALLBACK notify_callback(const char *errinfo,
void *user_data) {}
void OCLCreateImage::run(void) {
if (failed_) {
printf ("\n");
printf ("**********************************************************\n");
printf ("* WARNING: Test skip. Image may not be supported in OCL. *\n");
printf ("**********************************************************\n");
if (done_) {
return;
}
@@ -35,7 +35,7 @@ class OCLCreateImage : public OCLTestImp {
virtual unsigned int close(void);
private:
bool failed_;
bool done_;
unsigned int testID_;
size_t maxSize_;
size_t ImageSizeX;
@@ -112,9 +112,9 @@ static const AMDDeviceInfo DeviceInfo[] = {
/* Navi24 */ { "gfx1034", "gfx1034", 4, 32, 1, 256, 64 * Ki, 32, 10, 3 },
/* Rembrandt */{ "gfx1035", "gfx1035", 4, 32, 1, 256, 64 * Ki, 32, 10, 3 },
/* Raphael */ { "gfx1036", "gfx1036", 4, 32, 1, 256, 64 * Ki, 32, 10, 3 },
{ "gfx1100", "gfx1100", 4, 32, 1, 256, 64 * Ki, 32, 11, 0 },
{ "gfx1101", "gfx1101", 4, 32, 1, 256, 64 * Ki, 32, 11, 0 },
{ "gfx1102", "gfx1102", 4, 32, 1, 256, 64 * Ki, 32, 11, 0 },
/* Navi31*/ { "gfx1100", "gfx1100", 4, 32, 1, 256, 64 * Ki, 32, 11, 0 },
/* Navi32*/ { "gfx1101", "gfx1101", 4, 32, 1, 256, 64 * Ki, 32, 11, 0 },
/* Navi33*/ { "gfx1102", "gfx1102", 4, 32, 1, 256, 64 * Ki, 32, 11, 0 },
};
const int DeviceInfoSize = sizeof(DeviceInfo) / sizeof(AMDDeviceInfo);
@@ -66,7 +66,7 @@ OCLImage2DFromBuffer::~OCLImage2DFromBuffer() {}
void OCLImage2DFromBuffer::open(unsigned int test, char *units,
double &conversion, unsigned int deviceId) {
buffer = clImage2DOriginal = clImage2D = clImage2DOut = NULL;
done = false;
done_ = false;
pitchAlignment = 0;
_openTest = test;
@@ -83,7 +83,17 @@ void OCLImage2DFromBuffer::open(unsigned int test, char *units,
if (!(deviceType & CL_DEVICE_TYPE_GPU)) {
testDescString = "GPU device is required for this test!\n";
done = true;
done_ = true;
return;
}
cl_bool imageSupport;
size_t size;
_wrapper->clGetDeviceInfo(devices_[deviceId], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport), &imageSupport, &size);
if (!imageSupport) {
testDescString = "Image not supported, skipping this test! ";
done_ = true;
return;
}
@@ -93,7 +103,7 @@ void OCLImage2DFromBuffer::open(unsigned int test, char *units,
platform_, "clConvertImageAMD");
if (clConvertImageAMD == NULL) {
testDescString = "clConvertImageAMD not found!\n";
done = true;
done_ = true;
return;
}
}
@@ -103,7 +113,7 @@ void OCLImage2DFromBuffer::open(unsigned int test, char *units,
}
void OCLImage2DFromBuffer::run(void) {
if (_errorFlag || done) {
if (_errorFlag || done_) {
return;
}
@@ -231,7 +241,7 @@ void OCLImage2DFromBuffer::AllocateOpenCLImage() {
"status!=CL_INVALID_IMAGE_FORMAT_DESCRIPTOR) <=> (%p, %x)",
clImage2D, status);
if (requiredPitch != pitch) {
done = true;
done_ = true;
return;
}
}
@@ -43,7 +43,7 @@ class OCLImage2DFromBuffer : public OCLTestImp {
void CopyOpenCLImage(cl_mem clImageSrc);
void CompileKernel();
bool done;
bool done_;
size_t blockSizeX; /**< Work-group size in x-direction */
size_t blockSizeY; /**< Work-group size in y-direction */
cl_mem buffer;
@@ -50,7 +50,10 @@ const static char* strKernel =
"} \n"
" \n";
OCLLinearFilter::OCLLinearFilter() { _numSubTests = 2; }
OCLLinearFilter::OCLLinearFilter() {
done_ = false;
_numSubTests = 2;
}
OCLLinearFilter::~OCLLinearFilter() {}
@@ -65,6 +68,8 @@ void OCLLinearFilter::open(unsigned int test, char* units, double& conversion,
_wrapper->clGetDeviceInfo(devices_[i], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport), &imageSupport, &size);
if (!imageSupport) {
testDescString = "Image not supported, skipping this test! ";
done_ = true;
return;
}
}
@@ -147,15 +152,10 @@ static void CL_CALLBACK notify_callback(const char* errinfo,
void* user_data) {}
void OCLLinearFilter::run(void) {
cl_bool imageSupport;
size_t size;
for (size_t i = 0; i < deviceCount_; ++i) {
_wrapper->clGetDeviceInfo(devices_[i], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport), &imageSupport, &size);
if (!imageSupport) {
return;
}
if (done_) {
return;
}
cl_float values[4] = {0.f, 0.f, 0.f, 0.f};
cl_float ref[2] = {1.75f, 1.25f};
cl_mem image = buffers()[0];
@@ -33,6 +33,9 @@ class OCLLinearFilter : public OCLTestImp {
unsigned int deviceID);
virtual void run(void);
virtual unsigned int close(void);
private:
bool done_;
};
#endif // _OCL_LINEAR_FILTER_H_
@@ -70,7 +70,7 @@ static const char *rgba8888_kernel_write =
OCLReadWriteImage::OCLReadWriteImage() {
_numSubTests = MaxSubTests;
failed_ = false;
done_ = false;
imageWidth = imageSize;
imageHeight = imageSize;
imageDepth = imageSize;
@@ -104,7 +104,8 @@ void OCLReadWriteImage::open(unsigned int test, char *units, double &conversion,
_wrapper->clGetDeviceInfo(devices_[i], CL_DEVICE_IMAGE_SUPPORT,
sizeof(imageSupport), &imageSupport, &size);
if (!imageSupport) {
failed_ = true;
testDescString = "Image not supported, skipping this test! ";
done_ = true;
return;
}
}
@@ -174,7 +175,7 @@ static void CL_CALLBACK notify_callback(const char *errinfo,
void *user_data) {}
void OCLReadWriteImage::run(void) {
if (failed_) {
if (done_) {
return;
}
@@ -35,7 +35,7 @@ class OCLReadWriteImage : public OCLTestImp {
virtual unsigned int close(void);
private:
bool failed_;
bool done_;
unsigned int testID_;
size_t maxSize_;
size_t imageWidth;