Expand description
2026-09-26: One SHA-256 over everything a kernel target’s device code is
compiled from: the transitive quoted-#include closure of its sources, the
manifests, the nvcc flags, the arch string and the compiler string.
Owner: metrale-closure (shared by the kernels build script and the bench gate). Invariants:
- A path under the canonicalised
rootenters the digest relative to it, so two checkouts of one commit agree; a path outsiderootenters as given. - Every file in the closure is read, and any read error returns
Err; there is no partial digest. - A quoted include that names no file on disk is not an error: it is kept in
Closure::unresolvedand hashed by name, not by content.
The closure, not the resolved file set, is hashed because a leaf file can
#include the common file it shadows (the qwen3.6-27b nvfp4
attn_prefill_paged_indirect.cu includes its common/ namesake), and
because headers are not in layout::Layout::sources, which lists one
source per module.
Not covered:
- angle-bracket includes (only the compiler string stands for them);
- includes found through a search path or in another staged layer: an include is resolved only against the including file’s own directory;
- preprocessor conditionals, which are not evaluated, so an include in a dead branch is still walked;
- host code under
crates/: the gate’sexcusesrefuses any non-kernel path before it consults this hash; - anything not passed in
ClosureInputs.
Modules§
- layout
- 2026-09-26: Which files a
(hardware, model, quant)kernel target is compiled from.
Structs§
- Closure
- 2026-09-26: A computed closure: the digest, plus the includes that named no file.
- Closure
Inputs - 2026-09-26: The inputs of one target’s hash.
Enums§
Constants§
- CLOSURE_
SCHEMA - 2026-09-26: Version of the hash definition. It is the first value fed into the digest after the domain tag, so changing it changes every digest. Change it whenever what is fed into the digest changes (an input, an order, a separator), or old and new records compare equal while meaning different things.
Functions§
- circuit_
configs - 2026-09-28: The circuit configs of
hardwareunderroot. - circuit_
dirs - 2026-09-28: The directories
circuit_configsreads, forcargo:rerun-if-changed, so a circuit file added or removed reruns the build script too. - fusions_
chain - 2026-09-30: The FUSIONS.toml files
hardwareplans with, base first; empty when neither the class nor an ancestor declares rules. A cycle, an unreadable FUSIONS.toml or aninheritsthat is not a class name is an error, not a shorter list: a list that stopped early would leave an ancestor’s rules out of the hash. - hash
- 2026-09-26: The digest of
hash_with_report, without the unresolved set. - hash_
with_ report - 2026-09-26: Hash a target’s closure and report the quoted includes that named no file on disk.
- hex_
lower - 2026-09-30:
bytesas lower-case hex.