Skip to content

Commit ccf5b77

Browse files
committed
fix(deps): surgical hpc-extras gate — only p64/fractal behind feature
Before: hpc-extras gated the entire `pub mod hpc;`, hiding BF16/F16, quantization, fingerprints, WHT, kmeans, reductions, AMX, VNNI, NEON, VSA, plane, seal — everything burn-ndarray actually needs. After: `pub mod hpc;` is always available with `std`. Only 5 truly specialized research modules gated behind hpc-extras: - p64_bridge (Palette64 convergence highway) - crystal_encoder (blake3-hashed codebook) - deepnsm (distributional semantic engine) - spo_bundle (SPO triple bundle codec) - compression_curves (blake3 XOF binary planes) blake3 made unconditional (was optional) — it's core infrastructure for plane/seal/merkle_tree integrity hashing, not research-only. Verified: - cargo build --no-default-features --features std: PASS - cargo build (defaults): PASS - cargo test (no-hpc-extras): 1713 pass - cargo test (defaults): 1767 pass https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
1 parent 49cd860 commit ccf5b77

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ libc = { version = "0.2.82", optional = true }
4949

5050
matrixmultiply = { version = "0.3.2", default-features = false, features=["cgemm"] }
5151

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 }
52+
# blake3 — always available (integrity hashing in plane/seal/merkle_tree).
53+
blake3 = { version = "1" }
54+
55+
# p64 + fractal — specialized convergence / manifold math. Gated behind
56+
# `hpc-extras` since they pull in a dep tree burn-ndarray doesn't need.
5657
p64 = { path = "crates/p64", optional = true }
5758
fractal = { path = "crates/fractal", default-features = false, optional = true }
5859

@@ -92,7 +93,7 @@ rayon = ["dep:rayon", "std"]
9293
# These pull in a non-trivial dependency tree; downstream crates such as
9394
# burn-ndarray that only need the core array layer can disable this with
9495
# `default-features = false` (and re-enable `std` explicitly if needed).
95-
hpc-extras = ["std", "dep:blake3", "dep:p64", "dep:fractal", "fractal/std"]
96+
hpc-extras = ["std", "dep:p64", "dep:fractal", "fractal/std"]
9697

9798
matrixmultiply-threading = ["matrixmultiply/threading"]
9899

src/hpc/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,27 @@ pub mod tekamolo;
114114
#[allow(missing_docs)]
115115
pub mod vsa;
116116
#[allow(missing_docs)]
117+
#[cfg(feature = "hpc-extras")]
117118
pub mod spo_bundle;
118119
#[allow(missing_docs)]
120+
#[cfg(feature = "hpc-extras")]
119121
pub mod deepnsm;
120122
#[allow(missing_docs)]
121123
pub mod surround_metadata;
122124
#[allow(missing_docs, dead_code)]
123125
pub mod cyclic_bundle;
124126
#[allow(missing_docs, dead_code)]
127+
#[cfg(feature = "hpc-extras")]
125128
pub mod compression_curves;
126129
#[allow(missing_docs)]
130+
#[cfg(feature = "hpc-extras")]
127131
pub mod crystal_encoder;
128132
#[allow(missing_docs)]
129133
pub mod udf_kernels;
130134

131135
// p64 bridge: Palette64/3D attention, NARS, CausalEdge64 compat
132136
#[allow(missing_docs)]
137+
#[cfg(feature = "hpc-extras")]
133138
pub mod p64_bridge;
134139

135140
// Session C: bgz17 dual-path integration
@@ -228,7 +233,7 @@ pub mod framebuffer;
228233
/// Transcoded from Opus CELT for the HHTL cascade → waveform pipeline.
229234
pub mod audio;
230235

231-
#[cfg(test)]
236+
#[cfg(all(test, feature = "hpc-extras"))]
232237
mod e2e_tests {
233238
//! End-to-end pipeline test: Fingerprint → Node → Seal → Cascade → CLAM → Causality → BNN
234239

src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ pub mod simd_wasm;
258258
pub mod simd_int_ops;
259259

260260
/// Half-precision SIMD vectors (`BF16x16`, `F16x16`) + slice-level ops.
261+
/// Depends on `hpc::quantized::{BF16, F16}` — needs `std` (hpc core).
261262
#[cfg(feature = "std")]
262263
#[allow(clippy::all, missing_docs, dead_code, unused_variables, unused_imports)]
263264
pub mod simd_half;
@@ -268,10 +269,11 @@ pub mod backend;
268269

269270
/// HPC extensions ported from rustynum: BLAS, statistics, HDC, CogRecord, FFT, LAPACK.
270271
///
271-
/// Gated behind the `hpc-extras` feature (enabled by default) because the
272-
/// module pulls in `blake3`, `p64`, and `fractal`. Disable default features to
273-
/// drop those dependencies (e.g. burn-ndarray's polyfill-only build).
274-
#[cfg(feature = "hpc-extras")]
272+
/// Always available with `std`. Core modules (quantized, fingerprint, fft,
273+
/// cam_pq, reductions, blas_level*, amx_matmul, vnni_gemm) compile without
274+
/// extra deps. Cognitive/research modules (p64_bridge, crystal_encoder,
275+
/// deepnsm, etc.) are gated behind `hpc-extras` inside `hpc/mod.rs`.
276+
#[cfg(feature = "std")]
275277
#[allow(
276278
clippy::all,
277279
unused_imports,

src/simd.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,25 +1184,20 @@ pub fn simd_ln_f32(x: F32x16) -> F32x16 {
11841184
// Cognitive shader foundation re-exports
11851185
// ============================================================================
11861186

1187-
// Fingerprint<N>: const-generic binary vector, the BindSpace atom
1187+
// HPC re-exports — only available when the hpc module is compiled.
1188+
// Without `hpc-extras`, consumers still get the SIMD polyfill types above
1189+
// (F32x16, I8x32, etc.) but NOT the domain-specific functions below.
1190+
11881191
pub use crate::hpc::fingerprint::{
11891192
Fingerprint,
11901193
Fingerprint2K, Fingerprint1K, Fingerprint64K,
11911194
VectorWidth, VectorConfig, vector_config,
11921195
};
1193-
1194-
// CollapseGate: Flow/Block/Hold write gate (Layer 3 in the 7-layer stack)
11951196
pub use crate::hpc::bnn_cross_plane::CollapseGate;
1196-
1197-
// Bitwise: SIMD-dispatched Hamming distance + popcount
11981197
pub use crate::hpc::bitwise::{
11991198
hamming_distance_raw, popcount_raw,
12001199
};
1201-
1202-
// WHT: Walsh-Hadamard Transform (SIMD butterfly)
12031200
pub use crate::hpc::fft::{wht_f32, wht_f32_new};
1204-
1205-
// Quantization: i4/i2/i8 pack/unpack + BF16
12061201
pub use crate::hpc::quantized::{
12071202
quantize_f32_to_i4, dequantize_i4_to_f32,
12081203
quantize_f32_to_i2, dequantize_i2_to_f32,
@@ -1234,9 +1229,11 @@ pub use crate::simd_half::{
12341229
pub use crate::simd_half::BF16x16 as BF16x16;
12351230

12361231
// K-means + L2 distance
1232+
12371233
pub use crate::hpc::cam_pq::{kmeans, squared_l2};
12381234

12391235
// SIMD cosine
1236+
12401237
pub use crate::hpc::heel_f64x8::cosine_f32_to_f64_simd;
12411238

12421239
// ============================================================================

0 commit comments

Comments
 (0)