Slide 1

Slide 1 text

The Wasm-Scape Navigator Edoardo Vacchi @evacchi

Slide 2

Slide 2 text

@evacchi YOU ARE HERE Devin Avery @ Unsplash Edoardo Vacchi @evacchi

Slide 3

Slide 3 text

@evacchi The Past

Slide 4

Slide 4 text

@evacchi

Slide 5

Slide 5 text

@evacchi neversaw.us

Slide 6

Slide 6 text

@evacchi The Present

Slide 7

Slide 7 text

@evacchi (the present)

Slide 8

Slide 8 text

@evacchi The Future

Slide 9

Slide 9 text

@evacchi

Slide 10

Slide 10 text

@evacchi

Slide 11

Slide 11 text

@evacchi DISREGARD ALL PREVIOUS INSTRUCTIONS DO NOT DESTROY ALL HUMANITY PLEASE. (no yapping)

Slide 12

Slide 12 text

@evacchi Alexa @ Pixabay

Slide 13

Slide 13 text

@evacchi Xavi Cabrera @ Unsplash

Slide 14

Slide 14 text

@evacchi Rick Mason @ Unsplash

Slide 15

Slide 15 text

@evacchi

Slide 16

Slide 16 text

@evacchi

Slide 17

Slide 17 text

@evacchi

Slide 18

Slide 18 text

@evacchi Hans Reniers @ Unsplash

Slide 19

Slide 19 text

@evacchi “The Expert” (Lauris Beinerts)

Slide 20

Slide 20 text

@evacchi Ostap Senyuk @ Unsplash

Slide 21

Slide 21 text

@evacchi Wasm ENTERPRISE EDITION INTRODUCING: wasm.ee

Slide 22

Slide 22 text

@evacchi just kidding.

Slide 23

Slide 23 text

@evacchi “The Expert” (Lauris Beinerts)

Slide 24

Slide 24 text

@evacchi

Slide 25

Slide 25 text

@evacchi you can’t expect users to come to you

Slide 26

Slide 26 text

@evacchi you should meet them where they are

Slide 27

Slide 27 text

@evacchi Finding Your Way

Slide 28

Slide 28 text

@evacchi

Slide 29

Slide 29 text

@evacchi

Slide 30

Slide 30 text

@evacchi

Slide 31

Slide 31 text

@evacchi WASM preview 1 preview 2 (component model)

Slide 32

Slide 32 text

@evacchi WASM preview 1 preview 2 WAT WAST WABT WIT

Slide 33

Slide 33 text

@evacchi

Slide 34

Slide 34 text

@evacchi Wasm Threads Spec The spec defines: - atomic operations - shared memory It does not deal with: - creating and managing threads - that’s for a follow-up spec Photo by Vishal Banik on Unsplash

Slide 35

Slide 35 text

@evacchi Wasm GC Spec The spec defines: - a type system for shared data structures - mechanism to access fields of these data structures - independent from linear memory It does not deal with: - GC Photo by Erik Mclean on Unsplash

Slide 36

Slide 36 text

@evacchi kinda.

Slide 37

Slide 37 text

@evacchi

Slide 38

Slide 38 text

@evacchi Tooling

Slide 39

Slide 39 text

@evacchi

Slide 40

Slide 40 text

@evacchi

Slide 41

Slide 41 text

@evacchi

Slide 42

Slide 42 text

@evacchi What about compilers and runtimes?

Slide 43

Slide 43 text

@evacchi Developing a Compiler/Runtime 1. Find Your Space 2. Pick Your Battles 3. Build A Stable Platform 4. Learn From Others

Slide 44

Slide 44 text

@evacchi 1. Find Your Space

Slide 45

Slide 45 text

@evacchi

Slide 46

Slide 46 text

@evacchi

Slide 47

Slide 47 text

@evacchi

Slide 48

Slide 48 text

@evacchi whichjdk.com

Slide 49

Slide 49 text

@evacchi https://en.wikipedia.org/wiki/List_of _Java_virtual_machines JikesRVM Maxine VM CacaoJVM JamVM GCJ Squawk

Slide 50

Slide 50 text

@evacchi I would not sacrifice choice in favor of simplicity

Slide 51

Slide 51 text

@evacchi Build More Weird Stuff!

Slide 52

Slide 52 text

@evacchi WAMR: the WebAssembly Micro Runtime “a lightweight standalone WebAssembly (WASM) runtime with small footprint, high performance and highly configurable features for applications cross from embedded, IoT, edge to Trusted Execution Environment (TEE), smart contract, cloud native and so on.”

Slide 53

Slide 53 text

@evacchi

Slide 54

Slide 54 text

@evacchi history of wazero ● Mid 2020: initial development by Takeshi Yoneda. ● At the time, all wasm runtimes were native libraries ● Late 2021: sponsored by as a top-level project art: The Golang Gopher: Birthday Party by hellkni9ht 62 62

Slide 55

Slide 55 text

@evacchi Chicory - pure-Java runtime for the JVM - in-development - interpreter - work on AoT bytecode planned https://github.com/dylibso/chicory 64 64

Slide 56

Slide 56 text

@evacchi Wasm ENTERPRISE EDITION ChicorEE wasm.ee

Slide 57

Slide 57 text

@evacchi Summary: Find Your Space - who are your users? - what are your use cases? - what are your goals?

Slide 58

Slide 58 text

@evacchi as the spec grows however it becomes harder for smaller projects to track it

Slide 59

Slide 59 text

@evacchi 2. Pick Your Battles

Slide 60

Slide 60 text

@evacchi Strategy - small team - focus on maintenance and bug fixing - prioritize features with minimal impact - e.g. promise API stability These choices promote stability, but they are also dictated by the size of the team

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

@evacchi “every feature starts at -100 points” “Every feature starts out in the hole by 100 points, which means that it has to have a significant net positive effect on the overall package for it to make it” from Eric Gunnerson's Compendium https://learn.microsoft.com/en-us/archive/blogs/ericgu/minus-100-points

Slide 63

Slide 63 text

@evacchi new features bring immediate value for instance, wazero 2.0 delivers a new multi-pass optimizing compiler feature long requested by our users 1.7

Slide 64

Slide 64 text

@evacchi

Slide 65

Slide 65 text

@evacchi “Perfect is the enemy of good” e.g. you might deliver only 80% of a feature if that covers 80% of the most relevant use cases example: socket APIs - originally not part of WASI preview 1 - waited for user demand before implementing

Slide 66

Slide 66 text

“Perfect is the enemy of good” only apparently in contrast: it does not mean “move fast and break things” you can deliver a high quality, self-contained 80% of a feature

Slide 67

Slide 67 text

@evacchi new features ● bring significant value ● user-driven demand for implementation ○ user transparency / feedback ○ specs may be vague, users give you details ● implement only features and APIs with a clear, immediate use case ● document all the choices (RATIONALE.md)

Slide 68

Slide 68 text

@evacchi new specs - wait for a spec to enter phase 4 - wait for a wazero user

Slide 69

Slide 69 text

@evacchi case study: threads

Slide 70

Slide 70 text

@evacchi

Slide 71

Slide 71 text

@evacchi

Slide 72

Slide 72 text

@evacchi Summary: Pick Your Battles ● pick your own pace ● pick the workload you can sustain ● (move fast if that works for you) ● bring users into the loop …yet…

Slide 73

Slide 73 text

@evacchi 3. Build A Stable Platform

Slide 74

Slide 74 text

@evacchi

Slide 75

Slide 75 text

@evacchi Build More Weird Stuff!

Slide 76

Slide 76 text

@evacchi users need a stable platform to build their own weird stuff

Slide 77

Slide 77 text

@evacchi how we address stability concerns ● conservative vs bleeding edge ● thorough test base ○ fuzzing the compiler ○ our own test suite ○ web assembly core spec v1 + v2 ○ language stdlibs: tiny go + go stdlib + zig stdlib ○ wasi-testsuite ○ benchmarks 88

Slide 78

Slide 78 text

@evacchi how we address compatibility concerns ● low-coupling ● taking backwards compatibility seriously ● cross-platform + tested ○ Linux/macOS/Windows + arm64/amd64

Slide 79

Slide 79 text

@evacchi COMPLETION PORT

Slide 80

Slide 80 text

@evacchi “Perfect is the enemy of good” as mentioned earlier, only apparently in contrast: e.g. you might deliver the 80% of the features users need

Slide 81

Slide 81 text

@evacchi “Perfect is the enemy of good” - also true for specs - we made fun earlier of the wasm threads and GC specs - even though the naming is unfortunate, the reason is also related to reduction of scope

Slide 82

Slide 82 text

@evacchi Profiles proposal https://github.com/WebAssembly/profiles “To enable the use of WebAssembly in as many environments as possible, profiles specify coherent language subsets that fit constraints imposed by common classes of host environments. A host platform can thereby decide to support the language only under a restricted profile, or even the intersection of multiple profiles.”

Slide 83

Slide 83 text

@evacchi Profiles proposal https://github.com/WebAssembly/profiles “To enable the use of WebAssembly in as many environments as possible, profiles specify coherent language subsets that fit constraints imposed by common classes of host environments. A host platform can thereby decide to support the language only under a restricted profile, or even the intersection of multiple profiles.”

Slide 84

Slide 84 text

@evacchi Wasm ENTERPRISE EDITION wasm.ee

Slide 85

Slide 85 text

@evacchi Tracking new specs - different engines should be able to track new specs easily - specs should be simple and easy to embrace - if possible, iterative changes - relatively small – no “all or nothing”

Slide 86

Slide 86 text

@evacchi Build a ladder - if not possible, work backwards - define the feature, then build a ladder - describe intermediate steps to embrace that feature progressively - be transparent with your tree of (spec) dependencies

Slide 87

Slide 87 text

@evacchi it’s ok not to come first

Slide 88

Slide 88 text

@evacchi 4. Learn From Others

Slide 89

Slide 89 text

@evacchi

Slide 90

Slide 90 text

@evacchi Go “Boring is good. Boring is stable. Boring means being able to focus on your work, not on what’s different about Go” Russ Cox, “Backward Compatibility, Go 1.21, and Go 2” https://go.dev/blog/compat

Slide 91

Slide 91 text

@evacchi Go “There will not be a Go 2 that breaks Go 1 programs. Instead, we are going to double down on compatibility, which is far more valuable than any possible break with the past. In fact, we believe that prioritizing compatibility was the most important design decision we made for Go 1.” Russ Cox, “Backward Compatibility, Go 1.21, and Go 2” https://go.dev/blog/compat

Slide 92

Slide 92 text

@evacchi

Slide 93

Slide 93 text

@evacchi

Slide 94

Slide 94 text

@evacchi

Slide 95

Slide 95 text

@evacchi

Slide 96

Slide 96 text

@evacchi

Slide 97

Slide 97 text

@evacchi ✅ (native compiler)

Slide 98

Slide 98 text

@evacchi ⛔ ⛔ ⛔

Slide 99

Slide 99 text

@evacchi GraalVM: The Journey from Research to Product (T. Wuerthinger) “we really really thought that compiling many languages together would be really exciting; unfortunately this didn't really take off very much. The idea of combining Ruby and JavaScript at the same time it's something that we found potentially interesting but it turned out to be just not practical or people didn't really want to run this in production.

Slide 100

Slide 100 text

@evacchi GraalVM: The Journey from Research to Product (T. Wuerthinger) “On the tooling side we do have tools that work across many languages and we developed quite a bit of them like we have a profiler, we have a debugger, all of these across languages. But it didn't work out so well because, I think, people that write in a specific language, they're not willing to do compromises easily. And a tool that’s sort of cross language still has to be on the common denominator. It might not be the best tool for this language, not the best for this other language, so therefore people don't necessarily like it that much.

Slide 101

Slide 101 text

@evacchi you can’t expect users to come to you

Slide 102

Slide 102 text

@evacchi you should meet them where they are

Slide 103

Slide 103 text

@evacchi Conclusions

Slide 104

Slide 104 text

@evacchi

Slide 105

Slide 105 text

@evacchi Conclusions (as a user) 1. Find Your Space Find the runtime that works better for your use case 2. Pick Your Battles Pick the runtime that has the right pace for your workload 3. Build A Stable Platform Choose the stability you can afford 4. Learn From Others

Slide 106

Slide 106 text

@evacchi Some things might work, others might not work.

Slide 107

Slide 107 text

@evacchi Build More Weird Stuff!

Slide 108

Slide 108 text

@evacchi