Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Update test for new mode SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 #771

Merged
merged 2 commits into from
Jan 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions SYCL/Plugin/level_zero_device_scope_events.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
// REQUIRES: gpu, level_zero

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=1 SYCL_PI_TRACE=2 ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
// RUN: env SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=1 SYCL_PI_TRACE=-1 ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 | FileCheck --check-prefixes=MODE1 %s
// RUN: env SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_TRACE=-1 ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 | FileCheck --check-prefixes=MODE2 %s
// UNSUPPORTED: ze_debug-1,ze_debug4

// Checks that with L0 device-scope events enabled the only host-visible L0
// event created is at the end of all kernels submission, when host waits for
// the last kernel's event.
//
// CHECK-LABEL: Submitted all kernels
// CHECK: ---> piEventsWait(
// CHECK-NEXT: <unknown> : 1
// CHECK: ZE ---> zeEventCreate(ZeEventPool, &ZeEventDesc, &ZeHostVisibleEvent)
// CHECK: ZE ---> zeCommandListAppendWaitOnEvents(CommandList->first, 1, &ZeEvent)
// CHECK-NEXT: ZE ---> zeCommandListAppendSignalEvent(CommandList->first,
// ZeHostVisibleEvent)
// CHECK: Completed all kernels
// MODE1-LABEL: Submitted all kernels
// MODE1: ---> piEventsWait(
// MODE1-NEXT: <unknown> : 1
// MODE1: PI ---> EventCreate(Context, true, &HostVisibleEvent)
// MODE1: ZE ---> zeEventCreate(ZeEventPool, &ZeEventDesc, &ZeEvent)
// MODE1: ZE ---> zeCommandListAppendWaitOnEvents(CommandList->first, 1,
// &ZeEvent) MODE1-NEXT: ZE --->
// zeCommandListAppendSignalEvent(CommandList->first, HostVisibleEvent->ZeEvent)
// MODE1: Completed all kernels

// With the SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 mode look for pattern that
// creates host-visible event just before command-list submission.
//
// MODE2: PI ---> EventCreate(Context, true, &HostVisibleEvent)
// MODE2: ZE ---> zeEventCreate(ZeEventPool, &ZeEventDesc, &ZeEvent)
// MODE2: ZE ---> zeCommandListAppendSignalEvent(CommandList->first,
// HostVisibleEvent->ZeEvent) MODE2: ZE --->
// zeCommandListClose(CommandList->first) MODE2: ZE --->
// zeCommandQueueExecuteCommandLists(ZeCommandQueue, 1, &ZeCommandList,
// CommandList->second.ZeFence)
//
#include <CL/sycl.hpp>

int main(int argc, char **argv) {
Expand All @@ -38,4 +51,4 @@ int main(int argc, char **argv) {
e.wait(); // Waits for the last kernel to complete.
std::cout << "Completed all kernels" << std::endl;
return 0;
}
}