Skip to content

NonUniform decoration support #148

Open

Description

@Firestar99

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.

Activity

  1. Firestar99 commented on Dec 26, 2024

    @Firestar99
    MemberAuthor

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

  2. added a commit that references this issue on Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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