News for hackers. Stuff that matters.
Re:WebAssembly: The New Kubernetes? by samwillis on Friday January 21, 2022 @04:09AM (#30021022)
WASM being the “new k8s” is only one small fragment of where it is going to go. I think there is a good chance it’s going to become the defacto deployment target for a lot of software, so in addition to browser and server:

- Plugins for desktop/mobile apps, wasm provides a nicely sandboxed environment for them.

- Gaming, the combination of WASM and WebGPU will be the perfect platform for cross platform game development. I could see Steam, for example, creating their own runtime.

- Embedded electronics, simplifying the development and deployment of IoT devices.

When it comes to wasm on the server, it’s often talked about as targeting the “edge”. I believe this the next area of massive growth, however the part that I don’t think is fully solved yet is on the database side. If your server app is making multiple database calls from the edge to a central db there is a good chance that it will slower than a traditional (single location) deployment.

What’s needed is a edge first database, we need at least read replicas to be at the edge with your app. Fly.io have something like this with their Postgres’s product. The alternative is to use an eventually consistent db such as CouchBD, but that causes other problems. I’m interested to see if CloudFlare do anything in this area as it’s the part of their stack that’s missing.

Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @06:02AM (#30021915)
> Gaming, the combination of WASM and WebGPU will be the perfect platform for cross platform game development.

That storm already happened. It was called Unity. And since then others have joined, like Unreal.

WASM + WebGPU doesn't bring anything to the table here other than being a decade late, slower, and with fewer features. Why would anything outside of a web app touch any of it? Why would steam bother? You still have to build so, so much platform-specific stuff to make it work (input, audio, windowing, etc...), why would you do all that and then just pay a massive performance overhead to avoid compiling a whopping ~5 times?

WebGPU could potentially see a use as a middleware for things that want to use the GPU but aren't concerned all that much about performance or overhead, things like image filter effects. But there's also no shortage of existing solutions for them, either, like bgfx (as well as domain-specific offerings like halide of course)

Re:WebAssembly: The New Kubernetes? by truemotive on Friday January 21, 2022 @07:21AM (#30022423)
You left out the part where running WebGL via Unity was an absolute nightmare, and was fudged in as a stopgap when NPAPI was deprecated and there was no more Flash web player target. Barring that, before you even got the build up on the web you got to sit through 20 minutes of emscripten and wasm magic compiling, hoping and praying you considered any bridging methods to .Net from the frontend that don’t appear until they’re useless emscripten errors in the unity console. Oh, you’d like audio/video comms in your product? Well, hope you’re ready to build the non-supported WebGL compatible version of Photon/Agora’s voice subsystems.

Don’t get me wrong, I’m card carrying Unityman and just backed off of XR development recently in favor of more stable webdev work… but WebGL as a solution to high-performance browser gaming was an absolute shitshow from start to finish and I’m not even sure WebGPU lands in time for anything useful to be done with it to deprecate WebGL “support”. I assume that the lightweight 3D solutions based on threejs, etc. are going to drag the rest of the game engine industry kicking and screaming into whatever best solution arises and this wasm-as-k8s sounds like a neat component of that.

Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @07:33AM (#30022517)
I meant Unity already solved the "make creating a cross platform game trivial" thing.

Games on the web face far greater issues than WASM or WebGPU can solve (like a complete lack of an asset delivery pipeline), unless you're only after casual flash-style gaming anyway. But mobile largely replaced that market.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @09:53AM (#30024260)
Installing a native unity game requires more trust than running a game in a web browser. Web browser games would also work on platforms like Chromebooks, and don't require Google's or Apple's store approval, with their 30% cut.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @10:37AM (#30024973)
And where are you going to get your game assets from? Are you going to try and stream those over the network? Good luck with that. Or are you going to show a long loading screen as you try and fight with local storage limits to prefetch all your assets?

To give you a scope of the problem of game assets, "small" indie games like Stardew Valley or Terraria are close to 500MB. How on earth are you going to deploy that on the web?

And if you are assuming a reliable, super-fast internet connection to stream game assets over (along with paying for the CDN to host it), well cloud gaming already does this better and already exists in a meaningful way. Why struggle to fight with the incredibly pathetic limits of a web browser when you can just stream a video?

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @10:55AM (#30025259)
>"small" indie games like Stardew Valley or Terraria are close to 500MB. How on earth are you going to deploy that on the web?

With lazy loading? Or just an installation progress bar. What's the problem? The user has to click on the permissions dialog, allowing extended space usage, and that's it.

>reliable, super-fast internet connection

It wouldn't need a connection more reliable than what Steam requires for proper functioning.

>along with paying for the CDN to host it

I assure you the costs for a minimally successful game are minuscule when compared to the 30% cut Steam takes.

What you lose is the exposure that a release on a store like Steam gives you. That's not an insignificant problem, and is much more problematic than all the technical stuff you've mentioned.

>Why struggle to fight with the incredibly pathetic limits of a web browser when you can just stream a video?

Answered in a different comment.

Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @12:01PM (#30026329)
> With lazy loading?

And now you're back to 2006 era performance on a good day. 72 Mbit/s would be considered a pretty good internet connection. It's also the speed of a PS3's blu-ray drive.

People have been complaining about the 80-100MB/s on the outgoing generation of consoles for a long time now. Regressing by ~10x isn't a compelling argument.

> Or just an installation progress bar. What's the problem?

Without background downloads or updates? Every time someone wants to play your game, they're forced to stare at a progress bar that can easily take upwards of an hour depending on the game ("smaller" 3d games like subnautica push 10GB)? And you somehow don't see the problem?

> I assure you the costs for a minimally successful game are minuscule when compared to the 30% cut Steam takes.

And I assure you that you don't have to deploy on steam, either. You can both be a native game and get all the benefits of it and not pay anyone an app store fee! You don't have to suffer the web's treadmill of being a decade+ behind to have that.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @02:42PM (#30028934)
>Regressing by ~10x isn't a compelling argument.

If it's loading faster than user "consumes" assets, it doesn't matter how fast it is. It's not different for native games that allow you to play earlier than the whole thing finishes downloading.

>And you somehow don't see the problem?

Don't stupidly update the entire thing every time? Send deltas? Don't update as often? As for not having background updates it's a minor issue anyway (I for example don't start Steam unless I'm going to play), and there are Progressive Web Apps and Service workers to solve this issue.

>You don't have to suffer the web's treadmill of being a decade+ behind to have that.

Whoever needs the latest features can of course use a native platform. For developers who don't need the latest features or especially heavy graphics, WASM+WebGPU will be a viable option. That's all.

>You can both be a native game and get all the benefits of it and not pay anyone an app store fee!

And the user has to risk trusting me executing native code, which would definitely lower conversion rate.

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @05:47AM (#30035542)
You are missing the tiny detail that browsers are free to clean the cache any time they feel like, you as game developer have nothing to influence this, it is completely out of your hands as security measure not to bomb user's computers.
Re:WebAssembly: The New Kubernetes? by mr_toad on Friday January 21, 2022 @08:55PM (#30032396)
> With lazy loading?

AAA titles are already constrained by hard drive bandwidth, which is measured in Gbps on newer systems. They can’t keep all assets in memory. You’re going to have to have a top tier internet connection to get the same performance.

On top of that a browser thread can’t rely on having much more than half a gig of RAM assigned to it.

Re:WebAssembly: The New Kubernetes? by nullifidian on Saturday January 22, 2022 @05:22AM (#30035392)
Are you seriously considering AAA titles in a browser? Is that the benchmark WASM+WebGPU has to pass or otherwise it's worthless?

AAA titles are famously heavy in both GPU and CPU loads, and nobody is proposing to run them in a virtual machine, especially in the 32 bit one. ( memory64 is at the proposal stage)

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @05:54AM (#30035574)
They could start by matching Infinity Blade visuals, should be easy, it is a remarkable GL ES 2.0 game from 2010.
Re:WebAssembly: The New Kubernetes? by jacobolus on Friday January 21, 2022 @04:38PM (#30030333)
> To give you a scope of the problem of game assets, "small" indie games like Stardew Valley or Terraria are close to 500MB. How on earth are you going to deploy that on the web?

Someone watching YouTube videos is sucking down hundreds of megabytes if not gigabytes per hour: the higher-resolution the video the more bandwidth required. Most video game assets require less bandwidth (megabytes per minute of consumption time), and can be cached locally.

When designing games for the web, creators will have clear incentive to apply more aggressive compression to everything they send over the wire and figure out how to make do with smaller assets, to cut bandwidth. Games designed to be downloaded have a relaxed size budget and can afford plenty of inessential bloat.

Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @08:14PM (#30032112)
> Someone watching YouTube videos is sucking down hundreds of megabytes if not gigabytes per hour: the higher-resolution the video the more bandwidth required. Most video game assets require less bandwidth (megabytes per minute of consumption time), and can be cached locally.

This is completely incorrect. Games regularly saturate and are limited by the 80-100MB/s that can be streamed from a PS4 or Xbone hard drive. This is in fact the biggest differentiating feature of next gen consoles - the switch to NVME and even streaming directly from disk to the GPU, bypassing the CPU bottleneck.

Meanwhile YouTube video, and indeed most streaming video, is well under 10MB/s. Netflix is even content to only recommend 25mbit/s for 4k HDR content.

> Games designed to be downloaded have a relaxed size budget and can afford plenty of inessential bloat.

This is such an arrogant and asinine statement. Games already exclusively ship highly compressed assets. They aren't just pissing away storage space for the lulz, and if they only tried a little harder could somehow cut sizes to 1/1000th of what they are today. Especially not to satisfy the needs of a platform that provides nothing but problems and headaches.

You can't simultaneously claim that WASM and WebGPU will enable a new era of high quality web based games while just entirely ignoring all the actual problems with shipping games on the web. Which WASM and WebGPU literally solve none of the issues. WebGL2 is already competitive on feature set and capabilities with mobile, and yet casual web games are still largely dead - a regression from the flash era, even.

Re:WebAssembly: The New Kubernetes? by jacobolus on Friday January 21, 2022 @08:17PM (#30032127)
>> YouTube videos is sucking down hundreds of megabytes if not gigabytes per hour

> This is completely incorrect. [...] YouTube video, and indeed most streaming video, is well under 10MB/s.

10 MB/s is the same as 36 GB/hour. So we are in agreement.

But what game uses more than 36 GB of assets for 1 hour of play? I can’t imagine that is at all common. What kind of assets are they shipping that use that much data?

Re:WebAssembly: The New Kubernetes? by kllrnohj on Saturday January 22, 2022 @11:07AM (#30037842)
You don't understand what the phrase "well under" means, do you? It means less than. Videos use less than 10MB/s. Netflix estimates 1-7GB per hour. Games need to load that much data in under a minute. Games don't stream data over an hour, they need to load a world instantly and can then stream in things you don't see. It's those bursts that matter, as that's what players are stuck waiting on to complete before they can get back to playing.

Think of it as if video keyframes were 1GB. Video streaming wouldn't exist in such a world as nobody is going to watch a loading spinner for 20 minutes. No, it'd all be a world of pre-fetched, downloaded content. Which unsurprisingly is exactly how game stores & consoles work.

Here's some coverage of the storage architecture of new consoles and why it's such a big upgrade: https://www.anandtech.com/show/15848/storage-matters-xbox-ps...

Trying to shove lazy asset loading over the internet into that picture just doesn't work.

Re:WebAssembly: The New Kubernetes? by jacobolus on Saturday January 22, 2022 @09:55PM (#30043178)
> Netflix estimates 1-7GB per hour.

Yes, and my estimate was “hundreds of megabytes if not gigabytes per hour”. So apparently Netflix also agrees with me.

> Games need to load that much data in under a minute.

This is based on design decisions from the programmers, not some kind of iron law of nature. Obviously you can’t just drop a game designed for one set of constraints into an entirely different context without change and expect it to work precisely the same way.

Re:WebAssembly: The New Kubernetes? by kllrnohj on Sunday January 23, 2022 @10:45AM (#30046990)
> This is based on design decisions from the programmers, not some kind of iron law of nature.

No, it's based on that's what textures and model quality expectations are. Reducing that size is directly reducing image quality.

You can make a web based game that looks straight out of 2002, sure. But you can't make one that looks contemporary, and WASM+WebGPU aren't changing that.

And of course no game developer is going to bend over backwards and make their game look like shit so it can run in a web browser for no reason other than to satisfy the ridiculous beliefs of web evangelists.

Re:WebAssembly: The New Kubernetes? by mikewarot on Friday January 21, 2022 @09:55PM (#30032861)
>To give you a scope of the problem of game assets, "small" indie games like Stardew Valley or Terraria are close to 500MB. How on earth are you going to deploy that on the web?

A friend of mine just got 350 Mbps optical fiber to his house. I was wondering what would come along to eat up that kind of bandwidth, you just answered the question. Someone playing a game on the web could also be seeding the thing on bit-torrent at the same time, thus cutting down the hosting fees for the developer.

Re:WebAssembly: The New Kubernetes? by wbl on Friday January 21, 2022 @01:58PM (#30028287)
Back in the early 2000's you could deliver a fun immersive flash based game in under a megabyte. Sites like miniclip had dozens of games that could easily absorb several hours of fun.
Re:WebAssembly: The New Kubernetes? by nemothekid on Friday January 21, 2022 @02:32PM (#30028799)
1. Those types of games are still possible with HTML5.

2. The reason we don't see them anymore is because it's far easier to monetize them on mobile.

Re:WebAssembly: The New Kubernetes? by d13 on Saturday January 22, 2022 @04:20AM (#30035079)
I absolutely agree that this is 100% possible with HTML5, and the only we’re not seeing it happening on a massive scale is a because of a cultural blind spot - as evidence, most of the comments in this thread. The technologies we have now, like Phaser, are vastly superior for building games for the web than Flash ever was (I was a full time game developer for 10 years, and a full time HTML5 game developer now.) And I believe it’s actually easier to monetize these using Stripe than through an App Store. Your game lives on a URL, which is just click away, and paying for it is just one more click - this is about 10 seconds of work for a user. And, you control 100% of your business from production to distribution. There’s a huge pile of money lying on the table here for anyone who can see this.

An interesting article on the topic (not written by me): https://www.fortressofdoors.com/tag/instant-games/

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @05:56AM (#30035583)
Where is the Phaser designer that can match Flash tooling for the same purpose?
Re:WebAssembly: The New Kubernetes? by jaegerpicker on Friday January 21, 2022 @10:19AM (#30024664)
And Streaming games does that even better over WebRTC in the browser and we have that today! With a good internet connection (like 5g that is rolling out) the experience is fantastic. I bought my kids iPad Mini's for christmas, they have both 5g and we have 1gb internet at home and GeForce Now and XBox Cloud Gaming have been absolutely great for them. A ps5 controller and the ipad mini can be the best gaming device available today IMO.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @10:26AM (#30024780)
Streaming games is no different from distribution using a large platform/store with accompanying commissions -- you can't do it independently as a small company. Also more demanding towards one's internet connection and has higher running costs, since you have to pay for both traffic and a server side GPU, so not viable for a certain percentage of lower budget/cheaper/free games.
Re:WebAssembly: The New Kubernetes? by jaegerpicker on Friday January 21, 2022 @03:47PM (#30029775)
Almost no one can do game development as a small company without a large platform of some kind. The economies of scale are just too much for small indie dev style game studios to overcome. Speaking as someone that was an indie dev and has been around the game industry for 20 years. I highly doubt that is going to change anytime soon. Webassembly certainly won't fix that issue. I'm not sure what that comment has to do with the subject. With Webassembly you won't have to pay for server side gpu but you will have to pay for discovery, hosting/bandwidth, payment, likely some form of advertising, and some level of support. There is no free lunch and large platforms will nearly always win for software distribution.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @04:11PM (#30030059)
I'm not denying any of that, and said something similar in another comment. But Minecraft, Escape from Tarkov came into existence without dependence on a store or a platform. Same for Runescape, albeit in a different time. WASM+WebGPU will make an appearance of such things more possible in 2022+. It's just a technical capability. A web implementation (of an online game) could come in addition to the ones available on Steam and Android/Apple, etc.
Re:WebAssembly: The New Kubernetes? by sleepybrett on Friday January 21, 2022 @12:42PM (#30027037)
.. for money.
Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @09:54AM (#30024263)
3D on the Web is only good for online shops and trivial first generation playstation games.

3D API for 2010 hardware or last generation raytracing hardware, what do you prefer?

Unity cannot do anything against castrated 3D APIs.

No wonder streaming is where everyone is going instead.

Re:WebAssembly: The New Kubernetes? by echelon on Friday January 21, 2022 @10:34AM (#30024922)
> 3D on the Web is only good for online shops and trivial first generation playstation games.

That is absolutely not going to continue being the case.

> No wonder streaming is where everyone is going instead.

"Pixel streaming" is great if you don't have latency requirements or your client has a poor GPU, but otherwise native 3D is superior.

Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @10:36AM (#30024952)
Until WebGPU provides parity with native 3D, it is going to be the case no matter what.

Heck, 10 years of Web 3D and still there are no proper debugging tools that match native ones.

Re:WebAssembly: The New Kubernetes? by echelon on Friday January 21, 2022 @11:05AM (#30025392)
WASM is going to provide more than enough impetus for tooling.

The ecosystem will explode, and the tooling will come with it.

Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @01:17PM (#30027630)
The future is made of dreamers after all.
Re:WebAssembly: The New Kubernetes? by y4mi on Friday January 21, 2022 @06:40AM (#30022172)
To my knowledge (correct me if I'm wrong please), the performance issues from WASM only exist in the context of moving things back into the DOM. I was always of the understanding that WASM itself is super performant and if it's possible to run a WASM application without going through the DOM you'd get native performance, making it a valid choice for things like gaming.

Most devs would obviously still use unreal engine etc, but these engines will be able to give you improved performance of your games by utilizing WASM

Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @07:41AM (#30022614)
WASM gets you faster performance than JavaScript, sure, but it's not native, either. Sandboxing & byte code aren't free to have. See the extremely long history of existing byte code VMs here - WASM isn't really doing anything new.
Re:WebAssembly: The New Kubernetes? by manmal on Friday January 21, 2022 @07:50AM (#30022726)
Modern hypervisors have astonishing performance, and I don’t see why Chrome and Safari wouldn’t manage to eventually provide a similarly efficient implementation.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @08:46AM (#30023363)
Modern hypervisors don't run bytecode and are using the CPU to do security enforcement, not software emulating it like WASM is forced to do (since it's not using a hardware protection domain, aka a process)
Re:WebAssembly: The New Kubernetes? by paavohtl on Friday January 21, 2022 @03:00PM (#30029156)
WASM was explicitly designed to be easy to into native code. No production-ready WASM runtime is interpreting bytecode in hot code paths.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @04:17PM (#30030124)
Easy to convert to native code is very different from easy to convert to optimal native code. Just like WASM having performance as a design goal both doesn't mean they achieved it nor does it mean that it won when a compromise had to be made against other design goals like portability or security.

In fact I'm quite certain that whenever portability or security ran up against performance in WASM's design, that performance always lost. Those other two goals were definitely a higher priority for WASM's designers.

Stable, portable byte codes are always inherently lossy. Information that could be (and often is) useful to optimizers is lost in that conversion. Then the conversion from byte code to running code also is on the hot path - it's on the hot path of starting execution. This is the same problem existing byte code solutions face, like CLR & JVM. WASM didn't manage to magic a solution where nobody else had. It's the same thing that's been done to death, just with "web" slapped on the front of it & bundled in a browser. That part of "being in a browser" makes it interesting for web devs, sure, but in the broader context of "all of computing" it's... just not? It's what we already have had (and been using!) for decades.

Re:WebAssembly: The New Kubernetes? by Findecanor on Friday January 21, 2022 @06:22PM (#30031269)
For some server applications using WASM the biggest performance benefit is not really how fast it is running but how fast it is to start a new WASM instance compared to launching a new OS process.

However, I think it would be possible to make systems in which similar instances, because they are written in a type-safe, memory-safe language in the first place, could bypass WASM and both start up fast and run fast optimised code.

I have done some research on portable bytecodes, and have some novel ideas for getting more performance, but I agree that the inherent problem remains. One thing that help make optimised C/C++ fast is that optimisers assume that undefined behaviour doesn't get triggered. But in a system for portable code, you can't just assume - you'd have to prove that it can not exist to be able to do the same optimisations, and that is far from straightforward. And when it triggers, it has to work the same say, or it won't be portable (bug-compatible) between hardware.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @10:13AM (#30024545)
WASM is more secure than a hypervisor, since it prevents code injection.
Re:WebAssembly: The New Kubernetes? by eyberg on Friday January 21, 2022 @12:40PM (#30026991)
It is trivial to modify function pointers, implemented as indirect calls and "read-only" data in wasm.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @03:50PM (#30029820)
Yes, WASM in combination with an unsafe language is less secure than memory safe languages, but more secure than a hypervisor. You can also use WASM with a memory safe language.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @04:19PM (#30030146)
WASM is less secure than a regular process boundary, and far less secure than a hypervisor. I'm not sure where you're getting this from? Things like spectre mitigations in CPUs are not doing anything for the likes of WASM, after all, they only target process & ring boundaries. It's why you have to enable COOP and COEP to use thread with WASM - because the security for WASM's threads comes from the CPU enforcing process boundaries, not from WASM's sandbox.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @05:14PM (#30030662)
If we are concerned with leakage of user data available in your own web program, then unsafe WASM code is more secure than unsafe code in a hypervisor because it prevents RCE, which results in full control of the hypervisor environment, which also enables transient attacks against the host environment, if there are vulnerabilities in your hypervisor (previously hypervisors had to be patched for Spectre). If we are talking about host platform protection against arbitrary malicious code, information leakage from neighboring processes/tabs, WASM is no different from a process boundary, at least in chrome, because that's how it's implemented. It's an implementation detail independent of WASM. Could as well be implemented with hardware virtualization, but it would make interfacing with browser APIs more expensive, probably to the point of impracticality.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @06:58PM (#30031580)
Are you trying to say that code compiled with CFI is less vulnerable than code that wasn't? In which case sure, but that's entirely orthogonal to WASM. Code inside WASM isn't otherwise inherently protected. Code reuse attacks via indirect calls are still possible, as are of course side channel attacks and data leaks.

And since WASM uses linear memory and lacks things like ASLR, the code in the sandbox cannot achieve the same level of protection it could if it was in a hypervisor.

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @05:59AM (#30035600)
No need for RCE when data corruption suffices to change code paths.
Re:WebAssembly: The New Kubernetes? by eyberg on Friday January 21, 2022 @04:11PM (#30030055)
It doesn't matter if it's rust or not. You can still modify read only data and still redirect indirect calls. You can still modify the stack and the heap. Rust changes nothing.

Also, not sure where the comparison to a hypervisor is coming into play. As @kllrnohj mentioned hypervisors are relying on actual hardware.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @04:24PM (#30030191)
I'm not a rust expert, but I thought rust without unsafes should prevent such things at the compile time. C# and Java will be compiled into WASM differently, I believe no less securely than JVM or .NET. Having information leaks is still better than arbitrary code execution.
Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:01AM (#30035615)
No safe language in the world prevents anything if the attacker can change the binary contents, it is no longer the code produced by the compiler.

That is why we have signed binary execution to start with, WASM doesn't support any of this.

Re:WebAssembly: The New Kubernetes? by elevader on Friday January 21, 2022 @07:45AM (#30022677)
AFAIK you don't really get native performance, although it's hard to find good data on this (https://nickb.dev/blog/wasm-and-native-node-module-performan... was one I could find on the fly). WASM is still virtual machine based and not compiled to a native executable so this is to be expected I guess, it's supposed to be faster than JS and it achieves that goal. Maybe it can be an alternative to Unity, which would be good enough for a lot of games, but I don't know how that compares.
Re:WebAssembly: The New Kubernetes? by dathinab on Friday January 21, 2022 @08:16AM (#30023050)
> not compiled to a native executable

except it is, WASM is designed to be AOT compiled to native code.

Sure there is a bit of difference, WASM needs additional bounds checks and WASM also doesn't have all the info a more high level compiler has.

Now Unity is so much more then just a tool to make cross platform easier. So comparing it to WASM is kinda pointless IMHO. Though it probably is a grate choice for any extension mechanism, like mods or even in game scripting.

Re:WebAssembly: The New Kubernetes? by elevader on Friday January 21, 2022 @09:18AM (#30023777)
> except it is, WASM is designed to be AOT compiled to native code.

Interesting, I didn't know that. How does WASM handle different architectures? Do you build different binaries for x86/arm? Or does it do it the Apple way with the giant bundle that contains all binaries?

> Now Unity is so much more then just a tool to make cross platform easier. So comparing it to WASM is kinda pointless IMHO. Though it probably is a grate choice for any extension mechanism, like mods or even in game scripting.

Agreed, that was badly worded. Like you said, one could compare a module written in Unity and compiled to whatever Unity compiles to/is implemented in these days with a module in WASM.

Edit: Or does the AOT mean that the format that is shipped is some non-native format but the client compiles everything before the first run?

Re:WebAssembly: The New Kubernetes? by billti on Friday January 21, 2022 @12:42PM (#30027022)
> How does WASM handle different architectures?

The same way JavaScript or C#/Java do. It's a bytecode format (typically the first stage in today's JavaScript engines is to turn into a bytecode), which the different engines then JIT for the OS and architecture they are running on.

For more details on a couple different engine implementations, you may find the below of interest.

- https://v8.dev/docs/wasm-compilation-pipeline

- https://hacks.mozilla.org/2020/10/a-new-backend-for-cranelif...

Re:WebAssembly: The New Kubernetes? by dathinab on Saturday January 22, 2022 @04:35AM (#30035155)
"designed for AOT" means it ships platform independent byte code, which is easy to turn into assembly/machine code before running it.

AOT is a counter part to JIT:

- AOT ahead of time (but still on the system, e.g. just before running)

- JIT just in time (while interpreting code you notice a hot section and turn it into native code)

So what most WASM runtime do is parse the WASM byte code, running certain checks for wellformedness and emit assembly (with necessary bounds checks, etc. to not escape the WASM sandbox).

This doesn't mean you can't interpret it, or interpret + JIT it, it's just that AOT seemed like a better choice then JIT or pure interpretation for WASM, as just interpreting it isn't fast enough compared to JavaScript JIT/or asm.js, to make it worth adding it to the web.

Re:WebAssembly: The New Kubernetes? by astlouis44 on Friday January 21, 2022 @05:00PM (#30030524)
Epic deprecated support back in the 4.23 release of Unreal Engine, so developers haven't been able to export to HTML5 unlike Unity which has to this day maintained the abilit to target the browser, and in fact they are in the process of building out support for WebGPU. Check out this job ad:

https://careers.unity.com/position/software-developer-unity-...

Our startup is working on support for Unreal to support WebGPU from 4.24 onwards, and we've already upgraded support so developers can use WebGL 2.0 instead of WebGL 1.0 like was available previously before Epic made it a community supported platform extension.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @09:50AM (#30024220)
Unity is not a free standard with multiple implementations. Unity doesn't support a plurality of programming languages, while it's the goal of the garbage collected WASM. Unity is higher level in the stack, and could be executed on top of WASM and WebGPU. The work of making GCd WASM (which could interface with browser APIs without an overhead) and WebGPU fast is ongoing.
Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @09:56AM (#30024292)
There are plenty of other middleware options, Unity is not the only game in town.

What all of them have, is being able to take advantage of 2022 hardware in 2022, with 2022 3D APIs.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @10:03AM (#30024417)
Not all games need "to take advantage of 2022 hardware in 2022, with 2022 3D API". A good plenty would look fine with a middling level of graphical fidelity or "latestness" of employed GPU features. Using the web platform you also free yourself of gatekeeping, cut taking middlemen. So there is a niche for both WASM and WebGPU.
Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @10:34AM (#30024930)
Sure, I also like to revisit my Playstation and Amiga 500 games.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @10:44AM (#30025086)
So in your world there are only games employing the latest features, and "retro" games from the 80s and the 90ies, and nothing else? Ok.

As far as I know WebGPU doesn't lack any significant features beside raytracing (They are prioritizing the MVP, and raytracing could come later). Some of the newest features like mesh shaders are not yet supported by the native engines either, because there isn't a sufficient hardware base. Intel for example will support mesh shaders only in the yet to be released Alechemist GPU.

Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @10:46AM (#30025126)
What can I say, that is the quality of most WebGL games anyway.

10 years later there still isn't something at the same level of Infinity Blade.

Re:WebAssembly: The New Kubernetes? by nchi3 on Friday January 21, 2022 @11:15AM (#30025586)
I think one big difference with WebGL and WebGPU is that WebGL was never really a target that you'd use for native applications. I've never heard of WebGL running outside of a browser (you'd use OpenGL ES for that), whereas I think native WebGPU has the potential to end up being the OpenGL replacement people have been asking for for years.

It definitely won't kill Unity or Unreal, but I have hopes that it will make developing without a ready-made engine a bit more attractive at least!

Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @01:16PM (#30027599)
I don't see any benefit in using a castrated 3D API outside the browser.

Want Vulkan/DX12/Metal without boilerplate?

Just use Ogre or Godot, among endless other options.

Even Qt is better than what WebGPU is capable of.

Re:WebAssembly: The New Kubernetes? by nchi3 on Friday January 21, 2022 @04:30PM (#30030250)
>I don't see any benefit in using a castrated 3D API outside the browser.

Castrated how? A single digit performance loss compared to the most extremely complex graphics APIs which aren't properly cross-platform?

>Want Vulkan/DX12/Metal without boilerplate?

>Just use Ogre or Godot, among endless other options.

"I want a graphics API!"

- "Use this game engine or this old and outdated graphics library instead"

>Even Qt is better than what WebGPU is capable of.

Ah, is it? Do you have any example of implementing forward+ rendering in pure Qt? No? What about GPU compute? Not that either?

Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @06:45PM (#30031471)
> "I want a graphics API!"

> - "Use this game engine or this old and outdated graphics library instead"

That is the actual answer for when people ask that question, most of the time. Almost nobody is asking for a raw GPU API, which is what Vulkan, DX12, and WebGPU are. Rather they want a graphics API. Something that provides utilities and helpers. Something that can actually load textures, models, and animations. Or has a particle effect system.

But if all you want is a GPU API, as I mentioned far higher up in the thread there's no shortage of those today either (like bgfx, or even Angle). 'native' WebGPU isn't addressing some unserved market here.

Although if you actually do want a GPU API, there's also a good chance you actively don't want to use a middleware like WebGPU since it limits what you can do and gets in the way...

Re:WebAssembly: The New Kubernetes? by nchi3 on Saturday January 22, 2022 @07:23AM (#30036064)
bgfx is definitely a competitor in that sense. However, it doesn't have the same backing, is not standardized, and would have a hard time building momentum due to that.

I'm mostly thinking of indie game devs who decide to write their games from scratch (which still happens, though it's becoming rare), or up-and-coming game engines such as Bevy. They might not have a team who can spend the time optimizing Vulkan (while also making sure MoltenVK runs it fine, if they want to target MacOS), and might prefer something more modern than OpenGL.

>WebGPU since it limits what you can do and gets in the way

Does it do that more than OpenGL ever did though?

Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @05:24PM (#30030750)
Castrated by the security constraints of being a MVP 1.0 API to fit into the security sandbox of a Web browser.

By its nature cannot be more than that what browser do.

In case you missed the train, Qt now makes direct use of Metal, Vulkan, and DirectX 12.

I guess you were too busy keeping up with WGSL changes to notice that.

Re:WebAssembly: The New Kubernetes? by nchi3 on Friday January 21, 2022 @05:50PM (#30030976)
>Castrated by the security constraints of being a MVP 1.0 API to fit into the security sandbox of a Web browser.

What security contraints are you thinking of which are making it castrated? In what meaninful ways is it castrated?

> In case you missed the train, Qt now makes direct use of Metal, Vulkan, and DirectX 12.

So with Qt, can I write a complete renderer with advanced techniques, and have it run on all 3 platforms without changing a single file? If not, how is it relevant to even mention?

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @03:04AM (#30034687)
Qt3D is the ultimate goal for that, yes.

Here is a little secret, thanks to extension spaghetti and driver bugs, there is seldom "without changing a single file" unless it is some toy app, instead of being used across all possible consumer hardware.

Plus you are focusing too much on Qt while being defensive for WebGPU on native deployments, there are plenty of other middleware I can use as example.

Re:WebAssembly: The New Kubernetes? by nullifidian on Saturday January 22, 2022 @05:14AM (#30035354)
Qt3D examples use GLSL shaders. This example has 3 shader variants for different platforms https://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/advan...

What are you talking about? Are you saying that https://doc.qt.io/qt-6/qsgmaterialshader.html is less "castrated" than WGSL ? Doesn't look like it. I don't even see the spec, it only says "Vulkan-style GLSL"

>Here is a little secret

Google and Apple definitely have more resources to spend standardizing WGSL (WebGPU has a Conformance Test Suite) than whoever owns QT this time of the year.

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:06AM (#30035640)
Enjoy trying to make WebGPU having any commercial meaning outside the browser, done here.
Re:WebAssembly: The New Kubernetes? by nchi3 on Saturday January 22, 2022 @07:07AM (#30035954)
> while being defensive for WebGPU on native deployments

Because I still haven't heard a single argument against it from you that isn't extremely vague and handwavey.

For example, you skipping over my questions regarding more details on what you think makes WebGPU bad/castrated, or what is making Qt the better choice over WevGPU? (ignoring the fact that Qt doesn't seem to have a common shader language)

I'm open to hear the reasons, but it seems like your goal is to be contrarian.

Re:WebAssembly: The New Kubernetes? by coldtea on Friday January 21, 2022 @07:40PM (#30031860)
There's a multi-billion market for hyper casual games, and double so if we include slightly less casual games.

And since you need to be Epic or a multi-million funded team with big scale to do an AAA game, but everybody could do a casual (and even more a hyper casual game), I'd say the latter is smarter than sneering on simpler games...

You might not care for those, but billions do. Heck, Wordle could make 10 times the money an average FAANG made in their whole career if it chose so...

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:03AM (#30035624)
Sure, and everyone on that market moved to mobile, because it actually provides the proper tooling.
Re:WebAssembly: The New Kubernetes? by jmrm on Friday January 21, 2022 @07:00AM (#30022280)
The only part here that I'm a bit sceptic are the embedded electronic. Maybe I'm too into bare metal and RTOS instead of Yocto or other Linux-based development, but I don't see the advantages of using WASM here. By the other hand, I agree completely with the rest of the other deployment targets.
Re:WebAssembly: The New Kubernetes? by tracker1 on Friday January 21, 2022 @04:40PM (#30030353)
I wouldn't mind better isolation interfaces between my entertainment system and my engine performance options. Of course, this doesn't require WASM... also, the hardware horsepower (so to speak) for the computers you interact with are anemic to begin with, let alone the 2-5x impact of WASM on top of it.
Re:WebAssembly: The New Kubernetes? by throwaway81523 on Friday January 21, 2022 @07:03AM (#30022307)
Write once run anywhere sounds like Java of the 1990s ;).
Re:WebAssembly: The New Kubernetes? by brabel on Friday January 21, 2022 @07:17AM (#30022393)
It's very similar. If Java had had a good sandbox model and not shipped with a large runtime available to all applications, from the beginning, there would be no reason for WASM to exist.

WASM is like Java bytecode without access to the Java standard library (like, no `java.lang.String` or even `java.lang.Object`... just the primitives).

But it has a mechanism to call "host" or "imported" functions and to use linear memory (an array of bytes which can be shared with other modules and the host), which is how it actually does anything useful.

I can imagine a version of Java that works like this as well, actually, I wonder if there's ever been anything like that?

Re:WebAssembly: The New Kubernetes? by ptx on Friday January 21, 2022 @08:09AM (#30022947)
Once the GC proposal lands, letting the host and application interact through object graphs, won't that bring back most of the same perennial security problems that Java suffered from?
Re:WebAssembly: The New Kubernetes? by monocasa on Friday January 21, 2022 @11:25AM (#30025749)
Java's perennial security issues was that the sandboxing mechanism was implemented in Java in the same VM as it was trying to sandbox... then they added reflection. They couldn't plug all of the holes that could let you get a reference to the security management objects and go to town on them with reflection.
Re:WebAssembly: The New Kubernetes? by PoignardAzur on Friday January 21, 2022 @05:32PM (#30030821)
> Once the GC proposal lands

"Once".

That GC proposal isn't anywhere close to landing. It's making progress, but it's the "Zeno's paradox" kind of progress where the feature seems further away the more they work on it. I wouldn't be surprised at all if it still wasn't supported in browsers in 10 years.

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:12AM (#30035671)
WASM security story is sales talk, as anyone that understands pentesting is aware of.
Re:WebAssembly: The New Kubernetes? by anderspitman on Saturday January 22, 2022 @02:44PM (#30040141)
I'd be interested in hearing more about this if you can point to some resources.
Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @05:13PM (#30041328)
You can start here,

"USENIX Security '20 - Everything Old is New Again: Binary Security of WebAssembly"

https://www.youtube.com/watch?v=glL__xjviro

Then there are the issues that since WebAssembly doesn't prevent memory corruption, while RCE attacks or sandboxing breaks are not possible, by producing memory corruption, it is possible to eventually trigger alternative code paths that wouldn't be possible in normal circumstances.

A contrived use case would be to validate a user with higher credentials that they are supposed to have, in a WASM based security module.

Then since the external calls from the module are configured from the runtime, one can do man on the middle attacks on the functions being called from the module, thus access data that it wasn't supposed to be made available in normal cases.

And I bet that when the hacker community starts having fun with WebAssembly, as much as they have had with other bytecode formats, more issues will be found.

Re:WebAssembly: The New Kubernetes? by anderspitman on Thursday January 27, 2022 @01:03PM (#30103827)
Thanks!
Re:WebAssembly: The New Kubernetes? by nkozyra on Friday January 21, 2022 @07:18AM (#30022399)
It does, but so do interpreted languages and the many compiled languages with different compilation targets.

It's less of a problem in 2021 than it was in 1995.

Re:WebAssembly: The New Kubernetes? by dragonwriter on Friday January 21, 2022 @10:34AM (#30024923)
Sure, its the JVM, but open from the start, native in major browsers, and at a time when a popular choice for desktop development is “wrap a browser in a layer providing access to OS services”.
Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:14AM (#30035684)
With the caveat that Electron is basically Windows 98 Active Desktop, and if we forget about Mozilla boycotts against CodeAlchemy and PNaCL.

Ironically, those boycotts are now meaningless given Chrome market share, including Electron.

Re:WebAssembly: The New Kubernetes? by 8bitbuddhist on Friday January 21, 2022 @09:39AM (#30024041)
It's very similar for sure, but it's worth nothing how this is different. WASM is much more accessible as it doesn't require additional downloads or tooling. It also supports a wider range of languages. I can take my Qt desktop application written in C++, run it through emscripten, and have it running in Firefox or Chrome in just a few minutes. Instead of having to build and release binaries for Linux, Windows, Mac, and Android, I can make a single WASM build, host it on my website, and run it anywhere. It's honestly incredible
Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @09:57AM (#30024315)
Just like the Common Language Runtime.
Re:WebAssembly: The New Kubernetes? by coldtea on Friday January 21, 2022 @07:42PM (#30031870)
Which always worked quite fine on the server side.

For desktop use, it just never had a good GUI API.

Re:WebAssembly: The New Kubernetes? by astlouis44 on Friday January 21, 2022 @05:07AM (#30021488)
Agree 100% on gaming, which is why my team and I at Wonder Interactive are creating a suite of optimization tools and a hosting platform for Unreal Engine developers to to target the browser using WebAssembly, with WebGPU and WebXR support on the way for UE4 and UE5. We’ve already got some demos online that are really impressive despite only being WebGL 2 (OpenGL ES 3.0) for the time being. With WebGPU, it’ll enable desktop quality on par with what you’d except from Vulkan, Metal, or Direct 3D 12, except in Chrome, Safari, Edge, and Firefox.

The future of gaming and the metaverse is cross-platform and free of walled gardens, with developers empowered to distribute directly to their end users online without a middleman required. The reinvention and subsequent golden age of high fidelity 3D browser games will be upon us sooner than most realize.

Links for anyone interested:

https://www.theimmersiveweb.com/

Our Discord:

https://discord.gg/zUSZ3T8

Re:WebAssembly: The New Kubernetes? by manuelabeledo on Friday January 21, 2022 @05:44AM (#30021773)
> The future of gaming and the metaverse is cross-platform and free of walled gardens

Given that you mentioned Unreal Engine, why the web and not native?

I mean, this sounds like an awful lot of work to port something to the web, when it already runs in every platform.

Re:WebAssembly: The New Kubernetes? by Guidii on Friday January 21, 2022 @09:15AM (#30023734)
Perhaps because of the web's deployment model? Quickly getting from "interested in" to "running the game" might be a game-changer. (apologies for the unintentional pun)
Re:WebAssembly: The New Kubernetes? by have_faith on Friday January 21, 2022 @05:49AM (#30021806)
> free of walled gardens

How will it reduce walled gardens?

Re:WebAssembly: The New Kubernetes? by BlueTemplar on Friday January 21, 2022 @05:52AM (#30021834)
Well, the hardest in cross-platform has always been designing for different input / output devices (which usually fails, better stick to a single platform and do it well).

Another question : how, as a player, do you run a game like this offline, or run multiplayer when the game company servers have shut down ?

Re:WebAssembly: The New Kubernetes? by kaba0 on Friday January 21, 2022 @04:17AM (#30021080)
Do we have a bright lookout at WebGPU? Based on historic trends, similar projects seldom come to fruition, and not even cross-platform graphics frameworks managed to stick (vulkan, metal, directx, opengl, basically none of them run on all 3 major platforms, let alone if we add mobile platforms as well to the list)
Re:WebAssembly: The New Kubernetes? by codeflo on Friday January 21, 2022 @05:01AM (#30021435)
I don’t think it’s a matter of trends, we have to look at the particulars of each API.

OpenGL/WebGL aren’t well enough aligned with modern hardware to serve as a cross-platform graphics layer.

That’s where the newer APIs come in. Vulkan, Metal and DirectX 12 all follow similar principles that would work from a technical standpoint, but we live in an age where platform vendors would rather cripple their platform than make it easy to port software. Apple is the worst offender here, because while Microsoft isn’t happy about it and disables it in “metro” apps, at least they don’t prevent GPU vendors from shipping Vulkan support for normal “desktop” apps.

But I’m optimistic about WebGPU: It’s designed to be efficiently implemented on top of the vendor APIs, so platform vendors can’t block it. And it’s low-level enough that it should allow implementing modern games on top of it.

(To clarify: I’m optimistic about WebGPU as an API for desktop applications. For browser apps, it seems like all vendors are on board already.)

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.

Re:WebAssembly: The New Kubernetes? by BlueTemplar on Friday January 21, 2022 @05:57AM (#30021878)
Microsoft is definitely the core issue here : they are trying to unify XBOX and PC gaming, and are NOT supporting Vulkan on XBOX.
Re:WebAssembly: The New Kubernetes? by astlouis44 on Friday January 21, 2022 @04:16PM (#30030105)
WebGL 2.0 today runs on not just desktop browser but also through the web on Xbox, which has a Chromium-based Edge which can run browser games and will get turbocharged with near native performance with the arrival of WebGPU.

So you now have a platform target with one codebase that developers can target PC/Mac/Linux, mobile/tablet, and one of the biggest console platforms. I'd say that's pretty powerful.

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:18AM (#30035711)
We have always been in such an age, including console vendors.

Apple support for OpenGL is a side effect of NeXT's acquisition, had Copland's efforts succeeded, they would have kept using QuickDraw 3D.

Re:WebAssembly: The New Kubernetes? by yolo69420 on Friday January 21, 2022 @05:11AM (#30021511)
vulkan runs everywhere except on apple shit, and that is on nobody but apple. they are actively working against open standards. the world is better off if you ignore them and their users.
Re:WebAssembly: The New Kubernetes? by kaba0 on Friday January 21, 2022 @06:32AM (#30022115)
Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @09:58AM (#30024338)
No Vulkan for you on Playstation, XBox.
Re:WebAssembly: The New Kubernetes? by nicoburns on Friday January 21, 2022 @08:05AM (#30022900)
WebGPU is to WebGL as Vulkan, Metal, DX12 are to OpenGL, DX11 and below. In that context I would expect WebGPU to be just as successful as WebGL has been.
Re:WebAssembly: The New Kubernetes? by pjmlp on Friday January 21, 2022 @10:00AM (#30024360)
Basically mostly 3D renderings for online shops, while most indie devs rather focused on mordern hardware on mobile platforms.

Ah, and Google Maps.

Re:WebAssembly: The New Kubernetes? by torginus on Friday January 21, 2022 @10:48AM (#30025141)
I hope so. And for that matter, I hope that WebGPU makes it out of the browser as well. It's a modern API, based upon Metal, that has an execution model much closer to actual GPUs, much like Vulkan/DX12, while still handling some of the hairy scheduling/dependency issues for you, as well as lacking the incredible verbosity of the modern APIs.
Re:WebAssembly: The New Kubernetes? by bobthebuilders on Friday January 21, 2022 @04:27AM (#30021167)
As much as I hate it, I think economics will make WebGPU a thing the same way it did electron.
Re:WebAssembly: The New Kubernetes? by tracker1 on Friday January 21, 2022 @04:43PM (#30030387)
It could happen... I still remember how exciting VRML was in the 90's. Of course, I still have more of a wait and see approach to anything actually working out.
Re:WebAssembly: The New Kubernetes? by api on Friday January 21, 2022 @08:20AM (#30023086)
There are a lot of security reasons to get away from compiled native code as well as convenience reasons. Something like Spectre/Meltdown could have been mitigated completely with a JIT upgrade.

Then there's the huge advantage of encouraging more competition in the CPU market. Something like RISC-V would have a much better chance if you didn't have to recompile everything for it.

I'm surprised native binary is still the standard. Back in the 1990s when I saw Java and then .NET I thought it would be dead by now outside of specialized high performance libraries for things like codecs and cryptography.

Re:WebAssembly: The New Kubernetes? by delarq on Friday January 21, 2022 @06:48AM (#30022218)
> - Plugins for desktop/mobile apps, wasm provides a nicely sandboxed environment for them.

> - Gaming, the combination of WASM and WebGPU will be the perfect platform for cross platform game development. I could see Steam, for example, creating their own runtime.

> - Embedded electronics, simplifying the development and deployment of IoT devices.

We will finally be able to write code once and run it everywhere! I bet at least 3 billion devices will run WASM. It's a breakthrough, how come nobody came up with such great idea yet?

Re:WebAssembly: The New Kubernetes? by csmpltn on Friday January 21, 2022 @09:13AM (#30023706)
> "how come nobody came up with such great idea yet?"

Cross-platform Virtual Machines have been around for a very long time, enabling exactly the kind of thing you're talking about. So in-fact, lots of people thought about this, and built various versions of this. The browser doesn't bring anything new to the table here: it's yet another high-level abstraction layer which inevitably will incur performance penalties in a setting where performance means everything. People want to play complex, immersive games at 60 FPS with amazing graphics and textures, sounds, single/multiplayer settings, and more.

The browser was never built for modern triple-A gaming in mind, which means the APIs available for game creators will inevitably be less flexible and lag behind the more platform-native APIs we've had for 30+ years. This isn't a precedent by the way: recently developed APIs such as WebAudio & WebWorkers are just awful and don't come anywhere close to what a desktop application can do on a modern OS, and those are often considered "cutting edge". Synchronization APIs and locking primitives are only now being introduced to browsers - https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_A... - something games could easily make use of outside of the browser for the past 40+ years.

Lightweight gaming can easily take place within the browser, and perhaps this new technology can make that easier to build and use. But to build a proper heavy-weight game - you'll need much more than a browser can offer.

Re:WebAssembly: The New Kubernetes? by samwillis on Friday January 21, 2022 @09:30AM (#30023933)
I think unfortunately the post you are replying to was another sarcastic joke about the JVM and probably didn't deserve your thoughtful reply.

Completely agree that web despite being perfect for light weight and casual gaming, is not (yet) the platform for AAA games.

Re:WebAssembly: The New Kubernetes? by torginus on Friday January 21, 2022 @10:42AM (#30025066)
Isn't multithreading support, which is kinda essential for high-performance applications, spotty under WASM? I've read that threads in WASM are hack built-on top of Web Workers + SharedArrayBuffer, which is kinda dodgy at best, and most importantly, not even supported under Safari.
Re:WebAssembly: The New Kubernetes? by azakai on Friday January 21, 2022 @11:25AM (#30025747)
Safari does support wasm threads now! It's pretty recent:

https://twitter.com/RReverser/status/1471623675623481356

Yes, wasm threading support on the web uses workers + SAB. There are some limitations (the usual issues with blocking on the main thread on the web), but it works well in production for many things.

Re:WebAssembly: The New Kubernetes? by tlarkworthy on Friday January 21, 2022 @04:58AM (#30021414)
I hope to create a wire compatible Firebase Realtime server for edge use https://observablehq.com/@tomlarkworthy/rtdb-protocol
Re:WebAssembly: The New Kubernetes? by singularity2001 on Friday January 21, 2022 @05:12AM (#30021529)
> edge first database

Sqlite was successfully ported to wasm, maybe something can grow out of that?

Re:WebAssembly: The New Kubernetes? by samwillis on Friday January 21, 2022 @05:25AM (#30021625)
We are singing from the same song sheet.

SQLite in the browser and at the edge is going to explode in popularity. A slightly unknown feature of SQLite is “sessions” which would allow you to build an eventually consistent system on top of SQLite.

https://www.sqlite.org/sessionintro.html

I can very much see SAAS type apps wheee each costumer/workplace has a SQLite db effectively deployed to the edge.

Re:WebAssembly: The New Kubernetes? by infogulch on Friday January 21, 2022 @03:37PM (#30029659)
This is the biggest question actually.

Something like cockroachdb's serverless might fit too: https://www.cockroachlabs.com/blog/how-we-built-cockroachdb-...

Re:WebAssembly: The New Kubernetes? by ignoramous on Friday January 21, 2022 @07:48AM (#30022703)
> What’s needed is a edge first database, we need at least read replicas to be at the edge with your app... I'm interested to see if CloudFlare do anything in this area as it’s the part of their stack that’s missing.

Cloudflare already has a free caching layer, a freemium eventually-consistent KV store that optimises for frequently-read items, and a strongly-consistent datastore. Besides, they partner with other database vendors too: https://blog.cloudflare.com/partnership-announcement-db/

Re:WebAssembly: The New Kubernetes? by samwillis on Friday January 21, 2022 @08:21AM (#30023105)
> strongly-consistent datastore

I think you are referring to the upcoming R2 object store? I’m not aware of what I would think of as a “strongly-consistent datastore” which would be closer to a traditional database with querying. It’s that that I think is missing.

Quite right they have partnered with other db providers, however I think there is a need for something native to their platform that ensures good proximity to Workers to ensure low latency.

Re:WebAssembly: The New Kubernetes? by mwarkentin on Friday January 21, 2022 @08:33AM (#30023217)
I think they’re referring to Cloudflare Durablr Objects: https://developers.cloudflare.com/workers/learning/using-dur...
Re:WebAssembly: The New Kubernetes? by birdyrooster on Friday January 21, 2022 @04:28PM (#30030220)
The future in the datacenter is unikernel virtual machines scheduled by kubernetes.
Re:WebAssembly: The New Kubernetes? by tester34 on Friday January 21, 2022 @04:41AM (#30021271)
Is WASM going to replace:

Lua, JS and LLV IRM?

Re:WebAssembly: The New Kubernetes? by kortex on Friday January 21, 2022 @08:23AM (#30023124)
No, no, and no. The only one remotely close in scope is LLVM-IR, and even then scope is pretty significantly different. LLVM-IR is a general purpose IR for native compilation. Wasm is deliberately small in scope and designed for sandboxing.

Lua and JS are not even binary languages.

Re:WebAssembly: The New Kubernetes? by hajile on Friday January 21, 2022 @07:30PM (#30031791)
There is a proposal from Mozilla/Facebook for a binary JS format.

https://github.com/tc39/proposal-binary-ast

Re:WebAssembly: The New Kubernetes? by Findecanor on Friday January 21, 2022 @06:39PM (#30031413)
WASM is a compiler target. It was designed for fast compilation into native instructions with deterministic effects.

LLVM-IR has been considered, but has never been suitable as a compiler target. Code is targeted for a specific arch even before it becomes translated into LLVM-IR. Undefined behaviour in C is undefined also in LLVM-IR, and a portable compiler target can not have any. It is also changing too much between compiler versions (which is a reason why SPIR moved away from it).

BTW. It seems that in the long-term, the use of LLVM-IR in compilers is going to be replaced with MLIR (Multi-level IR).

Re:WebAssembly: The New Kubernetes? by BlueTemplar on Friday January 21, 2022 @06:00AM (#30021899)
Isn't it an intermediating language ? Why would it replace them, it's not like a lot of people directly code in assembly when C is available...
Re:WebAssembly: The New Kubernetes? by cpuguy83 on Friday January 21, 2022 @10:38AM (#30025003)
Instead of, as an example, coding a plugin in lua, you code it in whatever you want and compile to wasm (that supports wasm as a compile target). In that sense it would be replacing lua.
Re:WebAssembly: The New Kubernetes? by BlueTemplar on Friday January 21, 2022 @01:52PM (#30028201)
But lua is typically used as an easy scripting language for non-programmers...
Re:WebAssembly: The New Kubernetes? by _nalply on Friday January 21, 2022 @08:13AM (#30023001)
No. I am not a clairvoyante but I think there will be possibilitites to compile to WASM. LLV IRM is a special case but transcompiling is not unimaginable.
Re:WebAssembly: The New Kubernetes? by justshowpost on Friday January 21, 2022 @02:45PM (#30028967)
> What’s needed is a edge first database, we need at least read replicas to be at the edge with your app.

Cloudflare Durable Objects is exactly this.