Skip to content

Use clang-cl (LLVM) compiler for Windows ARM64 wheel builds #33715

Open

Description

@priyadharshni-mcw

Describe the workflow you want to enable

Scikit-learn currently ships ARM64 Windows wheels built with MSVC. This proposal is to switch the Windows ARM64 wheel build to use clang-cl in the CI pipeline for improved performance and build reliability.

Initial scikit-learn implementation already exists
A working PR switching the win_arm64 CI wheel build to clang-cl was raised and demonstrates the change builds and passes tests successfully.
scikit-learn PR #33435

Motivation:

The need for clang-cl on Windows ARM64 is well documented across the ecosystem:

CPython acknowledged the ARM64 Windows performance gap
Python release binaries on ARM64 Windows show significantly lower performance compared to x64, traced to MSVC's weaker ARM64 auto-vectorisation. This is the upstream root cause that affects all Python packages built with MSVC on this platform.
python/cpython #134524

Community discussion on clang-cl for Windows ARM64
A dedicated thread on Python.org Ideas discusses using clang-cl to address the performance gap in Windows ARM64 Python packages, with broad agreement from the scientific Python community that LLVM is the right path forward for this platform.
Python.org Discussions

NumPy formally proposed and adopted clang-cl for win_arm64
NumPy raised this as an enhancement issue to provide Windows ARM64 wheels compiled with the LLVM toolchain, citing the same MSVC ARM64 vectorisation gap. This was subsequently implemented and NumPy now ships win_arm64 wheels built with clang-cl.
numpy/numpy #29174
numpy/numpy #28106
numpy/numpy PR #28246

NumPy and SciPy
scikit-learn's two core dependencies already ship win_arm64 wheelsbuilt with clang-cl.

Describe your proposed solution

Switch the win_arm64 CI wheel build from MSVC to clang-cl (LLVM). The change is scoped to Windows ARM64 only all other platforms (win_amd64, Linux, macOS) remain unchanged.

Test suite

All scikit-learn tests pass with the clang-cl build. The implementation includes a fix for a uint32_t redefinition that
occurs specifically with clang-cl on Windows.

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Activity

  1. added
    Needs Investigation
    and removed
    Needs Triage
    on Apr 11, 2026
  2. priyadharshni-mcw commented on Apr 20, 2026

    @priyadharshni-mcw
    Author

    The ASV benchmark results comparing both compilers on WOA and X86:

    WOA Comparsions and X86 Comparisons
    1.ensemble.RandomForestClassifierBenchmark.time_predict

    Config LLVM WoA (ms) MSVC WoA (ms) Δ% WoA LLVM x86 (ms) MSVC x86 (ms) Δ% x86
    dense / n_jobs=1 95.4 120.0 +20.5% 170.0 154.0 -10.4%
    sparse / n_jobs=1 637.0 662.0 +3.8% 1050.0 848.0 -23.8%

    2.linear_model.SGDRegressorBenchmark.time_fit

    Config LLVM WoA (ms) MSVC WoA (ms) Δ% WoA LLVM x86 (ms) MSVC x86 (ms) Δ% x86
    dense 2390 2430 +1.7% 3920 2800 -40.0%
    sparse 1300 1380 +5.8% 3140 2410 -30.3%

    3. linear_model.RidgeBenchmark.time_predict

    Config LLVM WoA (ms) MSVC WoA (ms) Δ% WoA LLVM x86 (ms) MSVC x86 (ms) Δ% x86
    representation=dense / solver=auto 9.94 9.98 +0.4% 47.4 18.8 -152.1%
    representation=dense / solver=svd 9.98 9.97 -0.1% 47.6 18.9 -151.9%
    representation=dense / solver=cholesky 9.95 10.00 +0.5% 51.2 19.0 -169.5%
    representation=dense / solver=lsqr 9.99 9.97 -0.2% 50.6 18.8 -169.2%
    representation=dense / solver=sparse_cg 9.98 9.97 -0.1% 51.7 19.0 -172.1%
    representation=dense / solver=sag 10.00 10.80 +7.4% 51.0 19.2 -165.6%
    representation=dense / solver=saga 9.96 9.98 +0.2% 50.3 19.0 -164.7%
    representation=sparse / solver=auto 3.20 3.22 +0.6% 7.26 3.92 -85.2%
    representation=sparse / solver=svd n/a n/a n/a n/a n/a n/a
    representation=sparse / solver=cholesky 3.19 3.21 +0.6% 5.82 3.90 -49.2%
    representation=sparse / solver=lsqr 3.19 3.21 +0.6% 7.06 3.92 -80.1%
    representation=sparse / solver=sparse_cg 3.20 3.22 +0.6% 6.98 3.92 -78.1%
    representation=sparse / solver=sag 3.20 3.21 +0.3% 7.40 3.92 -88.8%
    representation=sparse / solver=saga 3.20 3.21 +0.3% 7.38 3.92 -88.3%

    4.neighbors.KNeighborsClassifierBenchmark.time_fit

    Config LLVM WoA (ms) MSVC WoA (ms) Δ% WoA LLVM x86 (ms) MSVC x86 (ms) Δ% x86
    brute / low / n_jobs=1 0.386 0.387 +0.3% 0.358 0.356 -0.6%
    brute / high / n_jobs=1 0.438 0.440 +0.5% 0.457 0.453 -0.9%
    kd_tree / low / n_jobs=1 2.31 6.98 +66.9% 3.82 7.07 +46.0%
    kd_tree / high / n_jobs=1 5.50 28.90 +81.0% 13.80 29.90 +53.8%
    ball_tree / low / n_jobs=1 2.43 4.65 +47.7% 3.94 4.89 +19.4%
    ball_tree / high / n_jobs=1 6.43 17.40 +63.1% 14.30 18.20 +21.4%

    5.neighbors.KNeighborsClassifierBenchmark.time_predict

    Config LLVM WoA (ms) MSVC WoA (ms) Δ% WoA LLVM x86 (ms) MSVC x86 (ms) Δ% x86
    brute / low / n_jobs=1 93.5 95.1 +1.7% 73.0 57.0 -28.1%
    brute / high / n_jobs=1 8640 8680 +0.5% 143.0 107.0 -33.6%
    kd_tree / low / n_jobs=1 274 308 +11.0% 394.0 343.0 -14.9%
    kd_tree / high / n_jobs=1 3600 3060 -17.6% 6120.0 2980.0 -105.4%
    ball_tree / low / n_jobs=1 433 530 +18.3% 635.0 658.0 +3.5%
    ball_tree / high / n_jobs=1 2910 2560 -13.7% 3730.0 2560.0 -45.7%

    Summary:

    • WoA: Improvements observed along with a few slight regressions.
    • x86: Predominantly regressions across the evaluated estimators..

    Notes:

    • Results are based on median execution time across runs
    • Built with equivalent optimization settings for fair comparison
  3. priyadharshni-mcw commented on May 21, 2026

    @priyadharshni-mcw
    Author

    Hi, just following up on this issue and PR #33435 . We have added further investigation including a motivation for the change , benchmark results between x86 and ARM. Happy to provide any additional information if that would help move the review forward. Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Build / CINeeds Investigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions