@@ -4354,9 +4354,9 @@ This attribute can be used in both OpenCL and SYCL.
43544354
43554355OpenCL documentation:
43564356The optional attribute intel_reqd_sub_group_size can be used to indicate that
4357- the kernel must be compiled and executed with the specified subgroup size. When
4357+ the kernel must be compiled and executed with the specified sub group size. When
43584358this attribute is present, get_max_sub_group_size() is guaranteed to return the
4359- specified integer value. This is important for the correctness of many subgroup
4359+ specified integer value. This is important for the correctness of many sub group
43604360algorithms, and in some cases may be used by the compiler to generate more optimal
43614361code. See `cl_intel_required_subgroup_size
43624362<https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt>`
@@ -4367,6 +4367,13 @@ The [[intel::reqd_sub_group_size(n)]] attribute indicates that the kernel must
43674367be compiled and executed with a sub-group of size n. The value of n must be set
43684368to a sub-group size supported by the device, or device compilation will fail.
43694369
4370+ The ``[[intel::sub_group_size(n)]]`` attribute has the same effect as the other
4371+ attribute spellings, except that it follows the SYCL 2020 Attribute Rules. See
4372+ the ``[[intel::named_sub_group_size(NAME)]]`` documentation for clarification.
4373+
4374+ This attribute is mutually exclusive with ``[[intel::named_sub_group_size(NAME)]]``
4375+ and ``[[intel::sycl_explicit_simd]]``.
4376+
43704377In addition to device functions, the required sub-group size attribute may also
43714378be specified in the definition of a named functor object and lambda functions,
43724379as in the examples below:
@@ -4390,6 +4397,47 @@ See Sub-groups for NDRange Parallelism proposal in sycl/doc/extensions/sub_group
43904397 }];
43914398}
43924399
4400+ def IntelNamedSubGroupSizeDocs : Documentation {
4401+ let Category = DocCatFunction;
4402+ let Content = [{
4403+ The ``[[intel::named_sub_group_size(NAME)]]`` attribute works similar to
4404+ ``[[intel::sub_group_size(N)]]`` attribute in that it defines the specific
4405+ sub group size for the kernel. The ``[[intel::named_sub_group_size(NAME)]]``
4406+ form accepts a required parameter of either ``automatic`` or ``primary``.
4407+
4408+ ``automatic`` specifies that the implementation is free to select any of the
4409+ valid sub-group sizes associated with the device to which the kernel is
4410+ submitted. ``primary`` specifies that the implementation should select the
4411+ device's primary sub-group size as reported by
4412+ ``info::device::primary_sub_group_size``.
4413+
4414+ This attribute may not be combined with ``[[intel::sub_group_size(N)]]``, as
4415+ the two attributes have different meanings. It is also mutually exclusive with
4416+ ``[[intel::sycl_explicit_simd]]``.
4417+
4418+ In addition to the attributes, a default sub-group size strategy may be
4419+ specified by the ``-fsycl-default-sub-group-size`` command line option, which
4420+ accepts either ``automatic``, ``primary``, or a default size as an integer.
4421+ These values match and have the same behavior as the ``automatic``, ``primary``,
4422+ and ``[[intel::sub_group_size(N)]]`` values respectively.
4423+
4424+ SYCL 2020 Attribute Rules:
4425+ SYCL 2020 specifies that kernel-type attributes should only be specified on the
4426+ kernel or a ``SYCL_EXTERNAL`` function. This implementation permits these
4427+ attributes to appear on all function declarations for the purposes of
4428+ self-documenting declarations. However, these attributes must match the kernel's
4429+ sub-group size as configured by the command line, or via an attribute
4430+ specifically.
4431+
4432+ In addition to the SYCL 2020 Attribute Rules, this attribute and the
4433+ ``[[intel::sub_group_size(N)]]`` attribute also require that any
4434+ ``SYCL_EXTERNAL`` functions defined in a different translation unit must have a
4435+ matching sub-group size specification, so ``SYCL_EXTERNAL`` functions not
4436+ defined in this translation unit must also have a matching sub-group
4437+ specification to the kernel function that calls it.
4438+ }];
4439+ }
4440+
43934441def OpenCLAccessDocs : Documentation {
43944442 let Category = DocCatStmt;
43954443 let Heading = "__read_only, __write_only, __read_write (read_only, write_only, read_write)";
0 commit comments