Skip to content

Commit

Permalink
Query support for 2D USM operations in CTS tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig committed Nov 8, 2023
1 parent a1fbbde commit d14b117
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 8 additions & 0 deletions test/conformance/enqueue/urEnqueueUSMFill2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ struct urEnqueueUSMFill2DTestWithParam
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urQueueTestWithParam::SetUp());

bool memfill2d_support = false;
ASSERT_SUCCESS(urContextGetInfo(
context, UR_CONTEXT_INFO_USM_FILL2D_SUPPORT,
sizeof(memfill2d_support), &memfill2d_support, nullptr));
if (!memfill2d_support) {
GTEST_SKIP() << "2D USM mem fill is not supported";
}

pitch = std::get<1>(GetParam()).pitch;
width = std::get<1>(GetParam()).width;
height = std::get<1>(GetParam()).height;
Expand Down
20 changes: 14 additions & 6 deletions test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ struct urEnqueueUSMMemcpy2DTestWithParam
GTEST_SKIP() << "Device USM is not supported";
}

bool memcpy2d_support = false;
ASSERT_SUCCESS(urContextGetInfo(
context, UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT,
sizeof(memcpy2d_support), &memcpy2d_support, nullptr));
if (!memcpy2d_support) {
GTEST_SKIP() << "2D USM memcpy is not supported";
}

const auto [inPitch, inWidth, inHeight] = getParam();
std::tie(pitch, width, height) =
std::make_tuple(inPitch, inWidth, inHeight);
Expand All @@ -28,9 +36,9 @@ struct urEnqueueUSMMemcpy2DTestWithParam
num_elements, &pDst));
ur_event_handle_t memset_event = nullptr;

ASSERT_SUCCESS(urEnqueueUSMFill2D(
queue, pSrc, pitch, sizeof(memset_value), &memset_value, width,
height, 0, nullptr, &memset_event));
ASSERT_SUCCESS(urEnqueueUSMFill(queue, pSrc, sizeof(memset_value),
&memset_value, pitch * height, 0,
nullptr, &memset_event));

ASSERT_SUCCESS(urQueueFlush(queue));
ASSERT_SUCCESS(urEventWait(1, &memset_event));
Expand Down Expand Up @@ -171,9 +179,9 @@ TEST_P(urEnqueueUSMMemcpy2DNegativeTest, InvalidEventWaitList) {
// enqueue something to get an event
ur_event_handle_t event = nullptr;
uint8_t fill_pattern = 14;
ASSERT_SUCCESS(urEnqueueUSMFill2D(queue, pDst, pitch, sizeof(fill_pattern),
&fill_pattern, width, height, 0, nullptr,
&event));
ASSERT_SUCCESS(urEnqueueUSMFill(queue, pDst, sizeof(fill_pattern),
&fill_pattern, pitch * height, 0, nullptr,
&event));
ASSERT_NE(event, nullptr);
ASSERT_SUCCESS(urQueueFinish(queue));

Expand Down

0 comments on commit d14b117

Please sign in to comment.