From ed00742961508fb813bd0d56e6f2cec1722e196c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 07:33:23 +0000 Subject: [PATCH 1/3] Patch ndarray to the AdaWorldAPI fork so tract can reach its SIMD polyfill Adds a [patch.crates-io] entry pointing ndarray at the AdaWorldAPI fork (git, master branch, so it resolves in any checkout including CI). The fork is API-compatible (same 0.17.2) but carries an additional simd/hpc module (crate::simd::F32x16, AVX-512/AVX2/NEON/scalar tier dispatch) that tract's own linalg kernels can be wired to later. This patch alone changes no behavior; tract's element-wise/reduce kernels still use their existing intrinsics path until a follow-up adds a parallel, non-overlapping kernel registration that calls into it. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht --- Cargo.lock | 22 ++++++++++++++++++++-- Cargo.toml | 11 +++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d07531612e..0b85cbeb3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1517,6 +1517,14 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fractal" +version = "0.1.0" +source = "git+https://github.com/AdaWorldAPI/ndarray?branch=master#db3a7dde568eb6d7f8806faff58bc0aa17d2a733" +dependencies = [ + "libm", +] + [[package]] name = "fs-err" version = "3.3.1" @@ -2499,13 +2507,15 @@ dependencies = [ [[package]] name = "ndarray" version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d" +source = "git+https://github.com/AdaWorldAPI/ndarray?branch=master#db3a7dde568eb6d7f8806faff58bc0aa17d2a733" dependencies = [ + "fractal", "matrixmultiply", "num-complex", "num-integer", "num-traits", + "p64", + "paste", "portable-atomic", "portable-atomic-util", "rawpointer", @@ -2946,6 +2956,14 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "p64" +version = "0.1.0" +source = "git+https://github.com/AdaWorldAPI/ndarray?branch=master#db3a7dde568eb6d7f8806faff58bc0aa17d2a733" +dependencies = [ + "fractal", +] + [[package]] name = "page_size" version = "0.6.0" diff --git a/Cargo.toml b/Cargo.toml index 3cbe58e5c3..e501110142 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -265,3 +265,14 @@ opt-level = 2 debug = false # strip = "debuginfo" does not work on android and ios incremental = false + +# AdaWorldAPI/ndarray fork: same 0.17.2 API surface as upstream, plus a +# `simd`/`hpc` module (crate::simd::F32x16 etc.) with a LazyLock-cached +# AVX-512 -> AVX2 -> NEON -> scalar dispatch tier (src/simd.rs, +# src/simd_avx512.rs). Patching it in is transparent for every existing +# ndarray:: call site; it does not by itself accelerate any tract kernel +# until tract's own linalg ops are rewritten to call crate::simd::* instead +# of their current SIMD path. Pinned via git (not a sibling path) so this +# resolves in any checkout, CI included. +[patch.crates-io] +ndarray = { git = "https://github.com/AdaWorldAPI/ndarray", branch = "master" } From 1226a6d288d3072454f02bf7c910ddff311c0481 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 07:48:50 +0000 Subject: [PATCH 2/3] Bump MSRV to 1.97 to match the ndarray fork's pinned toolchain CI was failing across the whole 1.91 matrix because the ndarray fork patched in by the previous commit requires rustc 1.97 (its rust-toolchain.toml is permanently pinned there for AdaWorldAPI-stack alignment). CI derives its tested toolchain straight from Cargo.toml's rust-version, so bumping that one field re-targets every job at once; updated the README rustc badge to match per the comment above that field. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht --- Cargo.toml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e501110142..7bee0b95be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,7 +124,7 @@ default-members = [ [workspace.package] # MSRV source of truth: CI derives the tested toolchain from this. Keep the # README rustc badge in sync when bumping. -rust-version = "1.91" +rust-version = "1.97" [workspace.dependencies] anstyle = "1.0.2" diff --git a/README.md b/README.md index 0755a39815..655556c04c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![tract-logo](assets/tract-logo/PNG/tract-horizontal-blue.png) ![Rust](https://img.shields.io/badge/rust-%23000000.svg?style=for-the-badge&logo=rust&logoColor=white) -![rustc >= 1.91.0](https://img.shields.io/badge/rustc-%3E%3D1.91.0-brightgreen) +![rustc >= 1.97.0](https://img.shields.io/badge/rustc-%3E%3D1.97.0-brightgreen) ![MIT/Apache 2](https://img.shields.io/crates/l/tract) [![Native Linux test status](https://github.com/sonos/tract/workflows/Native%20Linux/badge.svg)](https://github.com/sonos/tract/actions) [![Embedded targets status](https://github.com/sonos/tract/workflows/Embedded%20targets/badge.svg)](https://github.com/sonos/tract/actions) From b75947bbcade0fa836fc0656db764742e390e2b1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 07:50:17 +0000 Subject: [PATCH 3/3] Address codex review: allow the ndarray fork's git source in cargo-deny Both api/rs/deny.toml and cli/deny.toml gate git dependencies with an allow-git list that only permitted rustformers/llm; the ndarray patch resolves ndarray/fractal/p64 from AdaWorldAPI/ndarray, which the cargo-deny CI job would otherwise reject. Also trimmed the patch.crates-io comment to the current constraint (why the git pin exists) instead of narrating a follow-up change that hasn't happened. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht --- Cargo.toml | 5 +---- api/rs/deny.toml | 1 + cli/deny.toml | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7bee0b95be..8264ba49b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -269,10 +269,7 @@ incremental = false # AdaWorldAPI/ndarray fork: same 0.17.2 API surface as upstream, plus a # `simd`/`hpc` module (crate::simd::F32x16 etc.) with a LazyLock-cached # AVX-512 -> AVX2 -> NEON -> scalar dispatch tier (src/simd.rs, -# src/simd_avx512.rs). Patching it in is transparent for every existing -# ndarray:: call site; it does not by itself accelerate any tract kernel -# until tract's own linalg ops are rewritten to call crate::simd::* instead -# of their current SIMD path. Pinned via git (not a sibling path) so this +# src/simd_avx512.rs). Pinned via git (not a sibling path) so this # resolves in any checkout, CI included. [patch.crates-io] ndarray = { git = "https://github.com/AdaWorldAPI/ndarray", branch = "master" } diff --git a/api/rs/deny.toml b/api/rs/deny.toml index 0ec5a9aa9c..00db08df14 100644 --- a/api/rs/deny.toml +++ b/api/rs/deny.toml @@ -49,6 +49,7 @@ skip = [ # trusted git sources. allow-git = [ "https://github.com/rustformers/llm.git", + "https://github.com/AdaWorldAPI/ndarray", ] [licenses] diff --git a/cli/deny.toml b/cli/deny.toml index bee6142bb0..dab870aa0e 100644 --- a/cli/deny.toml +++ b/cli/deny.toml @@ -35,6 +35,7 @@ deny = [ # trusted git sources. allow-git = [ "https://github.com/rustformers/llm.git", + "https://github.com/AdaWorldAPI/ndarray", ] [licenses]