this is a compliment from the not-quite-dead-and-gone: wasm is becoming what Java always wanted to be, relative to JS as a complete & event-driven job control language...SPOOKY 👻
19:30 It can be argued that the OS is outside of the process, and, therefore, the same sort of thing is done to spawn threads: a"system call" or some exposed way of calling something running at a more privledged level.
Debugging with alerts? Yeah, I remember the time when I had many of them in a single script to make sure that everything is going how it supposed to be :D
The description of something that blocks after checking a value is close to how you would use a condition variable in combination with a mutex than what a bare mutex usually is.
If I'm right in anticipating what comes next; I would love to see some next HTTP 203 episode about Atomics and SharedArrayBuffers :-). Specially linking with previous episodes about COOP, CORB and other 4 letter acronyms security features. Maybe after release of Chrome 88 which will have those settled with crossOriginIsolated.
@@dassurma not when you are trying to center the visual boundary of a button label, rather than the logical line boundary (at least from what I could find!)
"syntactic sugar" is generally reserved for local translations, so eg functions are out due to things like argument renaming and return addresses being actual features that require agreement between different parts of the code, but a variable declaration might count as it's just an alias for some memory address (so long as you don't count the allocation of those addresses by the compiler) So WAT is reasonable to call a sugar, as the translation for each statement is very local and largely doesn't depend on any other part of the file (the only exceptions being a function name table, really) But really, sugar is a very ambiguous term, it's very hard to argue convincingly about why something is or isn't.
Same thread. It’s fairly optimized, but obviously does have a small cost. But for example Emscripten calls into JS for every single OpenGL call (and backs it with WebGL) and it performs really well.
There's some work to allow passing JS, including DOM, objects to WASM (which is currently sort of allowed), and allowing it to call into them, which presumably could be quite well optimized.
I don’t understand why you can’t have typed arrays like uint8_t as shared arrays, it would make a lot more sense than having everything tied to 64bit, specially for things like strings it puts unnecessary memory pressure specially for mobile devices
Surma says SIMD types in WASM are just 128bits long. Are there any WASM runtimes that take advantage of native AVX instructions or YMM registers where available? The true power of SIMD doesn't come from the wide registers, it comes from the cpu-specific instructions that take advantage of them
That is up to the engine. As I said, wasm is a intermediate format. So they needed a SIMD bit width and instruction set that compiles to native SIMD instructions on as many architectures as possible.
@@dassurma not your statement, sorry, the fact that i128 alone was found useful enough to spend the spec and implementation time on. I guess there are some uses like bloom filters or bignum (maybe image compression?) that can get a lot of value, but it's a bit of a surprising disappointment to me that float isn't when it's the first example I always see. I can see the argument that it's probably in the cases that you need float SIMD that you *need* it to be SIMD, while it's a nice to have for int, but that's just a guess.
@@SimonBuchanNz Oh I think I understand now! Sorry, I wasn’t completely thorough in what I said. Of course the SIMD proposal also supports interpreting the 128-bit vector as 4x 32-bit float or 2x 64-bit float.
@@rlamacraft I'm not sure what you mean by "fully functional" or "virtual machine". Web pages already run in a sandbox of sorts. Eg, you don't want a web page to be able to access your local filesystem without up-front permission.
@@jakearchibald I’m just observing the fact that it seems like as the Web evolves it’s approaching the full capabilities of a desktop runtime. I get that things are being done in a more secure way, as you say by explicitly requiring permissions for powerful features, so I guess it’s approaching something like iOS’s model. It started off with HTML, and then CSS, and then full Turing completeness with JS, and now we’re at the point where we’re running assembly code in threads. Is the goal to make the Web platform as capable as any desktop environment, albeit once the user has given full permissions?
I love this version of HTTP 203 so much, which has a length of 20-30 mins and more in-depth conversation. Great work! 👻
Woo this is what i wanted to learn about but too lazy to look at docs and specs
Happy halloween👻
Beautiful explanation surma. Now im onward to find a usecase of wasm threads for my blogging website.
Link to the episode on COOP and COEP that Jake mentioned at the end: ua-cam.com/video/vfAHa5GBLio/v-deo.html
We are hopefully going to see a lot of C libraries, like image and video processing being ported to the web! 👻
That's what we did for squoosh.app
@@jakearchibald I know, I peeked under the dev tools hood!
wow Surma, brilliant, you have deep undertanding of how things work
Really enjoyable breakdown of modern specs mapped to support classical programming paradigms.
If the slides are skipping, it’s probably the joy-con drift.
SIMD intrinsics tutorial in Rust next please!
Does Surma use a Switch controller for navigating slides during these videos?
I think they've done that a few times, yes. Maybe more than a few times but I've only actually seen it like 2 times.
Thank you guys this is just another great video which can be learnt or studied through great researches and many years of knowledge and experience
I really enjoy learning from both you! Thanks!
this is a compliment from the not-quite-dead-and-gone: wasm is becoming what Java always wanted to be, relative to JS as a complete & event-driven job control language...SPOOKY 👻
19:30 It can be argued that the OS is outside of the process, and, therefore, the same sort of thing is done to spawn threads: a"system call" or some exposed way of calling something running at a more privledged level.
Debugging with alerts? Yeah, I remember the time when I had many of them in a single script to make sure that everything is going how it supposed to be :D
I'd love an update on the state of wasm, threads, etc, Rust in 2024!
The description of something that blocks after checking a value is close to how you would use a condition variable in combination with a mutex than what a bare mutex usually is.
The perfect playlist for daily watching 👻
thanks for sharing this helpful and informative talk with us... I am new in programming and watching such videos makes me excited
If I'm right in anticipating what comes next; I would love to see some next HTTP 203 episode about Atomics and SharedArrayBuffers :-). Specially linking with previous episodes about COOP, CORB and other 4 letter acronyms security features. Maybe after release of Chrome 88 which will have those settled with crossOriginIsolated.
10:32 should we call that a race condition?
You really ran out of easy topics huh. Y u gotta bring assembly to my website I'm just trying to make my buttons look nice 😅
fwiw, the next episode is about using CSS/JS to fade something in, and back out again… and all the ways that can go wrong.
@@jakearchibald nothing is ever simple 😭
Except vertical centering nowadays 😮
@@dassurma not when you are trying to center the visual boundary of a button label, rather than the logical line boundary (at least from what I could find!)
9:45 Technically all of javascript is syntactic sugar over hardware machine code (x86, arm, what-have-you).
"syntactic sugar" is generally reserved for local translations, so eg functions are out due to things like argument renaming and return addresses being actual features that require agreement between different parts of the code, but a variable declaration might count as it's just an alias for some memory address (so long as you don't count the allocation of those addresses by the compiler)
So WAT is reasonable to call a sugar, as the translation for each statement is very local and largely doesn't depend on any other part of the file (the only exceptions being a function name table, really)
But really, sugar is a very ambiguous term, it's very hard to argue convincingly about why something is or isn't.
Thank you guys!
"Oh no?" What oh no?
Thank you for sharing this video very informative and helpful.
I've been using WebAssembly with rust and c++ but think I should try writing WAT by hand 👻
is that paul?
Happy Halloween!!! 👻
How expensive is context switching from JS to wasm? Is it different in a worker/thread context?
Cheers 👻
Same thread. It’s fairly optimized, but obviously does have a small cost. But for example Emscripten calls into JS for every single OpenGL call (and backs it with WebGL) and it performs really well.
@@dassurma Interesting, I definitely didn't expect that to be the case for emscripten/OpenGL -- thanks!
There's some work to allow passing JS, including DOM, objects to WASM (which is currently sort of allowed), and allowing it to call into them, which presumably could be quite well optimized.
Thanks! 👻
I see a photo of gentleman, it's written gone but not forgotten, who is he?
I was wondering the same
The days of C are counted.
"gringo" died but you are still showing him as alive on google
great vid. Thanks :3
Great video 👻!
wait surma don't you leave us with that cliffhanger D:
Well the episode went live so it seems like everything went okay after all ;)
spooky..ky....ky....ky...👻
Amazing video guys...👻
I don’t understand why you can’t have typed arrays like uint8_t as shared arrays, it would make a lot more sense than having everything tied to 64bit, specially for things like strings it puts unnecessary memory pressure specially for mobile devices
You totally can. `new Uint8Array(new SharedArrayBuffer(128))` works. It often makes more sense to use `DataView` tho
You should have a look to AssemblyScript
Oh I am _very_ aware. I love ASC (to the point where I even wrote a rollup plugin for AssemblyScript. github.com/surma/rollup-plugin-assemblyscript)
Are you using a joycon for changing slides?
Yes! Jake introduced me to that
@@dassurma is that just a joycon driver for bluetooth?
@@EonMack it doesn't even need a special driver. I just paired it and used Web Gamepad API
@@dassurma Awesome thanks for the response!
I don't like the fact that we need javascipt glue code in order to use threads in wasm. Javascript will be unremovable legacy even after 100 years :(
That's why Wasi is so important imo
Nice
Surma says SIMD types in WASM are just 128bits long. Are there any WASM runtimes that take advantage of native AVX instructions or YMM registers where available?
The true power of SIMD doesn't come from the wide registers, it comes from the cpu-specific instructions that take advantage of them
That is up to the engine. As I said, wasm is a intermediate format. So they needed a SIMD bit width and instruction set that compiles to native SIMD instructions on as many architectures as possible.
@@dassurma that actually confused me, as I expected that the primary use would be float operations (for matrix math)
How is my statement confusing wrt the use case you are stating?
@@dassurma not your statement, sorry, the fact that i128 alone was found useful enough to spend the spec and implementation time on.
I guess there are some uses like bloom filters or bignum (maybe image compression?) that can get a lot of value, but it's a bit of a surprising disappointment to me that float isn't when it's the first example I always see.
I can see the argument that it's probably in the cases that you need float SIMD that you *need* it to be SIMD, while it's a nice to have for int, but that's just a guess.
@@SimonBuchanNz Oh I think I understand now! Sorry, I wasn’t completely thorough in what I said. Of course the SIMD proposal also supports interpreting the 128-bit vector as 4x 32-bit float or 2x 64-bit float.
I assume this has fully replaced the audio podcast then??
We're planning more podcasts, just been pretty busy with Chrome Dev Summit stuff recently.
Thanks, 👻
👻👻
Spanish subs. Thanks
Cool, but why??
Well… threads have some history of success when it comes to application development
@@jakearchibald so is the end goal to turn the Web platform into a fully functional virtual machine?
@@rlamacraft I'm not sure what you mean by "fully functional" or "virtual machine". Web pages already run in a sandbox of sorts. Eg, you don't want a web page to be able to access your local filesystem without up-front permission.
@@jakearchibald I’m just observing the fact that it seems like as the Web evolves it’s approaching the full capabilities of a desktop runtime. I get that things are being done in a more secure way, as you say by explicitly requiring permissions for powerful features, so I guess it’s approaching something like iOS’s model. It started off with HTML, and then CSS, and then full Turing completeness with JS, and now we’re at the point where we’re running assembly code in threads. Is the goal to make the Web platform as capable as any desktop environment, albeit once the user has given full permissions?
@@rlamacraft I think that's kinda what the whole PWA thing is about web.dev/what-are-pwas/