|
1 |
| -= SYCL_INTEL_usm_runtime_properties |
| 1 | += sycl_ext_intel_runtime_buffer_location |
2 | 2 |
|
3 |
| -== Introduction |
4 |
| -IMPORTANT: This specification is a draft. |
| 3 | +:source-highlighter: coderay |
| 4 | +:coderay-linenums-mode: table |
5 | 5 |
|
6 |
| -NOTE: Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by permission by Khronos. |
| 6 | +// This section needs to be after the document title. |
| 7 | +:doctype: book |
| 8 | +:toc2: |
| 9 | +:toc: left |
| 10 | +:encoding: utf-8 |
| 11 | +:lang: en |
| 12 | +:dpcpp: pass:[DPC++] |
7 | 13 |
|
8 |
| -NOTE: This document is better viewed when rendered as html with asciidoctor. GitHub does not render image icons. |
| 14 | +// Set the default source code type in this document to C++, |
| 15 | +// for syntax highlighting purposes. This is needed because |
| 16 | +// docbook uses c++ and html5 uses cpp. |
| 17 | +:language: {basebackend@docbook:c++:cpp} |
9 | 18 |
|
10 |
| -NOTE: This serves as a temporary workaround for usm allocation to accept buffer location properties, and the formal solution may change in the future. |
| 19 | +== Notice |
11 | 20 |
|
12 |
| -This document propose a new buffer_location runtime property that can be passed to `malloc_device`. |
| 21 | +[%hardbreaks] |
| 22 | +Copyright (C) 2022-2022 Intel Corporation. All rights reserved. |
13 | 23 |
|
14 |
| -== Name Strings |
| 24 | +Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks |
| 25 | +of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by |
| 26 | +permission by Khronos. |
15 | 27 |
|
16 |
| -+SYCL_INTEL_runtime_buffer_location+ |
| 28 | +== Contact |
17 | 29 |
|
18 |
| -== Contributors |
19 |
| -Aditi Kumaraswamy, Intel + |
20 |
| -Gregory Lueck, Intel + |
21 |
| -Joe Garvey, Intel + |
22 |
| -Sherry Yuan, Intel + |
23 |
| -Steffen Larsen, Intel |
| 30 | +To report problems with this extension, please open a new issue at: |
24 | 31 |
|
25 |
| -== Notice |
| 32 | +https://github.com/intel/llvm/issues |
26 | 33 |
|
27 |
| -Copyright (c) 2020 Intel Corporation. All rights reserved. |
| 34 | +== Dependencies |
28 | 35 |
|
29 |
| -== Status |
| 36 | +This extension is written against the SYCL 2020 revision 4 specification. All |
| 37 | +references below to the "core SYCL specification" or to section numbers in the |
| 38 | +SYCL specification refer to that revision. |
30 | 39 |
|
31 |
| -Working Draft |
32 |
| - |
33 |
| -This is a preview extension specification, intended to provide early access to a feature for review and community feedback. When the feature matures, this specification may be released as a formal extension. |
34 |
| - |
35 |
| -Because the interfaces defined by this specification are not final and are subject to change they are not intended to be used by shipping software products. |
| 40 | +== Status |
| 41 | +This is an experimental extension specification, intended to provide early |
| 42 | +access to features and gather community feedback. Interfaces defined in this |
| 43 | +specification are implemented in {dpcpp}, but they are not finalized and may |
| 44 | +change incompatibly in future versions of {dpcpp} without prior notice. |
| 45 | +*Shipping software products should not rely on APIs defined in this |
| 46 | +specification.* |
36 | 47 |
|
37 |
| -== Version |
| 48 | +[NOTE] |
| 49 | +==== |
| 50 | +This extension is currently implemented in {dpcpp} only for FPGA devices. Attempting to use this extension on other devices or backends may result in no effect. |
38 | 51 |
|
39 |
| -Built On: {docdate} + |
40 |
| -Revision: 1 |
| 52 | +This serves as a temporary workaround for usm allocation to accept buffer location properties, and the formal solution will come in the future. |
| 53 | +==== |
41 | 54 |
|
42 | 55 | == Overview
|
43 | 56 |
|
44 |
| -This spec describes the solution of passing runtime buffer location properties to malloc APIs, specifically `malloc_device`. |
| 57 | +This document propose a new buffer_location runtime property that can be passed to `malloc_device`. |
45 | 58 |
|
46 | 59 | On targets that provide more than one type of global memory, this provide users the flexibility of choosing which memory the device usm should be allocated to.
|
47 | 60 |
|
48 | 61 | This information is not a hint; it is a functional requirement of the program that must be respected.
|
49 | 62 |
|
| 63 | +== Specification |
| 64 | + |
| 65 | +=== Feature test macro |
| 66 | + |
| 67 | +This extension provides a feature-test macro as described in the core SYCL |
| 68 | +specification. An implementation supporting this extension must predefine the |
| 69 | +macro `SYCL_EXT_INTEL_RUNTIME_BUFFER_LOCATION` to one of the values defined in the table |
| 70 | +below. Applications can test for the existence of this macro to determine if |
| 71 | +the implementation supports this feature, or applications can test the macro's |
| 72 | +value to determine which of the extension's features the implementation |
| 73 | +supports. |
| 74 | + |
| 75 | +[%header,cols="1,5"] |
| 76 | +|=== |
| 77 | +|Value |
| 78 | +|Description |
| 79 | + |
| 80 | +|1 |
| 81 | +|The APIs of this experimental extension are not versioned, so the |
| 82 | + feature-test macro always has this value. |
| 83 | +|=== |
| 84 | + |
50 | 85 | == Examples
|
51 | 86 |
|
52 | 87 | [source,c++]
|
53 | 88 | ----
|
54 | 89 | array = (int *)malloc_device<int>(
|
55 | 90 | N * sizeof(int), q,
|
56 |
| - property_list{property::buffer::detail::buffer_location(2)}); |
| 91 | + property_list{sycl::ext::intel::experimental::property::usm::buffer_location(2)}); |
57 | 92 |
|
58 | 93 | sycl::queue q;
|
59 | 94 | q.parallel_for(range<1>(N), [=] (id<1> i){
|
60 | 95 | data[i] *= 2;
|
61 | 96 | }).wait();
|
62 | 97 | ----
|
63 | 98 |
|
64 |
| -== Proposal |
65 |
| - |
66 |
| -=== Feature test macro |
67 |
| - |
68 |
| -This extension provides a feature-test macro as described in the core SYCL |
69 |
| -specification, Section 6.3.3 "Feature test macros". Therefore, an |
70 |
| -implementation supporting this extension must predefine the macro |
71 |
| -`SYCL_EXT_ONEAPI_RUNTIME_BUFFER_LOCATION` to one of the values defined in the table below. |
72 |
| -Applications can test for the existence of this macro to determine if the |
73 |
| -implementation supports this feature, or applications can test the macro's |
74 |
| -value to determine which of the extension's features |
75 |
| -that the implementation supports. |
76 |
| - |
77 |
| -[%header,cols="1,5"] |
78 |
| -|=== |
79 |
| -|Value |Description |
80 |
| -|1 |Initial extension version |
81 |
| -|=== |
82 | 99 |
|
83 | 100 | === Changes to runtime properties
|
84 | 101 |
|
85 | 102 | To pass the runtime properties into malloc API, a new buffer properties is introduced.
|
86 | 103 |
|
87 | 104 | [source,c++]
|
88 | 105 | ----
|
89 |
| -namespace sycl { |
90 |
| -namespace property { |
91 |
| -namespace buffer { |
92 |
| -namespace detail { |
93 |
| -class buffer_location |
94 |
| - : public sycl::detail::PropertyWithData< |
95 |
| - sycl::detail::PropWithDataKind::AccPropBufferLocation> { |
96 |
| -public: |
97 |
| - buffer_location(uint64_t Location) : MLocation(Location) {} |
98 |
| - uint64_t get_buffer_location() const { return MLocation; } |
99 |
| -
|
100 |
| -private: |
101 |
| - uint64_t MLocation; |
| 106 | +namespace sycl::ext::intel::experimental::property::usm { |
| 107 | +
|
| 108 | +class buffer_location { |
| 109 | + public: |
| 110 | + buffer_location(int location); |
| 111 | + int get_buffer_location() const; |
102 | 112 | };
|
103 |
| -} // namespace detail |
104 |
| -} // namespace buffer |
105 |
| -} // namespace property |
106 |
| -} // namespace sycl |
| 113 | +
|
| 114 | +} // namespace sycl::ext::intel::experimental::property::usm |
107 | 115 | ----
|
108 | 116 |
|
109 | 117 | == Issues
|
|
0 commit comments