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

Commit

Permalink
Promote till commit '821ca4084c7498818268ddc4d0f2f7ced2c5907d'
Browse files Browse the repository at this point in the history
Change-Id: I051d4126a98976af0749b0e0c66f3cc26ecd6002
  • Loading branch information
mangupta committed Mar 15, 2023
2 parents ff2cd04 + 821ca40 commit 6ec44e0
Show file tree
Hide file tree
Showing 37 changed files with 218 additions and 66 deletions.
4 changes: 4 additions & 0 deletions amdocl/cl_memobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2368,6 +2368,10 @@ RUNTIME_ENTRY(cl_int, clEnqueueWriteImage,
return CL_INVALID_OPERATION;
}

if (dstImage->getDims() == 2 && origin[2] != 0) {
return CL_INVALID_VALUE;
}

amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
if (NULL == queue) {
return CL_INVALID_COMMAND_QUEUE;
Expand Down
3 changes: 3 additions & 0 deletions amdocl/cl_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ RUNTIME_ENTRY(cl_int, clBuildProgram,
if ((num_devices > 0 && device_list == NULL) || (num_devices == 0 && device_list != NULL)) {
return CL_INVALID_VALUE;
}
if (pfn_notify == nullptr && user_data != nullptr) {
return CL_INVALID_VALUE;
}

amd::Program* amdProgram = as_amd(program);

Expand Down
7 changes: 0 additions & 7 deletions tests/ocltst/module/perf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ target_link_libraries(oclperf
PRIVATE
OpenCL)

if(OPENGL_FOUND AND GLEW_FOUND)
target_link_libraries(oclperf
PRIVATE
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES})
endif()

add_custom_command(
TARGET oclperf POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
Expand Down
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
Loading

0 comments on commit 6ec44e0

Please sign in to comment.