From 0aa5da0bb3f2723deee1e37c56f3808f1c885390 Mon Sep 17 00:00:00 2001 From: smaslov-intel Date: Tue, 29 Nov 2022 10:38:46 -0800 Subject: [PATCH] [SYCL] Add support for sycl::ext::oneapi::property::queue::use_priority (#1414) --- SYCL/Plugin/level_zero_queue_priority.cpp | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 SYCL/Plugin/level_zero_queue_priority.cpp diff --git a/SYCL/Plugin/level_zero_queue_priority.cpp b/SYCL/Plugin/level_zero_queue_priority.cpp new file mode 100644 index 0000000000..c9e1b81186 --- /dev/null +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -0,0 +1,42 @@ +// REQUIRES: gpu, level_zero, level_zero_dev_kit +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out +// RUN: env ZE_DEBUG=-1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER +// +// Check that queue priority is passed to Level Zero runtime +// This is the last value in the ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC +// +#include + +void test(sycl::property_list Props) { + sycl::queue Q(Props); + (void)Q.submit([&](sycl::handler &CGH) { + CGH.single_task([=]() {}); + }); + Q.wait(); +} + +int main(int Argc, const char *Argv[]) { + + // CHECK: [getZeQueue]: create queue {{.*}} priority = Normal + test(sycl::property_list{}); + + // CHECK: [getZeQueue]: create queue {{.*}} priority = Normal + test({sycl::ext::oneapi::property::queue::priority_normal{}}); + + // CHECK: [getZeQueue]: create queue {{.*}} priority = Low + test({sycl::ext::oneapi::property::queue::priority_low{}}); + + // CHECK: [getZeQueue]: create queue {{.*}} priority = High + test({sycl::ext::oneapi::property::queue::priority_high{}}); + + // CHECK: Queue cannot be constructed with different priorities. + try { + test({sycl::ext::oneapi::property::queue::priority_low{}, + sycl::ext::oneapi::property::queue::priority_high{}}); + } catch (sycl::exception &E) { + std::cerr << E.what() << std::endl; + } + + std::cout << "The test passed." << std::endl; + return 0; +}