Skip to content

simd: preserve native C vector types and ARM64 aggregate ABI - #2841

Open
zhouguangyuan0718 wants to merge 4 commits into
mainfrom
codex/simd-c-interop-20261017
Open

zhouguangyuan0718 wants to merge 4 commits into
mainfrom
codex/simd-c-interop-20261017

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

C vector typedefs imported through import "C" currently lose their vector identity when cmd/cgo spells them as Go arrays. A four-lane C addition returns a first lane of 3 instead of 11. Native SIMD structs also disagree with source unsafe layout, and ARM64 homogeneous vector aggregates are passed indirectly instead of using the HVA ABI.

Recover named 128-bit C integer/float/double vectors from the target Clang AST before type checking, retaining native vector values/storage while preserving Go array operations. Match source layout to native vector fields in imported structs and //llgo:cdecl structs, including embedded fields. Extend ARM64 homogeneous aggregate classification to short vectors and preserve whole-argument spilling. Ordinary Go arrays and archsimd memory layout remain unchanged.

Add executable C import/direct-binding tests for SSE/NEON operations, integer and double vectors, callbacks and exports, native aggregates, pointer/global/heap layout, array conversions, and register exhaustion. Include the suite in native SIMD CI. Diagnose unsupported vector widths, lane types, alignment, and the inspected unsupported record forms; wider vectors, vectorcall, SIMD reflection calls, and Wasm C interop execution remain outside this change.

Validation:

  • Full ssa, internal/cabi, and cl package tests pass. Full internal/build tests pass with GOWORK unset and a 30-minute package timeout; focused Clang vector/type/layout tests pass on Darwin and Linux.
  • Darwin ARM64, Linux AMD64, and Windows AMD64 (MinGW/Wine): all 24 C interop runs pass across O0/O2, ThinLTO, and Full LTO, with default features and cpu.all=off. These include SSE/NEON intrinsics, vector and aggregate callbacks, exports, embedded fields, and register exhaustion.
  • Final-commit compiler O2 C interop runs pass again on Linux and Windows after adding qualified/typeof typedef recognition.
  • Official Go shared import controls and the complete Darwin ARM64 SIMD O2 suite pass.
  • LLVM verification covers native C vector operations on Darwin ARM64, Linux AMD64/ARM64, Windows AMD64/ARM64, and WASI W32; this does not qualify Wasm C interop execution.

Hosted CI is still queued/running; the results above are local validation.

@zhouguangyuan0718
zhouguangyuan0718 marked this pull request as ready for review October 17, 2026 09:48

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: preserve native C vector types and aggregate ABI

This is a well-structured change with strong test coverage (source-vs-LLVM layout agreement, HVA spilling, callbacks/exports, array/union/alignment diagnostics). The security pass found no real issues — Clang is invoked via argv (no shell injection), temp files are cleaned up on every error path, and the unsafe.Pointer conversions follow the existing goProgram/aProgram layout-compatible pattern. The panics in cVectorArray are defensible as internal invariant assertions.

The findings below are the ones worth acting on — the two performance items affect every compiled package, not just vector-using ones. Everything is non-blocking.

Comment thread ssa/type.go
Comment thread internal/build/cgo_vector.go
Comment thread ssa/cvector.go
Comment thread test/simd/README.md Outdated
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/build/cgo_vector.go 93.61% 9 Missing ⚠️
ssa/cvector.go 97.14% 1 Missing ⚠️
ssa/vector_layout.go 98.36% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/simd-c-interop-20261017 branch from 9cd00e3 to c3b9a21 Compare October 18, 2026 03:52
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

LLGo baseline benchmarks

4ba3ce666d86 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Text size vs base Build vs base Run vs base
Linux cprintf 8336 B 0 B / +0.0% 387 B 0 B / +0.0% 874.738 ms -218.5 ms / -20.0% (better) 1.259 ms -105.5 us / -7.7% (better)
Linux cprintf-lto 8120 B 0 B / +0.0% 368 B 0 B / +0.0% 866.519 ms -196.3 ms / -18.5% (better) 1.283 ms -51.8 us / -3.9% (better)
Linux fmtprintf 2502128 B -48 B / -0.001918% (better) 506861 B 0 B / +0.0% 5.940 s -1.251 s / -17.4% (better) 10.840 ms +6.636 ms / +157.8% (worse)
Linux fmtprintf-lto 1960832 B +72 B / +0.003672% (worse) 444788 B 0 B / +0.0% 26.779 s -61.8 ms / -0.2% (better) 3.978 ms -101.3 us / -2.5% (better)
Linux println 229712 B +80 B / +0.03484% (worse) 17095 B 0 B / +0.0% 1.034 s -174.8 ms / -14.5% (better) 1.701 ms +29 us / +1.7% (worse)
Linux println-lto 92304 B -8 B / -0.008666% (better) 14484 B 0 B / +0.0% 1.781 s -15.45 ms / -0.9% (better) 1.681 ms +50.11 us / +3.1% (worse)
macOS cprintf 50672 B 0 B / +0.0% 4409 B 0 B / +0.0% 874.016 ms +128 ms / +17.2% (worse) 2.503 ms +204 us / +8.9% (worse)
macOS cprintf-lto 50592 B -16 B / -0.03162% (better) 161 B 0 B / +0.0% 773.785 ms +9.967 ms / +1.3% (worse) 2.265 ms +56.08 us / +2.5% (worse)
macOS fmtprintf 1659792 B 0 B / +0.0% 883620 B 0 B / +0.0% 3.308 s +258.9 ms / +8.5% (worse) 25.336 ms -218.2 us / -0.9% (better)
macOS fmtprintf-lto 1362160 B -16 B / -0.001175% (better) 766720 B 0 B / +0.0% 6.330 s +231.5 ms / +3.8% (worse) 37.252 ms -2.74 ms / -6.9% (better)
macOS println 96512 B 0 B / +0.0% 24519 B 0 B / +0.0% 801.004 ms +33.43 ms / +4.4% (worse) 3.153 ms +43.83 us / +1.4% (worse)
macOS println-lto 84112 B -16 B / -0.01902% (better) 21732 B 0 B / +0.0% 887.421 ms -59.5 ms / -6.3% (better) 4.281 ms +507.3 us / +13.4% (worse)
Windows MinGW cprintf 676352 B 0 B / +0.0% 4390 B 0 B / +0.0% 1.777 s +191 ms / +12.0% (worse) 4.250 ms +629.1 us / +17.4% (worse)
Windows MinGW cprintf-lto 44544 B 0 B / +0.0% 4342 B 0 B / +0.0% 1.770 s +111.4 ms / +6.7% (worse) 3.613 ms +129.4 us / +3.7% (worse)
Windows MinGW fmtprintf 5473792 B 0 B / +0.0% 605958 B 0 B / +0.0% 5.463 s +55.15 ms / +1.0% (worse) 11.101 ms +246.7 us / +2.3% (worse)
Windows MinGW fmtprintf-lto 4161024 B 0 B / +0.0% 553094 B 0 B / +0.0% 12.869 s -323.7 ms / -2.5% (better) 11.433 ms +246.2 us / +2.2% (worse)
Windows MinGW println 733696 B 0 B / +0.0% 25286 B 0 B / +0.0% 1.772 s +97.01 ms / +5.8% (worse) 7.397 ms +652.3 us / +9.7% (worse)
Windows MinGW println-lto 210944 B 0 B / +0.0% 22166 B 0 B / +0.0% 2.032 s +145.9 ms / +7.7% (worse) 6.570 ms +247.6 us / +3.9% (worse)
Windows MinGW 386 cprintf 627200 B 0 B / +0.0% 5352 B 0 B / +0.0% 1.549 s -63.36 ms / -3.9% (better) 6.087 ms -39.9 us / -0.7% (better)
Windows MinGW 386 cprintf-lto 104448 B 0 B / +0.0% 5112 B 0 B / +0.0% 1.608 s -65.02 ms / -3.9% (better) 5.128 ms -745.8 us / -12.7% (better)
Windows MinGW 386 fmtprintf 4776448 B 0 B / +0.0% 473886 B 0 B / +0.0% 5.224 s +31.29 ms / +0.6% (worse) 13.168 ms -533.3 us / -3.9% (better)
Windows MinGW 386 fmtprintf-lto 4162560 B 0 B / +0.0% 452294 B 0 B / +0.0% 12.304 s -35.56 ms / -0.3% (better) 20.581 ms -147.8 us / -0.7% (better)
Windows MinGW 386 println 681472 B 0 B / +0.0% 21694 B 0 B / +0.0% 1.569 s -39.08 ms / -2.4% (better) 9.105 ms -238.1 us / -2.5% (better)
Windows MinGW 386 println-lto 260608 B 0 B / +0.0% 19514 B 0 B / +0.0% 1.847 s -50.94 ms / -2.7% (better) 9.367 ms -175.1 us / -1.8% (better)
Windows MinGW ARM64 cprintf 686592 B 0 B / +0.0% 4204 B 0 B / +0.0% 1.979 s -152.3 ms / -7.1% (better) 6.808 ms -132.9 us / -1.9% (better)
Windows MinGW ARM64 cprintf-lto 44032 B 0 B / +0.0% 4156 B 0 B / +0.0% 1.981 s -143.2 ms / -6.7% (better) 6.904 ms -462.1 us / -6.3% (better)
Windows MinGW ARM64 fmtprintf 5381632 B 0 B / +0.0% 514048 B 0 B / +0.0% 5.699 s -19.42 ms / -0.3% (better) 17.011 ms +121.2 us / +0.7% (worse)
Windows MinGW ARM64 fmtprintf-lto 4326400 B 0 B / +0.0% 480124 B 0 B / +0.0% 12.682 s +54.39 ms / +0.4% (worse) 16.134 ms -19.3 us / -0.1% (better)
Windows MinGW ARM64 println 739840 B 0 B / +0.0% 23928 B 0 B / +0.0% 1.972 s -51.76 ms / -2.6% (better) 11.816 ms -387.9 us / -3.2% (better)
Windows MinGW ARM64 println-lto 218112 B 0 B / +0.0% 21284 B 0 B / +0.0% 2.230 s +2.304 ms / +0.1% (worse) 11.833 ms -376.7 us / -3.1% (better)
Windows MSVC cprintf 921088 B 0 B / +0.0% 66003 B 0 B / +0.0% 1.361 s +128 ms / +10.4% (worse) 2.830 ms +80.7 us / +2.9% (worse)
Windows MSVC cprintf-lto 292352 B 0 B / +0.0% 65971 B 0 B / +0.0% 1.266 s +53.41 ms / +4.4% (worse) 2.346 ms -434.7 us / -15.6% (better)
Windows MSVC fmtprintf 5774848 B 0 B / +0.0% 701862 B 0 B / +0.0% 4.217 s +3.28 ms / +0.1% (worse) 11.673 ms +879.6 us / +8.1% (worse)
Windows MSVC fmtprintf-lto 4484096 B 0 B / +0.0% 652806 B 0 B / +0.0% 10.620 s +250 ms / +2.4% (worse) 11.558 ms +1.199 ms / +11.6% (worse)
Windows MSVC println 1044992 B 0 B / +0.0% 121334 B 0 B / +0.0% 1.224 s +19.34 ms / +1.6% (worse) 5.677 ms -916.3 us / -13.9% (better)
Windows MSVC println-lto 531456 B 0 B / +0.0% 118870 B 0 B / +0.0% 1.504 s +86.87 ms / +6.1% (worse) 6.006 ms +45.5 us / +0.8% (worse)
Windows MSVC 386 cprintf 538624 B 0 B / +0.0% 3947 B 0 B / +0.0% 1.568 s +88.66 ms / +6.0% (worse) 5.720 ms -475.5 us / -7.7% (better)
Windows MSVC 386 cprintf-lto 44544 B 0 B / +0.0% 3901 B 0 B / +0.0% 1.589 s -106.3 ms / -6.3% (better) 8.234 ms +2.316 ms / +39.1% (worse)
Windows MSVC 386 fmtprintf 4508672 B 0 B / +0.0% 457314 B 0 B / +0.0% 5.406 s +233.3 ms / +4.5% (worse) 15.591 ms +2.868 ms / +22.5% (worse)
Windows MSVC 386 fmtprintf-lto 3910656 B 0 B / +0.0% 427681 B 0 B / +0.0% 11.671 s +198 ms / +1.7% (worse) 13.310 ms -542.9 us / -3.9% (better)
Windows MSVC 386 println 593920 B 0 B / +0.0% 20566 B 0 B / +0.0% 1.611 s +128.2 ms / +8.6% (worse) 11.329 ms +1.454 ms / +14.7% (worse)
Windows MSVC 386 println-lto 200192 B 0 B / +0.0% 18711 B 0 B / +0.0% 1.845 s +96.46 ms / +5.5% (worse) 11.077 ms +27.2 us / +0.2% (worse)
Windows MSVC ARM64 cprintf 687616 B 0 B / +0.0% 4240 B 0 B / +0.0% 1.564 s +21.83 ms / +1.4% (worse) 6.471 ms +283.6 us / +4.6% (worse)
Windows MSVC ARM64 cprintf-lto 49152 B 0 B / +0.0% 4140 B 0 B / +0.0% 1.576 s +38.43 ms / +2.5% (worse) 6.367 ms -4.9 us / -0.1% (better)
Windows MSVC ARM64 fmtprintf 5379072 B 0 B / +0.0% 514148 B 0 B / +0.0% 4.957 s +181.1 ms / +3.8% (worse) 15.967 ms +1.044 ms / +7.0% (worse)
Windows MSVC ARM64 fmtprintf-lto 4333568 B 0 B / +0.0% 480960 B 0 B / +0.0% 11.278 s +428.7 ms / +4.0% (worse) 17.329 ms +1.094 ms / +6.7% (worse)
Windows MSVC ARM64 println 741376 B 0 B / +0.0% 24200 B 0 B / +0.0% 1.539 s -21.49 ms / -1.4% (better) 11.856 ms +468.7 us / +4.1% (worse)
Windows MSVC ARM64 println-lto 223232 B 0 B / +0.0% 21688 B 0 B / +0.0% 1.776 s +16.82 ms / +1.0% (worse) 11.044 ms -713.3 us / -6.1% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 14.660 ns/op +0.11 ns/op / +0.8% (worse)
Linux BenchmarkMergeCompilerFlags 213.300 ns/op -2 ns/op / -0.9% (better)
Linux BenchmarkMergeLinkerFlags 144.100 ns/op -8.3 ns/op / -5.4% (better)
Linux BenchmarkChannelBuffered 56.690 ns/op +1.38 ns/op / +2.5% (worse)
Linux BenchmarkChannelHandoff 18660 ns/op +5303 ns/op / +39.7% (worse)
Linux BenchmarkDefer 59.170 ns/op +4.23 ns/op / +7.7% (worse)
Linux BenchmarkDirectCall 1.185 ns/op +0.018 ns/op / +1.5% (worse)
Linux BenchmarkGlobalRead 1.164 ns/op -0.002 ns/op / -0.2% (better)
Linux BenchmarkGlobalWrite 7.804 ns/op +0.025 ns/op / +0.3% (worse)
Linux BenchmarkGoroutine 28510 ns/op +3372 ns/op / +13.4% (worse)
Linux BenchmarkInterfaceCall 6.309 ns/op +0.071 ns/op / +1.1% (worse)
Linux BenchmarkRuntimeGetG 2.993 ns/op -0.054 ns/op / -1.8% (better)
macOS BenchmarkLookupPCRandom 12.060 ns/op -0.33 ns/op / -2.7% (better)
macOS BenchmarkMergeCompilerFlags 104.600 ns/op +11.26 ns/op / +12.1% (worse)
macOS BenchmarkMergeLinkerFlags 61.930 ns/op +1.78 ns/op / +3.0% (worse)
macOS BenchmarkChannelBuffered 25.040 ns/op -2.93 ns/op / -10.5% (better)
macOS BenchmarkChannelHandoff 9676 ns/op +2301 ns/op / +31.2% (worse)
macOS BenchmarkDefer 32.110 ns/op -3.64 ns/op / -10.2% (better)
macOS BenchmarkDirectCall 1.045 ns/op +0.011 ns/op / +1.1% (worse)
macOS BenchmarkGlobalRead 1.072 ns/op -0.026 ns/op / -2.4% (better)
macOS BenchmarkGlobalWrite 1.050 ns/op -0.011 ns/op / -1.0% (better)
macOS BenchmarkGoroutine 32388 ns/op +151 ns/op / +0.5% (worse)
macOS BenchmarkInterfaceCall 3.895 ns/op +0.172 ns/op / +4.6% (worse)
macOS BenchmarkRuntimeGetG 2.143 ns/op +0.024 ns/op / +1.1% (worse)
Windows MinGW BenchmarkLookupPCRandom 13.050 ns/op -0.17 ns/op / -1.3% (better)
Windows MinGW BenchmarkMergeCompilerFlags 613.700 ns/op -9.6 ns/op / -1.5% (better)
Windows MinGW BenchmarkMergeLinkerFlags 534.900 ns/op -16.3 ns/op / -3.0% (better)
Windows MinGW BenchmarkChannelBuffered 30.230 ns/op +0.52 ns/op / +1.8% (worse)
Windows MinGW BenchmarkChannelHandoff 1126 ns/op -180 ns/op / -13.8% (better)
Windows MinGW BenchmarkDefer 54.760 ns/op +0.91 ns/op / +1.7% (worse)
Windows MinGW BenchmarkDirectCall 1.548 ns/op -0.002 ns/op / -0.1% (better)
Windows MinGW BenchmarkGlobalRead 1.549 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalWrite 2.449 ns/op -0.002 ns/op / -0.1% (better)
Windows MinGW BenchmarkGoroutine 87714 ns/op -2662 ns/op / -2.9% (better)
Windows MinGW BenchmarkInterfaceCall 8.993 ns/op -0.001 ns/op / -0.01112% (better)
Windows MinGW BenchmarkRuntimeGetG 2.477 ns/op -0.003 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkLookupPCRandom 69.940 ns/op +0.02 ns/op / +0.0286% (worse)
Windows MinGW 386 BenchmarkMergeCompilerFlags 774.600 ns/op -16 ns/op / -2.0% (better)
Windows MinGW 386 BenchmarkMergeLinkerFlags 738.200 ns/op +0.2 ns/op / +0.0271% (worse)
Windows MinGW 386 BenchmarkChannelBuffered 54.140 ns/op +0.86 ns/op / +1.6% (worse)
Windows MinGW 386 BenchmarkChannelHandoff 1760 ns/op -108 ns/op / -5.8% (better)
Windows MinGW 386 BenchmarkDefer 45.700 ns/op -0.47 ns/op / -1.0% (better)
Windows MinGW 386 BenchmarkDirectCall 0.997 ns/op -0.0658 ns/op / -6.2% (better)
Windows MinGW 386 BenchmarkGlobalRead 0.999 ns/op -0.043 ns/op / -4.1% (better)
Windows MinGW 386 BenchmarkGlobalWrite 17.200 ns/op -0.01 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGoroutine 90368 ns/op +2922 ns/op / +3.3% (worse)
Windows MinGW 386 BenchmarkInterfaceCall 6.836 ns/op -0.184 ns/op / -2.6% (better)
Windows MinGW 386 BenchmarkRuntimeGetG 1.588 ns/op +0.119 ns/op / +8.1% (worse)
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.120 ns/op +0.1 ns/op / +0.8% (worse)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 568.700 ns/op +7.3 ns/op / +1.3% (worse)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 532.900 ns/op -4.3 ns/op / -0.8% (better)
Windows MinGW ARM64 BenchmarkChannelBuffered 37.300 ns/op -1.4 ns/op / -3.6% (better)
Windows MinGW ARM64 BenchmarkChannelHandoff 2440 ns/op -292 ns/op / -10.7% (better)
Windows MinGW ARM64 BenchmarkDefer 58.160 ns/op +2.96 ns/op / +5.4% (worse)
Windows MinGW ARM64 BenchmarkDirectCall 0.590 ns/op -0.0004 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkGlobalRead 0.664 ns/op -0.0002 ns/op / -0.03012% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.664 ns/op +0.0004 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkGoroutine 60311 ns/op -1026 ns/op / -1.7% (better)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.137 ns/op -0.008 ns/op / -0.2% (better)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.797 ns/op +0.027 ns/op / +1.5% (worse)
Windows MSVC BenchmarkLookupPCRandom 9.718 ns/op +0.132 ns/op / +1.4% (worse)
Windows MSVC BenchmarkMergeCompilerFlags 396.300 ns/op +22.6 ns/op / +6.0% (worse)
Windows MSVC BenchmarkMergeLinkerFlags 339.200 ns/op +5.9 ns/op / +1.8% (worse)
Windows MSVC BenchmarkChannelBuffered 23.120 ns/op +0.06 ns/op / +0.3% (worse)
Windows MSVC BenchmarkChannelHandoff 1087 ns/op -55 ns/op / -4.8% (better)
Windows MSVC BenchmarkDefer 44.550 ns/op -1.49 ns/op / -3.2% (better)
Windows MSVC BenchmarkDirectCall 1.360 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC BenchmarkGlobalRead 1.359 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC BenchmarkGlobalWrite 2.171 ns/op -0.001 ns/op / -0.04604% (better)
Windows MSVC BenchmarkGoroutine 59411 ns/op +2671 ns/op / +4.7% (worse)
Windows MSVC BenchmarkInterfaceCall 7.466 ns/op -0.086 ns/op / -1.1% (better)
Windows MSVC BenchmarkRuntimeGetG 1.633 ns/op 0 ns/op / +0.0%
Windows MSVC 386 BenchmarkLookupPCRandom 26.530 ns/op -0.02 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkMergeCompilerFlags 767.300 ns/op -13.6 ns/op / -1.7% (better)
Windows MSVC 386 BenchmarkMergeLinkerFlags 693.300 ns/op -15.7 ns/op / -2.2% (better)
Windows MSVC 386 BenchmarkChannelBuffered 39.830 ns/op -0.25 ns/op / -0.6% (better)
Windows MSVC 386 BenchmarkChannelHandoff 922.600 ns/op +29.8 ns/op / +3.3% (worse)
Windows MSVC 386 BenchmarkDefer 46.090 ns/op -0.73 ns/op / -1.6% (better)
Windows MSVC 386 BenchmarkDirectCall 1.549 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkGlobalRead 1.554 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGlobalWrite 7.788 ns/op +0.008 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGoroutine 111799 ns/op +629 ns/op / +0.6% (worse)
Windows MSVC 386 BenchmarkInterfaceCall 8.174 ns/op +0.01 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkRuntimeGetG 2.481 ns/op +0.004 ns/op / +0.2% (worse)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.110 ns/op +0.03 ns/op / +0.2% (worse)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 580.900 ns/op +10.9 ns/op / +1.9% (worse)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 529 ns/op -10.2 ns/op / -1.9% (better)
Windows MSVC ARM64 BenchmarkChannelBuffered 38.570 ns/op +1.04 ns/op / +2.8% (worse)
Windows MSVC ARM64 BenchmarkChannelHandoff 2905 ns/op -677 ns/op / -18.9% (better)
Windows MSVC ARM64 BenchmarkDefer 64.910 ns/op +5.74 ns/op / +9.7% (worse)
Windows MSVC ARM64 BenchmarkDirectCall 0.590 ns/op -0.0001 ns/op / -0.01696% (better)
Windows MSVC ARM64 BenchmarkGlobalRead 0.590 ns/op -0.0003 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.750 ns/op -0.003 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGoroutine 57886 ns/op +4161 ns/op / +7.7% (worse)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.152 ns/op +0.012 ns/op / +0.3% (worse)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.772 ns/op +0.003 ns/op / +0.2% (worse)
Timer runtime benchmarks
Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 919.100 ns/op -14 ns/op / -1.5% (better)
Linux AfterFuncZeroDelivery/LLGo 44112 ns/op +3575 ns/op / +8.8% (worse)
Linux CreateStop/Go 292.500 ns/op -11.2 ns/op / -3.7% (better)
Linux CreateStop/LLGo 1716 ns/op -55 ns/op / -3.1% (better)
Linux RearmStopped/Go 115.100 ns/op 0 ns/op / +0.0%
Linux RearmStopped/LLGo 1193 ns/op +209.5 ns/op / +21.3% (worse)
Linux ResetActive/Go 67.540 ns/op -1.03 ns/op / -1.5% (better)
Linux ResetActive/LLGo 699 ns/op +9.9 ns/op / +1.4% (worse)
Linux ResetHeap1024/Go 67.260 ns/op -1.26 ns/op / -1.8% (better)
Linux ResetHeap1024/LLGo 162 ns/op +0.7 ns/op / +0.4% (worse)
macOS AfterFuncZeroDelivery/Go 420.100 ns/op -4.9 ns/op / -1.2% (better)
macOS AfterFuncZeroDelivery/LLGo 29962 ns/op -1821 ns/op / -5.7% (better)
macOS CreateStop/Go 130.200 ns/op -5.9 ns/op / -4.3% (better)
macOS CreateStop/LLGo 354.300 ns/op -0.7 ns/op / -0.2% (better)
macOS RearmStopped/Go 58.240 ns/op -2.29 ns/op / -3.8% (better)
macOS RearmStopped/LLGo 273.400 ns/op +0.7 ns/op / +0.3% (worse)
macOS ResetActive/Go 41.990 ns/op -1.51 ns/op / -3.5% (better)
macOS ResetActive/LLGo 141.800 ns/op -1.6 ns/op / -1.1% (better)
macOS ResetHeap1024/Go 42.040 ns/op -1.74 ns/op / -4.0% (better)
macOS ResetHeap1024/LLGo 75.610 ns/op -0.12 ns/op / -0.2% (better)
Windows MinGW AfterFuncZeroDelivery/Go 570.700 ns/op +16.6 ns/op / +3.0% (worse)
Windows MinGW AfterFuncZeroDelivery/LLGo 183439 ns/op -1775 ns/op / -1.0% (better)
Windows MinGW CreateStop/Go 115.200 ns/op 0 ns/op / +0.0%
Windows MinGW CreateStop/LLGo 470.200 ns/op +12.8 ns/op / +2.8% (worse)
Windows MinGW RearmStopped/Go 31.360 ns/op -0.2 ns/op / -0.6% (better)
Windows MinGW RearmStopped/LLGo 247 ns/op +7.7 ns/op / +3.2% (worse)
Windows MinGW ResetActive/Go 20.050 ns/op +0.02 ns/op / +0.1% (worse)
Windows MinGW ResetActive/LLGo 139.400 ns/op -4.2 ns/op / -2.9% (better)
Windows MinGW ResetHeap1024/Go 20.590 ns/op +0.25 ns/op / +1.2% (worse)
Windows MinGW ResetHeap1024/LLGo 117 ns/op -1.2 ns/op / -1.0% (better)
Windows MinGW 386 AfterFuncZeroDelivery/Go 1018 ns/op +5 ns/op / +0.5% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 182038 ns/op +104 ns/op / +0.1% (worse)
Windows MinGW 386 CreateStop/Go 258 ns/op -3.7 ns/op / -1.4% (better)
Windows MinGW 386 CreateStop/LLGo 1222 ns/op +156 ns/op / +14.6% (worse)
Windows MinGW 386 RearmStopped/Go 93.130 ns/op -0.24 ns/op / -0.3% (better)
Windows MinGW 386 RearmStopped/LLGo 524.400 ns/op -17.4 ns/op / -3.2% (better)
Windows MinGW 386 ResetActive/Go 45.180 ns/op +0.08 ns/op / +0.2% (worse)
Windows MinGW 386 ResetActive/LLGo 293.200 ns/op -247 ns/op / -45.7% (better)
Windows MinGW 386 ResetHeap1024/Go 45.410 ns/op +0.02 ns/op / +0.04406% (worse)
Windows MinGW 386 ResetHeap1024/LLGo 156.200 ns/op -0.2 ns/op / -0.1% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 663.300 ns/op +1.6 ns/op / +0.2% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 156522 ns/op +6075 ns/op / +4.0% (worse)
Windows MinGW ARM64 CreateStop/Go 196.800 ns/op +0.5 ns/op / +0.3% (worse)
Windows MinGW ARM64 CreateStop/LLGo 389.100 ns/op +4.9 ns/op / +1.3% (worse)
Windows MinGW ARM64 RearmStopped/Go 70.640 ns/op +0.03 ns/op / +0.04249% (worse)
Windows MinGW ARM64 RearmStopped/LLGo 217 ns/op -3.4 ns/op / -1.5% (better)
Windows MinGW ARM64 ResetActive/Go 31.030 ns/op -0.14 ns/op / -0.4% (better)
Windows MinGW ARM64 ResetActive/LLGo 118.200 ns/op -10.8 ns/op / -8.4% (better)
Windows MinGW ARM64 ResetHeap1024/Go 31.130 ns/op -0.11 ns/op / -0.4% (better)
Windows MinGW ARM64 ResetHeap1024/LLGo 111.300 ns/op +0.1 ns/op / +0.1% (worse)
Windows MSVC AfterFuncZeroDelivery/Go 380.800 ns/op +2.7 ns/op / +0.7% (worse)
Windows MSVC AfterFuncZeroDelivery/LLGo 108471 ns/op -1005 ns/op / -0.9% (better)
Windows MSVC CreateStop/Go 91.790 ns/op -0.86 ns/op / -0.9% (better)
Windows MSVC CreateStop/LLGo 312.900 ns/op -6.3 ns/op / -2.0% (better)
Windows MSVC RearmStopped/Go 24.510 ns/op -0.01 ns/op / -0.04078% (better)
Windows MSVC RearmStopped/LLGo 188.500 ns/op -7.4 ns/op / -3.8% (better)
Windows MSVC ResetActive/Go 14.840 ns/op +0.02 ns/op / +0.1% (worse)
Windows MSVC ResetActive/LLGo 134.900 ns/op +10.7 ns/op / +8.6% (worse)
Windows MSVC ResetHeap1024/Go 14.830 ns/op +0.01 ns/op / +0.1% (worse)
Windows MSVC ResetHeap1024/LLGo 99.030 ns/op -0.3 ns/op / -0.3% (better)
Windows MSVC 386 AfterFuncZeroDelivery/Go 964.900 ns/op +8.7 ns/op / +0.9% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 200426 ns/op -8068 ns/op / -3.9% (better)
Windows MSVC 386 CreateStop/Go 190.800 ns/op -1.6 ns/op / -0.8% (better)
Windows MSVC 386 CreateStop/LLGo 437.500 ns/op +2.9 ns/op / +0.7% (worse)
Windows MSVC 386 RearmStopped/Go 63.460 ns/op -0.12 ns/op / -0.2% (better)
Windows MSVC 386 RearmStopped/LLGo 303 ns/op +6.3 ns/op / +2.1% (worse)
Windows MSVC 386 ResetActive/Go 39.050 ns/op -0.14 ns/op / -0.4% (better)
Windows MSVC 386 ResetActive/LLGo 920.900 ns/op -15 ns/op / -1.6% (better)
Windows MSVC 386 ResetHeap1024/Go 39.400 ns/op -0.06 ns/op / -0.2% (better)
Windows MSVC 386 ResetHeap1024/LLGo 160.100 ns/op +0.6 ns/op / +0.4% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 667.100 ns/op -6.2 ns/op / -0.9% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 143664 ns/op +6170 ns/op / +4.5% (worse)
Windows MSVC ARM64 CreateStop/Go 191.300 ns/op -14 ns/op / -6.8% (better)
Windows MSVC ARM64 CreateStop/LLGo 339.300 ns/op +4.7 ns/op / +1.4% (worse)
Windows MSVC ARM64 RearmStopped/Go 70.670 ns/op +0.31 ns/op / +0.4% (worse)
Windows MSVC ARM64 RearmStopped/LLGo 222.900 ns/op -1.4 ns/op / -0.6% (better)
Windows MSVC ARM64 ResetActive/Go 31.070 ns/op +0.08 ns/op / +0.3% (worse)
Windows MSVC ARM64 ResetActive/LLGo 109.400 ns/op +0.3 ns/op / +0.3% (worse)
Windows MSVC ARM64 ResetHeap1024/Go 31.080 ns/op +0.1 ns/op / +0.3% (worse)
Windows MSVC ARM64 ResetHeap1024/LLGo 114.900 ns/op -2.3 ns/op / -2.0% (better)

Compared with 577d51f5d4af measured in the same runner job.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

1b65c4b9f527 | workflow run | long-term charts

WebAssembly output sizes
Example, profile and compiler Wasm module vs base Generated JS glue vs base
cprintf/j32-emscripten/LLGo 147058 B 0 B / +0.0% 88541 B 0 B / +0.0%
cprintf/j32-goos-js/LLGo 145666 B 0 B / +0.0% 72985 B 0 B / +0.0%
cprintf/j64-emscripten-memory64/LLGo 134527 B 0 B / +0.0% 91712 B 0 B / +0.0%
cprintf/w32-goos-wasip1/LLGo 156385 B 0 B / +0.0% 0 B 0 B / 0.0%
cprintf/w32-wasi/LLGo 157083 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-emscripten/LLGo 2983979 B 0 B / +0.0% 120989 B 0 B / +0.0%
fmtprintf/j32-goos-js/Go 2526852 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-goos-js/LLGo 3074748 B 0 B / +0.0% 92052 B 0 B / +0.0%
fmtprintf/j64-emscripten-memory64/LLGo 2748837 B 0 B / +0.0% 125530 B 0 B / +0.0%
fmtprintf/w32-goos-wasip1/Go 2500019 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/w32-goos-wasip1/LLGo 2343602 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/w32-wasi/LLGo 2340298 B 0 B / +0.0% 0 B 0 B / 0.0%
j32-emscripten/LLGo 146575 B 0 B / +0.0% 88541 B 0 B / +0.0%
j32-goos-js/Go 1895533 B 0 B / +0.0% 0 B 0 B / 0.0%
j32-goos-js/LLGo 145416 B 0 B / +0.0% 72985 B 0 B / +0.0%
j64-emscripten-memory64/LLGo 134082 B 0 B / +0.0% 91712 B 0 B / +0.0%
reflectcall/j32-emscripten/LLGo 1510134 B 0 B / +0.0% 95329 B 0 B / +0.0%
reflectcall/j32-goos-js/Go 2191221 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/j32-goos-js/LLGo 1562301 B 0 B / +0.0% 79769 B 0 B / +0.0%
reflectcall/j64-emscripten-memory64/LLGo 1391259 B 0 B / +0.0% 99026 B 0 B / +0.0%
reflectcall/w32-goos-wasip1/Go 2205707 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/w32-goos-wasip1/LLGo 1273789 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/w32-wasi/LLGo 1271430 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-goos-wasip1/Go 1909947 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-goos-wasip1/LLGo 156059 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-wasi/LLGo 156757 B 0 B / +0.0% 0 B 0 B / 0.0%
LLGo WebAssembly build measurements
Example and profile Build vs base
j32-emscripten 7.612 s -173.9 ms / -2.2% (better)
j32-goos-js 7.780 s +635.8 ms / +8.9% (worse)
j64-emscripten-memory64 6.598 s +40.73 ms / +0.6% (worse)
reflectcall/w32-wasi 24.672 s -1.17 s / -4.5% (better)
w32-goos-wasip1 4.651 s -57.66 ms / -1.2% (better)
w32-wasi 4.514 s +194.6 ms / +4.5% (worse)

Compared with 0a2ebb890b83 measured in the same runner job.

@zhouguangyuan0718

Copy link
Copy Markdown
Collaborator Author

@fennoai /review

Please re-review the latest head 1b65c4b9f52761699aa0bd5418a91d6a127df04d against main, including the full PR diff and the follow-up changes since your previous review.

Added an atomic metadata guard for vector source-layout traversal, a failing-before/passing-after allocation regression, native-registration coverage, and clearer source-position/lane-count contracts. Kept the conservative C array prefilter to preserve unsupported-vector diagnostics; the inline reply explains why a 16-byte-only filter is unsafe. Full SSA tests, C vector build/diagnostic tests, and native C interop pass locally. Please pay particular attention to source layout, shared metadata and ABI boundaries.

The previous inline findings have individual responses and dispositions. All three SIMD PRs also include the isolated native-debug harness fix from commit 2cc3c5b in #2849: disable external symbol lookup and stream LLDB progress. Their preceding Ubuntu jobs exhausted the job limit in native source-debug acceptance after SIMD tests passed; the fixed harness passes locally. The preceding coverage checks passed (this is not a claim about the fresh CI run).

Fresh CI has been triggered for this head and is still pending. Please report any remaining correctness, regression, or performance issues against this exact revision. Review only; no code changes are requested.

@fennoai

fennoai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Re-review at 1b65c4b — complete

I re-reviewed the full PR diff against main plus the follow-up commits since my previous review, running four subagents (code quality, performance, security, documentation) focused on source layout, shared metadata, and ABI boundaries. Submitted as one non-blocking COMMENT review: pullrequestreview-5562655402.

Previous findings — all verified as addressed:

  • [P2] vector-layout traversal cost — Fixed with the new hasVectorLayouts atomic.Bool latch, mirroring the existing hasStructLayouts pattern; race-free monotonic latch, restores the zero-allocation common path, and guarded by a valid AllocsPerRun regression test.
  • [P2] conservative possibleVector Clang gate — Correctly kept. I independently confirmed a 16-byte prefilter would silently suppress the mandatory diagnostic for wider (e.g. vector_size(32)) vectors, since those arrive as 32-byte Go arrays and would never reach Clang.
  • [P3] SetNativeStructFields contract — Clarified and now proven by TestNativeEmbeddedFieldPositions.
  • [P3] README lane wording — Reworded accurately.

New commit c3b9a21d1 (shared aggregate path, value.Type() comparison) — Verified correct; it fixes a latent native-narrowed-field bug without regressing the common tuple/array/wide-pointer paths, well-covered by new wasm storage tests.

Security & docs — No issues.

One new non-blocking item (inline, P3): Offsetsof at ssa/type.go:111 derives native-ness from nativeFields (position-keyed) while Sizeof/Alignof use the enclosing named type — a latent offset-vs-size desync reachable only via the one-shot API (not the cgo path, which always registers both setters), and the same spot leaves a small residual lock/lookup outside the fast-path guard. Fixable together.

Not done: No code changes (review-only, as requested). I did not inspect the CI run (still pending per your note) or the native-debug harness fix from #2849, which is outside this PR's SIMD/C-vector scope.

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review at 1b65c4b — follow-up changes verified

I re-reviewed the full PR diff against main plus the follow-up commits since my last pass (c3b9a21d1, 1b65c4b9f), with four subagents focused on source layout, shared metadata, and ABI boundaries. Two subagents independently converged on the one item below.

Previous findings — all addressed:

  • [P2] vector-layout traversal cost → Fixed. The new hasVectorLayouts atomic.Bool latch (ssa/package_syntax.go), set in SetCVectorType/SetNativeStructFields/SetTypeCallConv and checked first in vectorLayout/vectorStructLayout, mirrors the existing hasStructLayouts pattern and restores the zero-allocation common path. The monotonic false→true latch (atomic store under mu, lock-free load) is race-free, and TestOrdinarySourceLayoutAllocations is a valid allocation-equality regression guard.
  • [P2] conservative possibleVector Clang gate → Correctly kept. I confirmed a 16-byte-only prefilter would silently suppress the mandatory "unsupported vector" diagnostic for wider vectors (a vector_size(32) typedef arrives as a 32-byte Go array and would never reach Clang). The added comment accurately explains why.
  • [P3] SetNativeStructFields position contract → Clarified and now proven by TestNativeEmbeddedFieldPositions across plain/pointer/qualified/generic embeds.
  • [P3] README lane wording → Reworded accurately.

New commit c3b9a21d1 (shared aggregate path): Verified correct — comparing against value.Type() in wrapStructConstantAs/wrapStructField skips the storage conversion only on an exact physical-type match, fixing a latent native-narrowed-field bug (e.g. wasm32 i64 uintptr value into an i32 slot) without regressing the common tuple, array, or wide-pointer paths. Well-covered by the new TestWasm32NativeStructAndGCRootStorage assertions.

Security & docs: No issues. The atomic latch is a safe monotonic flag with the mutex still guarding all shared-map access; the cVectorArray panics remain internal-invariant assertions unreachable from valid cgo input (and are now exercised by TestCVectorRejectsIncompatibleGoStorage).

One non-blocking latent item remains (inline). Overall this is a clean, well-tested revision.

Comment thread ssa/type.go
if abi.IsClosureFields(fields) {
return []int64{0, ptrSize}
}
if _, offsets, ok := p.vectorStructLayout(fields, prog.nativeFields(fields)); ok {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P3] Offsetsof derives native-ness from a different source than Sizeof/Alignof, and evaluates nativeFields outside the fast-path guard.

Two related observations on this line:

  1. Latent desync (one-shot API only). Offsetsof computes native-ness from prog.nativeFields(fields) (keyed on fields[0].Pos()), whereas Sizeof/Alignof compute it from the enclosing *types.Named's call conv via hasNativeStructLayout. For a //llgo:cdecl struct that (a) contains a vector-bearing field — so vectorStructLayout returns ok=true — and (b) also contains a function field or trailing zero-sized field, the two paths diverge when the struct was registered via SetTypeCallConv without SetNativeStructFields: Offsetsof would use native=false (func field = two words, trailing zero-field +1) while Sizeof/Alignof use native=true, so offsets stop agreeing with size. The normal cgo path is safe — handleTypeDecl (cl/import.go:1132-1143) always calls both setters together — so this is reachable only through the one-shot API. TestCVectorByteConstantsAndLayoutBounds registers exactly such a Callback struct via SetTypeCallConv alone and asserts Sizeof == 32, but never calls Offsetsof on it; adding that assertion would surface the divergence. Worth either deriving Offsetsof native-ness from the same source as Sizeof, or documenting the invariant explicitly.

  2. Residual guard gap (minor perf). prog.nativeFields(fields) is evaluated as an argument before vectorStructLayout's internal hasVectorLayouts guard runs, so it takes an RLock + map lookup on every Offsetsof call even when no vectors/native fields are registered. Sizeof/Alignof short-circuit on the atomic flag with zero extra work; gating nativeFields the same way would make the common path symmetric. (AllocsPerRun-based regression test can't catch this — it's a lock, not an allocation.)

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/simd-c-interop-20261017 branch from 1b65c4b to 4ba3ce6 Compare October 19, 2026 07:44
@zhouguangyuan0718

Copy link
Copy Markdown
Collaborator Author

@fennoai /review

Please re-review the latest head 4ba3ce666d86acc46260c76315d663cdfa7d7d6d after rebasing onto main 577d51f5d4afacb02f0182c9aa5fe642c8d8d2cb and fixing the remaining CI test isolation issue. Review only; no code changes are requested.

The preceding head had one failed check: Windows MSVC AMD64 core tests, where TestRuntimeNumGoroutineIncludesNewProc observed before=3 and during=3 instead of 4. Its os/exec child still initialized all of test/go, including runtimeinitgc's goroutine; channel completion does not guarantee that goroutine has exited runtime accounting. A controlled local probe demonstrated 3 -> 4 -> 3 when another goroutine exits. This is evidence for the test's unstable global-count assumption, not a native Windows reproduction (300 original-test process runs on macOS passed).

The assertion now lives in its own test package, retaining the exact +1 requirement and native subprocess isolation. Wasm worker and libffi invocations include the independent package, preserving their coverage. No runtime counter or timeout changes. The rebase retained both the merged integer-resize documentation and this PR's C-vector documentation; the duplicate LLDB harness commit dropped because it is already on main.

Validation: 300 isolated LLGo process runs, 20 LLGo runs with coverage enabled, 20 official Go runs, the Emscripten two-worker counter test, focused SSA/compiler/build C-vector regressions, native O2 C interop, shell syntax and diff checks passed. Fresh CI is queued; Windows confirmation remains pending. The previous non-blocking one-shot Offsetsof API observation is unchanged by this CI-focused update.

@fennoai

fennoai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Re-review at 4ba3ce6 — rebase + CI test-isolation fix verified

Submitted as one non-blocking COMMENT review: pullrequestreview-5568436121.

Scope confirmed. The rebase reduced the locked range (577d51f...4ba3ce6) to exactly the four PR commits with no unrelated base-main content. The three previously-reviewed commits (C-vector support, native-field-width aggregate fix, vector-layout-traversal guard) are byte-for-byte unchanged (verified per-file), so prior conclusions carry over and the only new content is the test-isolation commit.

Test-isolation fix — verified correct and complete:

  • TestRuntimeNumGoroutineIncludesNewProc moved from test/go/ (package gotest) into its own test/go/numgoroutine/ (package numgoroutine_test); old path removed, no stale copy. The assertion is byte-for-byte identical — same before+1 requirement, same os/exec subprocess isolation gated on non-wasm.
  • Root cause addressed: the dedicated package produces a minimal test binary whose init no longer includes test/go's fixtures (the runtimeinitgc goroutine that could still be exiting during the baseline sample, the source of the Windows MSVC before=3/during=3).
  • Native coverage retained, not dropped — the Windows MSVC core suite's main batch (go.yml) uses go list ./... with an anchored grep -v '^…/test/go$', which still includes test/go/numgoroutine (confirmed with the toolchain).
  • dev/test_wasm_workers.sh is coherent: the obsolete -skip dropped, dedicated and libffi runs retargeted to the new subpackage.
  • Local validation under standard Go: vets, compiles, passes 20/20.

Standing item (unchanged, non-blocking): the prior one-shot Offsetsof API observation (ssa/type.go:111) still applies verbatim since those files are identical; not reachable from the normal cgo path.

Not done: no code changes (review-only, as requested); I did not inspect CI logs — fresh-run/Windows confirmation remains the author's pending external check.

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review at 4ba3ce6 — rebase + CI test-isolation fix verified

The rebase cleaned the branch to exactly four commits with no unrelated base-main content in the locked range (577d51f...4ba3ce6). I confirmed the three previously-reviewed commits (C-vector support, native-field-width aggregate fix, vector-layout-traversal guard) are byte-for-byte unchanged — verified per-file — so all prior conclusions carry over and the only genuinely new content is the test-isolation commit 4ba3ce6.

Test-isolation fix (test: isolate goroutine count from package initialization) — verified correct and complete:

  • TestRuntimeNumGoroutineIncludesNewProc moved from test/go/ (package gotest) to its own test/go/numgoroutine/ (package numgoroutine_test); the old path is removed (no stale copy). The assertion is byte-for-byte identical — same exact before+1 requirement and same os/exec subprocess isolation gated on non-wasm.
  • The root cause is addressed: a dedicated package yields a minimal test binary whose init footprint no longer includes test/go's fixtures (the runtimeinitgc goroutine that could still be exiting while the baseline was sampled, giving the Windows MSVC before=3/during=3).
  • Native coverage is retained, not dropped. The Windows MSVC core suite's main batch (.github/workflows/go.yml) runs go list ./... through an anchored grep -v '^…/test/go$', which excludes only the exact test/go package and still includes test/go/numgoroutine — I confirmed this with the toolchain. So the moved test continues to run on Windows MSVC AMD64, now in its own isolated binary.
  • dev/test_wasm_workers.sh is coherent: the now-unnecessary -skip is dropped from the combined test/go run, the dedicated run and the libffi run point at test/go/numgoroutine, preserving wasm-worker and libffi coverage.
  • Local validation (standard Go): the package vets, compiles, and passes 20/20 runs; the parent + os/exec child path works.

Standing item (unchanged, non-blocking): the one-shot API observation from the previous review — Offsetsof (ssa/type.go:111) deriving native-ness from nativeFields (position-keyed) rather than the enclosing named type, with nativeFields also evaluated outside the hasVectorLayouts fast-path guard — still applies verbatim, since those files are identical to the prior revision. Not reachable from the normal cgo path; no action required for this CI-focused update.

No new issues. This revision is clean; the fix correctly targets the Windows flakiness without weakening the assertion or its coverage. CI/Windows confirmation on the fresh run remains the author's pending external check (I did not inspect CI logs).

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.

1 participant