Expand description
Static graph checker — the analysis behind cargo rlx check and the
#[rlx_model(check)] self-check hook.
rlx already computes everything a language server would surface, but only
exposes it through env-gated eprintln! (RLX_DISPATCH_REPORT,
RLX_FUSION_REPORT, RLX_LINT_NUMERICS) or compile-time panics. This module
folds those same pure functions into one structured CheckReport.
Six axes, all but execution-legality fully device-free (no GPU, no driver):
- shape / dtype —
rlx_ir::verify::verify_all(errors). - backend dispatch — per backend, ops that run native vs. portable common-IR (a perf note) vs. can’t be lowered (an error), resolved from the backend’s real op claim via the registry.
- fusion — patterns that should have collapsed but didn’t (warnings).
- numerics — constant subgraphs that provably fold to NaN/Inf (warnings).
- representation —
rlx_ir::repr_check: a consumer whose producer declares a different stride / encoding / arity (errors). - schedule — GPU tile utilization from
rlx_gpu_dispatch::cost(notes).
The severities are the design, not decoration. They are the three dispositions a pre-compile analysis can have, and collapsing them would make at least one unusable:
- gate (errors) — shape and representation. These do not degrade output, they compute a different function, so compilation must not proceed.
- report (warnings) — fusion and numerics. The program is well-formed but something is probably not what the author meant.
- hint (notes) — schedule. Nothing is wrong. The answer is correct and the machine is being wasted producing it. A finding that could fail a build here would mean rejecting correct programs for being slow.
Execution legality is only reported for backends compiled into the build.
CPU is always available and portable; other backends are opt-in behind the
consuming crate’s Cargo features (the claim is read driver-free — backend
factories build unit structs and supported_ops() is a const).
Structs§
- Backend
Summary - Per-backend rollup: fusion coverage (always) + execution legality (when the backend is compiled in) + resource budget.
- Budget
- What one run of this graph costs on one architecture.
- Check
Options - What to check and against which backends.
- Check
Report - The full result of
check_graph. - Diagnostic
- A single finding about the graph.
- Legality
- Execution-legality rollup against a backend’s real op claim.
Enums§
- Severity
- Diagnostic severity, ordered most-severe first for rendering.
Functions§
- all_
backends - Every fusion target rlx models a static op claim for.
- backend_
device - The execution
Devicewhose op claim answers legality for a fusion target. - backend_
name - Stable lowercase name for a backend target.
- check_
graph - default_
backends - A representative cross-vendor default set (CPU + the three big GPU families).
- model_
self_ check - Self-check hook injected by
#[rlx_model(check)]right after the model’s graph is traced. Runscheck_graphand reports findings to stderr. - parse_
backend - Parse a backend name (with common aliases) into a
FusionTarget.