scripts/gpu-bringup/sm86_assets.py: survey / infer / build / compare / check.
Default method is retarget (the sealed text with the .target line and two
documented sm_90+ rules edited, accepted only if ptxas -arch=sm_86 accepts it);
recompile from the .cu is the fallback and needs a recipe verified by a round
trip on sm_120. sm86-recipes.json is the round-trip evidence.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pin matches the checked-in PTX (length + sha256), PTX is real sm_120 with every
named entry exported, and the pin guards still refuse one-byte-corrupted,
wrong-length, wrong-digest, zero-pin, embedded-NUL and unterminated synthetic
copies. Refusals that relied on 'unsealed' are re-expressed with corrupted-pin
copies. GPU load is verified separately by the host smokes; no numerical claim.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds the six audited assets (head_native, original_verify_qsa, router, gr_post,
gr_norm, ple_native_batch) as an atomic reseal group built with --use_fast_math,
re-pins their old digests (incl. ple PTX_BYTES) and window-plan hex, and a
generic --flag-override recorded in the manifest and re-applied by the sealer.
compile_assets --isa-inventory/--driver-check and run_gpu_smokes.sh refuse a
driver older than the highest PTX ISA in the tree (9.0 needs >= 580.65.06).
Runbook: mandatory reseal + golden comparison section, step d' (linux-tests).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A virtual 8.6e9-element expert bank (group 96, section above 4 GiB) is never
allocated: archive bytes are a hash of the absolute offset, the planner and
kernel model decode first/middle/last-expert windows and the final partial
group, and every element is compared bit for bit with a per-element decode
written straight from the format definition. No defect found.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- check-cu.py now defaults to clang -x cuda --cuda-host-only with real qualifiers; --plain keeps the C++-only pass.
- qsa_prompt_attention_variants.cu: block_q4_0 under pack(1) as in kv_q4.hpp (cu_pin refreshed).
- native_head_native.cu: orphan copy had __launch_bounds__ before extern "C" __global__ (never nvcc-built); now the sealed twin's text.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
nvcc and a GPU are unavailable, and the kernel's only executable evidence was a
Rust transcription of it. This harness compiles the actual .cu with clang
through a small shim (threads for CUDA threads, a barrier for __syncthreads,
atomics for atomicOr) and replays model-generated cases: random valid windows
at levels 2..5, non-finite scales/books, ~1k corrupted launch-parameter sets,
multiply and SwiGLU. 17k cases (ASan build included) agree bit for bit; this
does not cover nvcc codegen or device behaviour.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every header field and directory byte is mutated with the directory digest and
header CRC recomputed so the structural validators are what is under test.
Whatever the inspector admits must also pass the nested-descriptor validator,
plan only ranges inside its own section, stage cleanly, run the kernel model
without panic, and equal the file-backed CPU oracle at level 2.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
smoke_inventory.py scans every real #[ignore] attribute, extracts the enabling
LELEKA_* flags and values, classifies tests (device / assets / mock) and assigns
them to dependency-ordered groups (smoke-groups.json). run_gpu_smokes.sh runs
them in order, stops a group at its first failure, skips dependents, continues
independent groups, treats a filter that matches nothing as a failure, records
nvidia-smi before/after, refuses a busy GPU and never starts a model run
without --allow-model-runs plus caller-supplied env. remote_sync.sh mirrors the
tree (no --delete, refuses to clobber unpulled sealed files) and builds the
three binaries and the test binaries on the host; host_sanity.sh is read-only;
record_env.sh captures hardware/software/model digests for the ledger.
Tested with stub cargo/nvidia-smi, shellcheck and a Linux container.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
compile_assets.py reads docs/cuda-seal-plan*.json (assets and new_sources
formats), an extra plan for assets no plan covers, and the four rope PTX list
of docs/rope-and-memory-plan.md; verifies .cu pins, runs nvcc with the exact
flags (fast-math policy lint, rope flag variants), validates exports and ABI
parameter counts, and writes PTX + build-manifest.json outside the tree.
seal_pins.py installs the PTX in the encoding each consumer expects and patches
every pin form (PtxPin arrays/structs, AssetSpec.sha, Option tuple arrays,
plain len/sha consts, re-pins of regenerated rope PTX, ptx_abi test) with
exactly one replacement per field and a read-back check. fake-nvcc and a
unittest suite exercise the pipeline on macOS; no GPU, no generated PTX.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PlanLayout was only compared with a copy of its own arithmetic: compare it
with OriginalVerifyLayout (plan span, mapped bytes, alignment) for every
max_t. Pin the split schedule's hazards for every layer count, and sweep the
controller over window shapes, draft noise, confidence floor, suffix lookup,
EOS and max_new asserting the emitted text is the greedy continuation and the
session equals the consumed tokens.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- validate_handle required MODE_DIGEST for Native, but a KAR-expert Load mixes
the source identity into the Native digest, so start_generation and unload
rejected the handle. The Proxy now derives the exact digest its owner will
publish from the operator config and validate_handle compares against it.
- The Load reply budget keyed only on KAR PLE/MTP modes; a Native Load that
hashes a whole KAR expert archive (plus overlay) got the 1200 s budget and a
timeout permanently shuts the owner down. KAR experts now get the long budget.
- MTP prompt tiles and window verification use chunked MoE paths that read the
GGUF experts, so KAR experts + MTP would build KV from one expert set and
decode from another. Refuse that combination at Load.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The serving backend always constructs a MoeWeightCache and step_cached passes
Some(cache) to MoeExpertStage::execute on every token. The KAR branch returned
IdentityMismatch whenever a cache was present, so with kar_expert_source set
every token failed at layer 0 and the feature was unreachable from serve_load.
The KAR branch never consults the cache for routed experts; it now ignores it
(the shared expert takes the existing uncached projection path).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rope_plan_golden compared kernel_args.corr_low/corr_high bit-for-bit, while the
corr_dims check right above already (correctly) treats NaN payload/sign as a libm
detail. For beta_slow=-1 the fixture, generated on arm64, holds 0x7fc00000, but
x86 SSE's default NaN is 0xffc00000, so the test failed on Linux x86_64. Compare
NaN-vs-NaN as equal for these two fields; all non-NaN bits stay exact.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The three adapters reduce pictures to a Responses input_image, the prompt renderer writes the template's
picture items and returns their sources in prompt order, and the request path encodes them (in turn with the
engine), expands every image pad to its token count and sends GENI with the combined SVE1 file. The encoder
is configured by a top-level vision section, stops with the engine and starts before it. Goldens recorded from
the Python handlers cover fourteen Chat and Messages requests.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two table errors in the Original-literal physical layout, both invisible to
type and extent checks and both reached only on the GPU:
1. Layout::full_role mapped tail buffers 8, 9, 10 (hit_dst, parts, hit_slot)
to roles 34, 35, 36. Role 35 (hit_dst_) is 40 bytes and 36 (hit_count_) 16,
but tail 9 (the 102400-byte expert parts) and tail 10 (40 bytes) were
placed there, so FullOwned::handle returned InvalidSize for them and no
round or step program could be planned. Map them to 35, 31 (parts_), 34.
2. Layout::scalar mapped the attention hyper-connection injection (scalar 10)
to inj2_ (role 14), the very buffer the tail uses as the MLP half's
inject_out (tail 20). mlp_gr passes the attention inject as inj_prev and
the MLP inject as inject_out, so the fused GR kernels read and wrote the
same 4 floats concurrently. Map scalar 10 to inj_ (role 13), as Original.
Add pure tests (red before, green after) that every tail buffer fits its
role without overlap and that the scalar and tail views share only the
step/pos records, which Original shares too.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The window seal plan only said 'some copies are a numerics risk'. List them
from the instruction mix of the sealed PTX against the fast-math-sensitive
operations of the Original sources: head_quant (amax / 127.0f, xi / d),
the analytic indexer append (powf/cosf/sinf), the native router (expf, 1/x),
native_gr_postops (sigmoid/silu), native_gr_norm (partial / n_cols) and the
native PLE post-ops are precise in the seals and fast-math in the Original;
bf16/combine differ in FTZ only; qsa_decode_postops, the shared expert and
the precise Original files already match. Names the re-seal action and that
native_flash_attn / native_qsa_score never run in the verify window.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Driver::load resolves cuMemsetD8_v2 (the `zero` entry point) up front, but the
synthetic mock_cuda.c (also #included by the q5/q6/projection-family mocks)
never defined it, so every isolated CPU ELF gate died in Driver::load with
MissingSymbol("cuMemsetD8_v2") before reaching its protocol assertions. Add a
load-only stub (same policy as the existing cuMemcpyDtoD_v2 stub) and an opt-in
`run.sh --mocks` mode that builds the fake libraries and runs the mock_driver,
q5_mock and q6_mock matrices in the Linux container.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Python-compatible `tojson` renderer (control-plane/src/prompt.rs, also
compiled into leleka-runtime) must reproduce json.dumps(json.loads(x)). Without
serde_json's float_roundtrip feature the default float parser is not correctly
rounded: 123456789012345680000.0 rendered as 1.2345678901234567e+20 instead of
Python's 1.2345678901234568e+20. The test only passed in whole-workspace builds
where leleka-context's dev-dependency happened to enable the feature; building
leleka-runtime alone failed. Enable the feature on both consumers.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test mutated only quartet member [3].layer and expected IdentityMismatch, but
validate_descriptors (which runs first) rejects a quartet whose members disagree
on the layer with InvalidDimension. Cover both branches explicitly: a consistent
quartet at the wrong layer index -> IdentityMismatch, a split quartet ->
InvalidDimension.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
QwenStepTxn::commit folded "no logits/argmax was produced" into the generic
`_ => IdentityMismatch` arm of the output match when prefill-finish support was
added. The previous guard (and its test
full_forward_guard_refuses_skipped_layers_missing_logits_and_wrong_callback_token)
distinguished a skipped forward (Unsupported(Executor)) from a wrong callback
token (IdentityMismatch). Restore that classification; wrong tokens, and the
finish_prefill None path, are unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>