|
| 1 | += SYCL_INTEL_usm_runtime_properties |
| 2 | + |
| 3 | +== Introduction |
| 4 | +IMPORTANT: This specification is a draft. |
| 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. |
| 7 | + |
| 8 | +NOTE: This document is better viewed when rendered as html with asciidoctor. GitHub does not render image icons. |
| 9 | + |
| 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. |
| 11 | + |
| 12 | +This document propose a new buffer_location runtime property that can be passed to `malloc_device`. |
| 13 | + |
| 14 | +== Name Strings |
| 15 | + |
| 16 | ++SYCL_INTEL_usm_runtime_properties+ |
| 17 | + |
| 18 | +== Contributors |
| 19 | +Aditi Kumaraswamy, Intel + |
| 20 | +Gregory Lueck, Intel + |
| 21 | +Joe Garvey, Intel + |
| 22 | +Sherry Yuan, Intel + |
| 23 | +Steffen Larsen, Intel |
| 24 | + |
| 25 | +== Notice |
| 26 | + |
| 27 | +Copyright (c) 2020 Intel Corporation. All rights reserved. |
| 28 | + |
| 29 | +== Status |
| 30 | + |
| 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. |
| 36 | + |
| 37 | +== Version |
| 38 | + |
| 39 | +Built On: {docdate} + |
| 40 | +Revision: 1 |
| 41 | + |
| 42 | +== Overview |
| 43 | + |
| 44 | +This spec describes the solution of passing runtime buffer location properties to malloc APIs, specifically `malloc_device`. |
| 45 | + |
| 46 | +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 | + |
| 48 | +This information is not a hint; it is a functional requirement of the program that must be respected. |
| 49 | + |
| 50 | +== Examples |
| 51 | + |
| 52 | +[source,c++] |
| 53 | +---- |
| 54 | +array = (int *)malloc_device<int>( |
| 55 | + N * sizeof(int), q, |
| 56 | + property_list{property::buffer::detail::buffer_location(2)}); |
| 57 | +
|
| 58 | +sycl::queue q; |
| 59 | +q.parallel_for(range<1>(N), [=] (id<1> i){ |
| 60 | + data[i] *= 2; |
| 61 | +}).wait(); |
| 62 | +---- |
| 63 | + |
| 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_USM_RUNTIME_PROPERTIES` 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 | + |
| 83 | +=== Changes to runtime properties |
| 84 | + |
| 85 | +To pass the runtime properties into malloc API, a new buffer properties is introduced. |
| 86 | + |
| 87 | +[source,c++] |
| 88 | +---- |
| 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; |
| 102 | +}; |
| 103 | +} // namespace detail |
| 104 | +} // namespace buffer |
| 105 | +} // namespace property |
| 106 | +} // namespace sycl |
| 107 | +---- |
| 108 | + |
| 109 | +== Issues |
| 110 | + |
| 111 | +== Revision History |
| 112 | + |
| 113 | +[cols="5,15,15,70"] |
| 114 | +[grid="rows"] |
| 115 | +[options="header"] |
| 116 | +|======================================== |
| 117 | +|Rev|Date|Author|Changes |
| 118 | +|1|2022-02-24|Sherry Yuan|*Initial public draft* |
| 119 | +|======================================== |
0 commit comments