Rust-GPU / Rust-GPU/rust-gpu

`NonUniform` decoration support

Open
#148 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating the existing decoration and descriptor-indexing handling in the Rust-GPU compiler, then clarify the intended uniformity semantics and how support should be validated across workgroup and subgroup invocations.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.