Add ReplacePushConstants pass for WebGPU.
WebGPU does not (today) support push constants, so we plan on emulating them using storage buffer bindings. This is the compiler side of that work - it replaces hal.interface.constant.load ops with hal.interface.binding.subspan ops. The actual HAL pipeline layouts are unchanged (so they will still include push_constants = 1).
This should fix errors like error: unknown SPIR-V storage class: 9SPIR-V pointer type with ID 6 has invalid storage class 9.
Here's a diff of some generated .spvasm files for unidirectional_lstm.mlir:
(raw files here: https://gist.github.com/ScottTodd/713a464e8a1c8af6ebd2a66db9348370)
Ill look in detail, but dont you also need to update the
hal.executable.variantto reflect the new sets?
My understanding is that the pipeline layouts will still mention push constants as before, then the WebGPU HAL will understand that the push constants are actually using buffer bindings (at least - that's how @benvanik has it implemented in the HAL right now AFAICT). I'm not sure if it would be better to fully remove the concept of push constants instead.
Correct - the runtime still sees push constants as a way to build the argument buffers and doesn't know about the hidden runtime buffer. Incidentally this is how we'd add support for printf and such in dispatches as well (runtime inserts a binding to append string contents into but from the vmfb perspective it's not there).