Skip to content

Commit 0d2ff49

Browse files
committed
Address Greg's offline comments
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent 2b7bc7a commit 0d2ff49

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

sycl/doc/design/DeviceAspectTraitDesign.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ traits `any_device_has` and `all_devices_have` as described in the
77
In summary, `any_device_has<aspect>` and `all_devices_have<aspect>` must inherit
88
from either `std::true_t` or `std::false_t` depending on whether the
99
corresponding compilation environment can guarantee that any and all the
10-
supported devices support the `aspect`. Since DPC++ allows for compiling for
11-
multiple targets, these traits can be different when compiling for the
12-
individual targets and on host.
10+
supported devices support the `aspect`.
1311

1412
The design of these traits is inspired by the implementation of the
1513
[sycl\_ext\_oneapi\_device\_if][2] and
@@ -28,22 +26,35 @@ specified in the device headers rather than by the names specified in the
2826

2927
For each target $t$ in `-fsycl-targets`, let $A^{any}_t$ be the set of aspects
3028
supported by any device supporting $t$ and let $A^{all}_t$ be the set of aspects
31-
supported by all devices supporting $t$. If $t$ has an entry in the
32-
configuration file, these sets are defined by the `aspects` list in that entry
33-
and $A^{any}_t = A^{all}_t$. If there is no entry for $t$ in the configuration
34-
file, then $A^{any}_t$ is the set of all aspects and $A^{all}_t = \emptyset$.
35-
36-
In the device-side compilation of a SYCL program for $t$ the driver defines the
37-
following macros:
38-
* `__SYCL_ALL_DEVICES_HAVE_`$i$`__` as `1` for all $i$ in $A^{all}_t$.
39-
* `__SYCL_ANY_DEVICE_HAS_ANY_ASPECT__` as `1` if $A^{any}_t$ is the set of all
29+
supported by all devices supporting $t$. These sets are defined as follows:
30+
* If $t$ has an entry in the configuration file, $A^{all}_t$ is the same as the
31+
`aspects` list in that entry.
32+
* If $t$ does not have an entry in the configuration file, $A^{all}_t$ is empty.
33+
* If $t$ has an entry in the configuration file and the entry has a value
34+
`may_support_other_aspects` set to `false`, $A^{any}_t$ is the same as the
35+
`aspects` list in that entry.
36+
* If $t$ does not have an entry the configuration file or the entry has a value
37+
`may_support_other_aspects` set to `true`, $A^{any}_t$ is the set of all
4038
aspects.
41-
* `__SYCL_ANY_DEVICE_HAS_`$j$`__` as `1` for all $j$ in $A^{any}_t$ if
42-
`__SYCL_ANY_DEVICE_HAS_ANY_ASPECT__` was not defined.
4339

44-
In the host-side compilation of a SYCL program, where $[t1, t2, \ldots, tn]$ are
45-
the $n$ targets specified in `-fsycl-targets`, the driver defines the following
46-
macros:
40+
For example, the target `intel_gpu_dg1` is supported by a specific device (DG1)
41+
and as such would have an entry in the configuration file with `aspects` being
42+
the set of aspects that device supports. Likewise it would have
43+
`may_support_other_aspects` set to `false` as there will be no other devices
44+
supporting this target, meaning there will never be any devices supporting
45+
the target and supporting anything not in `aspects`. In contrast, the target
46+
`nvidia_gpu_sm_80` is supported by CUDA devices with `sm_80` architecture or
47+
newer, so its entry in the configuration file would have
48+
`may_support_other_aspects` set to `true` to indicate that there could be future
49+
devices that support aspects not in `aspects`, while it is known that all
50+
current and future devices must support the aspects in `aspects`. Lastly, the
51+
default JIT SPIR-V target (`spir64`) should not have an entry in the
52+
configuration file as it cannot guarantee anything about the devices supporting
53+
the target.
54+
55+
When compiling a SYCL program, where $[t1, t2, \ldots, tn]$ are the $n$ targets
56+
specified in `-fsycl-targets` including any targets implicitly added by the
57+
driver, the driver defines the following macros:
4758
* `__SYCL_ALL_DEVICES_HAVE_`$i$`__` as `1` for all $i$ in
4859
${\bigcap}^n_{k=1} A^{all}_{tk}$.
4960
* `__SYCL_ANY_DEVICE_HAS_ANY_ASPECT__` as `1` if

sycl/doc/design/OptionalDeviceFeatures.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,15 @@ the supported aspects and sub-group sizes. For example:
905905
```
906906
intel_gpu_12_0_0:
907907
aspects: [1, 2, 3]
908+
may_support_other_aspects: false
908909
sub-group-sizes: [8, 16]
909910
intel_gpu_icl:
910911
aspects: [2, 3]
912+
may_support_other_aspects: false
911913
sub-group-sizes: [8, 16]
912914
x86_64_avx512:
913915
aspects: [1, 2, 3, 9, 11]
916+
may_support_other_aspects: false
914917
sub-group-sizes: [8, 32]
915918
```
916919

0 commit comments

Comments
 (0)