Skip to content

Commit c851cd3

Browse files
committed
[UR][L0v2] Add EnqueueDuringGraphCaptureUsesImmediateList validation
1 parent f7c2a32 commit c851cd3

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

unified-runtime/test/adapters/level_zero/v2/batched_queue_test.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,35 @@ TEST_P(urBatchedQueueTest, EnqueueDuringGraphCaptureUsesImmediateList) {
624624
ASSERT_SUCCESS(urQueueEndGraphCaptureExp(queue1, &graph));
625625
ASSERT_NE(graph, nullptr);
626626

627+
bool graphIsEmpty = true;
628+
ASSERT_SUCCESS(urGraphIsEmptyExp(graph, &graphIsEmpty));
629+
ASSERT_FALSE(graphIsEmpty)
630+
<< "recorded graph should contain the captured mem buffer write";
631+
632+
// Prove replay performs the write: clear the buffer, then run the executable
633+
// graph and read back the original pattern.
634+
const uint8_t clearByte = 0;
635+
ASSERT_SUCCESS(urEnqueueMemBufferFill(queue1, buffer, &clearByte,
636+
sizeof(clearByte), 0, buffer_size, 0,
637+
nullptr, nullptr));
638+
ASSERT_SUCCESS(urQueueFinish(queue1));
639+
640+
ur_exp_executable_graph_handle_t exGraph = nullptr;
641+
ASSERT_SUCCESS(urGraphInstantiateGraphExp(graph, &exGraph));
642+
ASSERT_NE(exGraph, nullptr);
643+
644+
ASSERT_SUCCESS(urEnqueueGraphExp(queue1, exGraph, 0, nullptr, nullptr));
645+
ASSERT_SUCCESS(urQueueFinish(queue1));
646+
647+
std::vector<uint8_t> output(buffer_size, 0);
648+
ASSERT_SUCCESS(urEnqueueMemBufferRead(queue1, buffer, /* isBlocking */ true, 0,
649+
buffer_size, output.data(), 0, nullptr,
650+
nullptr));
651+
for (size_t i = 0; i < buffer_size; i++) {
652+
ASSERT_EQ(output[i], data[i]) << "mismatch at byte " << i;
653+
}
654+
655+
ASSERT_SUCCESS(urGraphExecutableGraphDestroyExp(exGraph));
627656
ASSERT_SUCCESS(urEventRelease(event));
628657
ASSERT_SUCCESS(urGraphDestroyExp(graph));
629658
}

0 commit comments

Comments
 (0)