Skip to content

Why is gl_SubgroupSize restricted to be a power of 2? #45

@stevec611

Description

@stevec611

We have a target that executes a non-power-of-2 number of threads in lock-step. It would be natural to make a subgroup have one member per thread, but we are not able to because GL_KHR_shader_subgroup states:

If the extension GL_KHR_shader_subgroup_basic is enabled, the variable
<gl_SubgroupSize> is the number of invocations within a subgroup, and its
value is always a power of 2.

Why is there a restriction that it must be a power of 2? Is there any real need for that?

(As far as I can see, neither SPIR-V nor vulkan have this restriction, it is only in GLSL, so we could in theory have shaders written in other languages running on vulkan with a non-power-of-2 subgroup size.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    VulkanFunctionality applies to Vulkan API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions