Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/actions/setup-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
llvm-version:
description: "LLVM version to install"
required: true
default: "19"
default: "22"
install-llvm:
description: "Whether to install LLVM"
required: false
Expand All @@ -26,7 +26,7 @@ runs:
llvm_formula="llvm@${{inputs.llvm-version}}"
lld_formula="lld@${{inputs.llvm-version}}"

# GitHub macOS runners may pre-link another LLVM/LLD version (for example llvm@18),
# GitHub macOS runners may pre-link another LLVM/LLD version,
# which makes lld@<target> fail during Homebrew's automatic link step.
while IFS= read -r formula; do
case "${formula}" in
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: 19
llvm-version: 22

- name: Set up Go
uses: ./.github/actions/setup-go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
llvm: [19]
llvm: [22]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v7
Expand Down
51 changes: 25 additions & 26 deletions .github/workflows/coroutine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@ jobs:
fail-fast: false
matrix:
include:
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "compat", check: "test (19, 1.26.5, llvm19)" }
- { llvm: 20, go: "1.26.5", tags: "llvm20", lane: "compat", check: "test (20, 1.26.5, llvm20)" }
- { llvm: 21, go: "1.26.5", tags: "llvm21", lane: "compat", check: "test (21, 1.26.5, llvm21)" }
- { llvm: 22, go: "1.26.5", tags: "llvm22", lane: "compat", check: "test (22, 1.26.5, llvm22)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "integration", check: "test integration (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "integration-build", check: "test production build plan (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "native-e2e", check: "test native linked E2E (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "fleet-e2e", check: "test native fleet E2E (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "stdlib-time", fixtures: "time timer sync", check: "test stdlib time, timer and sync (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "stdlib-file", fixtures: "file syscall-file syscall-pipe", check: "test stdlib file and syscall (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "stdlib-tcp", fixtures: "tcp", check: "test stdlib TCP (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "target-core", check: "test target adapters (19, 1.26.5, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "target-js-wasm", check: "test JS/WASM command reactor (llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "target-wasi-command", check: "test WASI command reactor (llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "target-wasm", wasm_target: "wasip2", check: "test WASM host probes (wasip2, llvm19)" }
- { llvm: 19, go: "1.26.5", tags: "llvm19", lane: "target-wasm", wasm_target: "wasm-unknown", check: "test WASM host probes (wasm-unknown, llvm19)" }
- { llvm: 22, go: "1.26.5", lane: "compat", check: "test (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "integration", check: "test integration (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "integration-build", check: "test production build plan (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "native-e2e", check: "test native linked E2E (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "fleet-e2e", check: "test native fleet E2E (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "stdlib-time", fixtures: "time timer sync", check: "test stdlib time, timer and sync (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "stdlib-file", fixtures: "file syscall-file syscall-pipe", check: "test stdlib file and syscall (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "stdlib-tcp", fixtures: "tcp", check: "test stdlib TCP (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "target-core", check: "test target adapters (LLVM 22, Go 1.26.5)" }
- { llvm: 22, go: "1.26.5", lane: "target-js-wasm", check: "test JS/WASM command reactor (LLVM 22)" }
- { llvm: 22, go: "1.26.5", lane: "target-wasi-command", check: "test WASI command reactor (LLVM 22)" }
- { llvm: 22, go: "1.26.5", lane: "target-wasm", wasm_target: "wasip2", check: "test WASM host probes (wasip2, LLVM 22)" }
- { llvm: 22, go: "1.26.5", lane: "target-wasm", wasm_target: "wasm-unknown", check: "test WASM host probes (wasm-unknown, LLVM 22)" }
steps:
- uses: actions/checkout@v7

Expand Down Expand Up @@ -164,6 +161,7 @@ jobs:
# generation reuse, cancellation, and single-owner posting without
# silently restoring the old channel spin gate dependency.
go test -race -shuffle=on -tags=coro_sema_owner_test \
./internal/runtime/coro_current_task_route_test_adapter.go \
./internal/runtime/coro_keyed_registry_atomic_host.go \
./internal/runtime/coro_resume_materialize.go \
./internal/runtime/coro_operation_capacity.go \
Expand All @@ -174,6 +172,7 @@ jobs:
GOOS=js GOARCH=wasm CGO_ENABLED=0 go test \
-tags=coro_sema_owner_test \
-exec="$(go env GOROOT)/lib/wasm/go_js_wasm_exec" \
./internal/runtime/coro_current_task_route_test_adapter.go \
./internal/runtime/coro_keyed_registry_atomic_host.go \
./internal/runtime/coro_resume_materialize.go \
./internal/runtime/coro_operation_capacity.go \
Expand Down Expand Up @@ -373,7 +372,7 @@ jobs:

- name: Verify production time.Sleep coroutine plan
if: matrix.lane == 'compat'
run: go test -tags='${{ matrix.tags }}' -v ./internal/build -run '^TestCoroNativeTimeSleepProductionPlanAndCodegen$' -timeout=10m -count=1
run: go test -v ./internal/build -run '^TestCoroNativeTimeSleepProductionPlanAndCodegen$' -timeout=10m -count=1

- name: Test coroutine compiler integration
if: matrix.lane == 'integration'
Expand All @@ -383,33 +382,33 @@ jobs:

- name: Test structured LLVM coroutine builder
if: matrix.lane == 'compat'
run: go test -tags='${{ matrix.tags }}' -v ./ssa -run '^TestCoro' -count=1
run: go test -v ./ssa -run '^TestCoro' -count=1

- name: Test canonical coroutine plan digest and cache identity
if: matrix.lane == 'compat'
run: |
go test -tags='${{ matrix.tags }}' ./internal/coro -run '^TestCoroPlanDigest' -count=1
go test -tags='${{ matrix.tags }}' ./internal/build -run '^Test(BuildCoroPlanInstallsArchiveDigest|CoroutinePlanInputsAffectFingerprint|CoroEntryResolutionUsesPlanMatchedPackageCache|CoroPlanDigestMetadataUsesEffectiveLLVMTarget|CoroPhysicalABICacheRegistrationPreservesCollectedFuncInfo)$' -count=1
go test -tags='${{ matrix.tags }}' ./cl -run '^Test(CompilationCoroABIIdentityValidation|CoroEntryResolutionCacheRegistrationWithDigest|CoroPhysicalABICacheRegistrationPreservesPhysicalMetadata)$' -count=1
go test ./internal/coro -run '^TestCoroPlanDigest' -count=1
go test ./internal/build -run '^Test(BuildCoroPlanInstallsArchiveDigest|CoroutinePlanInputsAffectFingerprint|CoroEntryResolutionUsesPlanMatchedPackageCache|CoroPhysicalABICacheRegistrationPreservesCollectedFuncInfo)$' -count=1
go test ./cl -run '^Test(CompilationCoroABIIdentityValidation|CoroEntryResolutionCacheRegistrationWithDigest|CoroPhysicalABICacheRegistrationPreservesPhysicalMetadata)$' -count=1

- name: Test coroutine physical ABI and function dispatch lowering
if: matrix.lane == 'compat'
# Run every compiler test whose name is part of the coroutine contract;
# in particular this covers pure SSA aggregates/PHI and caller-frame
# park lowering on native64 and wasm32 before and after CoroSplit.
run: go test -tags='${{ matrix.tags }}' -v ./cl -run '^Test(Coro|EmissionUniverse(ActiveABIMethodTablesUseFrozenWrapperSymbols|ABIMethodDemandReferencesAreExactRecursiveAndOwnerScoped))' -count=1
run: go test -v ./cl -run '^Test(Coro|EmissionUniverse(ActiveABIMethodTablesUseFrozenWrapperSymbols|ABIMethodDemandReferencesAreExactRecursiveAndOwnerScoped))' -count=1

- name: Test coroutine TLS function dispatch proof
if: matrix.lane == 'compat'
run: go test -tags='${{ matrix.tags }}' -v ./internal/build -run '^TestCoroTLS' -count=1
run: go test -v ./internal/build -run '^TestCoroTLS' -count=1

- name: Test coroutine registry and control integration
if: matrix.lane == 'compat'
run: go test -tags='${{ matrix.tags }}' -v ./internal/build -run '^Test(CollectLinkedCoroRootAnchors|ActiveCoroABIVersions|BuildCoroPlanErrors|CoroProgramManifest.*|CoroProgramBootstrap.*|SelectCoroProgramBootstrap.*|GenMainModule.*Coro.*)$' -count=1
run: go test -v ./internal/build -run '^Test(CollectLinkedCoroRootAnchors|ActiveCoroABIVersions|BuildCoroPlanErrors|CoroProgramManifest.*|CoroProgramBootstrap.*|SelectCoroProgramBootstrap.*|GenMainModule.*Coro.*)$' -count=1

- name: Test LLVM 22 tool configuration
if: matrix.lane == 'compat' && matrix.llvm == 22
run: go test -tags=llvm22 ./xtool/env/llvm ./internal/xtool/llvm
if: matrix.lane == 'compat'
run: go test ./xtool/env/llvm ./internal/xtool/llvm

- name: Test resolved LLVM target configuration
if: matrix.lane == 'target-core'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
set -e
set -x
source doc/_readme/scripts/install_ubuntu.sh
echo "PATH=/usr/lib/llvm-19/bin:$PATH" >> $GITHUB_ENV
echo "PATH=/usr/lib/llvm-22/bin:$PATH" >> $GITHUB_ENV

- name: Install llgo with tools
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
os:
- macos-latest
- ubuntu-latest
llvm: [19]
llvm: [22]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: 19
llvm-version: 22

- name: Set up Go
uses: ./.github/actions/setup-go
Expand All @@ -128,7 +128,7 @@ jobs:
run: |
set -euo pipefail

llvm_config="$(command -v llvm-config || command -v llvm-config-19)"
llvm_config="$(command -v llvm-config || command -v llvm-config-22)"
cmake -S ltoplugin -B ltoplugin/build \
-DLLVM_DIR="$("${llvm_config}" --cmakedir)" \
-DCMAKE_BUILD_TYPE=Release
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: 19
llvm-version: 22

- name: Set up Go
uses: ./.github/actions/setup-go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: 19
llvm-version: 22

- name: Set up Go
uses: ./.github/actions/setup-go
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/llgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ jobs:
# 35-minute demo job.
include:
- os: ubuntu-latest
llvm: 19
llvm: 22
go: "1.24.2"
lane: compatibility
- os: ubuntu-latest
llvm: 19
llvm: 22
go: "1.26.5"
lane: primary
- os: macos-latest
llvm: 19
llvm: 22
go: "1.24.2"
lane: compatibility
- os: macos-latest
llvm: 19
llvm: 22
go: "1.26.5"
lane: primary
runs-on: ${{matrix.os}}
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
os:
- macos-latest
- ubuntu-latest
llvm: [19]
llvm: [22]
go: ["1.24.2", "1.26.5"]
# In-command package parallelism lets Ubuntu use two shards while
# retaining headroom for the serial std build-mode checks.
Expand Down Expand Up @@ -244,17 +244,17 @@ jobs:
matrix:
include:
- os: ubuntu-latest
llvm: 19
llvm: 22
go: "1.24.2"
lane: compatibility
- os: ubuntu-latest
llvm: 19
llvm: 22
go: "1.26.5"
lane: primary
# Keep the Go 1.26 user-module compatibility matrix on both host
# platforms; release artifact smoke tests alone only cover go 1.26.
- os: macos-latest
llvm: 19
llvm: 22
go: "1.26.5"
lane: primary
runs-on: ${{matrix.os}}
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
# Ubuntu. Native Darwin coverage remains in the primary LLGo lanes and
# release artifact smoke tests.
os: [ubuntu-latest]
llvm: [19]
llvm: [22]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -367,7 +367,7 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: 19
llvm-version: 22

- name: Set up Emscripten
uses: emscripten-core/setup-emsdk@v15
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/model-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: 19
llvm-version: 22

- name: Set up Go
uses: ./.github/actions/setup-go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
os:
- ubuntu-latest
llvm: [19]
llvm: [22]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v7
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,20 @@ Here are the Go packages that can be imported correctly:
## Dependencies

- [Go 1.21+](https://go.dev)
- [LLVM 18](https://llvm.org)
- [Clang 18](https://clang.llvm.org)
- [LLD 18](https://lld.llvm.org)
- [LLVM 22](https://llvm.org)
- [Clang 22](https://clang.llvm.org)
- [LLD 22](https://lld.llvm.org)
- [pkg-config 0.29+](https://www.freedesktop.org/wiki/Software/pkg-config/)
- [bdwgc/libgc 8.0+](https://www.hboehm.info/gc/)
- [OpenSSL 3.0+](https://www.openssl.org/)
- [zlib 1.2+](https://www.zlib.net)
- [Python 3.12+](https://www.python.org) (optional, for [github.com/goplus/lib/py](https://pkg.go.dev/github.com/goplus/lib/py))

LLGo's compiler, Go binding, coroutine lowering, and supported CI baseline are
LLVM 22 only. Version-pinned Espressif artifacts and generated ABI fixtures in
the target support tree are external vendor inputs, not an alternate supported
host LLVM/CoroSplit version.

## How to install

Follow these steps to generate the `llgo` command (its usage is the same as the `go` command):
Expand All @@ -360,9 +365,9 @@ Follow these steps to generate the `llgo` command (its usage is the same as the

```sh
brew update
brew install llvm@19 lld@19 bdw-gc openssl cjson libffi libuv pkg-config
brew install llvm@22 lld@22 bdw-gc openssl cjson libffi libuv pkg-config
brew install python@3.12 # optional
brew link --overwrite llvm@19 lld@19 libffi
brew link --overwrite llvm@22 lld@22 libffi
# curl https://raw.githubusercontent.com/xgo-dev/llgo/refs/heads/main/install.sh | bash
./install.sh
```
Expand All @@ -374,10 +379,10 @@ brew link --overwrite llvm@19 lld@19 libffi
<!-- embedme doc/_readme/scripts/install_ubuntu.sh#L2-L1000 -->

```sh
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-19 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-22 main" | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y llvm-19-dev clang-19 libclang-19-dev lld-19 libunwind-19-dev libc++-19-dev pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libsqlite3-dev libuv1-dev
sudo apt-get install -y llvm-22-dev clang-22 libclang-22-dev lld-22 libunwind-22-dev libc++-22-dev pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libsqlite3-dev libuv1-dev
sudo apt-get install -y python3.12-dev # optional
#curl https://raw.githubusercontent.com/xgo-dev/llgo/refs/heads/main/install.sh | bash
./install.sh
Expand All @@ -386,10 +391,10 @@ sudo apt-get install -y python3.12-dev # optional
#### Alpine Linux

```sh
apk add go llvm19-dev clang19-dev lld19 pkgconf gc-dev libunwind-dev openssl-dev zlib-dev
apk add go llvm22-dev clang22-dev lld22 pkgconf gc-dev libunwind-dev openssl-dev zlib-dev
apk add python3-dev # optional
apk add g++ # build only
export LLVM_CONFIG=/usr/lib/llvm19/bin/llvm-config
export LLVM_CONFIG=/usr/lib/llvm22/bin/llvm-config
export CGO_CPPFLAGS="$($LLVM_CONFIG --cppflags)"
export CGO_CXXFLAGS=-std=c++17
export CGO_LDFLAGS="$($LLVM_CONFIG --ldflags) $($LLVM_CONFIG --libs all)"
Expand Down
20 changes: 20 additions & 0 deletions benchmark/coro_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ runtime costs:
- `handoff`: unbuffered channel scheduling throughput;
- `timers`: concurrent standard-library timer registration and wakeup.

`testdata/pure_idle`, `testdata/pure_compute`, and `testdata/pure_handoff` have
no imports and no output. They are closed-world negative fixtures for the
optional worker executor. The first isolates fixed startup cost; the second
measures a billion direct, non-inlined integer calls plus loop safepoints; the
third performs 100,000 request/ack round trips through two unbuffered channels
without pulling standard-library, timer, poller, or worker costs into the
artifact. Success is established by exit status and compiler/runtime
capability gates, not by parsing stdout.

`testdata/io_workload` is separate so importing `os`, `io`, and `net` does not
pollute the core artifact. Its modes are:

Expand All @@ -28,6 +37,13 @@ pollute the core artifact. Its modes are:
- `tcp`: one persistent loopback TCP connection, with 4 KiB request/echo round
trips between two goroutines.

`testdata/preempt_timer` is a bounded progress gate: one goroutine sleeps on a
standard-library timer while the sole runnable goroutine executes a pure
compute loop. The timer must wake by compiler safepoint preemption before the
100-million-iteration guard is exhausted. This catches executor-service
optimizations which accidentally rely only on runnable peers or callbacks and
therefore starve elapsed timer/poll sources.

The final output field is workload wall time in nanoseconds, measured inside
the process after argument parsing. It excludes process startup; an external
resource tool should still measure peak RSS for `park`.
Expand Down Expand Up @@ -55,8 +71,12 @@ the host Go tool as a lightweight source check:

```sh
go test \
./benchmark/coro_core/testdata/pure_idle \
./benchmark/coro_core/testdata/pure_compute \
./benchmark/coro_core/testdata/pure_handoff \
./benchmark/coro_core/testdata/workload \
./benchmark/coro_core/testdata/io_workload \
./benchmark/coro_core/testdata/preempt_timer \
./benchmark/coro_core/testdata/wasm
```

Expand Down
Loading
Loading