Skip to content

Workgroup size from spec constant #150

@Firestar99

Description

@Firestar99

When you use subgroups, you can often simplify code by assuming subgroup size == workgroup size for any subgroup intrinsics. But subgroup size is defined by the HW you are executing on, so what you'd need to do is use a specialization constant to set your workgroup size. You can already do this in glsl since vulkan first released:

The built-in vector gl_WorkGroupSize can be specialized using special layout local_size_{xyz}_id's applied to the "in" qualifier. For example:
layout(local_size_x_id = 18, local_size_z_id = 19) in;
This leaves gl_WorkGroupSize.y as a non-specialization constant, with gl_WorkGroupSize being a partially specialized vector. Its x and z components can be later specialized using the ID's 18 and 19.

https://github.com/KhronosGroup/GLSL/blob/3e0d9a3b3f54651ef53d533392a7401a3b19e16d/extensions/khr/GL_KHR_vulkan_glsl.txt#L192

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions