Skip to content

fix: avoid workgroupUniformLoad on atomic type for iOS WGSL compatibility#8552

Merged
mvaligursky merged 1 commit intomainfrom
mv-fix-ios-wgsl-atomic
Mar 25, 2026
Merged

fix: avoid workgroupUniformLoad on atomic type for iOS WGSL compatibility#8552
mvaligursky merged 1 commit intomainfrom
mv-fix-ios-wgsl-atomic

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

@mvaligursky mvaligursky commented Mar 25, 2026

iOS Safari/WebKit's WGSL compiler strictly enforces that workgroupUniformLoad requires a concrete plain type, rejecting atomic<u32> with the error 'atomic<u32>' cannot be used as the type of a 'let'. Other platforms (macOS, Windows, Android) are more lenient and accept this.

Changes:

  • Add a non-atomic var<workgroup> doneCountShared: u32 intermediary variable in both compute rasterize shaders
  • After the barrier ensuring all atomicAdd calls are complete, thread 0 copies the atomic value into the plain variable via atomicLoad
  • All threads then read the value via workgroupUniformLoad on the plain u32, which satisfies both iOS (plain type requirement) and the WGSL uniformity analysis (uniform return value)
  • Applied to compute-gsplat-tile-rasterize and compute-gsplat-local-rasterize

…lity

iOS Safari/WebKit strictly enforces that workgroupUniformLoad requires a
concrete plain type, rejecting atomic<u32>. Other platforms are lenient.

Use a non-atomic workgroup intermediary: thread 0 copies the atomic value
into a plain u32 after a barrier, then all threads read it via
workgroupUniformLoad on the plain variable.

Made-with: Cursor
@mvaligursky mvaligursky self-assigned this Mar 25, 2026
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Mar 25, 2026
@mvaligursky mvaligursky merged commit bfb0b13 into main Mar 25, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-fix-ios-wgsl-atomic branch March 25, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant