forked from intel/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel_zero_queue_priority.cpp
42 lines (34 loc) · 1.42 KB
/
level_zero_queue_priority.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 <sycl/sycl.hpp>
void test(sycl::property_list Props) {
sycl::queue Q(Props);
(void)Q.submit([&](sycl::handler &CGH) {
CGH.single_task<class EmptyKernel>([=]() {});
});
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;
}