Expand description
describe — what a lowered program actually DOES, as facts derived from the IR.
★ WHY THIS EXISTS: A KERNEL MUST NOT BE ABLE TO ASSERT ITS OWN CORRECTNESS IN PROSE.
The tests this replaces asked the emitted C++ whether it did the right thing, by substring. That is
a question generated text can always answer favourably. The concrete case:
fused_row_family_lock asserted contains("per-row rmsnorm (weighted)") and passed for as long as
the retired template PRINTED THAT PHRASE IN A COMMENT — while its body declared cb_w and never
read it. The kernel claimed to apply a weight, in English, and did not apply one.
Swapping the needle for an instruction name (contains("mul_tiles_bcast_rows")) does not fix that;
it moves the same hole one level down, because a comment can contain an instruction name just as
easily as a sentence. The only durable answer is to stop asking the TEXT.
So these facts are computed from the SpatialProgram — from iterator kinds and access maps, the
things the compiler actually decided — and never from a string. A reduction is counted because an
axis is marked IterKind::Reduce. A per-column weight is counted because an operand’s access map
OMITS the row axis, which is what makes it constant down the rows. Nothing a printer emits, and no
comment anyone writes, can change either number.
Structs§
- Compute
Facts - What a program’s compute stages do, in the vocabulary of the algebra rather than of a backend.
Functions§
- compute_
facts - The facts of a program, computed from its stages. Cheap and total — it never fails, because every question it answers is structural.