Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workgroup size from spec constant #150

Open
Firestar99 opened this issue Nov 18, 2024 · 0 comments
Open

Workgroup size from spec constant #150

Firestar99 opened this issue Nov 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Firestar99
Copy link
Member

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

@Firestar99 Firestar99 added the enhancement New feature or request label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant