Storage
darkforest-core
module: tensor
since v0.1.0-alpha
Signature
rust
pub struct Storage<T: Element, D: Device> { ptr: NonNull<T>, len: usize, capacity: usize, device: D, _marker: PhantomData<T> }
Overview
Raw contiguous buffer allocation with platform-specific SIMD memory alignment guarantees.
Invariants & Design Principles
- Invariant: Allocations adhere strictly to 64-byte cache line alignment.
- Invariant: Drop implementation handles device deallocation cleanly across CPU and CUDA contexts.
Usage Example
rust
let storage = Storage::<f32, Cpu>::allocate(4096);