Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
frasercrmck committed Aug 27, 2024
1 parent 275c9ae commit 1594d8c
Showing 1 changed file with 62 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,10 @@ supports.

=== Kernel Properties

Most of the kernel properties below correspond to kernel attributes defined in
The kernel properties below correspond to kernel attributes defined in
Section 5.8.1 of the SYCL 2020 specification. Note that deprecated attributes
(such as `vec_type_hint`) are not included.

The `max_work_group_size` and `max_linear_work_group_size` kernel properties
are also provided as complements to other properties concerning work-group
sizes, without a corresponding function attribute form.

```c++
namespace sycl {
namespace ext {
Expand All @@ -143,16 +139,6 @@ struct work_group_size_hint_key {
using value_t = property_value<work_group_size_hint_key, std::integral_constant<size_t, Dims>...>;
}; // work_group_size_hint_key

struct max_work_group_size_key {
template <size_t... Dims>
using value_t = property_value<max_work_group_size_key, std::integral_constant<size_t, Dims>...>;
}; // max_work_group_size_key

struct max_linear_work_group_size_key {
template <size_t Size>
using value_t = property_value<max_linear_work_group_size_key, std::integral_constant<size_t, Size>>;
}; // max_linear_work_group_size_key

// Corresponds to reqd_sub_group_size
struct sub_group_size_key {
template <uint32_t Size>
Expand Down Expand Up @@ -189,12 +175,6 @@ inline constexpr work_group_size_key::value_t<Dims...> work_group_size;
template <size_t... Dims>
inline constexpr work_group_size_hint_key::value_t<Dims...> work_group_size_hint;

template <size_t... Dims>
inline constexpr max_work_group_size_key::value_t<Dims...> max_work_group_size;

template <size_t Size>
inline constexpr max_linear_work_group_size_key::value_t<Size> max_linear_work_group_size;

template <uint32_t Size>
inline constexpr sub_group_size_key::value_t<Size> sub_group_size;

Expand All @@ -203,8 +183,6 @@ inline constexpr device_has_key::value_t<Aspects...> device_has;

template <> struct is_property_key<work_group_size_key> : std::true_type {};
template <> struct is_property_key<work_group_size_hint_key> : std::true_type {};
template <> struct is_property_key<max_work_group_size_key> : std::true_type {};
template <> struct is_property_key<max_linear_work_group_size_key> : std::true_type {};
template <> struct is_property_key<sub_group_size_key> : std::true_type {};
template <> struct is_property_key<device_has_key> : std::true_type {};

Expand Down Expand Up @@ -234,6 +212,67 @@ template <> struct is_property_key<device_has_key> : std::true_type {};
of the work-group used to invoke the kernel. The order of the template
arguments matches the constructor of the `range` class.

|`sub_group_size`
|The `sub_group_size` property adds the requirement that the kernel must be
compiled and executed with the specified sub-group size. An implementation may
throw an exception for certain combinations of property values, devices and
launch configurations, as described for the `reqd_sub_group_size` attribute
in Table 180 of the SYCL 2020 specification.

|`device_has`
|The `device_has` property adds the requirement that the kernel must be
launched on a device that has all of the aspects listed in the `Aspects`
parameter pack. An implementation may throw an exception or issue a
diagnostic for certain combinations of aspects, devices and kernel functions,
as described for the `device_has` attribute in Table 180 of the SYCL 2020
specification.

|===

SYCL implementations may introduce additional kernel properties. If any
combinations of kernel attributes are invalid, this must be clearly documented
as part of the new kernel property definition.

=== Kernel Properties for the CUDA backend

The kernel properties specified in this section may only be used to decorate
kernels that are submitted to the CUDA backend. Attempting to submit a kernel
with these properties to another backend has undefined behavior.

```c++
namespace sycl {
namespace ext {
namespace oneapi {
namespace experimental {

struct max_work_group_size_key {
template <size_t... Dims>
using value_t = property_value<max_work_group_size_key, std::integral_constant<size_t, Dims>...>;
}; // max_work_group_size_key

struct max_linear_work_group_size_key {
template <size_t Size>
using value_t = property_value<max_linear_work_group_size_key, std::integral_constant<size_t, Size>>;
}; // max_linear_work_group_size_key

template <size_t... Dims>
inline constexpr max_work_group_size_key::value_t<Dims...> max_work_group_size;

template <size_t Size>
inline constexpr max_linear_work_group_size_key::value_t<Size> max_linear_work_group_size;

template <> struct is_property_key<max_work_group_size_key> : std::true_type {};
template <> struct is_property_key<max_linear_work_group_size_key> : std::true_type {};

} // namespace experimental
} // namespace oneapi
} // namespace ext
} // namespace sycl
```

|===
|Property|Description

|`max_work_group_size`
|The `max_work_group_size` property provides a promise to the compiler
that the kernel will never be launched with a larger work-group than the
Expand All @@ -254,27 +293,8 @@ If the kernel is submitted with an `nd_range` that exceeds the size specified
by the property, the implementation must throw a synchronous exception with the
`errc::nd_range` error code.

|`sub_group_size`
|The `sub_group_size` property adds the requirement that the kernel must be
compiled and executed with the specified sub-group size. An implementation may
throw an exception for certain combinations of property values, devices and
launch configurations, as described for the `reqd_sub_group_size` attribute
in Table 180 of the SYCL 2020 specification.

|`device_has`
|The `device_has` property adds the requirement that the kernel must be
launched on a device that has all of the aspects listed in the `Aspects`
parameter pack. An implementation may throw an exception or issue a
diagnostic for certain combinations of aspects, devices and kernel functions,
as described for the `device_has` attribute in Table 180 of the SYCL 2020
specification.

|===

SYCL implementations may introduce additional kernel properties. If any
combinations of kernel attributes are invalid, this must be clearly documented
as part of the new kernel property definition.

=== Adding a Property List to a Kernel Launch

To enable properties to be associated with kernels, this extension adds
Expand Down

0 comments on commit 1594d8c

Please sign in to comment.