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

Commit b17da40

Browse files
[SYCL][Level Zero] Add a test for sycl_ext_intel_queue_index extension (#1425)
Implementation: intel/llvm#7599.
1 parent 33a63e7 commit b17da40

File tree

3 files changed

+115
-8
lines changed

3 files changed

+115
-8
lines changed

SYCL/Basic/subdevice_pi.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static bool check_separate(device dev, buffer<int, 1> buf,
5959
}
6060
// CHECK-SEPARATE: Test sub device 0
6161
// CHECK-SEPARATE: ---> piContextCreate
62-
// CHECK-SEPARATE: ---> piQueueCreate
62+
// CHECK-SEPARATE: ---> piextQueueCreate
6363
// CHECK-SEPARATE: ---> piMemBufferCreate
6464
// CHECK-SEPARATE: ---> piEnqueueKernelLaunch
6565
// CHECK-SEPARATE: ---> piQueueFinish
@@ -71,7 +71,7 @@ static bool check_separate(device dev, buffer<int, 1> buf,
7171
}
7272
// CHECK-SEPARATE: Test sub device 1
7373
// CHECK-SEPARATE: ---> piContextCreate
74-
// CHECK-SEPARATE: ---> piQueueCreate
74+
// CHECK-SEPARATE: ---> piextQueueCreate
7575
// CHECK-SEPARATE: ---> piMemBufferCreate
7676
//
7777
// Verify that we have a memcpy between subdevices in this case
@@ -107,7 +107,7 @@ static bool check_shared_context(device dev, buffer<int, 1> buf,
107107
use_mem(buf, q0);
108108
}
109109
// CHECK-SHARED: Test sub device 0
110-
// CHECK-SHARED: ---> piQueueCreate
110+
// CHECK-SHARED: ---> piextQueueCreate
111111
// CHECK-SHARED: ---> piMemBufferCreate
112112
//
113113
// Make sure that a single buffer is created (and shared between subdevices):
@@ -122,7 +122,7 @@ static bool check_shared_context(device dev, buffer<int, 1> buf,
122122
use_mem(buf, q1);
123123
}
124124
// CHECK-SHARED: Test sub device 1
125-
// CHECK-SHARED: ---> piQueueCreate
125+
// CHECK-SHARED: ---> piextQueueCreate
126126
// CHECK-SHARED: ---> piEnqueueKernelLaunch
127127
// CHECK-SHARED: ---> piQueueFinish
128128
// CHECK-SHARED: ---> piEnqueueMemBufferRead
@@ -156,7 +156,7 @@ static bool check_fused_context(device dev, buffer<int, 1> buf,
156156
use_mem(buf, q);
157157
}
158158
// CHECK-FUSED: Test root device
159-
// CHECK-FUSED: ---> piQueueCreate
159+
// CHECK-FUSED: ---> piextQueueCreate
160160
// CHECK-FUSED: ---> piMemBufferCreate
161161
//
162162
// Make sure that a single buffer is created (and shared between subdevices
@@ -171,7 +171,7 @@ static bool check_fused_context(device dev, buffer<int, 1> buf,
171171
use_mem(buf, q0);
172172
}
173173
// CHECK-FUSED: Test sub device 0
174-
// CHECK-FUSED: ---> piQueueCreate
174+
// CHECK-FUSED: ---> piextQueueCreate
175175
// CHECK-FUSED: ---> piEnqueueKernelLaunch
176176
// CHECK-FUSED: ---> piQueueFinish
177177

@@ -181,7 +181,7 @@ static bool check_fused_context(device dev, buffer<int, 1> buf,
181181
use_mem(buf, q1);
182182
}
183183
// CHECK-FUSED: Test sub device 1
184-
// CHECK-FUSED: ---> piQueueCreate
184+
// CHECK-FUSED: ---> piextQueueCreate
185185
// CHECK-FUSED: ---> piEnqueueKernelLaunch
186186
// CHECK-FUSED: ---> piQueueFinish
187187
// CHECK-FUSED: ---> piEnqueueMemBufferRead
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out
2+
// RUN: env ZEX_NUMBER_OF_CCS=0:4 env ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out > %t.log 2>&1
3+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --check-prefixes=CHECK-PVC < %t.log
4+
//
5+
// Same with Immediate CommandLists
6+
// RUN: env SYCL_PI_LEVEL_ZERO_EXPOSE_CSLICE_IN_AFFINITY_PARTITIONING=1 env ZEX_NUMBER_OF_CCS=0:4 env ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out > %t.log 2>&1
7+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --check-prefixes=CHECK-PVC < %t.log
8+
9+
// Requires: level_zero
10+
11+
#include <sycl/sycl.hpp>
12+
13+
using namespace sycl;
14+
15+
void test_pvc(device &d) {
16+
std::cout << "Test PVC Begin" << std::endl;
17+
// CHECK-PVC: Test PVC Begin
18+
bool IsPVC = [&]() {
19+
if (!d.has(aspect::ext_intel_device_id))
20+
return false;
21+
return (d.get_info<ext::intel::info::device::device_id>() & 0xff0) == 0xbd0;
22+
}();
23+
std::cout << "IsPVC: " << std::boolalpha << IsPVC << std::endl;
24+
if (IsPVC) {
25+
assert(d.get_info<ext::intel::info::device::max_compute_queue_indices>() ==
26+
1);
27+
28+
auto sub_devices = d.create_sub_devices<
29+
info::partition_property::partition_by_affinity_domain>(
30+
info::partition_affinity_domain::next_partitionable);
31+
device &sub_device = sub_devices[1];
32+
assert(
33+
sub_device
34+
.get_info<ext::intel::info::device::max_compute_queue_indices>() ==
35+
4);
36+
37+
auto sub_sub_devices = sub_device.create_sub_devices<
38+
info::partition_property::ext_intel_partition_by_cslice>();
39+
device &sub_sub_device = sub_sub_devices[1];
40+
assert(
41+
sub_sub_device
42+
.get_info<ext::intel::info::device::max_compute_queue_indices>() ==
43+
1);
44+
45+
{
46+
bool ExceptionThrown = false;
47+
try {
48+
std::ignore = queue{d, ext::intel::property::queue::compute_index{-1}};
49+
50+
} catch (...) {
51+
ExceptionThrown = true;
52+
}
53+
assert(ExceptionThrown);
54+
}
55+
{
56+
bool ExceptionThrown = false;
57+
try {
58+
std::ignore = queue{sub_sub_device,
59+
ext::intel::property::queue::compute_index{1}};
60+
61+
} catch (...) {
62+
ExceptionThrown = true;
63+
}
64+
assert(ExceptionThrown);
65+
}
66+
67+
{
68+
queue q{sub_device};
69+
// CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 0 (round robin in [0, 0])
70+
q.single_task([=]() {}).wait();
71+
}
72+
{
73+
queue q{sub_device, ext::intel::property::queue::compute_index{2}};
74+
// CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2])
75+
q.single_task([=]() {}).wait();
76+
}
77+
{
78+
queue q{sub_device, ext::intel::property::queue::compute_index{2}};
79+
// CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2])
80+
q.single_task([=]() {}).wait();
81+
}
82+
{
83+
queue q{sub_sub_device};
84+
// CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 1 (round robin in [1, 1])
85+
q.single_task([=]() {}).wait();
86+
}
87+
} else {
88+
// Make FileCheck pass.
89+
std::cout << "Fake ZE_DEBUG output for FileCheck:" << std::endl;
90+
// clang-format off
91+
std::cout << "[getZeQueue]: create queue ordinal = 0, index = 0 (round robin in [0, 0])" << std::endl;
92+
std::cout << "[getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2])" << std::endl;
93+
std::cout << "[getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2])" << std::endl;
94+
std::cout << "[getZeQueue]: create queue ordinal = 0, index = 1 (round robin in [1, 1])" << std::endl;
95+
// clang-format on
96+
}
97+
std::cout << "Test PVC End" << std::endl;
98+
// CHECK-PVC: Test PVC End
99+
}
100+
101+
int main() {
102+
device d;
103+
104+
test_pvc(d);
105+
106+
return 0;
107+
}

SYCL/Scheduler/ReleaseResourcesTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int main() {
4848
}
4949

5050
// CHECK:---> piContextCreate
51-
// CHECK:---> piQueueCreate
51+
// CHECK:---> piextQueueCreate
5252
// CHECK:---> piProgramCreate
5353
// CHECK:---> piKernelCreate
5454
// CHECK:---> piQueueRelease

0 commit comments

Comments
 (0)