code wiki / (root) / nx_kda.nx

nx_kda.nx

buildroot/runtime/nx_kda.nx

3089 B57 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_kda.nx -- KDA LANE SUPPORT: the KDA:MLA interleave schedule. Deliberately does NOT reimplement the KDA kernel. WHY THIS FILE IS SMALL. An earlier pass this session built a full KDA numeric core here, then found that _hdl_build/nx_nofloat_kda.nx already implements it -- and better: Q16 not Q10, a whole-sequence forward rather than single steps, scratch hoisted out of the step loop, DRY reuse of nx_nofloat_linattn. The duplicate was removed rather than left to rot beside it. It was also a live hazard: both files defined kda_write and kda_step with DIFFERENT signatures, so any organ importing both would have broken. CORRECTION (same session, after the above was written): the schedule below is ALSO a duplicate. It was claimed here as "the part nobody had built", and that was wrong -- `_hdl_build/nx_nofloat_k3interleave.nx` implements the 3:1 structure more completely, assembling a real [KDA,KDA,KDA,MLA] stack from the proven KDA and MLA organs, and its gate T5 asserts the schedule mechanically (6 KDA : 2 MLA over 8 layers, MLA at l=3,7). That organ is now BUILT and RUN, 6/6 GREEN. THE AUTHORITATIVE ORGANS ARE THEIRS, NOT THIS FILE. Do not adopt the schedule below for new work; use nx_nofloat_k3interleave. What survives here that is genuinely NOT covered elsewhere is only the FACTORISATION IDENTITY proved in nx_kda_gate T1-T3, plus kdasched_kv_cut_permille, which turns the reported 75% KV cut into a computed number (750 permille) rather than a claim. The schedule functions remain solely because that permille calculation is built on them. Kept deliberately small and clearly labelled rather than silently left to rot beside the real thing. Names are prefixed kdasched_ so this can never collide with the kernel's kda_* symbols. Kernel: _hdl_build/nx_nofloat_kda.nx (gate 5/5 GREEN, first ever built + run 2026-07-31). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_kda.nx nx_kda_gate.nx

imports: nx_syscalls.nx

imported by: nx_kda_gate.nx

structs

none

consts

29const KDASCHED_LINEAR: i64 = 0
30const KDASCHED_FULL: i64 = 1

functions

34func kdasched_kind(layer: i64, ratio: i64) -> i64
41func kdasched_full_layers(n_layers: i64, ratio: i64) -> i64
53func kdasched_kv_cut_permille(n_layers: i64, ratio: i64) -> i64
called by 1: main calls 1: kdasched_full_layers