Uniformity Analysis in the WebGPU Shading Language
James Lee-Jones, John Wickerson, Alastair F. Donaldson
Abstract
The WebGPU programming model brings general-purpose GPU programming to the web, allowing untrusted JavaScript to issue parallel workloads to client GPUs. To ensure reliability, WebGPU mandates uniformity analysis —a static check that rejects programs that could cause barrier divergence , a GPU control-flow error that can hang execution and require OS-level recovery. While traditional GPU models treat barrier divergence as undefined behaviour, WebGPU’s need for safety and reliability makes this unacceptable. We present the first comprehensive formal and practical study of uniformity analysis in WebGPU, identifying four key issues and making corresponding contributions: (1) Lack of definition: The analysis currently defines non-uniform programs only as those it rejects, without an independent notion of barrier divergence. We provide an operational semantics for TinyWGSL, a core calculus of the WebGPU Shading Language (WGSL), developed in consultation with WGSL specification editors and implementers. This semantics rigorously defines barrier divergence in the context of WGSL for the first time. (2) Complex specification: The current description of uniformity analysis in WGSL is lengthy and imprecise. We reformulate it via concise formal rules for TinyWGSL and argue their soundness with respect to our semantics. (3) Lack of soundness and precision: Using our semantics, we expose soundness and precision flaws in the analysis as presented in the WGSL specification. In response, we have proposed four significant changes to the specification (all accepted). (4) Testing difficulty: The complex, semi-formal definition of uniformity in the WGSL specification makes it hard to test implementations. We mechanise uniformity analysis in Alloy and use Alloy’s test generation to stress-test the Chromium implementation, revealing specification–implementation discrepancies and a bug in the Chromium implementation. Overall, our work resolves an important GPU programming problem (rigorously defining barrier divergence), brings an interesting new analysis to the attention of the PL community, and demonstrates the impact of applying formal PL techniques to an important industrial language specification.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext a1b002ee-62f4-4222-87e8-9b2e5822995aBuilds on6
- Specifying and testing GPU workgroup progress modelsTyler Sorensen, Lucas F. Salvador, Harmit Raval, Hugues Evrard et al.OOPSLA 2021 · 11 citations
- An abstract interpretation for SPMD divergence on reducible control flow graphsJulian Rosemann, Simon Moll, Sebastian HackPOPL 2021 · 8 citations
- Towards Unified Analysis of GPU ConsistencyHaining Tong, Natalia Gavrilenko, Hernán Ponce de León, Keijo HeljankoASPLOS 2024 · 5 citations
- Taking Back Control in an Intermediate Representation for GPU ComputingVasileios Klimis, Jack Clark, Alan Baker, David Neto et al.POPL 2023 · 5 citations
- SafeRace: Assessing and Addressing WebGPU Memory Safety in the Presence of Data RacesReese Levine, Ashley Lee, Neha Abbas, Kyle Little et al.OOPSLA 2025 · 3 citations
Related papers
- Program Reconditioning: Avoiding Undefined Behaviour When Finding and Reducing Compiler BugsBastien Lecoeur, Hasan Mohsin, Alastair F. DonaldsonPLDI 2023 · 15 citations
- DarthShader: Fuzzing WebGPU Shader Translators & CompilersLukas Bernhard, Nico Schiller, Moritz Schloegel, Nils Bars et al.CCS 2024 · 3 citations
- GL2GPU: Accelerating WebGL Applications via Dynamic API Translation to WebGPUYudong Han, Weichen Bi, Ruibo An, Deyu Tian et al.WWW 2025 · 3 citations
- SIMT-Step Execution: A Flexible Operational Semantics for GPU Subgroup BehaviorZheyuan Chen, Naomi Rehman, Guido Martínez, Tyler SorensenPLDI 2026 · 2 citations
- Descend: A Safe GPU Systems Programming LanguageBastian Köpcke, Sergei Gorlatch, Michel SteuwerPLDI 2024 · 7 citations
