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

[SYCL] Rename deprecated access::target::global_buffer #647

Merged
merged 3 commits into from Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions SYCL/Basic/access_to_subset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include <CL/sycl.hpp>

using namespace cl::sycl;
using acc_w =
accessor<int, 2, access::mode::write, access::target::global_buffer>;
using acc_w = accessor<int, 2, access::mode::write, access::target::device>;

int main() {

Expand Down
18 changes: 9 additions & 9 deletions SYCL/Basic/accessor/accessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct IdxID3 {

template <typename T>
using AccAlias = cl::sycl::accessor<T, 1, cl::sycl::access::mode::write,
cl::sycl::access::target::global_buffer>;
cl::sycl::access::target::device>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving from SYCL 1.2.1 to SYCL 2020 should change three things about this line:

  1. The cl::sycl:: namespace should be sycl:: instead, since cl:: comes in only via <CL/sycl.hpp>
  2. sycl::access::target should be sycl::target because the former is deprecated (see here)
  3. global_buffer should be device (as changed in your patch)

Is there a reason to only make the global_buffer => device change here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pennycook Yes, the reason is just to change global_buffer => device here, moving from SYCL 1.2.1 to SYCL 2020 is a more global initiative.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I still think moving these things to the right namespace now would save time, but I won't argue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, there is a mix of the cl::sycl:: and just sycl:: namespaces in this file, for example it uses cl::sycl:: for access::target or property, but sycl:: for ::access::mode or buffer, or id. I'm going to fix the namespace mismatch in another PR.

template <typename T> struct InheritedAccessor : public AccAlias<T> {

using AccAlias<T>::AccAlias;
Expand Down Expand Up @@ -431,7 +431,7 @@ int main() {
sycl::queue queue;
queue.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 0, sycl::access::mode::read_write,
sycl::access::target::global_buffer>
sycl::access::target::device>
B(b, cgh);
cgh.single_task<class acc_with_zero_dim>([=]() {
auto B2 = B;
Expand Down Expand Up @@ -463,13 +463,13 @@ int main() {
sycl::queue queue;
queue.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 0, sycl::access::mode::read_write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc1(buf1, cgh);
sycl::accessor<int, 1, sycl::access::mode::read_write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc2(buf2, cgh);
sycl::accessor<int, 1, sycl::access::mode::read_write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc3(buf3, cgh, sycl::range<1>(1));
cgh.single_task<class acc_alloc_buf>([=]() {
acc1 *= 2;
Expand Down Expand Up @@ -506,7 +506,7 @@ int main() {
sycl::queue queue;
queue.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
D(d, cgh);
sycl::accessor<int, 1, sycl::access::mode::read,
sycl::access::target::constant_buffer>
Expand Down Expand Up @@ -536,7 +536,7 @@ int main() {
sycl::buffer<int, 1> c(&cnst, sycl::range<1>(1));

sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer,
sycl::access::target::device,
sycl::access::placeholder::true_t>
D(d);
sycl::accessor<int, 1, sycl::access::mode::read,
Expand Down Expand Up @@ -574,7 +574,7 @@ int main() {
sycl::queue queue;
queue.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
AccA(A, cgh);
sycl::accessor<int, 1, sycl::access::mode::read,
sycl::access::target::constant_buffer>
Expand Down Expand Up @@ -609,7 +609,7 @@ int main() {
sycl::queue queue;
queue.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::read_write,
sycl::access::target::global_buffer>
sycl::access::target::device>
B(b, cgh);
auto B1 = b1.template get_access<sycl::access::mode::read_write>(cgh);

Expand Down
16 changes: 9 additions & 7 deletions SYCL/Basic/buffer/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ int main() {
});

myQueue.submit([&](handler &cgh) {
accessor<int, 2, access::mode::write, access::target::global_buffer,
accessor<int, 2, access::mode::write, access::target::device,
access::placeholder::false_t>
B(Buffer, cgh, range<2>(20, 20), id<2>(10, 10));
cgh.parallel_for<class bufferByRangeOffset>(
Expand Down Expand Up @@ -621,10 +621,10 @@ int main() {
{
buffer<int, 1> a(data1.data(), range<1>(10));
buffer<int, 1> b(data2);
accessor<int, 1, access::mode::read_write, access::target::global_buffer,
accessor<int, 1, access::mode::read_write, access::target::device,
access::placeholder::true_t>
A(a);
accessor<int, 1, access::mode::read_write, access::target::global_buffer,
accessor<int, 1, access::mode::read_write, access::target::device,
access::placeholder::true_t>
B(b);
queue myQueue;
Expand Down Expand Up @@ -679,10 +679,12 @@ int main() {

queue Queue;
Queue.submit([&](handler &CGH) {
auto AK0 = accessor<char, 0, access::mode::read_write,
access::target::global_buffer>(Buf_1, CGH);
auto BK0 = accessor<char, 0, access::mode::read_write,
access::target::global_buffer>(Buf_2, CGH);
auto AK0 =
accessor<char, 0, access::mode::read_write, access::target::device>(
Buf_1, CGH);
auto BK0 =
accessor<char, 0, access::mode::read_write, access::target::device>(
Buf_2, CGH);
assert(AK0.get_size() == sizeof(char));
assert(BK0.get_size() == sizeof(char));
assert(AK0.get_count() == 1);
Expand Down
8 changes: 4 additions & 4 deletions SYCL/Basic/event_profiling_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ int main() {
// buffer copy
queue copyQueue{sycl::property::queue::enable_profiling()};
event copyEvent = copyQueue.submit([&](sycl::handler &Cgh) {
accessor<int, 1, access::mode::read, access::target::global_buffer>
AccessorFrom(BufferFrom, Cgh, range<1>(Size));
accessor<int, 1, access::mode::write, access::target::global_buffer>
AccessorTo(BufferTo, Cgh, range<1>(Size));
accessor<int, 1, access::mode::read, access::target::device> AccessorFrom(
BufferFrom, Cgh, range<1>(Size));
accessor<int, 1, access::mode::write, access::target::device> AccessorTo(
BufferTo, Cgh, range<1>(Size));
Cgh.copy(AccessorFrom, AccessorTo);
});

Expand Down
16 changes: 8 additions & 8 deletions SYCL/Basic/free_function_queries/free_function_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ int main() {
sycl::queue q;
q.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
results_acc(results_buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class IdTest>(n, [=](sycl::id<1> i) {
auto that_id = sycl::ext::oneapi::experimental::this_id<1>();
Expand Down Expand Up @@ -67,10 +67,10 @@ int main() {
sycl::queue q;
q.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
results_acc(results_buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class ItemTest>(n, [=](auto i) {
static_assert(std::is_same<decltype(i), sycl::item<1>>::value,
Expand Down Expand Up @@ -102,10 +102,10 @@ int main() {
sycl::id<1> offset(1);
q.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
results_acc(results_buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class ItemOffsetTest>(
sycl::range<1>{n}, offset, [=](sycl::item<1, true> i) {
Expand Down Expand Up @@ -136,10 +136,10 @@ int main() {
sycl::nd_range<1> NDR(sycl::range<1>{n}, sycl::range<1>{2});
q.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
results_acc(results_buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class NdItemTest>(NDR, [=](auto nd_i) {
static_assert(std::is_same<decltype(nd_i), sycl::nd_item<1>>::value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ int main() {
sycl::nd_range<1> NDR(sycl::range<1>{n}, sycl::range<1>{2});
q.submit([&](cl::sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
results_acc(results_buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class NdItemTest>(NDR, [=](auto nd_i) {
static_assert(std::is_same<decltype(nd_i), sycl::nd_item<1>>::value,
Expand Down
10 changes: 5 additions & 5 deletions SYCL/Basic/handler/handler_copy_with_offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using namespace cl::sycl;
constexpr access::mode read = access::mode::read;
constexpr access::mode write = access::mode::write;
constexpr access::target global_buffer = access::target::global_buffer;
constexpr access::target ondevice = access::target::device;

int main() {
{
Expand All @@ -39,8 +39,8 @@ int main() {
Queue.submit([&](handler &CGH) {
range<1> AccessRange{4};
id<1> AccessOffset{2};
auto Accessor = Buffer.get_access<write, global_buffer>(
CGH, AccessRange, AccessOffset);
auto Accessor =
Buffer.get_access<write, ondevice>(CGH, AccessRange, AccessOffset);
CGH.copy(DataGold.data(), Accessor);
});
Queue.wait();
Expand All @@ -63,8 +63,8 @@ int main() {
Queue.submit([&](handler &CGH) {
range<1> AccessRange{4};
id<1> AccessOffset{2};
auto Accessor = Buffer.get_access<read, global_buffer>(CGH, AccessRange,
AccessOffset);
auto Accessor =
Buffer.get_access<read, ondevice>(CGH, AccessRange, AccessOffset);
CGH.copy(Accessor, DataRaw.data());
});
Queue.wait();
Expand Down
6 changes: 3 additions & 3 deletions SYCL/Basic/handler/handler_generic_integral_lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main() {
sycl::queue q;
q.submit([&](cl::sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class GenericLambda>(
length, [=](auto item) { acc[item.get_id()] = item; });
Expand All @@ -44,7 +44,7 @@ int main() {
sycl::queue q;
q.submit([&](cl::sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class SizeTLambda>(
length, [=](std::size_t item) { acc[item] = item; });
Expand All @@ -62,7 +62,7 @@ int main() {
sycl::queue q;
q.submit([&](cl::sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::write,
sycl::access::target::global_buffer>
sycl::access::target::device>
acc(buf.get_access<sycl::access::mode::write>(cgh));
cgh.parallel_for<class IntLambda>(length,
[=](int item) { acc[item] = item; });
Expand Down
Loading