From 0a7190bbc1af087ef4b78e75b614ec7790b6d7f0 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Tue, 19 Mar 2024 16:20:30 +0000 Subject: [PATCH] Update the accessor section This reflects the restructure that @gmlueck suggested in https://github.com/KhronosGroup/SYCL-Docs/pull/537. --- adoc/chapters/programming_interface.adoc | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 23c38dec..3de910e1 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -6511,15 +6511,15 @@ access an element produces undefined behaviour. ==== Buffer accessor for commands -The [code]#accessor# class provides access to data in a [code]#buffer# from -within a <> or from within a <>. -When used in a <>, it accesses the contents of the buffer -via the device's <>. -These two forms of the accessor are distinguished by the [code]#AccessTarget# -template parameter as shown in <>. -Both forms support the following values for the [code]#AccessMode# template -parameter: [code]#access_mode::read#, [code]#access_mode::write# and -[code]#access_mode::read_write#. +The [code]#accessor# class provides access to data in a [code]#buffer# in three +different ways. +It can be used to access the buffer's data from within a +<> via the device's <>. +It can also be used to access the buffer's data on host from within a host task. +Finally, it can be used to get a native backend handle to the buffer from +within a host task, to be used on device. +The AccessTarget template parameter helps distinguish these three cases as +shown in <>. [[table.accessors.command.buffer.capabilities]] .Description of access targets for buffer accessors @@ -6528,20 +6528,20 @@ parameter: [code]#access_mode::read#, [code]#access_mode::write# and | Access target | Meaning | [code]#target::device# | Access a buffer from a <> via device global memory. + Also used to get a native backend handle to the buffer from within a host + task, to be used on device. | [code]#target::host_task# - | Access a buffer from a <>. + | Access a buffer's data on host from within a <>. |==== -Programs which specify the access target as [code]#target::device# and then -capture the [code]#accessor# in a <> can only use the accessor for -interoperability through the [code]#interop_handle#, any other uses result in -undefined behavior. - -An accessor with access target [code]#target::host_task# is accessible on the -host, within the host task function for which the accessor is declared. -Programs which specify the access target as [code]#target::host_task# and then -use the [code]#accessor# from a <> result in undefined -behavior. +When an [code]#accessor# is used from within a host task, the use of the +accessor must correspond to the access target, otherwise the behavior is +undefined. +If the access target is [code]#target::host_task#, the accessor may only be +used to access the buffer's data on host, from within the host task function. +If the access target is [code]#target::device#, the accessor may only be +used to get a native backend handle for the buffer as described in +<>. The dimensionality of the accessor must match the underlying buffer, however, there is a special case if the buffer is one-dimensional.