Skip to content

Commit c2c416a

Browse files
Pennycookbader
authored andcommitted
[SYCL][Doc] Add reqd_work_group_size extension (#1057)
Signed-off-by: John Pennycook <[email protected]>
1 parent e42b40e commit c2c416a

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SYCL_INTEL_reqd_work_group_size
2+
3+
Attribute asserting that a kernel may be invoked only with a specific work-group size.
4+
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
= SYCL_INTEL_reqd_work_group_size
2+
:source-highlighter: coderay
3+
:coderay-linenums-mode: table
4+
5+
// This section needs to be after the document title.
6+
:doctype: book
7+
:toc2:
8+
:toc: left
9+
:encoding: utf-8
10+
:lang: en
11+
12+
:blank: pass:[ +]
13+
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}
18+
19+
// This is necessary for asciidoc, but not for asciidoctor
20+
:cpp: C++
21+
22+
== Introduction
23+
IMPORTANT: This specification is a draft.
24+
25+
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.
26+
27+
NOTE: This document is better viewed when rendered as html with asciidoctor. GitHub does not render image icons.
28+
29+
This document describes an extension that introduces a +reqd_work_group_size+ attribute for SYCL kernels. This attribute enables developers to declare that a kernel may be invoked only with a specific work-group size.
30+
31+
== Name Strings
32+
33+
+SYCL_INTEL_reqd_work_group_size+
34+
35+
== Notice
36+
37+
Copyright (c) 2019 Intel Corporation. All rights reserved.
38+
39+
== Status
40+
41+
Working Draft
42+
43+
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.
44+
45+
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.
46+
47+
== Version
48+
49+
Built On: {docdate} +
50+
Revision: 1
51+
52+
== Contact
53+
John Pennycook, Intel (john 'dot' pennycook 'at' intel 'dot' com)
54+
55+
== Dependencies
56+
57+
This extension is written against the SYCL 1.2.1 specification, Revision v1.2.1-6.
58+
59+
== Overview
60+
61+
The +reqd_work_group_size+ attribute is declared in the +intel+ namespace, and can be attached to the declaration of kernel functors and kernel lambdas using {cpp}11 attribute specifier syntax:
62+
63+
[source,c++]
64+
----
65+
struct Functor
66+
{
67+
void operator()(nd_item<1> it) [[intel::reqd_work_group_size(32)]]
68+
{ ... }
69+
};
70+
----
71+
72+
[source,c++]
73+
----
74+
auto kernel = [](nd_item<1> it) [[intel::reqd_work_group_size(32)]] { ... };
75+
----
76+
77+
The attribute-token +intel::reqd_work_group_size+ shall appear at most once in each _attribute-list_. The attribute may be applied to the function-type in a function declaration. The first declaration of a function shall specify the +intel::reqd_work_group_size+ attribute if any declaration of that function specifies the +intel::reqd_work_group_size+ attribute. If a function is declared with the +intel::reqd_work_group_size+ attribute in one translation unit and the same function is declared without the +intel::reqd_work_group_size+ attribute in another translation unit, the program is ill-formed and no diagnostic is required.
78+
79+
SYCL device compilers should give a compilation error if the required work-group size is unsupported. If the kernel is submitted for execution using an incompatible work-group size, the SYCL runtime must throw a SYCL +nd_range_error+.
80+
81+
== Attribute Syntax
82+
83+
The attribute has three variants, corresponding to one-, two- and three-dimensional work-groups:
84+
85+
[source,c++]
86+
----
87+
[[intel::reqd_work_group_size(dim0)]]
88+
[[intel::reqd_work_group_size(dim0, dim1)]]
89+
[[intel::reqd_work_group_size(dim0, dim1, dim2)]]
90+
----
91+
92+
The sizes are written in row-major format. Each argument to the attribute must be a +constexpr+ integral value. The dimensionality of the attribute variant used must match the dimensionality of the work-group used to invoke the kernel.
93+
94+
== Issues
95+
96+
None.
97+
98+
//. asd
99+
//+
100+
//--
101+
//*RESOLUTION*: Not resolved.
102+
//--
103+
104+
== Revision History
105+
106+
[cols="5,15,15,70"]
107+
[grid="rows"]
108+
[options="header"]
109+
|========================================
110+
|Rev|Date|Author|Changes
111+
|1|2020-01-24|John Pennycook|*Initial public working draft*
112+
|========================================
113+
114+
//************************************************************************
115+
//Other formatting suggestions:
116+
//
117+
//* Use *bold* text for host APIs, or [source] syntax highlighting.
118+
//* Use +mono+ text for device APIs, or [source] syntax highlighting.
119+
//* Use +mono+ text for extension names, types, or enum values.
120+
//* Use _italics_ for parameters.
121+
//************************************************************************

0 commit comments

Comments
 (0)