Skip to content

Commit fc9c779

Browse files
committed
Add more details in the later subsection, change ordering of sections to align with template
1 parent 4a6bb6c commit fc9c779

File tree

1 file changed

+33
-48
lines changed

1 file changed

+33
-48
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_usm_properties.asciidoc

Lines changed: 33 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ or may be in a preliminary state. The specification itself may also change in
5656
incompatible ways before it is finalized. *Shipping software products should
5757
not rely on APIs defined in this specification.*
5858

59-
== Version
60-
61-
Revision: 1
6259

6360
== Contributors
6461

@@ -82,51 +79,53 @@ This extension also depends on the following other SYCL extensions:
8279
- link:../experimental/sycl_ext_oneapi_properties.asciidoc[sycl_ext_oneapi_properties]
8380
- link:../proposed/sycl_ext_oneapi_annotated_ptr.asciidoc[sycl_ext_oneapi_annotated_ptr]
8481

82+
83+
== Proposal
84+
85+
=== Feature test macro
86+
87+
This extension provides a feature-test macro as described in the core SYCL
88+
specification. An implementation supporting this extension must predefine the
89+
macro `SYCL_EXT_ONEAPI_USM_PROPERTIES` to one of the values defined in the table
90+
below. Applications can test for the existence of this macro to determine if
91+
the implementation supports this feature, or applications can test the macro's
92+
value to determine which of the extension's features the implementation
93+
supports.
94+
95+
96+
[%header,cols="1,5"]
97+
|===
98+
|Value
99+
|Description
100+
101+
|1
102+
|Initial version of this extension.
103+
|===
104+
105+
85106
=== Examples
86107

87-
The new USM malloc API can be used as follows:
108+
The following is a synopsis of the new USM malloc API.
88109

89110
[source,c++]
90111
----
91112
92-
using namespace sycl::ext::oneapi;
93-
94-
// A property list containing compile-time property (buffer_location) and runtime property (use_host_ptr)
95-
sycl::ext::oneapi::experimental::properties properties{sycl::ext::intel::buffer_location<1>, sycl::property::buffer::use_host_ptr};
113+
// A property list containing a compile-time property and a runtime property
114+
sycl::ext::oneapi::experimental::properties properties{some_compile_time_prop<1>, some_runtime_prop(1)};
96115
97-
// The compile time property is passed to template arguments of annotated_ptr, and runtime properties are passed to
98-
auto data = malloc_device(N, q, properties);
116+
// The compile time property is passed to template arguments of annotated_ptr
117+
auto data = sycl::ext::oneapi::experimental::malloc_device(N, q, properties);
118+
// data is of type annotated_ptr<void*, property_list_t<some_compile_time_prop<1>>>
99119
100-
auto data2 = malloc_device<int>(N, q, properties);
101-
// data2 is of type annotated_ptr<int*, property_list_t<sycl::ext::intel::buffer_location<1>>>
120+
auto data2 = sycl::ext::oneapi::experimental::malloc_device<int>(N, q, properties);
121+
// data2 is of type annotated_ptr<int*, property_list_t<some_compile_time_prop<1>>>
102122
103123
sycl::queue q;
104124
q.parallel_for(range<1>(N), [=] (id<1> i){
105125
data2[i] *= 2;
106126
}).wait();
107127
----
108128

109-
`buffer_location` property is defined as a part of `SYCL_INTEL_buffer_location` extension. Once passed in, buffer_location property is passed onto runtime libraries, and is available as template arguments for annotated_ptr.
110-
111-
== Proposal
112-
113-
=== Feature test macro
114-
115-
This extension provides a feature-test macro as described in the core SYCL
116-
specification, Section 6.3.3 "Feature test macros". Therefore, an
117-
implementation supporting this extension must predefine the macro
118-
`SYCL_EXT_ONEAPI_USM_PROPERTIES` to one of the values defined in the table below.
119-
Applications can test for the existence of this macro to determine if the
120-
implementation supports this feature, or applications can test the macro's
121-
value to determine which of the extension's features
122-
that the implementation supports.
123-
124-
[%header,cols="1,5"]
125-
|===
126-
|Value |Description
127-
|1 |Initial extension version
128-
|===
129-
130129

131130
=== New USM allocation APIs
132131

@@ -162,22 +161,8 @@ The same setup is applied to other overloads of malloc APIs.
162161

163162
Compile time properties can be pass into runtime properties within the allocation function.
164163

165-
The table below describes the effects of associating each properties with each malloc function.
166-
167-
|===
168-
|Property|Description
169-
170-
|`buffer_location`
171-
|The `buffer_location` property adds the requirement that the memory must be
172-
allocated to the specified memory location as defined in `SYCL_INTEL_buffer_location` extension.
173-
With `malloc_device` the returned device memory pointer must belong to the specified memory location.
174-
with `malloc_shared`, memory must implicitly migrate to the specified memory location.
175-
176-
|===
164+
The returned `annotated_ptr` contains the USM pointers and the passed in compile-time properties to enable additional compiler optimizations.
177165

178-
SYCL implementations may introduce additional properties. If any
179-
combinations of properties are invalid, this must be clearly documented
180-
as part of this spec.
181166

182167
== Revision History
183168

0 commit comments

Comments
 (0)