Skip to content

Commit 3dd16f6

Browse files
[SYCL][NFC] Modernize getting host accessor (#10224)
`get_access` for host accessor is deprecated by SYCL 2020 in favor of `get_host_access`. Note: this patch does not update all tests we have, there are still major categories skipped like `XPTI`, `Sampler`, etc.
1 parent 394300e commit 3dd16f6

21 files changed

+31
-32
lines changed

sycl/test-e2e/Basic/fpga_tests/buffer_location.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main() {
1717

1818
Queue.wait();
1919

20-
auto Acc = Buf.template get_access<sycl::access::mode::read_write>();
20+
auto Acc = Buf.get_host_access();
2121
assert(Acc[0] == 42 && "Value mismatch");
2222

2323
return 0;

sycl/test-e2e/Basic/fpga_tests/fpga_io_pipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int test_io_nb_pipe(sycl::queue Queue) {
7777
});
7878
});
7979

80-
auto readHostBuffer = writeBuf.get_access<sycl::access::mode::read>();
80+
auto readHostBuffer = writeBuf.get_host_access();
8181
if (readHostBuffer[0] != InputData) {
8282
std::cout << "Read from a file mismatches " << readHostBuffer[0]
8383
<< " Vs expected " << InputData << std::endl;
@@ -102,7 +102,7 @@ int test_io_bl_pipe(sycl::queue Queue) {
102102
});
103103
});
104104

105-
auto readHostBuffer = writeBuf.get_access<sycl::access::mode::read>();
105+
auto readHostBuffer = writeBuf.get_host_access();
106106
if (readHostBuffer[0] != InputData) {
107107
std::cout << "Read from a file mismatches " << readHostBuffer[0]
108108
<< " Vs expected " << InputData << std::endl;

sycl/test-e2e/Basic/fpga_tests/fpga_pipes_legacy_ns.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ template <typename PipeName> int test_simple_nb_pipe(sycl::queue Queue) {
4141
});
4242
});
4343

44-
auto readHostBuffer = writeBuf.get_access<sycl::access::mode::read>();
44+
auto readHostBuffer = writeBuf.get_host_access();
4545
if (readHostBuffer[0] != 42) {
4646
std::cout << "Result mismatches " << readHostBuffer[0] << " Vs expected "
4747
<< 42 << std::endl;

sycl/test-e2e/Basic/fpga_tests/fpga_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int main() {
116116
return -1;
117117
}
118118

119-
auto readBufferC = bufC.get_access<access::mode::read>();
119+
auto readBufferC = bufC.get_host_access();
120120
for (size_t i = 0; i != dataSize; ++i) {
121121
if (readBufferC[i] != 2 * i) {
122122
std::cout << "Result mismatches " << readBufferC[i] << " Vs expected "

sycl/test-e2e/Basic/handler/interop_task.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int main() {
4848
});
4949

5050
{
51-
auto DstAcc = DstBuf.template get_access<sycl::access::mode::read_write>();
51+
auto DstAcc = DstBuf.get_host_access();
5252
const int Expected = 42;
5353
for (int I = 0; I < DstAcc.get_count(); ++I)
5454
if (DstAcc[I] != Expected) {
@@ -59,8 +59,7 @@ int main() {
5959
}
6060

6161
{
62-
auto DstAcc2 =
63-
DstBuf2.template get_access<sycl::access::mode::read_write>();
62+
auto DstAcc2 = DstBuf2.get_host_access();
6463
const int Expected = 42;
6564
for (int I = 0; I < DstAcc2.get_count(); ++I)
6665
if (DstAcc2[I] != Expected) {

sycl/test-e2e/Basic/multisource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main() {
6868

6969
calc_buf(q, a, b, c, r);
7070

71-
auto C = c.get_access<access::mode::read>();
71+
auto C = c.get_host_access();
7272
for (size_t i = 0; i < N; i++) {
7373
if (C[i] != 1) {
7474
std::cout << "Wrong value " << C[i] << " for element " << i

sycl/test-e2e/HostInteropTask/host-task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void test2(queue &Q) {
5959
});
6060

6161
{
62-
auto Acc = Buffer2.get_access<mode::read>();
62+
auto Acc = Buffer2.get_host_access();
6363

6464
for (size_t Idx = 0; Idx < Acc.get_count(); ++Idx) {
6565
std::cout << "Second buffer [" << Idx << "] = " << Acc[Idx] << std::endl;

sycl/test-e2e/HostInteropTask/interop-task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ template <typename T> class Init;
1919

2020
template <typename BufferT, typename ValueT>
2121
void checkBufferValues(BufferT Buffer, ValueT Value) {
22-
auto Acc = Buffer.template get_access<mode::read>();
22+
auto Acc = Buffer.get_host_access();
2323
for (size_t Idx = 0; Idx < Acc.get_count(); ++Idx) {
2424
if (Acc[Idx] != Value) {
2525
std::cerr << "buffer[" << Idx << "] = " << Acc[Idx]

sycl/test-e2e/InorderQueue/in_order_buffs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main() {
5151
cgh.parallel_for<class ordered_reader>(myRange, myKernel);
5252
});
5353

54-
auto readBufferB = bufB.get_access<access::mode::read>();
54+
auto readBufferB = bufB.get_host_access();
5555
for (size_t i = 0; i != dataSize; ++i) {
5656
if (readBufferB[i] != i) {
5757
std::cout << "Result mismatches " << readBufferB[i] << " vs expected "

sycl/test-e2e/KernelParams/array-kernel-param-nested-run.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool test_accessor_array_in_struct(queue &myQueue) {
8181
output_accessor[index] = S.a[0][index] + S.a[1][index] + S.x + S.y;
8282
});
8383
});
84-
const auto HostAccessor = out_buffer.get_access<sycl::access::mode::read>();
84+
const auto HostAccessor = out_buffer.get_host_access();
8585

8686
return verify_1D("Accessor array in struct", c_num_items, output, ref);
8787
}
@@ -109,7 +109,7 @@ bool test_templated_array_in_struct(queue &myQueue) {
109109
output_accessor[index] = sint.a[index] + sll.a[index];
110110
});
111111
});
112-
const auto HostAccessor = out_buffer.get_access<sycl::access::mode::read>();
112+
const auto HostAccessor = out_buffer.get_host_access();
113113

114114
return verify_1D("Templated array in struct", c_num_items, output, ref);
115115
}

0 commit comments

Comments
 (0)