Module tc_policy

Module tc_policy 

Source
Expand description

2026-10-02: The tensor-core policy of a kernel class (kernels/<class>/HARDWARE.toml [tensor_core_policy]): which ops, at which modes, row counts and weight formats, a plan MUST run on a tensor-core kernel, and the stated exemptions. audit checks one fused plan against it from the compute units the class’s kernel families declare (venn::compute).

Owner: metrale-circuit (hardware). Invariants:

  • Pure: the policy arrives as text, the plan and families as values.
  • Nothing defaults: a requirement states its ops, modes, minimum rows and weight formats (["any"] is stated, not assumed); an exemption states its ops, modes, rows, the kernels it allows, its kind and its reason, and a measured exemption names its evidence.
  • A class’s policy is its own; it is not inherited along HARDWARE.toml inherits, since another class’s tensor cores and kernels differ. A class without one is reported as such.
  • A covered node whose group runs no tensor-core kernel is a violation unless an exemption lists the op, the mode, the row count and every kernel of the group. A covered node in a placeholder group (no kernel of the class covers the op) is a gap, listed, never a pass.

Structs§

Exempt
2026-10-02: A stated exemption.
Finding
2026-10-02: One covered node that runs off tensor cores.
OpMatch
2026-10-02: An op a policy entry names: a base name (linear is every role) or linear:<role>.
Require
2026-10-02: Ops that must run on tensor cores at these modes, from min_rows rows.
TcAudit
2026-10-02: One plan’s audit.
TcPolicy
2026-10-02: A class’s policy.

Enums§

ExemptKind
2026-10-02: Why an op may stay off tensor cores.
Weights
2026-10-02: The weight formats an entry covers.

Functions§

audit
2026-10-02: Audit plan of c against policy, with the units families declare. Covered nodes in groups emitted by skip_emitter (the hardware planner’s placeholders) are gaps, not violations.
describe
2026-10-02: One line per violation, for an error.
enforce
2026-10-02: Audit planned (and each runtime route’s arm) of c on r’s class: None when the class states no policy; an error (super::HwError::TensorCore) on a violation.
lint_rules
2026-10-02: Every rule-level violation of policy in rules, one message each.
parse_policy
2026-10-02: The class’s policy from its parsed HARDWARE.toml: None when it declares none.
unit_of_group
2026-10-02: The unit a group’s kernels run on, from the families; an error names a kernel no family declares. None for a group without kernels.
unit_tag
2026-10-02: A group’s unit as a plan line shows it (ComputeUnit::tag): None for a group without kernels, undeclared when a kernel is in no family.