Skip to content

Commit

Permalink
Merge pull request #2142 from aarongreig/aaron/fixIntegrationTestsCL
Browse files Browse the repository at this point in the history
Fix integration tests for CL.
  • Loading branch information
aarongreig authored Oct 2, 2024
2 parents 00f958f + 94ac139 commit 7f1332e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
1 change: 0 additions & 1 deletion test/conformance/enqueue/enqueue_adapter_opencl.match
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{NONDETERMINISTIC}}
{{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.Success/Intel_R__OpenCL___{{.*}}_
urEnqueueKernelLaunchKernelWgSizeTest.Success/Intel_R__OpenCL___{{.*}}_
{{OPT}}urEnqueueKernelLaunchUSMLinkedList.Success/Intel_R__OpenCL___{{.*}}_UsePoolEnabled
7 changes: 3 additions & 4 deletions test/conformance/enqueue/urEnqueueKernelLaunch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ inline std::string printKernelLaunchTestString(
}

struct urEnqueueKernelLaunchTestWithParam
: uur::urBaseKernelExecutionTestWithParam<testParametersEnqueueKernel> {
: uur::urKernelExecutionTestWithParam<testParametersEnqueueKernel> {
void SetUp() override {
global_range[0] = std::get<1>(GetParam()).X;
global_range[1] = std::get<1>(GetParam()).Y;
Expand All @@ -249,12 +249,11 @@ struct urEnqueueKernelLaunchTestWithParam
program_name = "fill_3d";
buffer_size *= global_range[1] * global_range[2];
}
UUR_RETURN_ON_FATAL_FAILURE(
urBaseKernelExecutionTestWithParam::SetUp());
UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTestWithParam::SetUp());
}

void TearDown() override {
UUR_RETURN_ON_FATAL_FAILURE(uur::urBaseKernelExecutionTestWithParam<
UUR_RETURN_ON_FATAL_FAILURE(uur::urKernelExecutionTestWithParam<
testParametersEnqueueKernel>::TearDown());
}

Expand Down
14 changes: 13 additions & 1 deletion test/conformance/integration/QueueEmptyStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,25 @@ struct QueueEmptyStatusTestWithParam : uur::IntegrationQueueTestWithParam {
GTEST_SKIP() << "Shared USM is not supported.";
}

// QUEUE_INFO_EMPTY isn't supported by all adapters
ur_bool_t empty_check = false;
auto result =
urQueueGetInfo(queue, UR_QUEUE_INFO_EMPTY, sizeof(empty_check),
&empty_check, nullptr);
if (result == UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION) {
GTEST_SKIP() << "QUEUE_INFO_EMPTY is not supported.";
}
ASSERT_SUCCESS(result);

ASSERT_SUCCESS(urUSMSharedAlloc(context, device, nullptr, nullptr,
ArraySize * sizeof(uint32_t),
&SharedMem));
}

void TearDown() override {
ASSERT_SUCCESS(urUSMFree(context, SharedMem));
if (SharedMem) {
ASSERT_SUCCESS(urUSMFree(context, SharedMem));
}
uur::IntegrationQueueTestWithParam::TearDown();
}

Expand Down
7 changes: 0 additions & 7 deletions test/conformance/integration/integration_adapter_opencl.match

This file was deleted.

15 changes: 14 additions & 1 deletion test/conformance/testing/include/uur/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,13 @@ template <class T> struct urProgramTestWithParam : urQueueTestWithParam<T> {
ur_program_handle_t program = nullptr;
};

// This fixture can provide a kernel, but it doesn't build the kernel at SetUp,
// instead Build() must be invoked separately. This is for tests that wish to
// check device capabilities to determine whether the test should run before
// trying to load any device code.
//
// For a fixture that provides the kernel at SetUp, inherit from urKernelTest
// instead.
struct urBaseKernelTest : urProgramTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urProgramTest::SetUp());
Expand Down Expand Up @@ -1252,6 +1259,8 @@ struct urKernelTest : urBaseKernelTest {
}
};

// Parameterized version of urBaseKernelTest, the comments on that fixture
// clarify why you'd want to use this instead of urKernelTestWithParam.
template <class T>
struct urBaseKernelTestWithParam : urProgramTestWithParam<T> {
void SetUp() override {
Expand Down Expand Up @@ -1386,11 +1395,13 @@ struct KernelLaunchHelper {
uint32_t current_arg_index = 0;
};

// Parameterized kernel fixture with execution helpers, for the difference
// between this and urKernelExecutionTestWithParam see the comment on
// urBaseKernelTest.
template <typename T>
struct urBaseKernelExecutionTestWithParam : urBaseKernelTestWithParam<T> {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTestWithParam<T>::SetUp());
UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTestWithParam<T>::Build());
}

void TearDown() override {
Expand Down Expand Up @@ -1429,6 +1440,8 @@ struct urBaseKernelExecutionTestWithParam : urBaseKernelTestWithParam<T> {
std::vector<ur_mem_handle_t> buffer_args;
};

// Kernel fixture with execution helpers, for the difference between this and
// urKernelExecutionTest see the comment on urBaseKernelTest.
struct urBaseKernelExecutionTest : urBaseKernelTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTest::SetUp());
Expand Down

0 comments on commit 7f1332e

Please sign in to comment.