Skip to content

Rekhoff/reapply update nativeaot llvm infrastructure#4897

Open
rekhoff wants to merge 23 commits intomasterfrom
rekhoff/reapply-update-nativeaot-llvm-infrastructure
Open

Rekhoff/reapply update nativeaot llvm infrastructure#4897
rekhoff wants to merge 23 commits intomasterfrom
rekhoff/reapply-update-nativeaot-llvm-infrastructure

Conversation

@rekhoff
Copy link
Copy Markdown
Contributor

@rekhoff rekhoff commented Apr 24, 2026

Description of Changes

Reapply changes from #4515 after reversion

API and ABI breaking changes

No API or ABI changes

Expected complexity level and risk

2 - This PR change itself is trivial, as it just reimplements #4515, however as #4515 had broken the quickstart smoketest, this should be considered when reviewing this PR.

Testing

  • Tested against python3 -m smoketests quickstart locally

cloutiertyler and others added 22 commits March 1, 2026 22:20
The experimental NativeAOT-LLVM build path (EXPERIMENTAL_WASM_AOT=1) was
missing several host function imports added in ABI versions 10.0-10.4,
and the compiler package reference was hardcoded to Windows x64 only.

Changes to SpacetimeDB.Runtime.targets:
- Add missing spacetime_10.0 imports: datastore_update_bsatn, identity
- Add all spacetime_10.1 imports: bytes_source_remaining_length
- Add all spacetime_10.2 imports: get_jwt
- Add all spacetime_10.3 imports: procedure_start_mut_tx,
  procedure_commit_mut_tx, procedure_abort_mut_tx, procedure_http_request
- Add all spacetime_10.4 imports: datastore_index_scan_point_bsatn,
  datastore_delete_by_index_scan_point_bsatn
- Replace hardcoded runtime.win-x64 package reference with
  runtime.$(NETCoreSdkPortableRuntimeIdentifier) so the AOT compiler
  package resolves correctly on both Windows x64 and Linux x64
- Use explicit version strings instead of $(SpacetimeNamespace) variable

Changes to ci.yml:
- Add AOT build smoketest in csharp-testsuite job to verify the
  NativeAOT-LLVM build path works on Linux x64

See #4514 for full context on the C# AOT situation.
#4601)

# Description of Changes
* Add dotnet-experimental feed + package source mapping for LLVM
packages in `sdks/csharp/tools~/write-nuget-config.sh`, so generated
NuGet.Config files include NativeAOT-LLVM prerequisites.
* Make LLVM toolchain packages explicit dependencies in
`SpacetimeDB.Runtime` to ensure restores succeed even when LLVM
dependencies are only referenced through the `.nupkg`.
* Import the LLVM targets from the package when
`EXPERIMENTAL_WASM_AOT=1` to enable NativeAOT build steps without
relying on downstream package reference resolution.
# Context
Changes are required to get `NativeAOT-LLVM` in #4515 to build correct,
but moving the packages closer to the build, to ensure they get into the
Nuget restore successfully.
Additional changes where needed to `write-nuget-config.sh‎` to allow
`Nuget.Config` files generated with required changes during regression
testing.
# API and ABI breaking changes
None.
# Expected complexity level and risk
2 (Low–moderate). Changes are scoped to build/restore infrastructure and
package configuration.
# Testing
- [X] Built CLI locally
- [X] Ran `run-regression-tests.sh` without errors

---------

Co-authored-by: Jason Larabie <jason@clockworklabs.io>
Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
…lish` for NativeAOT-LLVM support (#4672)

# Description of Changes
Adds `--native-aot` flag to `spacetime init` command for creating
NativeAOT-LLVM enabled C# projects. This automatically adds the required
LLVM package references to the generated `.csproj` file and sets
`"native-aot": true` in `spacetime.json`.

This also adds `--native-aot` flag to `spacetime publish`. This is
optional because the developer will still need to add the required LLVM
package references to their `.csproj` file, and the provided
instructions also include adding `"native-aot": true` to their
`spacetime.json` which will already apply the flag.

# API and ABI breaking changes
None.

# Expected complexity level and risk
1 (Low). Adds new optional flag to init command and post-processing of
generated .csproj files.

# Testing
- [X] Verified `spacetime init --lang csharp --native-aot` creates
projects with required LLVM package references
- [X] Confirmed `spacetime.json` is generated with `"native-aot": true`
- [X] Tested publish command works with both `--native-aot` flag and
`spacetime.json` configuration

---------

Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
@rekhoff rekhoff marked this pull request as ready for review April 25, 2026 16:11
Copy link
Copy Markdown
Contributor

@JasonAtClockwork JasonAtClockwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I ran tests locally and confirmed --native-aot working as intended.

Comment thread .github/workflows/ci.yml
# Add emscripten to PATH for subsequent steps and subprocesses
$emsdkPath = "$env:USERPROFILE\emsdk\upstream\emscripten"
Add-Content -Path $env:GITHUB_PATH -Value $emsdkPath
Write-Host "Added $emsdkPath to PATH"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, was this necessary? we at least attempt to do something similar on line 178, and I'm not quite sure why this would only be newly-required on this PR

Copy link
Copy Markdown
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like my code-owned files are the same as they were in the originally-approved PR, so approving.

the tests seem to all pass on this one, so that works for me 👍

@rekhoff rekhoff enabled auto-merge April 28, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants