pub struct TargetPtxSet {
pub target: KernelTarget,
pub ptx_arch: &'static str,
pub modules: Vec<(&'static str, &'static [u8])>,
pub sampling: SamplingPresets,
pub behavior: ModelBehavior,
pub model_type_matches: Vec<ModelTypeMatch>,
pub match_names: &'static [&'static str],
pub dflash: Option<DflashConfig>,
pub shadowed_dropped: &'static [(&'static str, &'static str)],
pub expected_absent: &'static [(&'static str, &'static str)],
}Expand description
Kernel modules hyperoptimized for a specific (H, M_q) target.
Each blob is the compiled kernel for one module, emitted uniformly as
&'static [u8] by build.rs (include_bytes!). NVIDIA PTX is ASCII
text but valid as bytes; SCALE/AMD and Metal produce binary objects.
The runtime registry sniffs text-vs-binary per blob at load time.
Fields§
§target: KernelTarget§ptx_arch: &'static strThe kernels/<hw>/HARDWARE.toml [hardware].arch this target was
compiled with, VERBATIM — sm_90a, sm_100a, sm_121f, gfx1151.
Additive to KernelTarget::arch, which records the same declaration
with its feature suffix stripped (sm_90, sm_121) because that is
the base SM the target constants, the gate baselines and every existing
record are keyed by. Both are needed, and they are not interchangeable:
- the base SM is an IDENTITY — “which architecture family is this”;
- this field is the only one a COMPATIBILITY question may be asked of,
because the suffix IS the rule (
anever runs forward onto a later architecture,fstays inside one major family, a baresm_XYJIT-compiles forward). Judging the stripped string applies plain forward-compat to PTX that has none, which is howsm_90akernels passed the GPU preflight on a CC 10.0 device and then failed insidecuModuleLoadData— the error the preflight exists to replace.
Empty only if a build recorded no architecture. Consumers treat empty as “no opinion” and skip, rather than inventing a verdict.
modules: Vec<(&'static str, &'static [u8])>§sampling: SamplingPresets§behavior: ModelBehavior§model_type_matches: Vec<ModelTypeMatch>§match_names: &'static [&'static str][model] match_names needles from MODEL.toml — case-insensitive
substrings of the checkpoint reference (HF id / --model-name /
resolved model dir) that identify checkpoints THIS target serves.
Consulted only to break a tie when several targets declare the same
(model_type, hidden_size) (e.g. qwen3.6-27b vs qwen3.8-27b, whose
configs are bit-identical); see crate::resolve::resolve_target. Empty
for targets that never collide — build.rs panics if a colliding
target omits them.
dflash: Option<DflashConfig>DFlash drafter pairing for this model. None when the MODEL.toml has
no [dflash] section. Consumed by spark-server when --dflash is
set without an explicit --draft-model flag.
shadowed_dropped: &'static [(&'static str, &'static str)](module, kernel) pairs this model’s kernel files DROPPED by shadowing
their common/ namesakes — the kernel exists in common/ but this
model’s fork of the file does not define it, so it is not compiled here.
Shadowing is whole-file, so a fork that predates a kernel added to
common/ silently loses it: try_kernel returns handle 0 and whatever
depends on it fails CLOSED. The startup audit joins this against the
kernels the model actually looked up, which separates the two classes of
missing kernel — dropped-by-fork (a build defect) from
never-built-for-this-architecture (expected, e.g. MLA on a Qwen model).
expected_absent: &'static [(&'static str, &'static str)](module, kernel) lookups this model’s dispatch may issue and fail to
resolve WITHOUT that being an error, declared in the model’s MODEL.toml
[expected_absent] with a mandatory stated reason per entry.
The boot audit (kernel_audit::classify_failures) fails CLOSED on every
unresolved lookup that is not in this list, so the list is the entire
difference between “this model is known to run this way” and “nobody has
looked”. It is TRANSITIONAL: the right fix for a lookup that can never
resolve is to gate it on config so it is never issued (see
qwen3_attention::init_arch_gates), which removes it from here.