Files
leleka/scripts/cuda-qsa-oracle/README.md
T

59 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Independent QSA component oracle
Test-only caller for the fixed 24-query-head / 2-KV-head / 256-dimension profile.
It loads the exact retained candidate PTX through the CUDA driver. Separate
translation units include the unchanged original Strata sources; those sources
are numerical references only and are never linked into Leleka serving.
`build-cuda-qsa-oracle.sh PRIVATE_OUTPUT_DIRECTORY` compiles without launching a
GPU. Use the admitted cached GPU-hidden CUDA 12.8.93 image. Original native norm,
RoPE, indexer and gate use `--use_fast_math`; selection and attention retain
`--fmad=true --ftz=false`. All eleven producer files and original source/header
inputs are pinned in `source.sha256`. Never silently refresh these pins.
The resulting executable accepts `ASSET_DIRECTORY PRIVATE_OUTPUT_DIRECTORY`
and an optional group: `norm`, `rope`, `pack`, `index`, `select`, `attention`,
`gate`, or `invalid`. The directory must already exist. Groups permit continuing
unexecuted cases after a concrete failure without repeating passing operators.
The default runs all groups and stops at the first mismatch.
## Fixed corpus and gates
- Weighted norm: Q 24×256, K 2×256, index query 4×128; exact original F32 bits.
- Partial RoPE: those geometries at positions 0, 1, 4, 7, 262143; exact original
F32 bits and unchanged dimensions 64 onward.
- Interleaved Q/gate split: independent literal indexing. FP16 pack: original
append plus independent words for round-to-even ties, signed zero, subnormal
and maximum finite values.
- Index append: chronological positions 0 through 7, exact rounded raw tail,
fixed spare and pooled output against the original native indexer.
- Score/selection: extents 1, 4, 7, 2051, 2052, 2053, 4096, 262144; exact source
scores and IDs, independent stable cell sort, literal lowest-ID all-equal ties.
- Attention: selected widths 1, 7, 257, 2051; exact original output plus separate
double dot/softmax/V reference on identical FP16 words, relative L1 ≤ 1e-5.
One-cell different KV values expose incorrect modulo head grouping.
- Native F32 gate: literal -1000, -100, -1, signed zeros, 1, 100, 1000 and exact
source bits; finite sigmoid saturation is valid. NaN norm and NaN/Inf gate
outputs must remain failure-only NaNs.
Inputs are deterministic literal/integer-rational data defined in `main.cu`.
Every successful comparison writes raw expected and actual values into the
private output directory. Preserve failures, compiler/source/binary hashes and
the actual hardware/software receipt. Do not adjust tolerances to match output.
`host_theta.cpp` and `theta_probe.cu` diagnose the concrete fixed-literal versus
runtime-parameter fast-pow lowering issue without changing the production
source or the reference. Their output is a diagnosis, not asset admission.
The supplemental `repair RETAINED_PROOF_DIRECTORY` group reuses the five
retained original reference objects. It checks Q RoPE at 1, 4, 7, 262143 and
K/index RoPE at 0, 1, 4, 7, 262143. Index append 7 restores its prior state
from `index_append_6.want` and `index_append_3.want`; positions 0 through 6
are not relaunched. Keep these retained fixtures and new proof in separate
private directories. Producer pins reflect the runtime-theta lowering repair
in DEV receipt `d070342f-3afa-44ef-9c54-27758bae07c5` only.
This harness does not qualify projections, full-model forward, model quality,
readiness, token transaction integration, latency or throughput. Root owns
review and admission of each fixed driver asset after independent evidence.