From ad412fc5e7bcf50d455a47116b2af520812b23c9 Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Wed, 23 Nov 2022 18:49:49 -0800 Subject: [PATCH 1/7] [SYCL] Add support for sycl::ext::oneapi::property::queue::use_priority Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level_zero_queue_priority.cpp | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 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 100755 index 0000000000..2b23af3be2 --- /dev/null +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -0,0 +1,37 @@ +// REQUIRES: gpu, level_zero, level_zero_dev_kit +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out +// RUN: %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: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 0} + test(sycl::property_list{}); + + // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 0} + test({sycl::ext::oneapi::property::queue::use_priority{ + sycl::ext::oneapi::property::queue::use_priority::normal}}); + + // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 1} + test({sycl::ext::oneapi::property::queue::use_priority{ + sycl::ext::oneapi::property::queue::use_priority::low}}); + + // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 2} + test({sycl::ext::oneapi::property::queue::use_priority{ + sycl::ext::oneapi::property::queue::use_priority::high}}); + + std::cout << "The test passed." << std::endl; + return 0; +} From ad0be9fcd5ebe40c1273729fb09e8588c22c9720 Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Wed, 23 Nov 2022 18:51:34 -0800 Subject: [PATCH 2/7] clang-format Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level_zero_queue_priority.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 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 old mode 100755 new mode 100644 index 2b23af3be2..f6d26b796e --- a/SYCL/Plugin/level_zero_queue_priority.cpp +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -10,8 +10,8 @@ void test(sycl::property_list Props) { sycl::queue Q(Props); (void)Q.submit([&](sycl::handler &CGH) { - CGH.single_task([=]() {}); - }); + CGH.single_task([=]() {}); + }); Q.wait(); } From 47ef95c4142ed153d908a34bbf7e3e1d1b4d1187 Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Sat, 26 Nov 2022 19:49:42 -0800 Subject: [PATCH 3/7] rely on ZE_DEBUG=-1 output Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level_zero_queue_priority.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SYCL/Plugin/level_zero_queue_priority.cpp b/SYCL/Plugin/level_zero_queue_priority.cpp index f6d26b796e..3211fd3ec3 100644 --- a/SYCL/Plugin/level_zero_queue_priority.cpp +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -1,6 +1,6 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out -// RUN: %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER +// 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 @@ -17,18 +17,18 @@ void test(sycl::property_list Props) { int main(int Argc, const char *Argv[]) { - // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 0} + // CHECK: [getZeQueue]: create queue .* priority = Normal test(sycl::property_list{}); - // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 0} + // CHECK: [getZeQueue]: create queue .* priority = Normal test({sycl::ext::oneapi::property::queue::use_priority{ sycl::ext::oneapi::property::queue::use_priority::normal}}); - // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 1} + // CHECK: [getZeQueue]: create queue .* priority = Low test({sycl::ext::oneapi::property::queue::use_priority{ sycl::ext::oneapi::property::queue::use_priority::low}}); - // CHECK: zeCommandQueueCreate: .* {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC(0xe) 0 0 0 0 2 2} + // CHECK: [getZeQueue]: create queue .* priority = High test({sycl::ext::oneapi::property::queue::use_priority{ sycl::ext::oneapi::property::queue::use_priority::high}}); From 489a65d78c4683774c6c0173b566bb7653033f0b Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Mon, 28 Nov 2022 13:50:47 -0800 Subject: [PATCH 4/7] add regexp Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level_zero_queue_priority.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SYCL/Plugin/level_zero_queue_priority.cpp b/SYCL/Plugin/level_zero_queue_priority.cpp index 3211fd3ec3..d0bf162a77 100644 --- a/SYCL/Plugin/level_zero_queue_priority.cpp +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -17,18 +17,18 @@ void test(sycl::property_list Props) { int main(int Argc, const char *Argv[]) { - // CHECK: [getZeQueue]: create queue .* priority = Normal + // CHECK: [getZeQueue]: create queue {{.*}} priority = Normal test(sycl::property_list{}); - // CHECK: [getZeQueue]: create queue .* priority = Normal + // CHECK: [getZeQueue]: create queue {{.*}} priority = Normal test({sycl::ext::oneapi::property::queue::use_priority{ sycl::ext::oneapi::property::queue::use_priority::normal}}); - // CHECK: [getZeQueue]: create queue .* priority = Low + // CHECK: [getZeQueue]: create queue {{.*}} priority = Low test({sycl::ext::oneapi::property::queue::use_priority{ sycl::ext::oneapi::property::queue::use_priority::low}}); - // CHECK: [getZeQueue]: create queue .* priority = High + // CHECK: [getZeQueue]: create queue {{.*}} priority = High test({sycl::ext::oneapi::property::queue::use_priority{ sycl::ext::oneapi::property::queue::use_priority::high}}); From e775a7ebc780d3c21d12aa00f5e2b001ded1c47c Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Mon, 28 Nov 2022 14:44:48 -0800 Subject: [PATCH 5/7] priority_low and priority_high Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level_zero_queue_priority.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/SYCL/Plugin/level_zero_queue_priority.cpp b/SYCL/Plugin/level_zero_queue_priority.cpp index d0bf162a77..108e7200f2 100644 --- a/SYCL/Plugin/level_zero_queue_priority.cpp +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -20,17 +20,19 @@ 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::use_priority{ - sycl::ext::oneapi::property::queue::use_priority::normal}}); - // CHECK: [getZeQueue]: create queue {{.*}} priority = Low - test({sycl::ext::oneapi::property::queue::use_priority{ - sycl::ext::oneapi::property::queue::use_priority::low}}); + test({sycl::ext::oneapi::property::queue::priority_low{}}); // CHECK: [getZeQueue]: create queue {{.*}} priority = High - test({sycl::ext::oneapi::property::queue::use_priority{ - sycl::ext::oneapi::property::queue::use_priority::high}}); + test({sycl::ext::oneapi::property::queue::priority_high{}}); + + // CHECK: Queue cannot be constructed with both of priority_low and priority_high. + 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; From a1d647d961706ebff87d1e53eb18bcb6e30facdd Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Mon, 28 Nov 2022 15:29:15 -0800 Subject: [PATCH 6/7] add priority_normal Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level_zero_queue_priority.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SYCL/Plugin/level_zero_queue_priority.cpp b/SYCL/Plugin/level_zero_queue_priority.cpp index 108e7200f2..7a2c5b9807 100644 --- a/SYCL/Plugin/level_zero_queue_priority.cpp +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -20,6 +20,9 @@ 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{}}); From 4170556578624595443e759ba404ae99fd07db8b Mon Sep 17 00:00:00 2001 From: smaslov-intel Date: Mon, 28 Nov 2022 15:33:03 -0800 Subject: [PATCH 7/7] Update SYCL/Plugin/level_zero_queue_priority.cpp --- SYCL/Plugin/level_zero_queue_priority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/Plugin/level_zero_queue_priority.cpp b/SYCL/Plugin/level_zero_queue_priority.cpp index 7a2c5b9807..c9e1b81186 100644 --- a/SYCL/Plugin/level_zero_queue_priority.cpp +++ b/SYCL/Plugin/level_zero_queue_priority.cpp @@ -29,7 +29,7 @@ int main(int Argc, const char *Argv[]) { // CHECK: [getZeQueue]: create queue {{.*}} priority = High test({sycl::ext::oneapi::property::queue::priority_high{}}); - // CHECK: Queue cannot be constructed with both of priority_low and 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{}});