Skip to content

Commit

Permalink
Merge pull request #2641 from igchor/add_test_mecpy
Browse files Browse the repository at this point in the history
[CTS] add simple test that combines kernel launch and memcpy
  • Loading branch information
pbalcer authored Feb 4, 2025
2 parents a15cfac + 1da81ab commit 39fa054
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/conformance/enqueue/urEnqueueKernelLaunch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,41 @@ TEST_P(urEnqueueKernelLaunchWithUSM, Success) {
}
}

TEST_P(urEnqueueKernelLaunchWithUSM, WithMemcpy) {
UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});

size_t work_dim = 1;
size_t global_offset = 0;
size_t global_size = alloc_size / sizeof(uint32_t);
uint32_t fill_val = 42;

ASSERT_SUCCESS(urKernelSetArgPointer(kernel, 0, nullptr, usmPtr));
ASSERT_SUCCESS(
urKernelSetArgValue(kernel, 1, sizeof(fill_val), nullptr, &fill_val));

std::vector<uint32_t> input(global_size, 0);
std::vector<uint32_t> data(global_size);

ASSERT_SUCCESS(urEnqueueUSMMemcpy(queue, false, usmPtr, input.data(),
alloc_size, 0, nullptr, nullptr));

ur_event_handle_t kernel_evt;
ASSERT_SUCCESS(urEnqueueKernelLaunch(queue, kernel, work_dim, &global_offset,
&global_size, nullptr, 0, nullptr,
&kernel_evt));

ur_event_handle_t memcpy_event;
ASSERT_SUCCESS(urEnqueueUSMMemcpy(queue, false, data.data(), usmPtr,
alloc_size, 1, &kernel_evt, &memcpy_event));

ASSERT_SUCCESS(urEventWait(1, &memcpy_event));

// verify fill worked
for (size_t i = 0; i < global_size; i++) {
ASSERT_EQ(data[i], fill_val);
}
}

struct urEnqueueKernelLaunchWithVirtualMemory : uur::urKernelExecutionTest {

void SetUp() override {
Expand Down

0 comments on commit 39fa054

Please sign in to comment.