-
Notifications
You must be signed in to change notification settings - Fork 769
/
Copy pathtarget_register_alloc_mode.cpp
43 lines (32 loc) · 1.47 KB
/
target_register_alloc_mode.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
43
// REQUIRES: arch-intel_gpu_pvc
// RUN: %{build} -ftarget-register-alloc-mode=pvc:auto -o %t_with.out
// RUN: %{build} -o %t_without.out
// RUN: %{build} -ftarget-register-alloc-mode=pvc:default -o %t_default.out
// RUN: env SYCL_UR_TRACE=2 %{run} %t_with.out 2>&1 | FileCheck --check-prefix=CHECK-OPT %s
// RUN: env SYCL_UR_TRACE=2 %{run} %t_without.out 2>&1 | FileCheck %if system-windows %{ --implicit-check-not=-ze-intel-enable-auto-large-GRF-mode %} %else %{ --check-prefix=CHECK-OPT %} %s
// RUN: env SYCL_UR_TRACE=2 %{run} %t_default.out 2>&1 | FileCheck --implicit-check-not=-ze-intel-enable-auto-large-GRF-mode %s
// CHECK-OPT: <--- urProgramBuild(
// CHECK-SAME-OPT: -ze-intel-enable-auto-large-GRF-mode
#include <sycl/detail/core.hpp>
int main() {
sycl::buffer<size_t, 1> Buffer(4);
sycl::queue Queue;
sycl::range<1> NumOfWorkItems{Buffer.size()};
Queue.submit([&](sycl::handler &cgh) {
sycl::accessor Accessor{Buffer, cgh, sycl::write_only};
cgh.parallel_for<class FillBuffer>(NumOfWorkItems, [=](sycl::id<1> WIid) {
Accessor[WIid] = WIid.get(0);
});
});
sycl::host_accessor HostAccessor{Buffer, sycl::read_only};
bool MismatchFound = false;
for (size_t I = 0; I < Buffer.size(); ++I) {
if (HostAccessor[I] != I) {
std::cout << "The result is incorrect for element: " << I
<< " , expected: " << I << " , got: " << HostAccessor[I]
<< std::endl;
MismatchFound = true;
}
}
return MismatchFound;
}