|
| 1 | += SYCL_INTEL_relax_standard_layout |
| 2 | + |
| 3 | +:source-highlighter: coderay |
| 4 | +:coderay-linenums-mode: table |
| 5 | + |
| 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 | + |
| 13 | +:blank: pass:[ +] |
| 14 | + |
| 15 | +// Set the default source code type in this document to C++, |
| 16 | +// for syntax highlighting purposes. This is needed because |
| 17 | +// docbook uses c++ and html5 uses cpp. |
| 18 | +:language: {basebackend@docbook:c++:cpp} |
| 19 | + |
| 20 | +// This is necessary for asciidoc, but not for asciidoctor |
| 21 | +:cpp: C++ |
| 22 | + |
| 23 | +== Introduction |
| 24 | +IMPORTANT: This specification is a draft. |
| 25 | + |
| 26 | +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. |
| 27 | + |
| 28 | +NOTE: This document is better viewed when rendered as html with asciidoctor. GitHub does not render image icons. |
| 29 | + |
| 30 | +This document describes an extension that removes the requirement for data accessible on a device to be standard layout. The trivially copyable requirement remains unchanged. |
| 31 | + |
| 32 | +== Name Strings |
| 33 | + |
| 34 | ++SYCL_INTEL_relax_standard_layout+ |
| 35 | + |
| 36 | +== Notice |
| 37 | + |
| 38 | +Copyright (c) 2020 Intel Corporation. All rights reserved. |
| 39 | + |
| 40 | +== Status |
| 41 | + |
| 42 | +Working Draft |
| 43 | + |
| 44 | +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. |
| 45 | + |
| 46 | +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. |
| 47 | + |
| 48 | +== Version |
| 49 | + |
| 50 | +Built On: {docdate} + |
| 51 | +Revision: 2 |
| 52 | + |
| 53 | +== Contact |
| 54 | +Michael Kinsner, Intel (michael 'dot' kinsner 'at' intel 'dot' com) |
| 55 | + |
| 56 | +== Dependencies |
| 57 | + |
| 58 | +This extension is written against the SYCL 1.2.1 specification, Revision 6. |
| 59 | + |
| 60 | +== Overview |
| 61 | + |
| 62 | +SYCL 1.2.1 requires data stored into a buffer or passed as a kernel argument to be standard layout. This is in addition to the data also being trivially copyable. This extension relaxes the standard layout requirement while leaving the trivially copyable requirement intact. |
| 63 | + |
| 64 | +Standard layout does not guarantee ABI compatibility across devices or between a device and the host, but can help. To avoid introducing incompatible data layouts, this extension also requires device compilers to validate that their layout of data is compatible with that used by the host. There are multiple implementation approaches that can achieve this, although they are beyond the scope of this extension which describes the behavior only. |
| 65 | + |
| 66 | +== Modifications of SYCL 1.2.1 Specification |
| 67 | + |
| 68 | +=== Modify Sentence in Section 3.10 (Language restrictions in kernels) |
| 69 | + |
| 70 | +==== From: |
| 71 | + |
| 72 | +Sharing data structures between host and device code imposes certain restrictions, such as use of only user defined classes that are {cpp}11 standard layout classes for the data structures, classes that are {cpp}11 trivially copyable classes for the data structures, and in general, no pointers initialized for the host can be used on the device. |
| 73 | + |
| 74 | +==== To: |
| 75 | + |
| 76 | +Sharing data structures between host and device code imposes certain restrictions, such as use of only user defined classes that are {cpp}11 trivially copyable classes for the data structures, and in general, no pointers initialized for the host can be used on the device. |
| 77 | + |
| 78 | +=== Modify Sentence in Section 4.8.5 (SYCL function for invoking kernels, +set_arg+ description) |
| 79 | + |
| 80 | +==== From: |
| 81 | + |
| 82 | +The argument can be either a SYCL accessor, a SYCL sampler or a trivially copyable and standard-layout C++ type. |
| 83 | + |
| 84 | +==== To: |
| 85 | + |
| 86 | +The argument can be either a SYCL accessor, a SYCL sampler or a trivially copyable C++ type. |
| 87 | + |
| 88 | +=== Modify Sentence in Section 4.8.9 (Defining kernels) |
| 89 | + |
| 90 | +==== From: |
| 91 | + |
| 92 | +These function objects provide the same functionality as any C++ function object, with the restriction that they need to follow {cpp}11 standard layout rules. |
| 93 | + |
| 94 | +==== To: |
| 95 | + |
| 96 | +These function objects provide the same functionality as any C++ function object, with the restriction that they need to follow {cpp}11 rules to be trivially copyable. |
| 97 | + |
| 98 | + |
| 99 | +=== Add new bullet point in Section 4.8.11 (Rules for parameter passing to kernels) |
| 100 | + |
| 101 | +The device compiler(s) must validate that the layout of any data shared between the host and the device(s) (e.g. value kernel arguments or data accessed through an accessor or USM) matches the layout of that data on the host. If there is a layout mismatch, realized or potential, the device compiler must issue an error and compilation must fail. |
| 102 | + |
| 103 | +=== Modify bullet point in Section 4.8.11 (Rules for parameter passing to kernels) |
| 104 | + |
| 105 | +==== From: |
| 106 | + |
| 107 | +{cpp} standard layout values must be passed by value to the kernel. |
| 108 | + |
| 109 | +==== To: |
| 110 | + |
| 111 | +{cpp} trivially copyable types must be passed by value to the kernel. |
| 112 | + |
| 113 | +=== Modify bullet point in Section 4.8.11 (Rules for parameter passing to kernels) |
| 114 | + |
| 115 | +==== From: |
| 116 | + |
| 117 | +{cpp} non-standard layout values must not be passed as arguments to a kernel that is compiled for a device. |
| 118 | + |
| 119 | +==== To: |
| 120 | + |
| 121 | +{cpp} non-trivially copyable types must not be passed as arguments to a kernel that is compiled for a device. |
| 122 | + |
| 123 | +=== Modify sentence in glossary entry for "SYCL kernel function" |
| 124 | + |
| 125 | +==== From: |
| 126 | + |
| 127 | +The function object can be a named standard layout type or lambda function. |
| 128 | + |
| 129 | +==== To: |
| 130 | + |
| 131 | +The function object can be a named trivially copyable type or lambda function. |
| 132 | + |
| 133 | +== Issues |
| 134 | + |
| 135 | +None. |
| 136 | + |
| 137 | +//. asd |
| 138 | +//+ |
| 139 | +//-- |
| 140 | +//*RESOLUTION*: Not resolved. |
| 141 | +//-- |
| 142 | +
|
| 143 | +== Revision History |
| 144 | +
|
| 145 | +[cols="5,15,15,70"] |
| 146 | +[grid="rows"] |
| 147 | +[options="header"] |
| 148 | +|======================================== |
| 149 | +|Rev|Date|Author|Changes |
| 150 | +|1|2020-03-17|Michael Kinsner|*Initial public working draft* |
| 151 | +|2|2020-03-24|Michael Kinsner|Remove repeated sentence and fix typo |
| 152 | +|======================================== |
| 153 | +
|
| 154 | +//************************************************************************ |
| 155 | +//Other formatting suggestions: |
| 156 | +// |
| 157 | +//* Use *bold* text for host APIs, or [source] syntax highlighting. |
| 158 | +//* Use +mono+ text for device APIs, or [source] syntax highlighting. |
| 159 | +//* Use +mono+ text for extension names, types, or enum values. |
| 160 | +//* Use _italics_ for parameters. |
| 161 | +//************************************************************************ |
0 commit comments