Skip to content

Commit 5bf631d

Browse files
authored
Propose a new LLVM CPU configuration: Lime1 (#235)
* Propose a new LLVM CPU configuration: Lime1 ## Overview I propose a new target CPU configuration for LLVM, and any toolchain or engine that wishes to share it, named "lime1". Lime1 would enable mutable-globals, bulk-memory-opt*, multivalue, sign-ext, nontrapping-fptoint, extended-const, and call-indirect-overlong**. The specific set is open to debate here. The idea is, once we stabilize it, Lime1 would be stable and we would not add or remove features from that point on. Lime1 could be followed by Lime2 and so on in the future if we wish to add or remove features after that. And we can always define new non-Lime CPUs as well, if there are needs for different sets. \* bulk-memory-opt would be a new feature that just includes `memory.copy` and `memory.fill`, and not the rest of bulk-memory \*\* call-indirect-overlong would be a new feature that just introduces the new `call_indirect` encoding from reference-types and not the actual reference types. ## Further background The LLVM Wasm target defaults to a "generic" CPU, which adds features over time as major engines support them. That's good for some users, but other users would benefit from more stable CPU options. Currently the only stable CPU in LLVM is "mvp", however that's pretty old at this point. We've always planned to add more CPUs, but haven't had convenient occasions. The Wasm spec gives us "Wasm 1.0" and "Wasm 2.0" and so on, however while those names may sound like curated user-facing versions, in practice they're more like snapshots of the spec at moments when the spec process reaches certain points. There have been discussions at the CG level about defining official subsets of the language, for engines that don't want to implement threads or other things. If the CG ends up defining specific subsets, we can certainly add new stable CPUs based on them. However, I expect that'll will be some time in the future yet, and it seems beneficial to define something LLVM can use sooner as well. So because there is no convenient external milestones, let's invent one! The name "Lime" is short for "*Li*near *me*mory", and refers to how this target is relatively focused on linear-memory languages. Just as the Wasm spec itself has no concept of "wasm32", it won't have any concept of "lime" either. Lime will just be an informal tooling and engine convention.
1 parent df8d737 commit 5bf631d

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

Lime.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# The Lime Series
2+
3+
Lime is a series of defined and stable subsets of [WebAssembly features] that producers
4+
and consumers can both use to promote interoperability. It is intended to be implemented
5+
by producers such as LLVM, using features such as LLVM's concept of target CPUs. Once a
6+
Lime configuration is defined, it will be stable and not add or remove any features.
7+
8+
Lime configuration names include a version number, such as "Lime1". When there is a
9+
need to add or remove features, a new Lime configuration with a new version number will
10+
be defined, such as "Lime2".
11+
12+
Lime aims for features which do not involve significant new runtime cost or complexity,
13+
and can be implemented in mobile devices and other highly constrained environments.
14+
15+
## The configurations
16+
17+
The following Lime configurations have been defined:
18+
- [Lime1](#lime1)
19+
20+
### Lime1
21+
22+
The Lime1 target consists of [WebAssembly 1.0] plus the following standardized
23+
([phase-5]) features:
24+
25+
- [mutable-globals]
26+
- [multivalue]
27+
- [sign-ext]
28+
- [nontrapping-fptoint]
29+
- [bulk-memory-opt]
30+
- [extended-const]
31+
- [call-indirect-overlong]
32+
33+
[WebAssembly features]: https://webassembly.org/features/
34+
[WebAssembly 1.0]: https://www.w3.org/TR/wasm-core-1/
35+
[phase-5]: https://github.com/WebAssembly/meetings/blob/main/process/phases.md#5-the-feature-is-standardized-working-group
36+
[mutable-globals]: https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md
37+
[multivalue]: https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md
38+
[sign-ext]: https://github.com/WebAssembly/spec/blob/master/proposals/sign-extension-ops/Overview.md
39+
[nontrapping-fptoint]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
40+
[bulk-memory-opt]: #bulk-memory-opt
41+
[extended-const]: https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md
42+
[call-indirect-overlong]: #call-indirect-overlong
43+
44+
## Feature subsets
45+
46+
[WebAssembly features] sometimes contain several features combined into a
47+
single proposal to simplify the standardization process, but can have very
48+
different implementation considerations. This section defines subsets of
49+
standardized features for use in Lime configurations.
50+
51+
### bulk-memory-opt
52+
53+
bulk-memory-opt is a subset of the [bulk-memory] feature that contains just the
54+
`memory.copy` and `memory.fill` instructions.
55+
56+
It does not include the table instructions, `memory.init`, or `data.drop`.
57+
58+
### call-indirect-overlong
59+
60+
call-indirect-overlong is a subset of the [reference-types] feature that contains
61+
just the change to the `call_indirect` instruction encoding to change the zero
62+
byte to an LEB encoding which may have an overlong encoding.
63+
64+
It does not include the actual reference types.
65+
66+
[bulk-memory]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
67+
[reference-types]: https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md

0 commit comments

Comments
 (0)