Skip to content
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

[wasi] Initial wasi/aot build support #95051

Merged
merged 11 commits into from
Nov 22, 2023
Merged

[wasi] Initial wasi/aot build support #95051

merged 11 commits into from
Nov 22, 2023

Conversation

radical
Copy link
Member

@radical radical commented Nov 21, 2023

With this RunAOTCompilation=true+publish runs the AOT build, same as for browser-wasm. The build structure closely follows what we have for wasm. And this will get consolidated in future PRs.

The output does not run right now, and fails with:

$ wasmtime run  --env MONO_LOG_LEVEL=debug --env MONO_LOG_MASK=aot --dir . dotnet.wasm Wasi.Console.Sample
[MONO] debug: Found statically linked AOT module 'System.Private.CoreLib'.
[MONO] debug: AOT: module System.Private.CoreLib wants to load image 0: System.Private.CoreLib
[MONO] debug: AOT: image 'System.Private.CoreLib' found.
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) () [0x29fe - 0x29ff 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (intptr,int) [0x2981 - 0x2982 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (int) [0x29bd - 0x29be 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (intptr,int) [0x29a9 - 0x29aa 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (intptr,int) [0x29a8 - 0x29a9 0xc84d0]
[MONO] debug: AOT: FOUND method System.OutOfMemoryException:.ctor (string) [0xfb4 - 0xfb5 0xc84d0]
[MONO] debug: AOT: FOUND method System.NullReferenceException:.ctor (string) [0xf31 - 0xf32 0xc84d0]
[MONO] debug: AOT: FOUND method System.StackOverflowException:.ctor (string) [0x1069 - 0x106a 0xc84d0]
[MONO] debug: AOT: FOUND method System.AppContext:Setup (char**,char**,int) [0xb64 - 0xb65 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper other) object:gsharedvt_out_sig (object&,object&,int&,intptr) [0x2c8e - 0x2c8f 0xc84d0]
[MONO] error: * Assertion: should not be reached at /Users/ankj/dev/r2/src/mono/mono/mini/mini.c:4435

/Users/ankj/dev/r2/src/mono/mono/mini/mini.c:4435 - this is in mono_llvm_cpp_catch_exception

  • EmccCompile: Add CompilerBinaryPath input property
  • [wasi] Add default rsp files to the runtime pack
  • [wasi] Add build support for AOT
  • [wasi] Add simple aot build tests
  • [wasi] update build-tasks target

@radical radical added arch-wasm WebAssembly architecture area-Build-mono os-wasi Related to WASI variant of arch-wasm labels Nov 21, 2023
@ghost
Copy link

ghost commented Nov 21, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

With this RunAOTCompilation=true+publish runs the AOT build, same as for browser-wasm.

The output does not run right now, and fails with:

$ wasmtime run  --env MONO_LOG_LEVEL=debug --env MONO_LOG_MASK=aot --dir . dotnet.wasm Wasi.Console.Sample
[MONO] debug: Found statically linked AOT module 'System.Private.CoreLib'.
[MONO] debug: AOT: module System.Private.CoreLib wants to load image 0: System.Private.CoreLib
[MONO] debug: AOT: image 'System.Private.CoreLib' found.
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) () [0x29fe - 0x29ff 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (intptr,int) [0x2981 - 0x2982 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (int) [0x29bd - 0x29be 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (intptr,int) [0x29a9 - 0x29aa 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper managed-to-native) object:__icall_wrapper_(null) (intptr,int) [0x29a8 - 0x29a9 0xc84d0]
[MONO] debug: AOT: FOUND method System.OutOfMemoryException:.ctor (string) [0xfb4 - 0xfb5 0xc84d0]
[MONO] debug: AOT: FOUND method System.NullReferenceException:.ctor (string) [0xf31 - 0xf32 0xc84d0]
[MONO] debug: AOT: FOUND method System.StackOverflowException:.ctor (string) [0x1069 - 0x106a 0xc84d0]
[MONO] debug: AOT: FOUND method System.AppContext:Setup (char**,char**,int) [0xb64 - 0xb65 0xc84d0]
[MONO] debug: AOT: FOUND method (wrapper other) object:gsharedvt_out_sig (object&,object&,int&,intptr) [0x2c8e - 0x2c8f 0xc84d0]
[MONO] error: * Assertion: should not be reached at /Users/ankj/dev/r2/src/mono/mono/mini/mini.c:4435

/Users/ankj/dev/r2/src/mono/mono/mini/mini.c:4435 - this is in mono_llvm_cpp_catch_exception

  • EmccCompile: Add CompilerBinaryPath input property
  • [wasi] Add default rsp files to the runtime pack
  • [wasi] Add build support for AOT
  • [wasi] Add simple aot build tests
  • [wasi] update build-tasks target
Author: radical
Assignees: -
Labels:

arch-wasm, area-Build-mono, os-wasi

Milestone: -

@ghost ghost assigned radical Nov 21, 2023
@radical radical requested a review from kg November 21, 2023 07:31
@radical
Copy link
Member Author

radical commented Nov 21, 2023

Follow up PRs will consolidate more of the wasi/wasm targets, rename emcccompile etc.

@lewing lewing added this to the 9.0.0 milestone Nov 21, 2023
@lewing lewing mentioned this pull request Nov 21, 2023
27 tasks
@radical radical merged commit e0355b9 into dotnet:main Nov 22, 2023
187 checks passed
@radical radical deleted the wasi-aot branch November 22, 2023 07:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-wasi Related to WASI variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants