You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Some WebGPU storage classes are mismatched/invalid #10145
Simple e2e repro, and I'm also adding a lit test hitting this in #10134:
iree-compile tests/e2e/xla_ops/reduce.mlir -o /dev/null --iree-input-type=mhlo --iree-hal-target-backends=webgpu
...
Tint reported 1 error(s) for a SPIR-V program, see diagnostics:
error: cannot initialize let of type 'ptr<storage, u32, read>' with value of type 'ptr<storage, u32, read_write>'
One idea was to restore the "memory access" attributes to our interface bindings across flow->stream->hal (see #7734). Looking at the sort of IR that triggers this, I'm also skeptical of the map-memref-spirv-storage-class pass and how that ends up being used via SPIR-V -> WGSL. Is this unique to codegen, or an issue in flow/stream/hal?
I'm trying to narrow down where the working and broken programs are differing, and I think it's in implicit / inferred storage classes, since what's explicitly included in the .spvasm files seems pretty similar. Tint has some code like DefaultAccessForStorageClass(), and I imagine there is some analysis of reads and writes that is being ran if we aren't explicit (but I haven't traced through the code to see where that's all happening).
I could go through and add back the memory access attributes across IREE's dialects, but I first want to pin down how our generated spirv should change (then work backwards from that through the dialects).
Yeah the above error seems to indicate there are deduction logic inside Tint that should be improved. Those NonWritable/NonReadable is not required for SPIR-V to be valid. Though we can certainly add them using a pass if it helps address the issue; that's not very hard. SPIR-V has this goal of trying to do analysis offline and "attach" the results to avoid driver compilers spending cycles doing that, this actually matches that. (Though driver compilers may not necessary believe in what's coming from the original SPIR-V, so yeah, hard to see the exact effect..)
I can try manually adding decorations to the .spvasm that I've been testing with to see if Tint prefers that (thankfully we can hack at IR and dumped files and run passes / tools in isolation - we don't need to jump straight to writing compiler code to test these theories).
Activity
ScottTodd commentedon Aug 22, 2022
I'm trying to narrow down where the working and broken programs are differing, and I think it's in implicit / inferred storage classes, since what's explicitly included in the .spvasm files seems pretty similar. Tint has some code like
DefaultAccessForStorageClass(), and I imagine there is some analysis of reads and writes that is being ran if we aren't explicit (but I haven't traced through the code to see where that's all happening).Should we be passing through the
NonWritable/NonReadabledecorations?https://registry.khronos.org/SPIR-V/specs/1.0/SPIRV.html#_a_id_decoration_a_decoration
I could go through and add back the memory access attributes across IREE's dialects, but I first want to pin down how our generated spirv should change (then work backwards from that through the dialects).
benvanik commentedon Aug 22, 2022
+1 to digging in, and those decorations would be nice. We'll need access info anyway for the host side as we need to define the access type on the binding: https://www.w3.org/TR/webgpu/#enumdef-gpubufferbindingtype needs
read-only-storageorstorageand it's used for making implementations aware of data hazards.antiagainst commentedon Aug 22, 2022
Yeah the above error seems to indicate there are deduction logic inside Tint that should be improved. Those
NonWritable/NonReadableis not required for SPIR-V to be valid. Though we can certainly add them using a pass if it helps address the issue; that's not very hard. SPIR-V has this goal of trying to do analysis offline and "attach" the results to avoid driver compilers spending cycles doing that, this actually matches that. (Though driver compilers may not necessary believe in what's coming from the original SPIR-V, so yeah, hard to see the exact effect..)ScottTodd commentedon Aug 22, 2022
I see some similar looking issues filed on Tint: https://bugs.chromium.org/p/tint/issues/list?q=storage&can=2
I can try manually adding decorations to the .spvasm that I've been testing with to see if Tint prefers that (thankfully we can hack at IR and dumped files and run passes / tools in isolation - we don't need to jump straight to writing compiler code to test these theories).
dneto0 commentedon Aug 23, 2022
Looking quickly at the SPIR-V assembly, this looks like a Tint bug. The wrong type is being deduced for the pointer for that
letdneto0 commentedon Aug 23, 2022
This is https://crbug.com/tint/1041
We've let that go dormant.
ScottTodd commentedon Aug 23, 2022
Ah, nice find, and thanks for looking :)
Can I work around this somehow? I'm fine with making edits to Tint's source for hacking, mostly looking to flush out what else might be blocking us.
Update Tint and enable passing WGSL/WebGPU memory access test. (#10888)
Update Tint and enable passing WGSL/WebGPU memory access test. (iree-…