clspv
clspv copied to clipboard
cl_khr_subgroups support
We would like to enable the cl_khr_subgroups extension for the following functions:
These functions will map to Builtin constants:
- get_sub_group_size - SubgroupSize
- get_max_sub_group_size - SubgroupMaxSize
- get_num_sub_groups - NumSubgroups
- get_sub_group_id - SubgroupId
- get_sub_group_local_id - SubgroupLocalInvocationId
And these functions will map to spv::Op's accordingly:
- sub_group_all - OpGroupNonUniformAll
- sub_group_any - OpGroupNonUniformAny
- sub_group_broadcast - OpGroupNonUniformBroadcast
- sub_group_barrier - OpControlBarrier
And the reduction functions as follows:
- sub_group_<group_operation>_add
- INT: OpGroupNonUniformIAdd
- FLOAT: OpGroupNonUniformFAdd
- sub_group_<group_operation>_min
- INT: OpGroupNonUniformSMin
- UINT: OpGroupNonUniformUMin
- FLOAT: OpGroupNonUniformFMin
- sub_group_<group_operation>_max
- INT: OpGroupNonUniformSMax
- UINT: OpGroupNonUniformUMax
- FLOAT: OpGroupNonUniformFMax With <group_operation> correspondingly:
- reduce - GroupOperationReduce
- scan_exclusive - GroupOperationExclusiveScan
- scan_inclusive - GroupOperationInclusiveScan
Adding the cl_khr_subgroups extension support requires OpenCL 2.0 or greater (clang front-end already supports with -cl-std=CL2.0) and also requires SPIR-V 1.3 or greater support. A command line switch will be required to specify the -spirv-std for the output version.
Setting -spirv-std=1.4 or greater requires updating the EntryPointInterface with all GlobalVariable IDs.
All tests should be run with -spirv-std=1.5 to test conformance.
The remainder of cl_khr_subgroups functions that should be implemented for full support:
- get_enqueued_num_subroups
- sub_group_reserve_read_pipe
- sub_group_reserve_write_pipe
- sub_group_commit_read_pipe
- sub_group_commit_write_pipe
- get_kernel_sub_group_count_for_ndrange
- get_kernel_max_sub_group_size_for_ndrange
#610 added sub_group_barrier
support.
Are there any plans to introduce support for the intel extension 'cl_intel_subgroups' which includes subgroup functions sub_group_shuffle function etc...?