google / google/clspv

cl_khr_subgroups support

Open
#602 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
LLVM
Stars
729
Forks
110
Avg merge
17h 51m
Merged PRs (30d)
23

Description

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__add
* INT: OpGroupNonUniformIAdd
* FLOAT: OpGroupNonUniformFAdd
* sub_group__min
* INT: OpGroupNonUniformSMin
* UINT: OpGroupNonUniformUMin
* FLOAT: OpGroupNonUniformFMin
* sub_group__max
* INT: OpGroupNonUniformSMax
* UINT: OpGroupNonUniformUMax
* FLOAT: OpGroupNonUniformFMax
With 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.