Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,20 @@ class accessor {
...
```

The `handler::require` function is modified to reflect this type change:

```c++
namespace sycl {
class handler {
public:
template <typename DataT, int Dimensions, access_mode AccessMode,
target AccessTarget, access::placeholder IsPlaceholder,
typename property_listT>
void require(accessor<DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, property_listT> acc);
};
} // namespace sycl
```

Modify the code listing to add variants of all the accessor constructors that take a property_list
that instead take an accessor_property_list:

Expand Down
7 changes: 5 additions & 2 deletions sycl/include/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1586,8 +1586,11 @@ class __SYCL_EXPORT handler {
///
/// \param Acc is a SYCL accessor describing required memory region.
template <typename DataT, int Dims, access::mode AccMode,
access::target AccTarget, access::placeholder isPlaceholder>
void require(accessor<DataT, Dims, AccMode, AccTarget, isPlaceholder> Acc) {
access::target AccTarget, access::placeholder isPlaceholder,
typename propertyListT>
void require(
accessor<DataT, Dims, AccMode, AccTarget, isPlaceholder, propertyListT>
Acc) {
if (Acc.is_placeholder())
associateWithHandler(&Acc, AccTarget);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <sycl/detail/core.hpp>

constexpr int Val = 42;

int main() {
sycl::queue Q;
int OutVal = 0;
{
sycl::buffer<int> Buffer(&OutVal, sycl::range{1});
sycl::accessor Acc(Buffer, sycl::ext::oneapi::accessor_property_list{
sycl::ext::oneapi::no_alias});
Q.submit([&](sycl::handler &CGH) {
CGH.require(Acc);
CGH.single_task([=]() { Acc[0] = Val; });
});
}
assert(OutVal == Val);
return 0;
}