1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Cache-efficient tensor permutation / transpose.
//!
//! This crate provides optimized copy and permutation operations for strided
//! multidimensional arrays. It is designed as a single-responsibility crate
//! sitting between `strided-view` (data structures) and `strided-kernel`
//! (general map/reduce/broadcast operations).
//!
//! # Dependency graph
//!
//! ```text
//! strided-view -> strided-perm -> strided-kernel
//! ```
//!
//! # Threading
//!
//! Every copy takes a [`threadteam::Exec`] placement token as its last
//! parameter and splits the permutation within that budget. The width is
//! decided by the token: the serial time of the copy
//! ([`copy_ns_per_element`] times its elements) against the dispatch cost of one
//! section (`Exec::width_for`), so a copy too small to repay a fan-out runs on the
//! calling thread whatever the budget. The crate never reaches a global
//! pool; pass `Exec::serial()` for a copy on the calling thread.
// Re-export primary API
pub use ;
pub use ;
pub use ;
// Constants
pub const BLOCK_MEMORY_SIZE: usize = 32 * 1024;
pub const CACHE_LINE_SIZE: usize = 64;