Skip to content

GPU Web 2025‐11‐04 WGSL

Jim Blandy edited this page Jan 10, 2026 · 3 revisions

Attendance

WIP, the list of all the people invited to the meeting. In bold, the people that have been seen in the meeting:

  • Apple
    • Mike Wyrzykowski
  • Google
    • Alan Baker
    • Dan Sinclair
    • David Neto
    • James Price
    • Peter McNeeley
    • Ryan Harrison
  • Microsoft
    • Rafael Cintron
  • Mozilla
    • Jim Blandy
  • WESL
    • Stefan Brandmair (Stefnotch)

Administrivia

  • November 11, 2025 (next Tuesday) is a holiday in the US, so we should plan our next meeting for November 18.
  • Tuesday, November 25, 2025 is not a holiday, but US Thanksgiving is that Thursday
  • [bindless] Add the proposed WGSL additions #5380
    • JimB: procedural question: I expect Corentin to put bindless on the agenda for the next API meeting. It seems to me that the WGSL features are tightly connected to the rest of the bindless design, so the conversation will be easiest if we don’t split it across two committees, and we should actually cover both WGSL and API bindless stuff in the API meetings.
    • DS: Does that mean filterable/non-filterable as well?
    • JimB: Expect to keep that here.
  • Today’s agenda is a bit thin, but I wanted to give members time to read #5423 thoroughly.

FYIs and notable offline merges

  • Add buffer-view proposal (#5400)
  • Language feature for relaxing uniform address space layout (#5347)
  • Subgroup_id (#5416) and cts (#4487)

⏳ Timeboxes (until XX:20)

WGSL Proposal for fragment depth (less, greater, any) #5342

  • JB: THis is a proposal PR. Looks like lots of details, want to have the bar for proposals to be low. CW commented, DS involved in discussion.
  • DS: One question from Jasper, seems like it will be >= <= everywhere, Metal was unclear but Mike says Metal is >= <= everywhere. Question of is this still useful if you cannot do early fragment tests? Sounds like yes based on recent comments from others. Recommend that we change the names just to be clear. So think we can land the proposal and try testing it out.
  • MW: <thumbs up>
  • DS: Yes, merge proposal
  • RESOLVED: accept as proposal

WGSL: support atomics on f32 (in workgroup and storage buffer) #4894

  • DN: Have atomics for unsigned numbers, also on platforms support for atomic add for floating point numbers. Had comment showing you could do it with bitcast and loop. True if you have forward progress guarantees. Imagine shader author writes with atomic add from 2 invocations. If in backend in loop with bitcast and retry then implicitly relying on one make progress far enough so they "win" the lottery. So, the polyfill is dubious when youd on't have forward progress guarantee, and those forward progress guarantees are the wild west. Functionally looks like it works, probably works, but a bit of a bug-a-boo. Channeling remindings from AB that things arent' as they seem.
  • JB: So condition is simply that hte atomic-compare-exchange-weak returns false on all invocations?
  • DN: Or you get interleaving for one succeeding on one iteration, then other succeeds and they race and it doesn't work. Think there is a combination of moves that gets you starved, so both sides see stale data. Ping-poing is worst schedule. With atomic FAdd, straight line code where one "wins" and finishes and the other then runs. But ping-pong'g would get you hosed. So, maybe not forward progress bug bad scheduling
  • AB: Similar to a spinlock. Need scheduling between threads to get this right. Can point to papers. There are some classic algorithms with fair scheduling and atomic spin lock is one, message passing is another one.
  • JB: So, if can't polyfil, can still provide as an enable feature, just not as a language feature. Guess we could provide as an enable and then if it turns out we are able to do a polyfil we could enable it everywhere (promote to language feature)
  • MW: think we should do as suggested and don't see any issues with that.
  • JB: Agreed to at least do an enable, so next step is PR?
  • DN: Yea, not very involved from spec perspective. F32 is more commonly supported then f16. Would just do f32 one. Have to check what functions are supported, add/min/max are common cluster i believe.
  • AB: SPIR did those in different extensions. Someone needs to collect features on platforms and see what implementations need for each one. Should list hardware feature.
  • DS: Proposal doc then?
  • AB/DN: Makes sense
  • RESOLUTION: Move forward with a proposal doc which lists available features

⚖️ Discussions

Specify immediate data API and WGSL <immediate> address space #5423

  • JB: PR for specifying immediate data. Understanding is this is a popular thing in graphics APIS. Think a lot of graphics folks would be happy if it was in the API and shipped. So, looks like most of the conversation has been Kai.
  • DN: This is a way of getting constant data into shader that is uniform. Popular because it's fast, fewer indirections. Because it's fast, it's tiny. Feature allows a single variable in the "immediate" address space which is declared at module scope, it's uniform. From a WGSL perspective, slides in with other addres spaces. Most restrictions are API side. Make sure data gets in (api call) part of the binding pipeline descriptor to say space size. Validation for space side on api side covers the variable in the WGSL shader. Single immediate space of memory used for all the shaders in a given pipeline (unified model). THere is some validation about which 32-bit words have to be set in order to supply data. Don't have to write padding. Discussion about the imprecision of padding bytes. We dont' define padding or the inverse in a structure. Kind of implied. We could/recommend cleaning that up after this lands. Otherwise, editorial feedback. TLDR; fast uniform data access in shader.
  • JB: Restriction against arrays, no arrays in the value, not even in struct. Is the reason that the platform level instructions for accessing odn't allow dynamic offsets?
  • AB: Vulkan has a restriction that it's dynamically uniform
  • JB: Do mention the WGSL out of bounds rules, if there are no arrays then that only applies to vectors and matrices. So, guess what's going on is the WebGPU backend needs to lift dynamic indexing of vectors and matrices in the immediate data into something. LIfting to a variable and indexing into that or something
  • DN: That sounds right. Saw out of bounds doesn't really apply but you're right vector and matrices does exercise that.
  • JB: Otherwise, editorial comments. Only remaining interesting thing is question of render bundles. Way it's specified that after bundle runs the immediate data is considered uninitialized. Chose that because it's the most restrictive and easiest to implement. If decide later due to render bundle transparency can consider relaxing this restriction. Want to start most restrictive and allow more over time. What is the status of this for CTS implementation and Dawn implementation.
  • DS: Think the implementation is done, modulo bug fixes. We use this mechanism to pass side channel data for Dawn. Don’t think CTS is started.
  • JB: Precedent I have in mind, when talking about subgroup_id, we said it looks good, and is accepted but wait for CTS before merging to main. Think the same reasoning applies here. Want to make sure we have CTS passing and the benefit from CTS before going ahead and shipping. MW has comment would prefer not using enable as it can be supported or emulated everywhere.
  • DN: On WGSL side because it's a new feature we want enable or feature so we can write skipping conformance tests. Agree with MW that this should be everywhere, question in my mind is emulation steals uniform buffer slot, do we worry or need wording in API that the limits possibly get eaten into. Not a language concern, but an API concern.
  • JB: So as far as WGSL is concerned … ok. How does this pr phrase it now, just no extension at all? Ok, seems like a good thing to fix.
  • MW: Perhaps an issue for API meeting. Seems the only backend which doesn't support it is metal and there are ways to do it without taking a buffer slot (probably outside the scope of this meeting)
  • JB: Then not a lot of discussion for this meeting. So, resolved on language extension?
  • MW: <thumbs up>
  • DN: That's my preference
  • JB: Mozilla is thumbs up.
  • RESOLUTION: Make it a language extension, PR is good, needs CTS before landing PR

Clone this wiki locally