trueno_explain/lib.rs
1//! trueno-explain: PTX/SIMD/wgpu Visualization and Tracing CLI
2//!
3//! A CLI tool that visualizes and traces code generation flows across
4//! Trueno's execution targets. Implements the Toyota Way principle of
5//! **Genchi Genbutsu** (Go and See) by making invisible compiler
6//! transformations visible.
7//!
8//! # Features
9//!
10//! - PTX register pressure analysis
11//! - Memory access pattern detection
12//! - Warp divergence visualization (Heijunka)
13//! - Muda (waste) detection and elimination suggestions
14//!
15//! # Example
16//!
17//! ```rust
18//! use trueno_explain::ptx::PtxAnalyzer;
19//! use trueno_explain::analyzer::Analyzer;
20//!
21//! let ptx = r#"
22//! .entry test() {
23//! .reg .f32 %f<16>;
24//! ret;
25//! }
26//! "#;
27//!
28//! let analyzer = PtxAnalyzer::new();
29//! let report = analyzer.analyze(ptx).expect("PTX analysis should succeed");
30//! assert_eq!(report.registers.f32_regs, 16);
31//! ```
32
33// Allow some pedantic lints for this CLI tool
34#![allow(clippy::cast_precision_loss)] // Acceptable for display percentages
35#![allow(clippy::cast_possible_truncation)] // Instruction counts won't exceed u32
36#![allow(clippy::format_push_string)] // Performance not critical for CLI
37#![allow(clippy::too_many_lines)] // Will refactor in future sprints
38#![allow(clippy::unwrap_used)] // Safe for compile-time constant regex
39#![allow(clippy::unused_self)] // Methods may need self for future extensibility
40#![allow(clippy::map_unwrap_or)] // Style preference
41#![allow(clippy::unnecessary_literal_bound)] // Trait signature constraint
42
43pub mod analyzer;
44pub mod compare;
45pub mod diff;
46pub mod error;
47pub mod output;
48pub mod ptx;
49pub mod simd;
50pub mod tui;
51pub mod wgpu;
52
53pub use analyzer::{AnalysisReport, Analyzer, MudaWarning, RegisterUsage};
54pub use compare::{compare_analyses, format_comparison_json, format_comparison_text};
55pub use diff::{compare_reports, format_diff_json, format_diff_text, DiffReport, DiffThresholds};
56pub use error::{ExplainError, Result};
57pub use output::{format_json, format_text, OutputFormat};
58pub use ptx::{
59 BugSeverity, PtxAnalyzer, PtxBug, PtxBugAnalyzer, PtxBugClass, PtxBugReport, PtxCoverageReport,
60 PtxCoverageTracker, PtxCoverageTrackerBuilder, PtxFeature,
61};
62pub use simd::{SimdAnalyzer, SimdArch, SimdInstructionCounts};
63pub use tui::{run_tui, TuiApp};
64pub use wgpu::{WgpuAnalyzer, WorkgroupSize};