From 4f6a9264f2f6c61355e18fac82ebafdf83fc1095 Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Wed, 13 Aug 2025 23:17:40 -0700 Subject: [PATCH] [SYCL][Docs] Add accessor property list to handler::require This commit adds the extension accessor property list type to the type of accessor in the handler::require signature. This allows for the extension property lists to be used with placeholder accessors. Fixes https://github.com/intel/llvm/issues/3536. Signed-off-by: Larsen, Steffen --- ...cl_ext_oneapi_accessor_properties.asciidoc | 14 ++++++++++++ sycl/include/sycl/handler.hpp | 7 ++++-- .../accessor_property_list_placeholder.cpp | 22 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 sycl/test-e2e/Basic/accessor/accessor_property_list_placeholder.cpp diff --git a/sycl/doc/extensions/supported/sycl_ext_oneapi_accessor_properties.asciidoc b/sycl/doc/extensions/supported/sycl_ext_oneapi_accessor_properties.asciidoc index 57be57150514f..3d6b43bbb6239 100644 --- a/sycl/doc/extensions/supported/sycl_ext_oneapi_accessor_properties.asciidoc +++ b/sycl/doc/extensions/supported/sycl_ext_oneapi_accessor_properties.asciidoc @@ -335,6 +335,20 @@ class accessor { ... ``` +The `handler::require` function is modified to reflect this type change: + +```c++ +namespace sycl { +class handler { +public: + template + void require(accessor 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: diff --git a/sycl/include/sycl/handler.hpp b/sycl/include/sycl/handler.hpp index bd91b9dc755ec..755e6573c25c0 100644 --- a/sycl/include/sycl/handler.hpp +++ b/sycl/include/sycl/handler.hpp @@ -1586,8 +1586,11 @@ class __SYCL_EXPORT handler { /// /// \param Acc is a SYCL accessor describing required memory region. template - void require(accessor Acc) { + access::target AccTarget, access::placeholder isPlaceholder, + typename propertyListT> + void require( + accessor + Acc) { if (Acc.is_placeholder()) associateWithHandler(&Acc, AccTarget); } diff --git a/sycl/test-e2e/Basic/accessor/accessor_property_list_placeholder.cpp b/sycl/test-e2e/Basic/accessor/accessor_property_list_placeholder.cpp new file mode 100644 index 0000000000000..d4abf844cfa19 --- /dev/null +++ b/sycl/test-e2e/Basic/accessor/accessor_property_list_placeholder.cpp @@ -0,0 +1,22 @@ +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out + +#include + +constexpr int Val = 42; + +int main() { + sycl::queue Q; + int OutVal = 0; + { + sycl::buffer 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; +}