cbtop/bricks/panels/load/
types.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5pub enum ComputeBackend {
6 #[default]
7 Auto,
8 CpuScalar,
9 CpuSimd,
10 GpuCuda,
11 GpuWgpu,
12}
13
14impl ComputeBackend {
15 pub fn name(&self) -> &'static str {
17 match self {
18 Self::Auto => "Auto",
19 Self::CpuScalar => "CPU (Scalar)",
20 Self::CpuSimd => "CPU (SIMD)",
21 Self::GpuCuda => "GPU (CUDA)",
22 Self::GpuWgpu => "GPU (wgpu)",
23 }
24 }
25
26 pub const ALL: [ComputeBackend; 5] = [
28 Self::Auto,
29 Self::CpuScalar,
30 Self::CpuSimd,
31 Self::GpuCuda,
32 Self::GpuWgpu,
33 ];
34}
35
36#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
38pub enum WorkloadType {
39 #[default]
40 Gemm,
41 Softmax,
42 LayerNorm,
43 Attention,
44 Lz4Compress,
45 Mixed,
46}
47
48impl WorkloadType {
49 pub fn name(&self) -> &'static str {
51 match self {
52 Self::Gemm => "GEMM (Matrix Multiply)",
53 Self::Softmax => "Softmax",
54 Self::LayerNorm => "Layer Normalization",
55 Self::Attention => "Attention",
56 Self::Lz4Compress => "LZ4 Compression",
57 Self::Mixed => "Mixed Workload",
58 }
59 }
60
61 pub fn short_name(&self) -> &'static str {
63 match self {
64 Self::Gemm => "GEMM",
65 Self::Softmax => "Softmax",
66 Self::LayerNorm => "LayerNorm",
67 Self::Attention => "Attention",
68 Self::Lz4Compress => "LZ4",
69 Self::Mixed => "Mixed",
70 }
71 }
72
73 pub const ALL: [WorkloadType; 6] = [
75 Self::Gemm,
76 Self::Softmax,
77 Self::LayerNorm,
78 Self::Attention,
79 Self::Lz4Compress,
80 Self::Mixed,
81 ];
82}
83
84#[derive(Debug, Clone, Default)]
86pub struct LoadStats {
87 pub iterations: u64,
89 pub elapsed_ms: u64,
91 pub ops_per_sec: f64,
93 pub throughput_gbs: f64,
95 pub avg_latency_us: f64,
97 pub p99_latency_us: f64,
99}