Skip to content

numr 0.3.0#2

Merged
farhan-syah merged 5 commits into
mainfrom
0.3.0
Feb 10, 2026
Merged

numr 0.3.0#2
farhan-syah merged 5 commits into
mainfrom
0.3.0

Conversation

@farhan-syah

@farhan-syah farhan-syah commented Feb 10, 2026

Copy link
Copy Markdown
Member

Summary

Complete foundational tensor API, close backend parity gaps, and prepare public API for 1.0 stability.

New Operations

  • unfold — sliding window extraction (im2col generalization), critical for boostr conv implementations
  • repeat_interleave — per-element repetition along dimension (upsampling, embedding expansion)
  • take / put — flat indexing operations, both functional (&Tensor -> Result<Tensor>)

Backend Parity

  • Audit and close CUDA and WebGPU gaps vs CPU
  • Zero Unimplemented errors for core ops used by solvr/boostr

Public API (Pre-1.0)

  • Wrap Shape/Strides in opaque newtypes (currently leaks SmallVec)
  • API ergonomics pass: naming consistency, dimension indexing (isize vs usize), index dtype contracts

Performance

  • Per-call parallelism control (avoid global Rayon pool contention in solvr/boostr composition)
  • Fused multi-dim reductions for small tensors

Design Rules

  • View ops (zero-copy): flip, transpose, reshape, squeeze, unsqueeze, slice, expand
  • Kernel ops (always allocate): repeat, pad, roll, cat, stack, unfold, repeat_interleave

Not in Scope (belongs in solvr)

Optimization, ODE/PDE solvers, interpolation, advanced statistics, signal processing, spatial algorithms

CI Checks

  • cargo clippy --all-targets --features f16,sparse -- -D warnings
  • cargo test --features f16,sparse
  • cargo fmt --all --check

Introduce dedicated Shape and Strides types with SmallVec backing to
reduce heap allocations for common tensor ranks (≤4 dimensions).

This improves type safety, reduces Layout complexity, and provides a
clearer separation of concerns between shape metadata and memory layout.

Changes:
- Add Shape type with stack allocation for common cases
- Add Strides type with signed offsets for negative strides
- Update Layout to use new types
- Expose Shape/Strides in public API
- Make TensorId crate-internal visibility
Split large monolithic files into focused modules following the
target architecture pattern of one operation per file.

FFT changes:
- Split fft.rs (single file) → fft/ directory with mod, real, shift
- Add configurable parallelism via min_batch_len parameter
- Improve parallel batching efficiency with par_chunks_mut

Reduce changes:
- Split reduce.rs → reduce/ with common, single_dim, multi_dim, precision
- Expose ParallelismConfig in public API for tuning

This reduces file sizes and improves code organization without
changing functionality.
Implement unfold and repeat_interleave as composite operations built
from primitive shape ops (narrow, stack, cat, permute).

All backends delegate to impl_generic implementations to guarantee
numerical parity and consistent behavior across CPU, CUDA, and WebGPU.

This follows the architecture pattern where composite operations share
a single algorithm while primitives have backend-specific kernels.
Introduce configurable chunk_size parameter across CPU kernels to allow
tuning parallelism granularity. This enables better performance on
diverse workloads and hardware configurations.

Changes:
- Add chunk_size parameter to complex, FFT, and other parallel kernels
- Feature-gate half_convert module for x86_64 only
- Update indexing operations for consistency across backends
- Add ParallelismConfig tests to verify chunking behavior
- Update backend parity tests for new configurations

No functional changes to existing default behavior.
@farhan-syah farhan-syah marked this pull request as ready for review February 10, 2026 08:31
@farhan-syah farhan-syah merged commit 51be269 into main Feb 10, 2026
10 checks passed
@farhan-syah farhan-syah deleted the 0.3.0 branch February 10, 2026 19:33
@farhan-syah farhan-syah restored the 0.3.0 branch February 11, 2026 00:39
@farhan-syah farhan-syah deleted the 0.3.0 branch February 12, 2026 01:33
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.

1 participant