mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
Migrate extensions suites to the new test registration framework (#2334)
This covers: * cl_ext_cxx_for_opencl * cl_khr_command_buffer * cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch * cl_khr_dx9_media_sharing * cl_khr_external_semaphore * cl_khr_kernel_clock * cl_khr_semaphore Contributes to #2181. --------- Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
@@ -12,24 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "procs.h"
|
||||
#include "harness/testHarness.h"
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST_VERSION(external_semaphores_queries, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_cross_context, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_simple_1, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_simple_2, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_reuse, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_cross_queues_ooo, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_cross_queues_io, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_cross_queues_io2, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_multi_signal, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_multi_wait, Version(1, 2)),
|
||||
ADD_TEST_VERSION(external_semaphores_import_export_fd, Version(1, 2)),
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
// A device may report the required properties of a queue that
|
||||
@@ -38,6 +22,8 @@ int main(int argc, const char *argv[])
|
||||
// for this in the tests themselves, rather than here, where we have a
|
||||
// device to query.
|
||||
const cl_command_queue_properties queue_properties = 0;
|
||||
return runTestHarnessWithCheck(argc, argv, ARRAY_SIZE(test_list), test_list,
|
||||
return runTestHarnessWithCheck(argc, argv,
|
||||
test_registry::getInstance().num_tests(),
|
||||
test_registry::getInstance().definitions(),
|
||||
false, queue_properties, nullptr);
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2022 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef CL_KHR_EXTERNAL_SEMAPHORE_PROCS_H
|
||||
#define CL_KHR_EXTERNAL_SEMAPHORE_PROCS_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
|
||||
// Basic command-buffer tests
|
||||
|
||||
extern int test_external_semaphores_queries(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_cross_context(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_simple_1(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_simple_2(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_reuse(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_cross_queues_ooo(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_cross_queues_io(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_cross_queues_io2(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue defaultQueue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_multi_signal(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_multi_wait(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
#endif // CL_KHR_EXTERNAL_SEMAPHORE_PROCS_H
|
||||
@@ -119,9 +119,7 @@ static cl_int get_device_semaphore_handle_types(
|
||||
}
|
||||
|
||||
// Confirm the semaphores can be successfully queried
|
||||
int test_external_semaphores_queries(cl_device_id device, cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_queries, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_semaphore");
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
@@ -199,10 +197,7 @@ int test_external_semaphores_queries(cl_device_id device, cl_context context,
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
int test_external_semaphores_cross_context(cl_device_id device,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_cross_context, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
@@ -325,9 +320,7 @@ int test_external_semaphores_cross_context(cl_device_id device,
|
||||
}
|
||||
|
||||
// Confirm that a signal followed by a wait will complete successfully
|
||||
int test_external_semaphores_simple_1(cl_device_id device, cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_simple_1, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
@@ -397,9 +390,7 @@ int test_external_semaphores_simple_1(cl_device_id device, cl_context context,
|
||||
|
||||
// Confirm that signal a semaphore with no event dependencies will not result
|
||||
// in an implicit dependency on everything previously submitted
|
||||
int test_external_semaphores_simple_2(cl_device_id device, cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_simple_2, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
@@ -501,9 +492,7 @@ int test_external_semaphores_simple_2(cl_device_id device, cl_context context,
|
||||
}
|
||||
|
||||
// Confirm that a semaphore can be reused multiple times
|
||||
int test_external_semaphores_reuse(cl_device_id device, cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_reuse, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
@@ -689,51 +678,42 @@ static int external_semaphore_cross_queue_helper(cl_device_id device,
|
||||
|
||||
|
||||
// Confirm that a semaphore works across different ooo queues
|
||||
int test_external_semaphores_cross_queues_ooo(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_cross_queues_ooo, Version(1, 2))
|
||||
{
|
||||
cl_int err;
|
||||
|
||||
// Create ooo queues
|
||||
clCommandQueueWrapper queue_1 = clCreateCommandQueue(
|
||||
context, deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
|
||||
context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
|
||||
test_error(err, "Could not create command queue");
|
||||
|
||||
clCommandQueueWrapper queue_2 = clCreateCommandQueue(
|
||||
context, deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
|
||||
context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
|
||||
test_error(err, "Could not create command queue");
|
||||
|
||||
return external_semaphore_cross_queue_helper(deviceID, context, queue_1,
|
||||
return external_semaphore_cross_queue_helper(device, context, queue_1,
|
||||
queue_2);
|
||||
}
|
||||
|
||||
// Confirm that a semaphore works across different in-order queues
|
||||
int test_external_semaphores_cross_queues_io(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_cross_queues_io, Version(1, 2))
|
||||
{
|
||||
cl_int err;
|
||||
|
||||
// Create in-order queues
|
||||
clCommandQueueWrapper queue_1 =
|
||||
clCreateCommandQueue(context, deviceID, 0, &err);
|
||||
clCreateCommandQueue(context, device, 0, &err);
|
||||
test_error(err, "Could not create command queue");
|
||||
|
||||
clCommandQueueWrapper queue_2 =
|
||||
clCreateCommandQueue(context, deviceID, 0, &err);
|
||||
clCreateCommandQueue(context, device, 0, &err);
|
||||
test_error(err, "Could not create command queue");
|
||||
|
||||
return external_semaphore_cross_queue_helper(deviceID, context, queue_1,
|
||||
return external_semaphore_cross_queue_helper(device, context, queue_1,
|
||||
queue_2);
|
||||
}
|
||||
|
||||
int test_external_semaphores_cross_queues_io2(cl_device_id device,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_cross_queues_io2, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
@@ -835,10 +815,7 @@ int test_external_semaphores_cross_queues_io2(cl_device_id device,
|
||||
}
|
||||
|
||||
// Confirm that we can signal multiple semaphores with one command
|
||||
int test_external_semaphores_multi_signal(cl_device_id device,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_multi_signal, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
@@ -920,9 +897,7 @@ int test_external_semaphores_multi_signal(cl_device_id device,
|
||||
}
|
||||
|
||||
// Confirm that we can wait for multiple semaphores with one command
|
||||
int test_external_semaphores_multi_wait(cl_device_id device, cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_multi_wait, Version(1, 2))
|
||||
{
|
||||
REQUIRE_EXTENSION("cl_khr_external_semaphore");
|
||||
|
||||
|
||||
@@ -20,14 +20,11 @@
|
||||
|
||||
// Test it is possible to export a semaphore to a sync fd and import the same
|
||||
// sync fd to a new semaphore
|
||||
int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue defaultQueue,
|
||||
int num_elements)
|
||||
REGISTER_TEST_VERSION(external_semaphores_import_export_fd, Version(1, 2))
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
if (!is_extension_available(deviceID, "cl_khr_external_semaphore"))
|
||||
if (!is_extension_available(device, "cl_khr_external_semaphore"))
|
||||
{
|
||||
log_info(
|
||||
"cl_khr_external_semaphore is not supported on this platoform. "
|
||||
@@ -35,7 +32,7 @@ int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
if (!is_extension_available(deviceID, "cl_khr_external_semaphore_sync_fd"))
|
||||
if (!is_extension_available(device, "cl_khr_external_semaphore_sync_fd"))
|
||||
{
|
||||
log_info("cl_khr_external_semaphore_sync_fd is not supported on this "
|
||||
"platoform. Skipping test.\n");
|
||||
@@ -43,7 +40,7 @@ int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
}
|
||||
|
||||
cl_command_queue_properties device_props = 0;
|
||||
err = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES,
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
|
||||
sizeof(device_props), &device_props, NULL);
|
||||
test_error(err, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
|
||||
|
||||
@@ -55,15 +52,15 @@ int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
}
|
||||
|
||||
// Obtain pointers to semaphore's API
|
||||
GET_PFN(deviceID, clCreateSemaphoreWithPropertiesKHR);
|
||||
GET_PFN(deviceID, clEnqueueSignalSemaphoresKHR);
|
||||
GET_PFN(deviceID, clEnqueueWaitSemaphoresKHR);
|
||||
GET_PFN(deviceID, clGetSemaphoreHandleForTypeKHR);
|
||||
GET_PFN(deviceID, clReleaseSemaphoreKHR);
|
||||
GET_PFN(device, clCreateSemaphoreWithPropertiesKHR);
|
||||
GET_PFN(device, clEnqueueSignalSemaphoresKHR);
|
||||
GET_PFN(device, clEnqueueWaitSemaphoresKHR);
|
||||
GET_PFN(device, clGetSemaphoreHandleForTypeKHR);
|
||||
GET_PFN(device, clReleaseSemaphoreKHR);
|
||||
|
||||
// Create ooo queue
|
||||
clCommandQueueWrapper queue = clCreateCommandQueue(
|
||||
context, deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
|
||||
clCommandQueueWrapper test_queue = clCreateCommandQueue(
|
||||
context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
|
||||
test_error(err, "Could not create command queue");
|
||||
|
||||
// Create semaphore
|
||||
@@ -84,14 +81,14 @@ int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
|
||||
// Signal semaphore
|
||||
clEventWrapper signal_event;
|
||||
err = clEnqueueSignalSemaphoresKHR(queue, 1, &sema_1, nullptr, 0, nullptr,
|
||||
&signal_event);
|
||||
err = clEnqueueSignalSemaphoresKHR(test_queue, 1, &sema_1, nullptr, 0,
|
||||
nullptr, &signal_event);
|
||||
test_error(err, "Could not signal semaphore");
|
||||
|
||||
// Extract sync fd
|
||||
int handle = -1;
|
||||
size_t handle_size;
|
||||
err = clGetSemaphoreHandleForTypeKHR(sema_1, deviceID,
|
||||
err = clGetSemaphoreHandleForTypeKHR(sema_1, device,
|
||||
CL_SEMAPHORE_HANDLE_SYNC_FD_KHR,
|
||||
sizeof(handle), &handle, &handle_size);
|
||||
test_error(err, "Could not extract semaphore handle");
|
||||
@@ -112,12 +109,12 @@ int test_external_semaphores_import_export_fd(cl_device_id deviceID,
|
||||
|
||||
// Wait semaphore
|
||||
clEventWrapper wait_event;
|
||||
err = clEnqueueWaitSemaphoresKHR(queue, 1, &sema_2, nullptr, 0, nullptr,
|
||||
&wait_event);
|
||||
err = clEnqueueWaitSemaphoresKHR(test_queue, 1, &sema_2, nullptr, 0,
|
||||
nullptr, &wait_event);
|
||||
test_error(err, "Could not wait semaphore");
|
||||
|
||||
// Finish
|
||||
err = clFinish(queue);
|
||||
err = clFinish(test_queue);
|
||||
test_error(err, "Could not finish queue");
|
||||
|
||||
// Check all events are completed
|
||||
|
||||
Reference in New Issue
Block a user