Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# AGENTS.md

## Cursor Cloud specific instructions

This is a Rust library crate (ndarray fork with HPC extensions). No external services (databases, APIs) are needed.

### Quick reference

| Action | Command |
|--------|---------|
| Build | `cargo build` |
| Lint | `cargo clippy -- -D warnings` |
| Test (lib) | `cargo test --lib -p ndarray` |
| Test (workspace) | `cargo test` |
| Test (HPC subset) | `cargo test --lib -p ndarray -- hpc::` |
| Run example | `cargo run --example life` |
| Format check | `cargo fmt -- --check` |

### Environment notes

- **Rust 1.94.0** is pinned via `rust-toolchain.toml`; rustup auto-selects it in `/workspace`.
- **No AVX-512 hardware** in Cloud Agent VMs — SIMD kernel tests using `#[target_feature(enable = "avx512f")]` are compile-gated and will be skipped at runtime. This is expected behavior.
- **Feature gates**: `intel-mkl` and `openblas` are mutually exclusive and require system libraries not installed by default. The default build uses `native` (pure Rust SIMD) which needs no extra libs.
- **Build time**: ~18s cold, <1s incremental. Tests (~1819) take ~70s.
- The workspace has sub-crates under `crates/` and `ndarray-rand/`. Default members exclude `blas-tests` and `blas-mock-tests` (they activate the `blas` feature which needs cblas-sys linking).
- `libssl-dev` is needed as a build dependency for some transitive crates.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ name = "ndarray"
bench = false
test = true

[[example]]
name = "ocr_benchmark"
required-features = ["std"]

[dependencies]
num-integer = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion src/hpc/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ mod tests {
let _ = &*GLOBAL_RENDERER;
// First-touch: tick count is 0; capacity is at least 4096
// (could be greater if PREFERRED_F32_LANES > 16 at some future tier).
assert!(GLOBAL_RENDERER.tick_count() >= 0);
assert_eq!(GLOBAL_RENDERER.tick_count(), 0);
let f = GLOBAL_RENDERER.read_front();
assert!(f.capacity >= 4096);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hpc/vml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ mod tests {

// Generate "weight" data (deterministic, mimics Gaussian distribution)
let weights: Vec<f64> = (0..d)
.map(|i| ((i as f64 * 0.7 + 13.0).sin() * 2.5))
.map(|i| (i as f64 * 0.7 + 13.0).sin() * 2.5)
.collect();

// ── ENCODING: f64[4096] → f64[17] (golden-step projection) ──
Expand Down
2 changes: 1 addition & 1 deletion src/hpc/vnni_gemm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ mod tests {
let n = 5;
let k = 8;
let a: Vec<u8> = (0..m * k).map(|i| (i % 200) as u8).collect();
let b: Vec<i8> = (0..k * n).map(|i| ((i % 100) as i8 - 50)).collect();
let b: Vec<i8> = (0..k * n).map(|i| (i % 100) as i8 - 50).collect();
let expected = scalar_gemm(&a, &b, m, n, k);
let mut c = vec![0i32; m * n];
int8_gemm_vnni(&a, &b, &mut c, m, n, k);
Expand Down
4 changes: 2 additions & 2 deletions src/simd_int_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ mod tests {
#[test]
fn add_i16_matches_scalar_for_tail_lengths() {
for &len in &[0usize, 1, 31, 32, 33, 64, 65, 100] {
let a_init: Vec<i16> = (0..len).map(|i| (i as i16 * 7 - 1000)).collect();
let b: Vec<i16> = (0..len).map(|i| (i as i16 * -3 + 500)).collect();
let a_init: Vec<i16> = (0..len).map(|i| i as i16 * 7 - 1000).collect();
let b: Vec<i16> = (0..len).map(|i| i as i16 * -3 + 500).collect();

let mut a_simd = a_init.clone();
add_i16(&mut a_simd, &b);
Expand Down
Loading