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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Device-neutral kernel descriptors shared by the tensor4all CPU and GPU
//! backends (tensor4all/tcontract-rs#209).
//!
//! A descriptor says *what* a batched kernel computes over flat buffers,
//! offsets, extents and leading dimensions, and nothing about *how* or *where*.
//! It holds no buffer, pointer, device, executor, plan or scalar value. A CPU
//! route (cpueinsum's `GroupedPlan`, tcontract's fused executor) and a GPU
//! backend (cuBLAS grouped GEMM, CUTLASS, cuTENSOR) consume the same validated
//! descriptor without translating it into another vocabulary.
//!
//! - [`gemm`]: a grouped-GEMM job list in NVIDIA's grouped-GEMM model
//! (`cublasGemmGroupedBatchedEx`, CUTLASS `GemmGrouped`), validated once
//! into a [`gemm::GemmBatch`] together with its groups and strided runs.
//! - A block-sparse tensor descriptor in cuTENSOR's model
//! (tensor4all/cpueinsum-rs#81) will be a sibling module; it is not here
//! yet.
//!
//! Like `t4a-cost`, this crate depends on nothing but `std`, so libraries can
//! share it without depending on each other.
/// The element type of a descriptor's buffers: the set cuBLAS grouped GEMM
/// and cuTENSOR's block-sparse contraction share.
///
/// The set is closed on purpose, without `#[non_exhaustive]`: a new kind is a
/// breaking change, so every backend's `match` has to decide whether it serves
/// it instead of falling through a wildcard arm.
///
/// # Examples
///
/// ```
/// use t4a_desc::ScalarKind;
///
/// assert_eq!(ScalarKind::C64.size_of(), 16);
/// assert!(!ScalarKind::F32.is_complex());
/// ```