Skip to main content

Module buffer_pool

Module buffer_pool 

Source
Expand description

Typed host buffer pooling for reusable tensor allocations.

§Examples

use tenferro_tensor::buffer_pool::{BufferPool, PoolScalar};

let mut pool = BufferPool::new();
let mut buf = unsafe { <f64 as PoolScalar>::pool_acquire(&mut pool, 4) };
buf.fill(1.0);
<f64 as PoolScalar>::pool_release(&mut pool, buf);
assert_eq!(pool.len(), 1);

Structs§

BufferPool
Typed buffer pool keyed by element capacity and separated by scalar type.

Traits§

PoolScalar
Scalar types supported by BufferPool.