Skip to content

Uniformity annotations for global variables #1791

@RobinMorisset

Description

@RobinMorisset

The uniformity analysis (still under discussion, see #1571) treats all accesses to global variables as non-uniform.

If I understood @kvark right, Naga currently uses global variables that always contain uniform data when compiling some builtins from SPIRV. It would be quite easy to support this use case by providing an annotation that could be added to these variables.

It would be trivial for the analysis to use these annotations:

  • Verify that any store to such a variable is of a uniform value (and in uniform control-flow)
  • Assume that every read from such a variable sees a uniform value.

Such annotations may also be useful for programmers outside of Naga, so I'd rather have them as something supported in the spec than as a Naga-specific hack.

I have no opinion on the syntax that would be best for them. The simplest might be an attribute [AlwaysUniformValue] or something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    uniformityIssues / discussions around uniformity analysiswgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions