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

NonUniform decoration support #148

Open
Firestar99 opened this issue Nov 18, 2024 · 1 comment
Open

NonUniform decoration support #148

Firestar99 opened this issue Nov 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Firestar99
Copy link
Member

Add support for the NonUniform decoration, allowing invocations within a workgroup (or subgroup) to access an array of descriptors using different indices.

I'd suggest that any indexing of descriptors should by default be NonUniform, and that the guarantee of uniformity should be an unsafe opt-in, to guarantee the code at the very least always works. Contrary to the current situation on glsl, where the guarantee of uniformity is the default and you have to opt-out of it using nonUniformExt().

One could also make a pass to automatically figure out which accesses are guaranteed to be uniform and remove the NonUniform Decoration. However, looking at how the IHV implement it, I question if making such a pass would actually bring any improvement (afaik):

  • Nvidia: NonUniform doesn't make a difference on their cards, I assume every access is always NonUniform.
  • Intel: I've heard that it also shouldn't make any difference, like Nvidia.
  • AMD: NonUniform is implemented with a uniform loop where each unique index within the subgroup is accessed one after the other. This is most likely quite slow, however, AMD is also really good in figuring out which instructions are uniform across the workgroup, due to them having dedicated scalar registers and a dedicated scalar unit for scalar operations. So the driver should eliminate unnecessary NonUniform accesses anyway, as it wants to optimize them from vector into scalar / uniform loads.

These statements are all afaik and I've done no actual testing.

@Firestar99 Firestar99 added the enhancement New feature or request label Nov 18, 2024
@Firestar99
Copy link
Member Author

I've made a branch where every access is annotated with NonUniform, in case anyone needs this right now: #177

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