Skip to content

Commit 236c32e

Browse files
committed
Add API to get backend and tweak lifetime of view
Two changes that make it easier to use `device_image` by code that does not also have the `kernel_bundle` object: * Add an API to `device_image` that returns the backend. * Change the lifetime of the content view to be the lifetime of the `device_image` object instead of the containing `kernel_bundle` object.
1 parent d288119 commit 236c32e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_device_image_backend_content.asciidoc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ namespace sycl {
9898
template <bundle_state State>
9999
class device_image {
100100
public:
101+
backend ext_oneapi_get_backend() const noexcept;
101102
std::vector<std::byte> ext_oneapi_get_backend_content() const;
102103
103104
#if defined(__cpp_lib_span)
@@ -112,6 +113,21 @@ class device_image {
112113

113114
'''
114115

116+
[frame=all,grid=none,separator="@"]
117+
!====
118+
a@
119+
[source,c++]
120+
----
121+
backend ext_oneapi_get_backend() const noexcept;
122+
----
123+
!====
124+
125+
_Returns:_ The backend that is associated with this device image.
126+
This is always the same as the backend of the kernel bundle that contains this
127+
device image.
128+
129+
'''
130+
115131
[frame=all,grid=none,separator="@"]
116132
!====
117133
a@
@@ -144,8 +160,7 @@ Available only when the compiler defines the `__cpp_lib_span` feature-test macro
144160
_Constraints:_ Available only when `State` is `bundle_state::executable`.
145161

146162
_Returns:_ A view of the raw backend content for this device image.
147-
The data behind this view has the same lifetime as the `kernel_bundle` that
148-
contains this `device_image`.
163+
The data behind this view has the same lifetime as the `device_image` object.
149164
The format of this data is implementation-defined.
150165
See below for a description of the formats used by {dpcpp}.
151166

0 commit comments

Comments
 (0)