Skip to content

Commit 38f4d91

Browse files
[SYCL][Docs] Move sycl_ext_oneapi_non_uniform_groups to experimental (#11535)
This commit makes the following changes to allow us to consider the sycl_ext_oneapi_non_uniform_groups extensions as experimentally supported: * Make the extension aspects per-group to allow the CUDA backend to not support tangle_group yet. * Define the SYCL_EXT_ONEAPI_NON_UNIFORM_GROUPS feature test macro. * Move the extension document to experimental. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 1060b20 commit 38f4d91

File tree

10 files changed

+92
-36
lines changed

10 files changed

+92
-36
lines changed

llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ def AspectExt_oneapi_mipmap : Aspect<"ext_oneapi_mipmap">;
6262
def AspectExt_oneapi_mipmap_anisotropy : Aspect<"ext_oneapi_mipmap_anisotropy">;
6363
def AspectExt_oneapi_mipmap_level_reference : Aspect<"ext_oneapi_mipmap_level_reference">;
6464
def AspectExt_intel_esimd : Aspect<"ext_intel_esimd">;
65-
def AspectExt_oneapi_non_uniform_groups : Aspect<"ext_oneapi_non_uniform_groups">;
65+
def AspectExt_oneapi_ballot_group : Aspect<"ext_oneapi_ballot_group">;
66+
def AspectExt_oneapi_fixed_size_group : Aspect<"ext_oneapi_fixed_size_group">;
67+
def AspectExt_oneapi_opportunistic_group : Aspect<"ext_oneapi_opportunistic_group">;
68+
def AspectExt_oneapi_tangle_group : Aspect<"ext_oneapi_tangle_group">;
6669
// Deprecated aspects
6770
def AspectInt64_base_atomics : Aspect<"int64_base_atomics">;
6871
def AspectInt64_extended_atomics : Aspect<"int64_extended_atomics">;
@@ -111,7 +114,8 @@ def : TargetInfo<"__TestAspectList",
111114
AspectExt_oneapi_bindless_images_shared_usm, AspectExt_oneapi_bindless_images_1d_usm, AspectExt_oneapi_bindless_images_2d_usm,
112115
AspectExt_oneapi_interop_memory_import, AspectExt_oneapi_interop_memory_export,
113116
AspectExt_oneapi_interop_semaphore_import, AspectExt_oneapi_interop_semaphore_export,
114-
AspectExt_oneapi_mipmap, AspectExt_oneapi_mipmap_anisotropy, AspectExt_oneapi_mipmap_level_reference, AspectExt_intel_esimd, AspectExt_oneapi_non_uniform_groups],
117+
AspectExt_oneapi_mipmap, AspectExt_oneapi_mipmap_anisotropy, AspectExt_oneapi_mipmap_level_reference, AspectExt_intel_esimd,
118+
AspectExt_oneapi_ballot_group, AspectExt_oneapi_fixed_size_group, AspectExt_oneapi_opportunistic_group, AspectExt_oneapi_tangle_group],
115119
[]>;
116120
// This definition serves the only purpose of testing whether the deprecated aspect list defined in here and in SYCL RT
117121
// match.

sycl/doc/extensions/proposed/sycl_ext_oneapi_non_uniform_groups.asciidoc renamed to sycl/doc/extensions/experimental/sycl_ext_oneapi_non_uniform_groups.asciidoc

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@ SYCL specification refer to that revision.
4444

4545
== Status
4646

47-
This is a proposed extension specification, intended to gather community
48-
feedback. Interfaces defined in this specification may not be implemented yet
49-
or may be in a preliminary state. The specification itself may also change in
50-
incompatible ways before it is finalized. *Shipping software products should
51-
not rely on APIs defined in this specification.*
47+
This is an experimental extension specification, intended to provide early
48+
access to features and gather community feedback. Interfaces defined in this
49+
specification are implemented in {dpcpp}, but they are not finalized and may
50+
change incompatibly in future versions of {dpcpp} without prior notice.
51+
*Shipping software products should not rely on APIs defined in this
52+
specification.*
5253

5354

5455
== Backend support status
5556

56-
The APIs in this extension may be used only on a device that has
57-
`aspect::ext_oneapi_non_uniform_groups`. The application must check that the
57+
The APIs in this extension may be used only on a device that has one or more of
58+
the xref:ext-aspects[extension aspects]. The application must check that the
5859
device has this aspect before submitting a kernel using any of the APIs in this
5960
extension. If the application fails to do this, the implementation throws a
6061
synchronous exception with the `errc::kernel_not_supported` error code when the
@@ -105,20 +106,33 @@ implementation supports.
105106
feature-test macro always has this value.
106107
|===
107108

109+
[#ext-aspects]
108110
=== Extension to `enum class aspect`
109111

110112
[source]
111113
----
112114
namespace sycl {
113115
enum class aspect {
114116
...
115-
ext_oneapi_non_uniform_groups
117+
ext_oneapi_ballot_group
118+
ext_oneapi_fixed_size_group
119+
ext_oneapi_opportunistic_group
120+
ext_oneapi_tangle_group
116121
}
117122
}
118123
----
119124

120-
If a SYCL device has the `ext_oneapi_non_uniform_groups` aspect,
121-
then it supports the non-uniform groups described in the next sections.
125+
If a SYCL device has these aspects, that device supports the non-uniform groups
126+
as follows:
127+
128+
[%header,cols="2,3"]
129+
|===
130+
| Aspect | Supported group
131+
| `ext_oneapi_ballot_group` | `ballot_group`
132+
| `ext_oneapi_fixed_size_group` | `fixed_size_group`
133+
| `ext_oneapi_opportunistic_group` | `opportunistic_group`
134+
| `ext_oneapi_tangle_group` | `tangle_group`
135+
|===
122136

123137
=== Control Flow
124138

sycl/include/sycl/device_aspect_macros.hpp

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,24 @@
278278
#define __SYCL_ALL_DEVICES_HAVE_ext_intel_esimd__ 0
279279
#endif
280280

281-
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_non_uniform_groups__
282-
// __SYCL_ASPECT(ext_oneapi_non_uniform_groups, 54)
283-
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_non_uniform_groups__ 0
281+
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_ballot_group__
282+
// __SYCL_ASPECT(ext_oneapi_ballot_group, 54)
283+
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_ballot_group__ 0
284+
#endif
285+
286+
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_fixed_size_group__
287+
// __SYCL_ASPECT(ext_oneapi_fixed_size_group, 55)
288+
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_fixed_size_group__ 0
289+
#endif
290+
291+
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_opportunistic_group__
292+
// __SYCL_ASPECT(ext_oneapi_opportunistic_group, 56)
293+
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_opportunistic_group__ 0
294+
#endif
295+
296+
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_tangle_group__
297+
// __SYCL_ASPECT(ext_oneapi_tangle_group, 57)
298+
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_tangle_group__ 0
284299
#endif
285300

286301
#ifndef __SYCL_ANY_DEVICE_HAS_host__
@@ -553,7 +568,22 @@
553568
#define __SYCL_ANY_DEVICE_HAS_ext_intel_esimd__ 0
554569
#endif
555570

556-
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_non_uniform_groups__
557-
// __SYCL_ASPECT(ext_oneapi_non_uniform_groups, 54)
558-
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_non_uniform_groups__ 0
571+
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_ballot_group__
572+
// __SYCL_ASPECT(ext_oneapi_ballot_group, 54)
573+
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_ballot_group__ 0
574+
#endif
575+
576+
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_fixed_size_group__
577+
// __SYCL_ASPECT(ext_oneapi_fixed_size_group, 55)
578+
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_fixed_size_group__ 0
579+
#endif
580+
581+
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_opportunistic_group__
582+
// __SYCL_ASPECT(ext_oneapi_opportunistic_group, 56)
583+
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_opportunistic_group__ 0
584+
#endif
585+
586+
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_tangle_group__
587+
// __SYCL_ASPECT(ext_oneapi_tangle_group, 57)
588+
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_tangle_group__ 0
559589
#endif

sycl/include/sycl/ext/oneapi/experimental/ballot_group.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ template <typename ParentGroup> class ballot_group;
2929

3030
template <typename Group>
3131
#ifdef __SYCL_DEVICE_ONLY__
32-
[[__sycl_detail__::__uses_aspects__(
33-
sycl::aspect::ext_oneapi_non_uniform_groups)]]
32+
[[__sycl_detail__::__uses_aspects__(sycl::aspect::ext_oneapi_ballot_group)]]
3433
#endif
3534
inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> &&
3635
std::is_same_v<Group, sycl::sub_group>,
37-
ballot_group<Group>>
38-
get_ballot_group(Group group, bool predicate);
36+
ballot_group<Group>> get_ballot_group(Group group,
37+
bool predicate);
3938

4039
template <typename ParentGroup> class ballot_group {
4140
public:

sycl/include/sycl/ext/oneapi/experimental/fixed_size_group.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ template <size_t PartitionSize, typename ParentGroup> class fixed_size_group;
2929

3030
template <size_t PartitionSize, typename Group>
3131
#ifdef __SYCL_DEVICE_ONLY__
32-
[[__sycl_detail__::__uses_aspects__(
33-
sycl::aspect::ext_oneapi_non_uniform_groups)]]
32+
[[__sycl_detail__::__uses_aspects__(sycl::aspect::ext_oneapi_fixed_size_group)]]
3433
#endif
3534
inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> &&
3635
std::is_same_v<Group, sycl::sub_group>,

sycl/include/sycl/ext/oneapi/experimental/opportunistic_group.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ class opportunistic_group;
2929
namespace this_kernel {
3030
#ifdef __SYCL_DEVICE_ONLY__
3131
[[__sycl_detail__::__uses_aspects__(
32-
sycl::aspect::ext_oneapi_non_uniform_groups)]]
32+
sycl::aspect::ext_oneapi_opportunistic_group)]]
3333
#endif
34-
inline opportunistic_group
35-
get_opportunistic_group();
34+
inline opportunistic_group get_opportunistic_group();
3635
} // namespace this_kernel
3736

3837
class opportunistic_group {

sycl/include/sycl/ext/oneapi/experimental/tangle_group.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ template <typename ParentGroup> class tangle_group;
2828

2929
template <typename Group>
3030
#ifdef __SYCL_DEVICE_ONLY__
31-
[[__sycl_detail__::__uses_aspects__(
32-
sycl::aspect::ext_oneapi_non_uniform_groups)]]
31+
[[__sycl_detail__::__uses_aspects__(sycl::aspect::ext_oneapi_tangle_group)]]
3332
#endif
3433
inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> &&
3534
std::is_same_v<Group, sycl::sub_group>,
36-
tangle_group<Group>>
37-
get_tangle_group(Group group);
35+
tangle_group<Group>> get_tangle_group(Group group);
3836

3937
template <typename ParentGroup> class tangle_group {
4038
public:
@@ -152,9 +150,10 @@ get_tangle_group(Group group) {
152150
sub_group_mask mask = sycl::ext::oneapi::group_ballot(group, true);
153151
return tangle_group<sycl::sub_group>(mask);
154152
#elif defined(__NVPTX__)
155-
// TODO: Construct from compiler-generated mask
156-
static_assert(false,
157-
"tangle_group is not currently supported on this platform.");
153+
// TODO: Construct from compiler-generated mask. Return an invalid group in
154+
// in the meantime. CUDA devices will report false for the tangle_group
155+
// support aspect so kernels launch should ensure this is never run.
156+
return tangle_group<sycl::sub_group>(0);
158157
#endif
159158
#else
160159
throw runtime_error("Non-uniform groups are not supported on host device.",

sycl/include/sycl/info/aspects.def

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ __SYCL_ASPECT(ext_oneapi_mipmap, 50)
4848
__SYCL_ASPECT(ext_oneapi_mipmap_anisotropy, 51)
4949
__SYCL_ASPECT(ext_oneapi_mipmap_level_reference, 52)
5050
__SYCL_ASPECT(ext_intel_esimd, 53)
51-
__SYCL_ASPECT(ext_oneapi_non_uniform_groups, 54)
51+
__SYCL_ASPECT(ext_oneapi_ballot_group, 54)
52+
__SYCL_ASPECT(ext_oneapi_fixed_size_group, 55)
53+
__SYCL_ASPECT(ext_oneapi_opportunistic_group, 56)
54+
__SYCL_ASPECT(ext_oneapi_tangle_group, 57)

sycl/source/detail/device_impl.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,11 +554,19 @@ bool device_impl::has(aspect Aspect) const {
554554
&support, nullptr) == PI_SUCCESS;
555555
return call_successful && support;
556556
}
557-
case aspect::ext_oneapi_non_uniform_groups: {
557+
case aspect::ext_oneapi_ballot_group:
558+
case aspect::ext_oneapi_fixed_size_group:
559+
case aspect::ext_oneapi_opportunistic_group: {
558560
return (this->getBackend() == backend::ext_oneapi_level_zero) ||
559561
(this->getBackend() == backend::opencl) ||
560562
(this->getBackend() == backend::ext_oneapi_cuda);
561563
}
564+
case aspect::ext_oneapi_tangle_group: {
565+
// TODO: tangle_group is not currently supported for CUDA devices. Add when
566+
// implemented.
567+
return (this->getBackend() == backend::ext_oneapi_level_zero) ||
568+
(this->getBackend() == backend::opencl);
569+
}
562570
}
563571
throw runtime_error("This device aspect has not been implemented yet.",
564572
PI_ERROR_INVALID_DEVICE);

sycl/source/feature_test.hpp.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ inline namespace _V1 {
9696
#define SYCL_EXT_ONEAPI_PREFETCH 1
9797
#define SYCL_EXT_INTEL_CACHE_CONTROLS 1
9898
#define SYCL_EXT_INTEL_FP_CONTROL 1
99+
#define SYCL_EXT_ONEAPI_NON_UNIFORM_GROUPS 1
99100

100101
#ifndef __has_include
101102
#define __has_include(x) 0

0 commit comments

Comments
 (0)