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
44
45
46
47
//! 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 [`strided_exec::Exec`] placement token as its last
//! parameter and splits the permutation within that budget. A copy of at most
//! [`MINTHREADLENGTH`] elements runs on the calling thread whatever the budget,
//! because a fan-out costs more than the copy. 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 ;
/// Minimum number of elements for a copy to fan out.
///
/// The single threshold of the strided stack: `copy_into*` narrow the token to
/// one task at or below it, and `strided-basic` re-exports this constant for
/// its own entries. Matches Julia's `MINTHREADLENGTH = 1 << 15`; see
/// `docs/design/erased-execution-policy.md` for the decision record.
pub const MINTHREADLENGTH: usize = 1 << 15;
// Constants
pub const BLOCK_MEMORY_SIZE: usize = 32 * 1024;
pub const CACHE_LINE_SIZE: usize = 64;