Skip to content

Commit

Permalink
Merge branch 'main' into cl_khr_unified_svm
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug committed Feb 4, 2025
2 parents 7b966bb + cc9e616 commit ced5412
Show file tree
Hide file tree
Showing 194 changed files with 5,157 additions and 4,904 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Build dir
[Bb]uild/
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang"
# Enable more warnings if not doing a release build.
add_cxx_flag_if_supported(-Wall)
endif()
add_cxx_flag_if_supported(-Wno-format)
add_cxx_flag_if_supported(-Wno-error=cpp) # Allow #warning directive
add_cxx_flag_if_supported(-Wno-unknown-pragmas) # Issue #785
add_cxx_flag_if_supported(-Wno-error=asm-operand-widths) # Issue #784
Expand Down
1 change: 1 addition & 0 deletions test_common/harness/errorHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const char *IGetErrorString(int clErrorCode)
return "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR";
case CL_INVALID_COMMAND_BUFFER_KHR:
return "CL_INVALID_COMMAND_BUFFER_KHR";
case CL_INVALID_SEMAPHORE_KHR: return "CL_INVALID_SEMAPHORE_KHR";
default: return "(unknown)";
}
}
Expand Down
15 changes: 13 additions & 2 deletions test_common/harness/testHarness.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ template <typename T> T *register_test(const char *name, Version version)
}

#define REGISTER_TEST_VERSION(name, version) \
extern int test_##name(cl_device_id deviceID, cl_context context, \
extern int test_##name(cl_device_id device, cl_context context, \
cl_command_queue queue, int num_elements); \
class test_##name##_class : public test { \
private: \
Expand All @@ -145,11 +145,22 @@ template <typename T> T *register_test(const char *name, Version version)
}; \
test_##name##_class *var_##name = \
register_test<test_##name##_class>(#name, version); \
int test_##name(cl_device_id deviceID, cl_context context, \
int test_##name(cl_device_id device, cl_context context, \
cl_command_queue queue, int num_elements)

#define REGISTER_TEST(name) REGISTER_TEST_VERSION(name, Version(1, 2))

#define REQUIRE_EXTENSION(name) \
do \
{ \
if (!is_extension_available(deviceID, name)) \
{ \
log_info(name \
" is not supported on this device. Skipping test.\n"); \
return TEST_SKIPPED_ITSELF; \
} \
} while (0)

extern int gFailCount;
extern int gTestCount;
extern cl_uint gReSeed;
Expand Down
7 changes: 3 additions & 4 deletions test_conformance/SVM/test_allocate_shared_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ REGISTER_TEST(svm_allocate_shared_buffer)
clCommandQueueWrapper queues[MAXQ];

cl_device_svm_capabilities caps;
err = clGetDeviceInfo(deviceID, CL_DEVICE_SVM_CAPABILITIES,
err = clGetDeviceInfo(device, CL_DEVICE_SVM_CAPABILITIES,
sizeof(cl_device_svm_capabilities), &caps, NULL);
test_error(err, "clGetDeviceInfo failed for CL_DEVICE_SVM_CAPABILITIES");

// under construction...
err =
create_cl_objects(deviceID, NULL, &contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
err = create_cl_objects(device, NULL, &contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
if (err) return -1;

Expand Down
7 changes: 3 additions & 4 deletions test_conformance/SVM/test_allocate_shared_buffer_negative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ REGISTER_TEST(svm_allocate_shared_buffer_negative)
clCommandQueueWrapper queues[MAXQ];

cl_device_svm_capabilities caps;
err = clGetDeviceInfo(deviceID, CL_DEVICE_SVM_CAPABILITIES,
err = clGetDeviceInfo(device, CL_DEVICE_SVM_CAPABILITIES,
sizeof(cl_device_svm_capabilities), &caps, NULL);
test_error(err, "clGetDeviceInfo failed for CL_DEVICE_SVM_CAPABILITIES");

// under construction...
err =
create_cl_objects(deviceID, NULL, &contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
err = create_cl_objects(device, NULL, &contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
if (err) return err;

Expand Down
2 changes: 1 addition & 1 deletion test_conformance/SVM/test_byte_granularity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ REGISTER_TEST(svm_byte_granularity)
cl_uint num_devices = 0;
cl_int err = CL_SUCCESS;

err = create_cl_objects(deviceID, &byte_manipulation_kernels[0],
err = create_cl_objects(device, &byte_manipulation_kernels[0],
&contextWrapper, &program, &queues[0], &num_devices,
CL_DEVICE_SVM_FINE_GRAIN_BUFFER);
context = contextWrapper;
Expand Down
2 changes: 1 addition & 1 deletion test_conformance/SVM/test_cross_buffer_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ REGISTER_TEST(svm_cross_buffer_pointers_coarse_grain)
cl_int error = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

error = create_cl_objects(deviceID, &SVMCrossBufferPointers_test_kernel[0],
error = create_cl_objects(device, &SVMCrossBufferPointers_test_kernel[0],
&contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
Expand Down
2 changes: 1 addition & 1 deletion test_conformance/SVM/test_enqueue_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ REGISTER_TEST(svm_enqueue_api)
cl_int error = CL_SUCCESS;
RandomSeed seed(0);

error = create_cl_objects(deviceID, NULL, &contextWrapper, NULL, &queues[0],
error = create_cl_objects(device, NULL, &contextWrapper, NULL, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
if (error) return TEST_FAIL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ REGISTER_TEST(svm_fine_grain_memory_consistency)
char *source[] = { hash_table_kernel };

err = create_cl_objects(
deviceID, (const char **)source, &contextWrapper, &program, &queues[0],
device, (const char **)source, &contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS,
required_extensions);
context = contextWrapper;
Expand Down
7 changes: 3 additions & 4 deletions test_conformance/SVM/test_fine_grain_sync_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ REGISTER_TEST(svm_fine_grain_sync_buffers)
cl_int err = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

err = create_cl_objects(deviceID, &find_targets_kernel[0], &contextWrapper,
&program, &queues[0], &num_devices,
CL_DEVICE_SVM_FINE_GRAIN_BUFFER
| CL_DEVICE_SVM_ATOMICS);
err = create_cl_objects(
device, &find_targets_kernel[0], &contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS);
context = contextWrapper;
if (err == 1)
return 0; // no devices capable of requested SVM level, so don't execute
Expand Down
4 changes: 2 additions & 2 deletions test_conformance/SVM/test_migrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ REGISTER_TEST(svm_migrate)
clProgramWrapper program;
cl_int error;

error = create_cl_objects(deviceID, &sources[0], &contextWrapper, &program,
error = create_cl_objects(device, &sources[0], &contextWrapper, &program,
&queues[0], &num_devices,
CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
Expand Down Expand Up @@ -202,7 +202,7 @@ REGISTER_TEST(svm_migrate)

// Check the event command type for clEnqueueSVMMigrateMem (OpenCL 3.0 and
// newer)
Version version = get_device_cl_version(deviceID);
Version version = get_device_cl_version(device);
if (version >= Version(3, 0))
{
cl_command_type commandType;
Expand Down
8 changes: 4 additions & 4 deletions test_conformance/SVM/test_pointer_passing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ REGISTER_TEST(svm_pointer_passing)
cl_int error = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

error = create_cl_objects(deviceID, &SVMPointerPassing_test_kernel[0],
error = create_cl_objects(device, &SVMPointerPassing_test_kernel[0],
&contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
Expand Down Expand Up @@ -127,10 +127,10 @@ REGISTER_TEST(svm_pointer_passing)
return -1;
}
}
}

error = clFinish(cmdq);
test_error(error, "clFinish failed");
error = clFinish(cmdq);
test_error(error, "clFinish failed");
}
}


Expand Down
7 changes: 5 additions & 2 deletions test_conformance/SVM/test_set_kernel_exec_info_svm_ptrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ REGISTER_TEST(svm_set_kernel_exec_info_svm_ptrs)
cl_int error = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

//error = create_cl_objects(deviceID, &set_kernel_exec_info_svm_ptrs_kernel[0], &context, &program, &q, &num_devices, CL_DEVICE_SVM_FINE_GRAIN);
error = create_cl_objects(deviceID, &set_kernel_exec_info_svm_ptrs_kernel[0], &c, &program, &queues[0], &num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
// error = create_cl_objects(device, &set_kernel_exec_info_svm_ptrs_kernel[0],
// &context, &program, &q, &num_devices, CL_DEVICE_SVM_FINE_GRAIN);
error = create_cl_objects(device, &set_kernel_exec_info_svm_ptrs_kernel[0],
&c, &program, &queues[0], &num_devices,
CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
if(error == 1) return 0; // no devices capable of requested SVM level, so don't execute but count test as passing.
if(error < 0) return -1; // fail test.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ int shared_address_space_coarse_grain(cl_device_id deviceID, cl_context context2

REGISTER_TEST(svm_shared_address_space_coarse_grain_old_api)
{
return shared_address_space_coarse_grain(deviceID, context, queue,
return shared_address_space_coarse_grain(device, context, queue,
num_elements, CL_FALSE);
}

REGISTER_TEST(svm_shared_address_space_coarse_grain_new_api)
{
return shared_address_space_coarse_grain(deviceID, context, queue,
return shared_address_space_coarse_grain(device, context, queue,
num_elements, CL_TRUE);
}
6 changes: 3 additions & 3 deletions test_conformance/SVM/test_shared_address_space_fine_grain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ REGISTER_TEST(svm_shared_address_space_fine_grain)
cl_int error = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

error = create_cl_objects(
deviceID, &linked_list_create_and_verify_kernels[0], &contextWrapper,
&program, &queues[0], &num_devices, CL_DEVICE_SVM_FINE_GRAIN_SYSTEM);
error = create_cl_objects(device, &linked_list_create_and_verify_kernels[0],
&contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_FINE_GRAIN_SYSTEM);
context = contextWrapper;
if (error == 1)
return 0; // no devices capable of requested SVM level, so don't execute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ REGISTER_TEST(svm_shared_address_space_fine_grain_buffers)
cl_int error = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

error = create_cl_objects(
deviceID, &linked_list_create_and_verify_kernels[0], &contextWrapper,
&program, &queues[0], &num_devices, CL_DEVICE_SVM_FINE_GRAIN_BUFFER);
error = create_cl_objects(device, &linked_list_create_and_verify_kernels[0],
&contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_FINE_GRAIN_BUFFER);
context = contextWrapper;
if (error == 1)
return 0; // no devices capable of requested SVM level, so don't execute
Expand Down
2 changes: 1 addition & 1 deletion test_conformance/SVM/test_shared_sub_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ REGISTER_TEST(svm_shared_sub_buffers)
cl_int error = CL_SUCCESS;
clCommandQueueWrapper queues[MAXQ];

error = create_cl_objects(deviceID, &shared_sub_buffers_test_kernel[0],
error = create_cl_objects(device, &shared_sub_buffers_test_kernel[0],
&contextWrapper, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
context = contextWrapper;
Expand Down
41 changes: 11 additions & 30 deletions test_conformance/allocations/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,48 +272,28 @@ int doTest(cl_device_id device, cl_context context, cl_command_queue queue,
return failure_counts;
}

int test_buffer(cl_device_id device, cl_context context, cl_command_queue queue,
int num_elements)
{
return doTest(device, context, queue, BUFFER);
}
int test_image2d_read(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(buffer) { return doTest(device, context, queue, BUFFER); }
REGISTER_TEST(image2d_read)
{
return doTest(device, context, queue, IMAGE_READ);
}
int test_image2d_write(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(image2d_write)
{
return doTest(device, context, queue, IMAGE_WRITE);
}
int test_buffer_non_blocking(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(buffer_non_blocking)
{
return doTest(device, context, queue, BUFFER_NON_BLOCKING);
}
int test_image2d_read_non_blocking(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(image2d_read_non_blocking)
{
return doTest(device, context, queue, IMAGE_READ_NON_BLOCKING);
}
int test_image2d_write_non_blocking(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(image2d_write_non_blocking)
{
return doTest(device, context, queue, IMAGE_WRITE_NON_BLOCKING);
}

test_definition test_list[] = {
ADD_TEST(buffer),
ADD_TEST(image2d_read),
ADD_TEST(image2d_write),
ADD_TEST(buffer_non_blocking),
ADD_TEST(image2d_read_non_blocking),
ADD_TEST(image2d_write_non_blocking),
};

const int test_num = ARRAY_SIZE(test_list);

int main(int argc, const char *argv[])
{
char *endPtr;
Expand Down Expand Up @@ -382,8 +362,9 @@ int main(int argc, const char *argv[])
}
}

int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list,
false, 0, init_cl);
int ret = runTestHarnessWithCheck(
argCount, argList, test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), false, 0, init_cl);

free(argList);
return ret;
Expand Down Expand Up @@ -416,8 +397,8 @@ void printUsage(const char *execName)
"of the memory objects.\n");
log_info("\n");
log_info("Test names (Allocation Types):\n");
for (int i = 0; i < test_num; i++)
for (int i = 0; i < test_registry::getInstance().num_tests(); i++)
{
log_info("\t%s\n", test_list[i].name);
log_info("\t%s\n", test_registry::getInstance().definitions()[i].name);
}
}
1 change: 1 addition & 0 deletions test_conformance/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ set(${MODULE_NAME}_SOURCES
test_queue_properties_queries.cpp
test_pipe_properties_queries.cpp
test_wg_suggested_local_work_size.cpp
test_device_command_queue.cpp
)

include(../CMakeCommon.txt)
Loading

0 comments on commit ced5412

Please sign in to comment.