-
Notifications
You must be signed in to change notification settings - Fork 16.8k
[WebAssembly] WASIP3 and component model threading support #175800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TartanLlama
wants to merge
126
commits into
llvm:main
Choose a base branch
from
TartanLlama:sy/wasip3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
126 commits
Select commit
Hold shift + click to select a range
48a90dd
Initial work
TartanLlama 540d785
Get wasip3 into working state
TartanLlama 8f222c9
Don't disable threads on WASIP3 if no atomics, and don't set the TLS …
TartanLlama e9775de
Merge branch 'main' into sy/wasip3
TartanLlama 6d2b464
Factor out WASIP3 into options and features
TartanLlama 0bf29ae
Merge branch 'sy/wasip3' of github.com:TartanLlama/llvm-project into …
TartanLlama 4a18333
Tighten up features
TartanLlama 927daeb
Make feature detection work properly
TartanLlama e632709
Fix TLS relocations for non WASIP3
TartanLlama f44bf29
Add stack pointer ABI test
TartanLlama 18a1ee3
Add tests for component model threading feature
TartanLlama 8980e38
Add wasm-features test
TartanLlama 08a3a16
wasm-toolchain tests
TartanLlama 9092b93
Formatting
TartanLlama 81ffb2b
Formatting
TartanLlama a9e7310
Revert arch change
TartanLlama c369bb2
Formatting
TartanLlama d368838
Revert formatting change
TartanLlama 61f03e5
Revert formatting change
TartanLlama c9665c1
Revert formatting changes
TartanLlama 07e122d
Revert formatting changes
TartanLlama 651c362
Revert formatting changes
TartanLlama 0175bd5
Revert formatting changes
TartanLlama 9a93078
Revert formatting changes
TartanLlama 85fab66
Revert formatting changes
TartanLlama e577185
Revert formatting changes
TartanLlama 446d56d
Revert formatting changes
TartanLlama 3f10fe8
Remove linker flag
TartanLlama dbae3ef
Determine thread context ABI automatically
TartanLlama e0dcb2a
Merge branch 'main' into sy/wasip3
TartanLlama e8babc7
Fix comment
TartanLlama 822ea98
Test updates
TartanLlama cb2fb8d
TLS fixes
TartanLlama 6cf7c2a
TLS test
TartanLlama fa7eea8
Continue rather than break when determiting thread context ABI
TartanLlama cc1ea2f
Only consider the current object file's symbols for determining threa…
TartanLlama b9039eb
Typo
TartanLlama 1b490cd
Formatting
TartanLlama b55ae63
TLS fixes
TartanLlama a1c563b
Tighten up Toolchain driver
TartanLlama 69654ef
Fix clang test
TartanLlama b98b9ab
Add wasm-target-features test for preprocessor defines
TartanLlama 7121ea5
Remove debug code
TartanLlama 70b3b93
Complete asm printing/parsing changes
TartanLlama 43f756f
Clean up target feature decision
TartanLlama 4ffe623
Use llvm::Triple::WASIp3 rather than a string
TartanLlama 36c39bf
More driver tests
TartanLlama d953510
Fix tests
TartanLlama 0656bbf
Strip thread locals if no bulk memory
TartanLlama c5190ff
Thread pointer test
TartanLlama 6e0c9c0
TLS local exec test
TartanLlama 3386a11
Add stack abi test
TartanLlama 5775592
Shared memory fixes
TartanLlama 4d7a81e
Enable component model context in WASIP3 in LLVM
TartanLlama 1001e65
Merge branch 'main' into sy/wasip3
TartanLlama 7a44741
Tighten up linker changes
TartanLlama 4c62c81
Fix LLVM tests
TartanLlama 5bebe2a
Merge branch 'main' into sy/wasip3
TartanLlama e9fa9fc
Remove unused code
TartanLlama 10ed134
Change asserts for symbol creation
TartanLlama 2ee9845
Fix frame debug info
TartanLlama c6ddead
Merge branch 'main' into sy/wasip3
TartanLlama 2bae426
Merge branch 'sy/wasip3' of github.com:TartanLlama/llvm-project into …
TartanLlama 557bfac
Tighten up linker changes
TartanLlama 61c25c8
Typo
TartanLlama 0fe07f0
Improve TLS test
TartanLlama 7a58fce
Fix TLS in shared objects
TartanLlama 8047c76
Update comment
TartanLlama 24cb457
Remove symbol file changes for now
TartanLlama ff172dc
Merge branch 'main' into sy/wasip3
TartanLlama d11664a
Clang format
TartanLlama f04b74a
Format
TartanLlama 6bdff2c
Fix tests
TartanLlama a637ae1
fmt
TartanLlama 0bf18a6
Add chain to TLS base
TartanLlama 6c9c276
fmt
TartanLlama f019ea9
Change chain impl
TartanLlama de9424c
Correct chain
TartanLlama 5954755
fmt
TartanLlama 1f9e903
Simplify getTLSBase
TartanLlama f61837a
fmt
TartanLlama bde41fc
Add missing include
TartanLlama daf5b03
fmt
TartanLlama 36ea1df
Merge branch 'main' into sy/wasip3
TartanLlama 41f8893
Revert archive-export changes
TartanLlama 0a8c6ec
Merge branch 'main' into sy/wasip3
TartanLlama 90c342f
Revert archive-export changes
TartanLlama a42942c
Merge branch 'sy/wasip3' of github.com:TartanLlama/llvm-project into …
TartanLlama 13d3870
Revert tailcail changes
TartanLlama f75cb64
Revert tail call change
TartanLlama e1992e8
Review comments
TartanLlama c3d46dc
Newlines
TartanLlama 9ecceef
Newlines
TartanLlama 9d296ec
Remove changes from other PR
TartanLlama 95fc53a
Comments
TartanLlama ae859d0
split-file
TartanLlama abc859d
Don't disable feature for MVP cpu
TartanLlama 3749d9e
Don't disable feature for MVP cpu
TartanLlama 0028170
fmt
TartanLlama f9f40b7
Revert test changes
TartanLlama c8d5420
Merge branch 'main' into sy/wasip3
TartanLlama 9908d72
Remove merge artifact
TartanLlama 0e1a5a9
Move writer utils
TartanLlama e187d8e
Revert WriterUtils changes
TartanLlama a2e3a85
Merge branch 'main' into sy/wasip3
TartanLlama b7bc6a3
Merge branch 'main' into sy/wasip3
TartanLlama a79dc2f
Merge branch 'main' into sy/wasip3
TartanLlama 09f0fe3
Merge branch 'main' into sy/wasip3
TartanLlama 1ee14c4
Abstract out context.get/set builtins
TartanLlama af1eb70
fmt
TartanLlama c661e66
fmt
TartanLlama e00d35f
Merge branch 'main' into sy/wasip3
TartanLlama 742ae7c
Add comment
TartanLlama 9b688ca
Remove option
TartanLlama 3570777
Refactor into two config options
TartanLlama 45ff0f0
Merge branch 'main' into sy/wasip3
TartanLlama e841994
Refactor
TartanLlama da1949c
Merge branch 'sy/wasip3' of github.com:TartanLlama/llvm-project into …
TartanLlama 8dfc97c
Cleanup
TartanLlama cdca5aa
fmt
TartanLlama 7559ec5
Flag for libcall thread context
TartanLlama 4135d3d
Test fixes
TartanLlama a1cacc9
fmt
TartanLlama a2367c8
Merge branch 'main' into sy/wasip3
TartanLlama dfbfcd9
Cleanup
TartanLlama 5c04563
newline
TartanLlama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # RUN: split-file %s %t | ||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/use.o %t/use.s | ||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/disallow.o %t/disallow.s | ||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/start.o %t/start.s | ||
| # RUN: wasm-ld --libcall-thread-context -o %t/libcall.wasm %t/use.o %t/start.o | ||
| # RUN: obj2yaml %t/libcall.wasm | FileCheck %s --check-prefix=LIBCALL | ||
| # RUN: wasm-ld -o %t/global.wasm %t/disallow.o %t/start.o | ||
| # RUN: obj2yaml %t/global.wasm | FileCheck %s --check-prefix=GLOBAL | ||
|
|
||
| #--- start.s | ||
| .globl _start | ||
| _start: | ||
| .functype _start () -> () | ||
| end_function | ||
|
|
||
| #--- disallow.s | ||
| .section .custom_section.target_features,"",@ | ||
| .int8 1 | ||
| .int8 45 | ||
| .int8 22 | ||
| .ascii "libcall-thread-context" | ||
|
|
||
| #--- use.s | ||
|
|
||
| .section .custom_section.target_features,"",@ | ||
| .int8 1 | ||
| .int8 43 | ||
| .int8 22 | ||
| .ascii "libcall-thread-context" | ||
|
|
||
| # LIBCALL: Name: __init_stack_pointer | ||
| # GLOBAL: Name: __stack_pointer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Test that linking object files with mismatched thread context ABIs fails with an error. | ||
|
|
||
| # RUN: split-file %s %t | ||
|
|
||
| # Test that the presence of an import of __stack_pointer from the env module is treated | ||
| # as an indication that the global thread context ABI is being used, even if the | ||
| # libcall-thread-context feature is not disallowed. | ||
|
|
||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/start.o %t/start.s | ||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/stack-pointer.o %t/stack-pointer.s | ||
| # RUN: not wasm-ld --libcall-thread-context %t/start.o %t/stack-pointer.o -o %t/fail.wasm 2>&1 | FileCheck %s | ||
|
|
||
| # Test that explicitly disallowing the libcall-thread-context feature causes linking to fail | ||
| # with an error when other files use the feature. | ||
|
|
||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/disallow.o %t/disallow.s | ||
| # RUN: not wasm-ld --libcall-thread-context %t/start.o %t/disallow.o -o %t/fail.wasm 2>&1 | FileCheck %s | ||
|
|
||
| # CHECK: error: --libcall-thread-context is disallowed by {{.*}} because it uses globals for thread context rather than library function calls. | ||
|
|
||
| #--- start.s | ||
| .globl _start | ||
| _start: | ||
| .functype _start () -> () | ||
| end_function | ||
|
|
||
| .section .custom_section.target_features,"",@ | ||
| .int8 1 | ||
| .int8 43 | ||
| .int8 22 | ||
| .ascii "libcall-thread-context" | ||
|
|
||
| #--- stack-pointer.s | ||
| .globaltype __stack_pointer, i32 | ||
|
|
||
| .globl use_stack_pointer | ||
| use_stack_pointer: | ||
| .functype use_stack_pointer () -> () | ||
| global.get __stack_pointer | ||
| drop | ||
| end_function | ||
|
|
||
| #--- disallow.s | ||
| .section .custom_section.target_features,"",@ | ||
| .int8 1 | ||
| .int8 45 | ||
| .int8 22 | ||
| .ascii "libcall-thread-context" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s | ||
| # RUN: wasm-ld --libcall-thread-context --shared-memory -no-gc-sections -o %t.wasm %t.o | ||
| # RUN: obj2yaml %t.wasm | FileCheck %s | ||
| # RUN: llvm-objdump -d --no-print-imm-hex --no-show-raw-insn %t.wasm | FileCheck %s --check-prefix=DIS | ||
|
|
||
| .globl __wasm_get_tls_base | ||
| __wasm_get_tls_base: | ||
| .functype __wasm_get_tls_base () -> (i32) | ||
| i32.const 0 | ||
| end_function | ||
|
|
||
| .globl _start | ||
| _start: | ||
| .functype _start () -> (i32) | ||
| call __wasm_get_tls_base | ||
| i32.const tls1@TLSREL | ||
| i32.add | ||
| i32.load 0 | ||
| call __wasm_get_tls_base | ||
| i32.const tls2@TLSREL | ||
| i32.add | ||
| i32.load 0 | ||
| i32.add | ||
| end_function | ||
|
|
||
| .section .tdata.tls1,"",@ | ||
| .globl tls1 | ||
| tls1: | ||
| .int32 1 | ||
| .size tls1, 4 | ||
|
|
||
| .section .tdata.tls2,"",@ | ||
| .globl tls2 | ||
| tls2: | ||
| .int32 2 | ||
| .size tls2, 4 | ||
|
|
||
| .section .custom_section.target_features,"",@ | ||
| .int8 3 | ||
| .int8 43 | ||
| .int8 22 | ||
| .ascii "libcall-thread-context" | ||
| .int8 43 | ||
| .int8 11 | ||
| .ascii "bulk-memory" | ||
| .int8 43 | ||
| .int8 7 | ||
| .ascii "atomics" | ||
|
|
||
|
|
||
| # CHECK: GlobalNames: | ||
| # CHECK-NEXT: - Index: 0 | ||
| # CHECK-NEXT: Name: __init_stack_pointer | ||
| # CHECK-NEXT: - Index: 1 | ||
| # CHECK-NEXT: Name: __init_tls_base | ||
| # CHECK-NEXT: - Index: 2 | ||
| # CHECK-NEXT: Name: __tls_size | ||
| # CHECK-NEXT: - Index: 3 | ||
| # CHECK-NEXT: Name: __tls_align | ||
|
|
||
| # DIS-LABEL: <__wasm_init_memory>: | ||
|
|
||
| # DIS-LABEL: <_start>: | ||
| # DIS-EMPTY: | ||
| # DIS-NEXT: call 4 | ||
| # DIS-NEXT: i32.const 0 | ||
| # DIS-NEXT: i32.add | ||
| # DIS-NEXT: i32.load 0 | ||
| # DIS-NEXT: call 4 | ||
| # DIS-NEXT: i32.const 4 | ||
| # DIS-NEXT: i32.add | ||
| # DIS-NEXT: i32.load 0 | ||
| # DIS-NEXT: i32.add | ||
| # DIS-NEXT: end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.