Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image arguments tests for cl_khr_command_buffer_mutable_dispatch. #1750

Merged
merged 13 commits into from
Jul 11, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(MODULE_NAME CL_KHR_MUTABLE_DISPATCH)
set(${MODULE_NAME}_SOURCES
main.cpp
mutable_command_info.cpp
mutable_command_image_arguments.cpp
../basic_command_buffer.cpp
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ test_definition test_list[] = {
ADD_TEST(mutable_command_info_global_work_offset),
ADD_TEST(mutable_command_info_local_work_size),
ADD_TEST(mutable_command_info_global_work_size),
ADD_TEST(mutable_dispatch_image_1d_arguments),
ADD_TEST(mutable_dispatch_image_2d_arguments),
};

int main(int argc, const char *argv[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
#include "../basic_command_buffer.h"
#include "../command_buffer_test_base.h"

// If it is supported get the addresses of all the APIs here.
#define GET_EXTENSION_ADDRESS(FUNC) \
FUNC = reinterpret_cast<FUNC##_fn>( \
clGetExtensionFunctionAddressForPlatform(platform, #FUNC)); \
if (FUNC == nullptr) \
{ \
log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed" \
" with " #FUNC "\n"); \
return TEST_FAIL; \
}

struct BasicMutableCommandBufferTest : BasicCommandBufferTest
{
BasicMutableCommandBufferTest(cl_device_id device, cl_context context,
Expand Down Expand Up @@ -84,24 +95,52 @@ struct BasicMutableCommandBufferTest : BasicCommandBufferTest
&platform, nullptr);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");

// If it is supported get the addresses of all the APIs here.
#define GET_EXTENSION_ADDRESS(FUNC) \
FUNC = reinterpret_cast<FUNC##_fn>( \
clGetExtensionFunctionAddressForPlatform(platform, #FUNC)); \
if (FUNC == nullptr) \
{ \
log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed" \
" with " #FUNC "\n"); \
return TEST_FAIL; \
GET_EXTENSION_ADDRESS(clUpdateMutableCommandsKHR);

return CL_SUCCESS;
}

clUpdateMutableCommandsKHR_fn clUpdateMutableCommandsKHR = nullptr;

const char* kernelString = "__kernel void empty() {}";
const size_t global_work_size = 4 * 16;
};

struct InfoMutableCommandBufferTest : BasicMutableCommandBufferTest
{
InfoMutableCommandBufferTest(cl_device_id device, cl_context context,
cl_command_queue queue)
: BasicMutableCommandBufferTest(device, context, queue)
{}

virtual cl_int SetUp(int elements) override
{
BasicMutableCommandBufferTest::SetUp(elements);

cl_int error = init_extension_functions();
test_error(error, "Unable to initialise extension functions");

return CL_SUCCESS;
}

cl_int init_extension_functions()
{
BasicCommandBufferTest::init_extension_functions();

cl_platform_id platform;
cl_int error =
clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(cl_platform_id),
&platform, nullptr);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");

GET_EXTENSION_ADDRESS(clGetMutableCommandInfoKHR);

return CL_SUCCESS;
}

clGetMutableCommandInfoKHR_fn clGetMutableCommandInfoKHR = nullptr;
const char* kernelString = "__kernel void empty() {}";
const size_t global_work_size = 4 * sizeof(cl_int);
};

#endif // CL_KHR_MUTABLE_COMMAND_BASIC_H
#undef GET_EXTENSION_ADDRESS

#endif //_CL_KHR_MUTABLE_COMMAND_BASIC_H
Loading