Build and run Windows like Linux: shared LLVM build and jobs, sccache + S3, unique CAPI name #466
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #466"
general
weight: 0.35
atmnp
Description
Windows had its own LLVM build script, its own CI jobs, a devcontainer, and its own way of turning MLIR into libNVVM IR, and none of its LLVM builds had a compiler cache or the S3 tier. Every LLVM cache-key change meant a cold MSVC build: about 50 min per Python on win-64 and about 70 min on win-arm64, versus a ~3 min build step on Linux, where sccache hits.
This PR makes Windows build and run the way Linux does, keeping only what MSVC strictly needs, and gives every platform the same cache tiers.
Same LLVM build on every platform
ci/build-llvm-modern.shandci/build-llvm7.shnow run on Linux and on Windows (Git Bash with MSVC onPATH);ci/build-windows.shis removed. What remains Windows-only is the MSVC CMake flags (cl,/MT, fallback TypeIDs, zlib/zstd off) and, for LLVM 7, theLLVM-C.dlllink step, because MSVC cannot build LLVM 7 as a DLL.build-llvm.ymlhas onebuild-llvm-modernjob and onebuild-llvm7job for all four platforms, with the same steps:setup-hardened-python(now on Linux too), sccache, AWS credentials, then GHA cache, S3 tarball (ci/llvm-cache.sh), build. Linux still builds inside manylinux (container:is empty on Windows); only the MSVC setup step is Windows-only. win-64 moves from a devcontainer on a self-hosted runner towindows-2022, like win-arm64 and the wheel builds; the devcontainer and its PowerShell wrappers are removed.--depth 1 --filter=blob:noneand a sparse checkout of the directories the build reads (llvm mlir cmake third-party;llvmfor LLVM 7). They used to clone the default branch and then fetch the pinned commit, which took 73 s on Linux, 137 s on win-64 and 404 s on WoA. The source path is unchanged, so compile commands and sccache keys are too.cmake --installalready installs the.pyd, CAPI and nanobind DLLs. The wheel therefore no longer picks up build-tree leftovers (.expand.libfiles for every extension,__pycache__), andsetup.pyleaves the remaining import libraries out of the wheel; they are only needed to linkcextat build time.LLVM-C.dllstraight intollvm7-install/bin/, so the artifact is one DLL instead of a full install. The linker comes from CMake's cache (Git Bash's coreutilslink.exeshadows MSVC's), andgen-llvm-c-exports.pyreads symbol names from the.libarchive index instead of runningdumpbin.ci/llvm-cache.shreports S3 errors instead of discarding them; only a missing tarball is a quiet miss, and a failed download or extraction now counts as a miss instead of a hit.Same MLIR-to-libNVVM path on every platform
cext/launcher/llvm_downgrade.cpp, as Linux does. That code loads the LLVM C API from the MLIR Python CAPI library, which a Linux.soexports by default but a Windows DLL did not. A small CMake hook,cext/mlir-python/CMakeLists.txt, loaded throughLLVM_EXTERNAL_PROJECTS, adds/EXPORT:for the 81 functions it uses and installs the import library next to the DLL.MLIRModernToNVVMbridge (cext/mlir-modern/, a C++ copy of the same passes with its own LLVM/MLIR copy; it exchanged only MLIR text with the rest of the process) and the Windows-only branches inmlir_optimization.pyandllvm_utils.py. This does not address #208, which is aboutMLIRToLLVM70.dlland is unchanged here.llvm_downgrade.cpp, and the LLVM 7 bridge'sCAPILoader.h) now open their UTF-8 library paths withLoadLibraryW;LoadLibraryAread them in the ANSI code page and failed for installs under non-ASCII paths.Unique name for the MLIR Python CAPI library
MLIRPythonCAPI-numba_cuda_mlir, like our nanobind and support libraries. With upstream's default name, an MLIR-based package imported first would capture our bindings, because glibc reuses an already-loaded library with a matching soname (Windows does the same by module name).test_same_named_capi_library_does_not_hijack_bindingsloads a decoylibMLIRPythonCAPI.sofirst; onmainit fails withlibMLIRPythonSupport-numba_cuda_mlir.so: undefined symbol: mlirTypeIsAShaped. A baremake -C tests/datanow builds the decoy too.sccache and S3 everywhere
.github/actions/install-sccacheis ported verbatim from NVIDIA/cuda-python@ba7dcd05e545b7bf8a1a8fdfb451b406c03459cb (first commit), then extended to Windows x64/arm64. Every sccache install uses it, so Linux moves from unpinnedlatestto the SHA-256-verifiedv0.18.0-rapids.7. CMake launchesclthrough sccache directly, so the setuptools shim from NVIDIA/cuda-python#1185 is not needed.ci/setup-sccache.shwrites its config to%APPDATA%\Mozilla\sccache\config\configon Windows.sccache-summaryaction, as the wheel builds do. The action now writes the summary as UTF-8 and preferspython, since Windows defaults to cp1252 and Windows venvs have nopython3.exe.configure-aws-credentialsusesspecial-characters-workaround. When the AWS secret key starts with/, Git Bash rewrites it into a Windows path beforeaws.exeandsccache.exesee it, and every S3 request in that job fails withSignatureDoesNotMatch(see aws-actions/configure-aws-credentials#528). This hit two Windows jobs during this PR.SCCACHE_SKIP_CACHE_CHECKand the rate-limit-on-error variables as cuda-python does (NVIDIA/cuda-python#3273), so a cache-backend error at server startup cannot fail the build.LLVM_WINDOWS_MSVC_TOOLSET, LLVM and wheel builds) and is part of the Windows cache keys.All LLVM cache keys change, so LLVM rebuilds everywhere once. Linux compile commands are unchanged, so that rebuild hits sccache.
Not in scope: sccache for the Windows wheel builds and multi-level sccache (GHA + S3). #463 adds its own
cext/mlir-python/and will need to carry the CAPI name and Windows exports from here.Testing
- sccache with a warm cache: 98.8% hits for Linux modern LLVM (about 6 min per job), 100% for LLVM 7 (win-64 LLVM 7 in 2.9 min instead of 21 min cold), and 97.9% for a WoA modern build (16 min instead of 125 min cold). For comparison,
main's last full WoA build without sccache took 98 min.- The GitHub-hosted Windows runners assume the AWS role through OIDC and read and write the S3 caches; the empty
container:runs the Windows jobs on the host.- win-64 wheels against
main(cp312): 47.0 → 41.7 MB compressed and 140.8 → 115.2 MB unpacked. The CAPI DLL keeps its size and gains exactly the 81 LLVM C exports, plus_Avx2WmemEnabledWeakValue, which the Windows SDK'sucrt/wchar.hdefines andmain'sMLIRToLLVM70.dllalready exports.LLVM-C.dllhas the same 938 exports. Every_mlir*.pyd, the support DLL andMLIRToLLVM70.dllimport the new CAPI name.tests/test_symbol_isolation.py. 5751 passed, 89 skipped, 289 xfailed; the only failures are the 2test_multigputests, because this host mixes GPU models. All 4 isolation tests pass, including the new one, which fails onmain.LLVM_PARALLEL_LINK_JOBS, which add no compile flags; LLVM 7 is identical.gen-llvm-c-exports.pywas checked against real archives, and theci/llvm-cache.sherror paths with a stubaws.-- Leo's bot