Skip to content

Commit 4f62643

Browse files
committed
feat(deps): gate blake3/p64/fractal behind hpc-extras feature
Make blake3, p64, and fractal optional dependencies pulled in only when the hpc-extras feature is enabled. hpc-extras is enabled by default so existing consumers see no change. Downstream crates (notably burn-ndarray) that only need the core array layer can opt out via: [dependencies] ndarray = { version = "0.17", default-features = false, features = ["std"] } This keeps cargo build (default) and cargo build --no-default-features both clean while removing ~200 transitive deps from minimal builds. Sprint A1 of burn-ndarray parity sprint. https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
1 parent 658ab59 commit 4f62643

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ cblas-sys = { workspace = true, optional = true }
4848
libc = { version = "0.2.82", optional = true }
4949

5050
matrixmultiply = { version = "0.3.2", default-features = false, features=["cgemm"] }
51-
blake3 = "1"
52-
p64 = { path = "crates/p64" }
53-
fractal = { path = "crates/fractal", default-features = false }
51+
52+
# HPC extras — gated behind the `hpc-extras` feature so downstream consumers
53+
# (e.g. burn-ndarray) can opt out of the heavy compile tree when only the core
54+
# array layer is needed. Enabled by default to preserve existing behavior.
55+
blake3 = { version = "1", optional = true }
56+
p64 = { path = "crates/p64", optional = true }
57+
fractal = { path = "crates/fractal", default-features = false, optional = true }
5458

5559
serde = { version = "1.0", optional = true, default-features = false, features = ["alloc"] }
5660
rawpointer = { version = "0.2" }
@@ -73,17 +77,23 @@ itertools = { workspace = true }
7377
ndarray-gen = { workspace = true }
7478

7579
[features]
76-
default = ["std"]
80+
default = ["std", "hpc-extras"]
7781

7882
# Enable blas usage
7983
# See README for more instructions
8084
blas = ["dep:cblas-sys", "dep:libc"]
8185

8286
serde = ["dep:serde"]
8387

84-
std = ["num-traits/std", "matrixmultiply/std", "fractal/std"]
88+
std = ["num-traits/std", "matrixmultiply/std"]
8589
rayon = ["dep:rayon", "std"]
8690

91+
# HPC extras: blake3 hashing, p64 palette/NARS bridge, fractal manifold.
92+
# These pull in a non-trivial dependency tree; downstream crates such as
93+
# burn-ndarray that only need the core array layer can disable this with
94+
# `default-features = false` (and re-enable `std` explicitly if needed).
95+
hpc-extras = ["std", "dep:blake3", "dep:p64", "dep:fractal", "fractal/std"]
96+
8797
matrixmultiply-threading = ["matrixmultiply/threading"]
8898

8999
# JITSON: JSON parser + validator + template + scan pipeline (no Cranelift)

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,11 @@ pub mod simd_wasm;
257257
pub mod backend;
258258

259259
/// HPC extensions ported from rustynum: BLAS, statistics, HDC, CogRecord, FFT, LAPACK.
260-
#[cfg(feature = "std")]
260+
///
261+
/// Gated behind the `hpc-extras` feature (enabled by default) because the
262+
/// module pulls in `blake3`, `p64`, and `fractal`. Disable default features to
263+
/// drop those dependencies (e.g. burn-ndarray's polyfill-only build).
264+
#[cfg(feature = "hpc-extras")]
261265
#[allow(
262266
clippy::all,
263267
unused_imports,

0 commit comments

Comments
 (0)