Skip to content

Commit

Permalink
test_cl_ext_buffer_device_address: use the new registration framework
Browse files Browse the repository at this point in the history
  • Loading branch information
franz committed Dec 19, 2024
1 parent fa80d2c commit 4947e2c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.
//

#include "procs.h"
#include "harness/typeWrappers.h"

#define BUF_SIZE 1024
Expand Down Expand Up @@ -62,7 +61,7 @@ class BufferDeviceAddressTest {
cl_int error = 0;
clMemWrapper TempBuffer = clCreateBuffer(
context, (cl_mem_flags)(CL_MEM_READ_WRITE | address_type),
(size_t)BUF_SIZE * sizeof(cl_int), BufferHost, &error);
(size_t)BUF_SIZE * sizeof(cl_int), nullptr, &error);
return (error != CL_SUCCESS);
}

Expand Down Expand Up @@ -360,33 +359,16 @@ class BufferDeviceAddressTest {
}
};

int MakeAndRunTest(cl_device_id device, cl_context context,
cl_command_queue queue, cl_mem_properties address_type)
{
if (!is_extension_available(device, "cl_ext_buffer_device_address"))
{
log_info("The device does not support the "
"cl_ext_buffer_device_address extension.\n");
return TEST_SKIPPED_ITSELF;
}

cl_version ext_version =
get_extension_version(device, "cl_ext_buffer_device_address");
if (ext_version != CL_MAKE_VERSION(0, 9, 1))
{
log_info("The test is written against cl_ext_buffer_device_address "
"extension version 0.9.1, device supports version: %u.%u.%u\n",
CL_VERSION_MAJOR(ext_version), CL_VERSION_MINOR(ext_version),
CL_VERSION_PATCH(ext_version));
return TEST_SKIPPED_ITSELF;
}
}

BufferDeviceAddressTest test_fixture =
BufferDeviceAddressTest(device, context, queue, address_type);
REGISTER_TEST(private_address)
{
BufferDeviceAddressTest test_fixture = BufferDeviceAddressTest(
device, context, queue, CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT);

if (test_fixture.Skip())
{
log_info("TEST FIXTURE SKIP\n");
log_info("Test fixture skip\n");
return TEST_SKIPPED_ITSELF;
}

Expand All @@ -395,12 +377,3 @@ int MakeAndRunTest(cl_device_id device, cl_context context,

return TEST_PASS;
}

}

int test_private_address(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
{
return MakeAndRunTest(device, context, queue,
CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT);
}
43 changes: 37 additions & 6 deletions test_conformance/extensions/cl_ext_buffer_device_address/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,47 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "procs.h"

#include "harness/testHarness.h"
#include "harness/deviceInfo.h"

test_status InitCL(cl_device_id device)
{
auto version = get_device_cl_version(device);
auto expected_min_version = Version(3, 0);

test_definition test_list[] = {
ADD_TEST(private_address),
};
if (version < expected_min_version)
{
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

if (!is_extension_available(device, "cl_ext_buffer_device_address"))
{
log_info("The device does not support the "
"cl_ext_buffer_device_address extension.\n");
return TEST_SKIPPED_ITSELF;
}

cl_version ext_version =
get_extension_version(device, "cl_ext_buffer_device_address");
if (ext_version != CL_MAKE_VERSION(0, 9, 1))
{
log_info("The test is written against cl_ext_buffer_device_address "
"extension version 0.9.1, device supports version: %u.%u.%u\n",
CL_VERSION_MAJOR(ext_version), CL_VERSION_MINOR(ext_version),
CL_VERSION_PATCH(ext_version));
return TEST_SKIPPED_ITSELF;
}

return TEST_PASS;
}

int main(int argc, const char *argv[])
{
return runTestHarness(argc, argv, ARRAY_SIZE(test_list), test_list, false,
0);
return runTestHarnessWithCheck(
argc, argv, test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), false, 0, InitCL);
}
25 changes: 0 additions & 25 deletions test_conformance/extensions/cl_ext_buffer_device_address/procs.h

This file was deleted.

0 comments on commit 4947e2c

Please sign in to comment.