Skip to content

Commit b6f2951

Browse files
committed
[compiler] Support cl_intel_required_subgroup_size
Note: this commit does not yet enable the extension by default! See below. This commit adds support for the cl_intel_required_subgroup_size OpenCL extension. * It supports device-specific lists of sub-group sizes by adding two new fields to the Mux device info available to targets: a pointer to a list of sub-group sizes, and a size for the list. The pointer should point to static/managed data. * It supports the kernel data necessary for the extension by extending `compiler::KernelInfo` with the (optional) required sub-group size and the 'spill mem size'. The required sub-group size is encoded/decoded through the binary header. The spill size is not, but that's in keeping with the private mem size - this might indicate an oversight for offline-compiled binaries. The rest of the work is plumbing that data into the extension's queries, and adding testing coverage. Two new compiler passes have been added to force the compiler into failing if the required sub-group size is not supported by the device, or if the requirement has not been satisfied by the compiler. Both of these are always true as none of our targets advertise any sub-group sizes, and never force the vectorizer into vectorizing to that size. The `muxc` compiler tool can be given supported sub-group sizes via a command-line option to ensure these compiler passes can be tested in a device-agnostic way. Note that this doesn't include support for this extension when the program was compiled with SPIR-V (clCreateProgramWithILKHR). In a strict reading of the extension spec, `CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL` only reports the value of the attribute and thus has no meaning for SPIR-V, but we can be charitable here. It is expected that this property will manifest itself via the `SubgroupSize` execution mode, but more work needs to be done here. For that reason the extension is left disabled until SPIR-V support is added.
1 parent 45fb808 commit b6f2951

File tree

1 file changed

+17
-0
lines changed
  • llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/docs

1 file changed

+17
-0
lines changed

llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/docs/utils.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,23 @@ the ``NoUnwind`` attribute can still be generated in certain cases. This pass
10671067
adds the ``NoUnwind`` attribute to every function in the module, for target code
10681068
generators that can't handle exceptions.
10691069

1070+
VerifyReqdSubGroupSizeLegalPass & VerifyReqdSubGroupSizeSatisfiedPass
1071+
---------------------------------------------------------------------
1072+
1073+
These passes check whether the compiler can handle, and has successfully
1074+
handled, a kernel with a required sub-group size.
1075+
1076+
The ``VerifyReqdSubGroupSizeLegalPass`` searches for any kernel with a required
1077+
sub-group size and checks whether the device supports such a size. It does this
1078+
using the target's ``compiler::utils::DeviceInfo`` analysis. Any unsupported
1079+
size results in a compiler diagnostic, which the compiler can handle (usually
1080+
via a build error).
1081+
1082+
The ``VerifyReqdSubGroupSizeSatisfiedPass`` searches for any kernel entry point
1083+
with a required sub-group size and checks whether the vectorizer was able to
1084+
satisfy that requirement. As such, it should be run after vectorization. A
1085+
compiler diagnostic is raised for each kernel for which this does not hold.
1086+
10701087
Metadata Utilities
10711088
------------------
10721089

0 commit comments

Comments
 (0)