News for hackers. Stuff that matters.
Re:WebAssembly: The New Kubernetes? by j-pb on Friday January 21, 2022 @05:16AM (#30021554)
> It’s designed to be efficiently implemented on top of the vendor APIs, so platform vendors can’t block it.

Their choice of inventing their own shading language instead of using the ONE standard that the industry finally could agree on (SPIRV) makes me very pessimistic.

Apple is purposefully crippling stuff to retain their App dominance yes, but Apple IS a major part of WebGPU. So it never had a chance and was doomed to fail from the very begining.

Google even had a presentation titled "regaining developer trust" on this topic, but WebGPU continued to push WGSL nevertheless.

Re:WebAssembly: The New Kubernetes? by the_duke on Friday January 21, 2022 @05:53AM (#30021842)
As the draft says [1]:

> Trivially convertable to SPIR-V

> Constructs are defined as normative references to their [SPIR-V] counterparts

> All features in WGSL are directly translatable to [SPIR-V]

> Features and semantics are exactly the ones of [SPIR-V]

> Each item in this spec must provide the mapping to [SPIR-V] for the construct

So WGSL is essentially just an alternative representation for SPIR-V.

But I don't see how this compromises the viability of webgpu.

[1] https://www.w3.org/TR/WGSL

Re:WebAssembly: The New Kubernetes? by j-pb on Friday January 21, 2022 @08:27AM (#30023171)
That was the original sales pitch which has been abandoned in favour of "Lets make a Rust-like language for shaders!".

It's a textbook case of: Embrace, Extend, Extinguish

Google tried to save it, but that proposal was rejected: https://docs.google.com/presentation/d/1ybmnmmzsZZTA0Y9awTDU...

The Proposal to work with both WGSL, was also not accepted because it would "weaken the position of WGSL".

"But think of the children/open web!"

Apple knows how to push the right buttons on the Mozilla folks so that they tag along: Rust, wEB-StAnDARds, not invented here.

- SPIRV was done by an evil technological group, not an open and inclusive standard body. We would tie our standard to whatever the SPRIV says, that's not open web. The open web can only flourish if everything is text based! cough WASM cough Rust ist such a modern language! -

It's similar to what happened to WebSQL, except this time it's much worse as it also ruins any hope that WASM might be able to replace all the other technological cruft. Playing the old guessing game of how the transpiler will mangle your SPIRV is simply not something that people want to go back to.

Re:WebAssembly: The New Kubernetes? by the_duke on Friday January 21, 2022 @08:39AM (#30023284)
I'm a bit confused.

The draft was just updated two days ago.

Are you saying that the direct mapping requirements I quoted above have been abandoned?

Re:WebAssembly: The New Kubernetes? by j-pb on Friday January 21, 2022 @08:58AM (#30023517)
> Are you saying that the direct mapping requirements I quoted above have been abandoned?

Yes.

See these quotes:

Apple: "Having an isolated focus on SPIR-V is not a good perspective, we have MSL etc. to consider too"

...

Apple: "Extreme A is no interaction with SPIRV?, extreme B is very tightly coupled to SPIRV, we should find a middle point"

...

Google: "We take all targets into consideration. We can allow developers do runtime probing and maybe branch according to that. Optimization occurs in existence of uncertainty. Dealing with fuzziness is a fact of life and we should give the tools to developers to determine in runtime."

From https://docs.google.com/document/d/15Pi1fYzr5F-aP92mosOLtRL4...

See also:

https://github.com/gpuweb/gpuweb/pull/599

https://github.com/gpuweb/gpuweb/issues/582

https://github.com/gpuweb/gpuweb/issues/566

http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html

https://github.com/gpuweb/gpuweb/issues/847#issuecomment-642...

https://news.ycombinator.com/item?id=24858172

The process has been very implementation driven, with Naga, the Rust tooling that does the whole conversion shenanigans, growing and changing its IR and semantics steadily. It's ironic that a group that is usually very adverse to having a single implementation of things is now pointing to Naga and arguing that we don't need an easy conversion step because we have all the compiler infrastructure build already.

The group has slowly redefined "bijective" to mean "easily compilable", which would be pretty hilarious, if it weren't so sad.

Re:WebAssembly: The New Kubernetes? by codeflo on Friday January 21, 2022 @07:10PM (#30031660)
I agree Apple is the bad guy here and even the public discussions were a clown show, who knows how much worse it was behind closed doors. But I’d rather have an inelegant standard than none at all, and I think the problems with WGSL can be worked around.
Re:WebAssembly: The New Kubernetes? by kaba0 on Friday January 21, 2022 @06:31AM (#30022108)
Without much experience in the topic, why was the “de facto standard” SPIR-V was not chosen then instead? If they are so similar, is there any advantage of a new format?
Re:WebAssembly: The New Kubernetes? by codeflo on Friday January 21, 2022 @07:19AM (#30022406)
Here’s a comment summarizing the official rationale: https://github.com/gpuweb/gpuweb/issues/847#issuecomment-642...

TBH, I don’t find those arguments convincing, but then, WebGPU is largely a political compromise, not a technical one. In a politics-free zone, they’d have standardized a “WebVulkan”, not made an entirely new thing. That would have been on the table, but Apple vetoed it. The same for a “Web-SPIR-V”.

However, I also don’t think it’s that big of a deal in the grand scheme of things. I’m glad we have a viable standard at all.

Re:WebAssembly: The New Kubernetes? by krona on Friday January 21, 2022 @05:35AM (#30021715)
SPIR-V is an intermediate representation and WSGL compiles to it. WSGL is (or will eventually be) a w3c specification.

I fail to see where your point about trust fits in to that.

Re:WebAssembly: The New Kubernetes? by j-pb on Friday January 21, 2022 @08:34AM (#30023233)
Apple + Mozilla did a bait and switch on developers in a textbook case of: Embrace, Extend, Extinguish

The original google proposal was to simply use SPIRV. A compromise was then settled for the intermediary language to be isomorphic to SPIRV, removing some of the warts and edges of it and make verification easier.

However, Apple with the help of the Mozilla folk successfully managed to twist the semantics into something that is no longer easy to translate from and to.

Game developers don't want to work with WSGL, the whole point of the new WASM and WASI ecosystem is to allow devs to bring their own tools.

This is especially bad for something like a shader language, where you want to squeeze every bit of performance out of the hardware, often with hand rolled instructions. Having the browser run a mangled version of the SPIRV that you or your toolchain/engine e.t.c. produced is simply not acceptable.