Skip to main content

candle_graph/
lib.rs

1//! TensorFlow Profiler-style execution graphs for [Candle](https://github.com/huggingface/candle) runs.
2//!
3//! Record one representative JSONL trace with [`instrument::TraceSession`], qualify its structural
4//! health and evidence capabilities with [`evidence::build_evidence`], and inspect it through the
5//! CLI or, with the `visualizer` feature, [`viewer::render_evidence_html`].
6//!
7//! There is **no static Rust analysis** — the graph comes only from what executed.
8//!
9//! Keep these evidence planes distinct:
10//!
11//! - span duration is host timing unless the producer declares stronger synchronization semantics;
12//! - [`timing`] device intervals retain their own device clock;
13//! - [`trace::memory`] logical storage lifetimes do not imply physical allocator usage; and
14//! - optional [`nsight`] evidence retains the Nsight clock and artifact provenance.
15//!
16//! Failed or structurally invalid captures remain diagnostic but do not produce a derived
17//! [`graph::ExecutionGraph`]. Finalized evidence can be published and deeply verified through
18//! [`artifact`], while eligible repeated timing comparisons require verified bundles through
19//! [`comparison`].
20
21pub mod artifact;
22pub mod capability;
23pub mod cli;
24pub mod comparison;
25pub mod evidence;
26pub mod graph;
27pub mod instrument;
28pub mod nsight;
29pub mod phase;
30pub mod timing;
31pub mod trace;
32#[cfg(feature = "visualizer")]
33pub mod viewer;
34
35pub use artifact::{
36    publish_bundle, verify_bundle, BundleManifest, BundleVerificationReceipt,
37    SCHEMA as BUNDLE_SCHEMA,
38};
39pub use capability::{
40    CaptureContract, CoverageLevel, ExpectedGradient, GradientContract, GradientFamilyContract,
41    GradientFamilyExpectation, MeasurementScope, GRADIENT_MANIFEST_SCHEMA,
42};
43pub use comparison::{
44    compare_unverified_traces, compare_verified_bundles, ComparisonInputVerification,
45    ComparisonInputs, ComparisonVerdict, ReplicatedComparison, TensorStatsComparison,
46    TensorStatsComparisonRow, VerifiedBundleInput, SCHEMA as COMPARISON_SCHEMA,
47};
48pub use evidence::{build_evidence, EvidencePacket, SCHEMA as EVIDENCE_SCHEMA};
49pub use graph::{build_from_trace, ExecutionGraph, SCHEMA as GRAPH_SCHEMA};
50#[cfg(feature = "candle")]
51pub use instrument::candle;
52pub use instrument::{
53    CaptureSelector, DeviceIntervalRecord, DeviceMemoryRecord, MemoryRecord, OpRecord, ProfileRun,
54    SpanGuard, SpanId, SpanKind, TensorRecord, TraceSession,
55};
56pub use nsight::{GpuEvidenceStatus, NsightEvidence};
57pub use phase::{ExecutionPhase, ExecutionStep};
58pub use trace::{parse_trace, write_jsonl, TraceDocument, TraceEvent, SCHEMA as TRACE_SCHEMA};
59pub use trace::{ComparisonIdentity, TimingMode};