Skip to content

Add Windows CI and fix Tensor QR FFI (rtol) - #124

Merged
terasakisatoshi merged 2 commits into
mainfrom
ci/windows-rusttoolchain-bootstrap
Jul 11, 2026
Merged

Add Windows CI and fix Tensor QR FFI (rtol)#124
terasakisatoshi merged 2 commits into
mainfrom
ci/windows-rusttoolchain-bootstrap

Conversation

@terasakisatoshi

@terasakisatoshi terasakisatoshi commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Add .github/workflows/CI_Windows.yml for automated Windows testing of Tensor4all.jl.
  • Adapted from RustToolChain.jl's windows-rusttoolchain-bootstrap.yml: remove/hide system Rust on the runner, assert cargo/rustc/rustup are unavailable, then rely on RustToolChain.jl for the Windows installer fallback.
  • Matrix: Julia lts and 1 on windows-2025; builds against the pinned tensor4all-rs checkout and runs Pkg.test().
  • Fix Tensor QR FFI missing rtol breaks on Windows #123: pass rtol through t4a_tensor_qr so the Windows ABI matches the C API.

Windows CI design

Linux/macOS CI (CI.yml) installs a system Rust toolchain via dtolnay/rust-toolchain. Windows end users typically get cargo/rustc through RustToolChain.jl instead. This workflow locks in that path so regressions in Windows bootstrap, deps/build.jl, or the Rust cdylib install do not slip past CI.

JULIA_DEPOT_PATH is not fully isolated so julia-actions/cache remains effective; PATH filtering alone forces the RustToolChain fallback.

Tensor QR fix (#123)

t4a_tensor_qr expects (tensor, left_inds, n_left, rtol, out_q, out_r). The Julia wrapper previously omitted rtol, which misaligned the call on Windows (out_q or out_r is null / ReadOnlyMemoryError).

  • Accept rtol::Real=0.0 (exact-QR sentinel)
  • Validate finite and non-negative
  • Pass Cdouble(rtol) in the ccall
  • Forward kwargs from qr(t, inds...; kwargs...)
  • Extend test/core/tensor_factorize.jl

Test plan

  • Local Pkg.test() on macOS
  • Windows CI bootstrap path (no system Rust) succeeds
  • Windows Pkg.build() succeeds via RustToolChain
  • Windows Pkg.test() green for Julia lts and 1
  • Linux/macOS CI still green

Closes #123

Run Tensor4all.jl build and tests on windows-2025 without system Rust so
the Windows installer fallback path is covered end-to-end.
The C API expects rtol before out_q/out_r; omitting it misaligned the
Windows call and left out handles null. Accept and validate rtol, and
cover the exact-QR path plus invalid rtol in tests.
@terasakisatoshi

Copy link
Copy Markdown
Member Author

Follow-up: fix #123 on this PR

Pushed the Julia-side FFI fix for Tensor QR:

  • Pass rtol::Cdouble to t4a_tensor_qr (was missing; ABI misalignment on Windows)
  • Validate rtol is finite and non-negative
  • Forward kwargs from qr(t, inds...; kwargs...)
  • Extend test/core/tensor_factorize.jl for exact rtol=0 and invalid rtol

Local Pkg.test() passed on macOS. Waiting on Windows CI re-run for confirmation.

@terasakisatoshi terasakisatoshi linked an issue Jul 11, 2026 that may be closed by this pull request
@terasakisatoshi terasakisatoshi changed the title Add Windows CI with RustToolChain bootstrap path Add Windows CI and fix Tensor QR FFI (rtol) Jul 11, 2026
@terasakisatoshi

Copy link
Copy Markdown
Member Author

Windows CI re-run is green after the QR fix:

  • Julia lts / Windows: pass (~15m)
  • Julia 1 / Windows: pass (~17m)
  • Linux/macOS/docs: pass

Run: https://github.com/tensor4all/Tensor4all.jl/actions/runs/29138855687

@terasakisatoshi
terasakisatoshi merged commit 9faf2bd into main Jul 11, 2026
8 checks passed
@terasakisatoshi
terasakisatoshi deleted the ci/windows-rusttoolchain-bootstrap branch July 11, 2026 04:17
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.

Tensor QR FFI missing rtol breaks on Windows

1 participant