diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/_hook.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/_hook.py new file mode 100644 index 0000000000000000000000000000000000000000..d11eff38cb26fbad1c9ee6888c4ca8aab709dd8f --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/_hook.py @@ -0,0 +1,78 @@ +"""Post-import hooks: run a callback right after a module finishes executing. + +The overlay must not import sglang (and torch) in every Python process that the +container starts, so patches are attached to their target modules lazily. If the +target module is already imported when the hook is registered, the callback runs +immediately. A callback that raises makes the import of its target fail. +""" + +import importlib.abc +import sys +import threading + +_lock = threading.RLock() +_callbacks: dict[str, list] = {} +_finder = None + + +class _Loader(importlib.abc.Loader): + def __init__(self, inner, name): + self._inner = inner + self._name = name + + def create_module(self, spec): + create = getattr(self._inner, "create_module", None) + return create(spec) if create is not None else None + + def exec_module(self, module): + self._inner.exec_module(module) + _run(self._name, module) + + def __getattr__(self, attr): + # get_source, get_filename, is_package, ... for inspect / linecache. + return getattr(self._inner, attr) + + +class _Finder(importlib.abc.MetaPathFinder): + def __init__(self): + self._busy = set() + + def find_spec(self, fullname, path, target=None): + if fullname not in _callbacks or fullname in self._busy: + return None + self._busy.add(fullname) + try: + spec = None + for finder in sys.meta_path: + if finder is self or not hasattr(finder, "find_spec"): + continue + spec = finder.find_spec(fullname, path, target) + if spec is not None: + break + finally: + self._busy.discard(fullname) + if spec is None or spec.loader is None: + return None + spec.loader = _Loader(spec.loader, fullname) + return spec + + +def _run(name, module): + with _lock: + callbacks = _callbacks.pop(name, []) + for callback in callbacks: + callback(module) + + +def when_imported(name, callback): + """Call callback(module) once module `name` has been imported.""" + global _finder + with _lock: + module = sys.modules.get(name) + if module is None: + _callbacks.setdefault(name, []).append(callback) + if _finder is None: + _finder = _Finder() + sys.meta_path.insert(0, _finder) + return + callback(module) diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/build.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/build.py new file mode 100644 index 0000000000000000000000000000000000000000..744b1974d3ab593738b79f5dcf2a48054a9817d3 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/build.py @@ -0,0 +1,113 @@ +"""Build (or reuse) the inkling_wide CUDA extension with torch.utils.cpp_extension. + +Sources: csrc/wide_ext.cu (+ csrc/bf16x_format.cuh, pico's bf16x reader, MIT). Flags: -gencode +arch=compute_121a,code=sm_121a -O3 -std=c++20 --expt-relaxed-constexpr -lineinfo. Built into //, + = INKLING_WIDE_CACHE (default ~/.cache/inkling-wide, i.e. /root/.cache/inkling-wide in the container), + a hash of the sources, the flags and the torch / CUDA versions: a later start with the same inputs only +imports the built .so, a changed input never reuses a stale build. + + python3 -m inkling_wide.build # build now (no GPU needed); prints the path + +Needs nvcc and ninja (both in the SGLang image). +""" + +import hashlib +import os +import sys +import time + +HERE = os.path.dirname(os.path.abspath(__file__)) +SOURCES = (os.path.join(HERE, "csrc", "wide_ext.cu"),) +HEADERS = (os.path.join(HERE, "csrc", "bf16x_format.cuh"),) +NAME = "inkling_wide_ext" + +# torch adds -D__CUDA_NO_{HALF,BFLOAT16}_* to every nvcc line; the kernel uses __floats2bfloat162_rn. +_UNDEF = ( + "-U__CUDA_NO_HALF_OPERATORS__", + "-U__CUDA_NO_HALF_CONVERSIONS__", + "-U__CUDA_NO_BFLOAT16_CONVERSIONS__", + "-U__CUDA_NO_HALF2_OPERATORS__", +) + + +def default_cache_dir(): + return os.path.join(os.path.expanduser("~"), ".cache", "inkling-wide") + + +def cuda_flags(arch="121a"): + return [ + f"-gencode=arch=compute_{arch},code=sm_{arch}", + "-O3", + "-std=c++20", + "--expt-relaxed-constexpr", + "-lineinfo", + *_UNDEF, + ] + + +def build_tag(flags, torch_version, cuda_version): + h = hashlib.sha256() + for path in SOURCES + HEADERS: + with open(path, "rb") as f: + h.update(os.path.basename(path).encode() + b"\0" + f.read() + b"\0") + h.update("\0".join(flags).encode()) + h.update(f"\0{torch_version}\0{cuda_version}".encode()) + return h.hexdigest()[:16] + + +_EXT = None +INFO = {} + + +def load(cache_dir=None, arch="121a", verbose=False): + """Import the extension, building it first when / holds no build of these inputs.""" + global _EXT + if _EXT is not None: + return _EXT + import torch + from torch.utils import cpp_extension + + flags = cuda_flags(arch) + if verbose: + flags = flags + ["-Xptxas=-v"] + tag = build_tag(flags, torch.__version__, torch.version.cuda) + build_dir = os.path.join(cache_dir or default_cache_dir(), tag) + os.makedirs(build_dir, exist_ok=True) + cached = any(f.endswith(".so") and f.startswith(NAME) for f in os.listdir(build_dir)) + t0 = time.monotonic() + try: + ext = cpp_extension.load( + name=NAME, + sources=list(SOURCES), + extra_cuda_cflags=flags, + extra_include_paths=[os.path.join(HERE, "csrc")], + build_directory=build_dir, + verbose=verbose, + ) + except Exception as exc: # noqa: BLE001 + raise RuntimeError(f"inkling_wide: building the extension in {build_dir} failed: {exc}") from exc + for attr in ("gemm", "decode", "prepare", "bucket", "kernel_info", "prepare_certwide", "certwide_exact"): + if not callable(getattr(ext, attr, None)): + raise RuntimeError(f"inkling_wide: extension in {build_dir} lacks {attr}()") + INFO.update(build_dir=build_dir, cached=cached, seconds=time.monotonic() - t0, tag=tag) + _EXT = ext + return ext + + +def main(argv=None): + import argparse + + p = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + p.add_argument("--cache", default=os.environ.get("INKLING_WIDE_CACHE") or default_cache_dir()) + p.add_argument("--verbose", action="store_true") + a = p.parse_args(argv) + ext = load(a.cache, verbose=a.verbose) + print( + f"inkling_wide extension {'reused' if INFO['cached'] else 'built'} in {INFO['seconds']:.1f} s: " + f"{INFO['build_dir']} (max_rows={ext.max_rows} block_n={ext.block_n})" + ) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/csrc/bf16x_format.cuh b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/csrc/bf16x_format.cuh new file mode 100644 index 0000000000000000000000000000000000000000..131edba020c76e3362301fb6cbb826c5073bf64d --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/csrc/bf16x_format.cuh @@ -0,0 +1,57 @@ +// Reader of pico's exactly coded BF16 weight format (`bf16x`). The layout description, bf16x_raw_off, mad_imm, +// bf16x_dec and ldg_bf16x below are copied from pico (dsgx10 ds41f-4xgx10-switchless/engine/kernels/gemv16.cu, +// commit f2117916), MIT License, Copyright (c) 2026 Andy Shu; full licence text in third_party/pico/LICENSE. +// Only the reader is copied; the coding itself (bf16x_encode / bf16x_check) stays in inkling_pico12, whose +// packed buffers this package reads. +// +// pico's tiled layout of a BF16 weight W [N][K]: tile (n8, p) = rows 8*n8 .. 8*n8+7, values 32p .. 32p+31 +// (64 bytes of each row); lane l of a warp owns row l/4, values 32p + 8(l%4) .. +7 (16 bytes). With +// T = N/8 * K/32 tiles, tile index i = n8 * (K/32) + p, the coded buffer holds: +// [T][256 B] sign and mantissa bytes (sign << 7 | mantissa): lane l's 8 values at 8l +// [T][128 B] exponent offsets: lane l's u32 at 4l, nibble j (bits 4j) value 2j, nibble 4 + j value 2j + 1 +// [T] u32 header: (b << 23) | (b << 7), b the tile's least exponent; raw tile r: 0x80000000 | r +// [R][512 B] the raw tiles as they were, from the first multiple of 256 bytes after the headers +// A raw tile's 512 bytes are the tile's 8 rows x 64 bytes, lane l's 16 bytes at 16l. +#pragma once +#include +#include + +namespace wide { + +__host__ __device__ constexpr size_t bf16x_raw_off(size_t T) { return (T * 388 + 255) & ~(size_t)255; } + +// a * M + c as one multiply-add +template +__device__ __forceinline__ uint32_t mad_imm(uint32_t a, uint32_t c) { + uint32_t d; + asm("mad.lo.u32 %0, %1, %2, %3;" : "=r"(d) : "r"(a), "n"(M), "r"(c)); + return d; +} + +// A lane's 8 values of a coded tile (s0, s1: their sign-mantissa bytes; e: their exponent offsets; hb: the +// tile's header) -> the raw tile's 16 bytes of that lane (4 words of bf16 pairs) +__device__ __forceinline__ uint4 bf16x_dec(uint32_t s0, uint32_t s1, uint32_t e, uint32_t hb) { + const uint32_t e2 = e >> 8; + uint4 o; + o.x = (__byte_perm(s0, 0, 0x1100) & 0x807F807Fu) | mad_imm<128>(e & 0x000F000Fu, hb); + o.y = (__byte_perm(s0, 0, 0x3322) & 0x807F807Fu) | mad_imm<8>(e & 0x00F000F0u, hb); + o.z = (__byte_perm(s1, 0, 0x1100) & 0x807F807Fu) | mad_imm<128>(e2 & 0x000F000Fu, hb); + o.w = (__byte_perm(s1, 0, 0x3322) & 0x807F807Fu) | mad_imm<8>(e2 & 0x00F000F0u, hb); + return o; +} + +// A lane's load of one tile by the tile's header h: a raw tile's 16 bytes at r, or a coded one's 8 at s and 4 at +// e (x, y; z). Predicated rather than branched (h is warp-uniform). Streamed past L1. +__device__ __forceinline__ uint4 ldg_bf16x(uint32_t h, const uint8_t* r, const uint8_t* s, const uint8_t* e) { + uint4 v; + asm volatile( + "{\n\t.reg .pred p;\n\tsetp.lt.s32 p, %4, 0;\n\t" + "@p ld.global.nc.L1::no_allocate.v4.u32 {%0, %1, %2, %3}, [%5];\n\t" + "@!p ld.global.nc.L1::no_allocate.v2.u32 {%0, %1}, [%6];\n\t" + "@!p ld.global.nc.L1::no_allocate.u32 %2, [%7];\n\t}" + : "=r"(v.x), "=r"(v.y), "=r"(v.z), "=r"(v.w) + : "r"(h), "l"(r), "l"(s), "l"(e)); + return v; +} + +} // namespace wide diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/csrc/wide_ext.cu b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/csrc/wide_ext.cu new file mode 100644 index 0000000000000000000000000000000000000000..4cac5f4cbbf79f7027a40d116835319a7b6bf739 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/csrc/wide_ext.cu @@ -0,0 +1,787 @@ +// inkling_wide: weight-streaming BF16 GEMM for 17..256 activation rows (DSpark verify batches), on raw BF16 +// weights (natural [N][K] row-major, the layer's own storage) or on pico's exactly coded `bf16x` copy (built by +// inkling_pico12; reader in bf16x_format.cuh, pico by Andy Shu, MIT). +// +// out[m, n] = sum_k x[m, k] W[n, k] BF16 operands, FP32 accumulation (mma.sync m16n8k16), FP32 or BF16 out +// +// Each weight byte is read from DRAM once per call. A CTA owns kBN = 128 weight rows (16 tiles of 8 rows) and a +// K slice (split-K over gridDim.y CTAs, fixed-order reduction by the last CTA of a column block). Its warps own +// MT tiles each (MT = 2 up to 128 rows, 1 above) and stream them straight into registers (16 bytes per lane and +// tile step, one batch of 2 steps ahead), decode them in registers (bf16x) and multiply them with ALL M rows of +// the activations: the weights are the MMA's B operand (n8 = 8 weight rows), the activations its A operand +// (m16 = 16 rows), read from shared memory, where the CTA stages x[0:M, 64-value chunk] with cp.async (3 stages). +// +// A tile step's lane layout (lane (g, t): weight row g, values 8t .. 8t+7 of the step's 32) is the layout of the +// mma B fragment with the k order permuted (pair j of the lane's 8 values is k position 2t + 8*(j&1) of MMA +// (j>>1)); the A fragment is loaded with the same permutation (16 contiguous bytes of row g and of row g + 8), so +// each MMA computes a correct partial dot product. Raw and coded weights give the same B registers after the +// decode, so the two formats give the same bits. +// +// Stacked q/k/v (Inkling2Attention._project_sources with three sources): the CTA's column block picks its +// activation source (columns [rb1, rb2): x1, [rb2, rb3): x2, else x0) and its output row offset (roff), so the +// three sources share one read of the weight. Region bounds must be multiples of kBN (checked on the host). +// +// CUDA graphs: the launch allocates nothing and does not synchronise; split-K uses a caller-owned FP32 workspace +// and a counter per column block that the reducing CTA resets to zero. +// PDL: the first weight batch is loaded before griddepcontrol.wait; x, out, ws and cnt only after it. The weights +// must therefore not be written by the kernel launched just before (they are load-time constants here). +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "bf16x_format.cuh" + +namespace wide { + +constexpr int kBN = 128; // weight rows (output columns) per CTA +constexpr int kTilesCta = kBN / 8; // 16 tiles of 8 rows +constexpr int kStepK = 32; // k values per tile step +constexpr int kBatch = 2; // steps per pipeline batch +constexpr int kStages = 3; // activation stages in shared memory +constexpr int kRowB = kBatch * kStepK * 2; // 128 bytes of a staged activation row +constexpr int kMaxM = 256; + +enum Fmt { kRaw = 0, kBF16X = 2 }; + +struct Params { + const __nv_bfloat16* x0; + const __nv_bfloat16* x1; + const __nv_bfloat16* x2; + long long ldx; // row stride of every source (elements) + int M; + int rb1, rb2, rb3; // column regions: [rb1, rb2) -> x1, [rb2, rb3) -> x2, else x0 + long long roff1, roff2; // output row offset of sources 1 and 2 (source 0: 0) + const uint8_t* W; + int N, K; + void* out; + long long ldo; // output row stride (elements) + int f32; // 1: FP32 out, 0: BF16 out + int S; // split-K slices (gridDim.y) + int pfd; // L2 prefetch distance in batches (0: none) + float* ws; // [S][M][N] partials (S > 1) + int* cnt; // [gridDim.x] arrival counters, zero between calls (S > 1) + const int* cert_state; // optional device gate [fallback reason, union size] + const int* cert_tiles; // sparse slot -> original 16-column tile + const int* cert_groups; // sparse slot -> bitmask of candidate m16 groups +}; + +__device__ __forceinline__ void mma_bf16(float d[4], uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t b0, + uint32_t b1) { + asm volatile( + "mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 {%0,%1,%2,%3},{%4,%5,%6,%7},{%8,%9},{%0,%1,%2,%3};\n" + : "+f"(d[0]), "+f"(d[1]), "+f"(d[2]), "+f"(d[3]) + : "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(b0), "r"(b1)); +} + +__device__ __forceinline__ uint4 ldg_stream128(const void* p) { + uint4 r; + asm volatile("ld.global.nc.L1::no_allocate.v4.u32 {%0,%1,%2,%3}, [%4];" + : "=r"(r.x), "=r"(r.y), "=r"(r.z), "=r"(r.w) + : "l"(p)); + return r; +} + +__device__ __forceinline__ void cp_async16(void* smem, const void* gmem) { + asm volatile("cp.async.cg.shared.global [%0], [%1], 16;" ::"r"((uint32_t)__cvta_generic_to_shared(smem)), "l"(gmem) + : "memory"); +} +// 16 bytes, or 16 zero bytes when !live (src-size 0; src must still be a valid address) +__device__ __forceinline__ void cp_async16_zfill(void* smem, const void* gmem, bool live) { + asm volatile("cp.async.cg.shared.global [%0], [%1], 16, %2;" ::"r"((uint32_t)__cvta_generic_to_shared(smem)), + "l"(gmem), "r"(live ? 16 : 0) + : "memory"); +} +__device__ __forceinline__ int atomic_add_acq_rel_gpu(int* p, int v) { + int old; + asm volatile("atom.acq_rel.gpu.global.add.s32 %0, [%1], %2;" : "=r"(old) : "l"(p), "r"(v) : "memory"); + return old; +} +__device__ __forceinline__ void cp_async_commit() { asm volatile("cp.async.commit_group;" ::: "memory"); } +template +__device__ __forceinline__ void cp_async_wait() { + asm volatile("cp.async.wait_group %0;" ::"n"(N) : "memory"); +} +__device__ __forceinline__ void pdl_launch_dependents() { asm volatile("griddepcontrol.launch_dependents;" ::: "memory"); } +__device__ __forceinline__ void pdl_wait() { asm volatile("griddepcontrol.wait;" ::: "memory"); } + +// MT: tiles per warp. 2 up to 128 rows; above, 1 (16 warps, 64 accumulators a lane) or 2 (8 warps, 128 +// accumulators a lane, half the shared-memory traffic per MMA). +constexpr int default_mt(int MI) { return MI <= 8 ? 2 : 1; } + +// MG: warp groups along M. 1: every warp multiplies its tiles with all rows; 2 (buckets 6 and 8): two warps load +// the same tiles and take half the rows each (16 warps a CTA, half the accumulators a lane; the second load of a +// tile is an L2 hit). +template +struct Cfg { + static constexpr int MT = MT_; + static constexpr int MG = MG_; + static constexpr int MIW = MI / MG; // m16 tiles per warp + static constexpr int NWN = kTilesCta / MT; // warps along N + static constexpr int NW = NWN * MG; // warps per CTA + static constexpr int NT = NW * 32; // threads per CTA + static constexpr int MINB = (MI <= 4 && MG == 1) ? 2 : 1; // CTAs per SM the register budget aims at + static constexpr int STAGE = MI * 16 * kRowB; // bytes of one activation stage + static constexpr int SMEM = kStages * STAGE; +}; + +template +__global__ void __launch_bounds__(Cfg::NT, Cfg::MINB) k_wide(const Params p) { + using C = Cfg; + static_assert(MI % MG_ == 0, "rows split evenly between the warp groups"); + constexpr int MT = C::MT; + constexpr int MIW = C::MIW; + constexpr int NT = C::NT; + constexpr int STAGE = C::STAGE; + extern __shared__ __align__(16) uint8_t smem[]; + __shared__ int s_last; + __shared__ unsigned active_m16; + // The certificate is a preceding stream dependency; wait before using its + // device-produced gate or indices. Regular wide still preloads weights first. + if (p.cert_state) { + pdl_wait(); + const bool fallback = p.cert_state[0] != 0; + if constexpr (SPARSE) { + if (fallback || blockIdx.x * (kBN / 16) >= p.cert_state[1]) return; + } else { + if (!fallback) return; + } + } + + const int warp = threadIdx.x >> 5, lane = threadIdx.x & 31, g = lane >> 2, t = lane & 3; + const int wn = warp % C::NWN, mg = warp / C::NWN; // the warp's tiles, its row group + if constexpr (SPARSE) { + if (warp == 0) { + constexpr int slots_per_cta = kBN / 16; + const int slot = blockIdx.x * slots_per_cta + lane; + const unsigned mask = lane < slots_per_cta && slot < p.cert_state[1] ? p.cert_groups[slot] : 0u; + const unsigned all_groups = __reduce_or_sync(0xffffffffu, mask); + if (lane == 0) active_m16 = all_groups; + } + __syncthreads(); + } + + const int M = p.M, N = p.N, K = p.K; + const int P = K / kStepK; // tile steps along K + const int NB = P / kBatch; // batches along K + const int S = p.S, s = blockIdx.y; + const int b0 = (int)((long long)NB * s / S), b1 = (int)((long long)NB * (s + 1) / S); + const int n_cta = blockIdx.x * kBN; + const int ntiles = N / 8; + const int src = (n_cta >= p.rb1 && n_cta < p.rb2) ? 1 : (n_cta >= p.rb2 && n_cta < p.rb3) ? 2 : 0; + const __nv_bfloat16* __restrict__ xs = src == 1 ? p.x1 : src == 2 ? p.x2 : p.x0; + const long long roff = src == 1 ? p.roff1 : src == 2 ? p.roff2 : 0; + + // ---- this lane's weight pointers + int nt[MT]; + bool valid[MT]; + unsigned groups[MT]; + unsigned warp_groups = 0; + const uint8_t* wptr[MT]; // raw: row 8*nt+g at value 8t; bf16x: tile (nt, 0)'s sign-mantissa bytes of the lane + const uint8_t* eptr[MT]; // bf16x: exponent offsets of tile (nt, 0) of the lane + const uint32_t* hptr[MT]; // bf16x: header of tile (nt, 0) + const size_t T = (size_t)ntiles * P; + // bf16x: the lane's bytes of raw tile 0, less 2^40: raw tile r (header h = 2^31 + r) at rawq + 512 h + const uint64_t rawq = + FMT == kBF16X ? reinterpret_cast(p.W + bf16x_raw_off(T) + 16 * lane) - (1ull << 40) : 0; +#pragma unroll + for (int i = 0; i < MT; ++i) { + const int slot = blockIdx.x * kTilesCta + wn * MT + i; + if constexpr (SPARSE) { + valid[i] = slot / 2 < p.cert_state[1]; + nt[i] = valid[i] ? 2 * p.cert_tiles[slot / 2] + slot % 2 : 0; + groups[i] = valid[i] ? p.cert_groups[slot / 2] : 0; + warp_groups |= groups[i]; + } else { + nt[i] = slot; + valid[i] = nt[i] < ntiles; + } + const size_t ti = (size_t)(valid[i] ? nt[i] : 0) * P; + if constexpr (FMT == kBF16X) { + wptr[i] = p.W + ti * 256 + 8 * lane; + eptr[i] = p.W + T * 256 + ti * 128 + 4 * lane; + hptr[i] = reinterpret_cast(p.W + T * 384) + ti; + } else { + wptr[i] = p.W + ((size_t)(valid[i] ? nt[i] : 0) * 8 + g) * (size_t)K * 2 + 16 * t; + eptr[i] = nullptr; + hptr[i] = nullptr; + } + } + + // bf16x: the headers of the warp's tiles in registers, loaded once (before the PDL wait: weights only): lane l + // holds steps l, l + 32, l + 64 (P <= 96, checked on the host); a step's header is a shuffle from lane ps % 32. + uint32_t hreg[MT][3]; +#pragma unroll + for (int i = 0; i < MT; ++i) +#pragma unroll + for (int j = 0; j < 3; ++j) { + const int ps = lane + 32 * j; + hreg[i][j] = (FMT == kBF16X && valid[i] && ps < P) ? __ldg(hptr[i] + ps) : 0u; + } + auto hdr = [&](int i, int ps) -> uint32_t { + const int j = ps >> 5; // warp-uniform + const uint32_t v = j == 0 ? hreg[i][0] : j == 1 ? hreg[i][1] : hreg[i][2]; + return __shfl_sync(0xffffffffu, v, ps & 31); + }; + + // L2 prefetch of batch b's weight lines (fire and forget; group 0 only): lanes 16i .. 16i+15 for tile i. + auto prefetch = [&](int b) { + if (b >= b1 || mg != 0) return; + const int i = MT == 2 ? (lane >> 4) : 0, li = lane & 15; + if (MT == 1 && lane >= 16) return; + const bool vi = MT == 2 ? (i == 0 ? valid[0] : valid[MT - 1]) : valid[0]; + if (!vi) return; + const int nti = MT == 2 ? (i == 0 ? nt[0] : nt[MT - 1]) : nt[0]; + const uint8_t* a = nullptr; + if constexpr (FMT == kBF16X) { + const size_t ti = (size_t)nti * P; + if (li < 4) a = p.W + ti * 256 + (size_t)b * 512 + li * 128; + else if (li < 6) a = p.W + T * 256 + ti * 128 + (size_t)b * 256 + (li - 4) * 128; + } else { + if (li < 8) a = p.W + (((size_t)nti * 8 + li) * (size_t)K + (size_t)b * 64) * 2; + } + if (a) asm volatile("prefetch.global.L2 [%0];" ::"l"(a)); + }; + + float acc[MT][MIW][4]; +#pragma unroll + for (int i = 0; i < MT; ++i) +#pragma unroll + for (int j = 0; j < MIW; ++j) acc[i][j][0] = acc[i][j][1] = acc[i][j][2] = acc[i][j][3] = 0.f; + + uint4 wa[kBatch][MT], wb[kBatch][MT]; + uint32_t ha[kBatch][MT], hb[kBatch][MT]; +#pragma unroll + for (int u = 0; u < kBatch; ++u) +#pragma unroll + for (int i = 0; i < MT; ++i) { + wa[u][i] = wb[u][i] = make_uint4(0, 0, 0, 0); + ha[u][i] = hb[u][i] = 0; + } + + auto load = [&](uint4 (&w)[kBatch][MT], uint32_t (&h)[kBatch][MT], int b) { +#pragma unroll + for (int u = 0; u < kBatch; ++u) { + const int ps = b * kBatch + u; +#pragma unroll + for (int i = 0; i < MT; ++i) { + if (!valid[i]) continue; + if constexpr (FMT == kBF16X) { + const uint32_t hh = hdr(i, ps); + h[u][i] = hh; + w[u][i] = ldg_bf16x(hh, reinterpret_cast(rawq + (uint64_t)hh * 512), + wptr[i] + (size_t)ps * 256, eptr[i] + (size_t)ps * 128); + } else { + w[u][i] = ldg_stream128(wptr[i] + (size_t)ps * 64); + } + } + } + }; + + // activation stage of batch b -> buffer `buf`: rows < M copied, rows M .. Mpad-1 (the last m16 tile's padding) + // zero-filled; 8 chunks of 16 bytes a row; chunk c of row r lands at chunk c ^ 4 when r is odd, so that the two + // rows (16mi+g, g = 2j and 2j+1) one 8-lane phase of a 128-bit load reads fall into different bank halves. + const int Mpad = (M + 15) & ~15; + auto issue_x = [&](int b, int buf) { + uint8_t* dst = smem + buf * STAGE; + const __nv_bfloat16* srcp = xs + (size_t)b * (kBatch * kStepK); + for (int c = threadIdx.x; c < Mpad * 8; c += NT) { + const int r = c >> 3, ch = c & 7; + if constexpr (SPARSE) { + if (!(active_m16 & (1u << (r / 16)))) continue; + } + const bool live = r < M; + cp_async16_zfill(dst + r * kRowB + ((ch ^ ((r & 1) << 2)) << 4), srcp + (size_t)(live ? r : 0) * p.ldx + ch * 8, + live); + } + }; + + auto comp = [&](uint4 (&w)[kBatch][MT], const uint32_t (&h)[kBatch][MT], int buf) { + const uint8_t* xb = smem + buf * STAGE; +#pragma unroll + for (int u = 0; u < kBatch; ++u) { + uint4 wd[MT]; +#pragma unroll + for (int i = 0; i < MT; ++i) { + wd[i] = w[u][i]; + if constexpr (FMT == kBF16X) { + if ((int)h[u][i] >= 0) wd[i] = bf16x_dec(wd[i].x, wd[i].y, wd[i].z, h[u][i]); + } + } + const int off = ((u * 4 + t) ^ ((g & 1) << 2)) << 4; // rows 16mi+g and 16mi+g+8 have g's parity +#pragma unroll + for (int j = 0; j < MIW; ++j) { + const int mi = mg * MIW + j; + if (mi * 16 >= M) break; + if constexpr (SPARSE) { + if (!(warp_groups & (1u << mi))) continue; + } + const int r = mi * 16 + g; + const uint4 a = *reinterpret_cast(xb + r * kRowB + off); + const uint4 a2 = *reinterpret_cast(xb + (r + 8) * kRowB + off); +#pragma unroll + for (int i = 0; i < MT; ++i) { + if constexpr (SPARSE) { + if (!(groups[i] & (1u << mi))) continue; + } + mma_bf16(acc[i][j], a.x, a2.x, a.y, a2.y, wd[i].x, wd[i].y); + mma_bf16(acc[i][j], a.z, a2.z, a.w, a2.w, wd[i].z, wd[i].w); + } + } + } + }; + + load(wa, ha, b0); + for (int d = 1; d <= p.pfd; ++d) prefetch(b0 + d); + pdl_launch_dependents(); + pdl_wait(); + issue_x(b0, 0); + cp_async_commit(); + if (b0 + 1 < b1) issue_x(b0 + 1, 1); + cp_async_commit(); + int stage = 0; + for (int b = b0; b < b1; b += 2) { + if (b + 1 < b1) load(wb, hb, b + 1); + if (p.pfd) prefetch(b + 1 + p.pfd); + cp_async_wait<1>(); + __syncthreads(); + if (b + 2 < b1) issue_x(b + 2, stage == 0 ? 2 : stage - 1); + cp_async_commit(); + comp(wa, ha, stage); + stage = stage == 2 ? 0 : stage + 1; + if (b + 1 >= b1) break; + if (b + 2 < b1) load(wa, ha, b + 2); + if (p.pfd) prefetch(b + 2 + p.pfd); + cp_async_wait<1>(); + __syncthreads(); + if (b + 3 < b1) issue_x(b + 3, stage == 0 ? 2 : stage - 1); + cp_async_commit(); + comp(wb, hb, stage); + stage = stage == 2 ? 0 : stage + 1; + } + cp_async_wait<0>(); + + // ---- epilogue. acc[i][mi]: c0, c1 = (row 16mi+g, columns 8nt+2t, +1), c2, c3 = (row 16mi+g+8, same columns) + auto store2 = [&](int m, int n, float v0, float v1) { + const size_t o = (size_t)(roff + m) * (size_t)p.ldo + n; + if (p.f32) { + *reinterpret_cast(reinterpret_cast(p.out) + o) = make_float2(v0, v1); + } else { + *reinterpret_cast<__nv_bfloat162*>(reinterpret_cast<__nv_bfloat16*>(p.out) + o) = __floats2bfloat162_rn(v0, v1); + } + }; + if (S == 1) { +#pragma unroll + for (int i = 0; i < MT; ++i) { + if (!valid[i]) continue; + const int out_tile = SPARSE ? blockIdx.x * kTilesCta + wn * MT + i : nt[i]; + const int n = out_tile * 8 + 2 * t; +#pragma unroll + for (int j = 0; j < MIW; ++j) { + const int mi = mg * MIW + j; + if constexpr (SPARSE) { + if (!(groups[i] & (1u << mi))) continue; + } + const int r = mi * 16 + g; + if (r < M) store2(r, n, acc[i][j][0], acc[i][j][1]); + if (r + 8 < M) store2(r + 8, n, acc[i][j][2], acc[i][j][3]); + } + } + return; + } + if constexpr (SPARSE) return; // certified heads use S = 1 + + // split-K: every slice writes its partials; the last CTA of the column block sums slices 0..S-1 in order + float* wsl = p.ws + (size_t)s * M * N; +#pragma unroll + for (int i = 0; i < MT; ++i) { + if (!valid[i]) continue; + const int n = nt[i] * 8 + 2 * t; +#pragma unroll + for (int j = 0; j < MIW; ++j) { + const int r = (mg * MIW + j) * 16 + g; + if (r < M) __stcg(reinterpret_cast(wsl + (size_t)r * N + n), make_float2(acc[i][j][0], acc[i][j][1])); + if (r + 8 < M) + __stcg(reinterpret_cast(wsl + (size_t)(r + 8) * N + n), make_float2(acc[i][j][2], acc[i][j][3])); + } + } + // publication: every writer fences, the CTA barrier orders the writers before the leader's device-scope acq_rel + // arrival (release: the CTA's partials; acquire, in the last CTA: every other CTA's), and the second barrier + // orders the leader's acquire before the readers' loads. + __threadfence(); + __syncthreads(); + if (threadIdx.x == 0) s_last = atomic_add_acq_rel_gpu(p.cnt + blockIdx.x, 1) == S - 1; + __syncthreads(); + if (!s_last) return; + __threadfence(); +#pragma unroll + for (int i = 0; i < MT; ++i) { + if (!valid[i]) continue; + const int n = nt[i] * 8 + 2 * t; +#pragma unroll + for (int jm = 0; jm < MIW; ++jm) { +#pragma unroll + for (int hf = 0; hf < 2; ++hf) { + const int r = (mg * MIW + jm) * 16 + g + 8 * hf; + if (r >= M) continue; + float2 v = __ldcg(reinterpret_cast(p.ws + (size_t)r * N + n)); + for (int j = 1; j < S; ++j) { + const float2 q = __ldcg(reinterpret_cast(p.ws + ((size_t)j * M + r) * N + n)); + v.x += q.x; + v.y += q.y; + } + store2(r, n, v.x, v.y); + } + } + } + if (threadIdx.x == 0) p.cnt[blockIdx.x] = 0; // ready for the next call (stream order) +} + +// coded (bf16x) -> natural [N][K] BF16, through the same reader as k_wide: the GPU check compares it with the +// layer's weight bit for bit. One warp per tile. +__global__ void k_decode(const uint8_t* __restrict__ X, int N, int K, __nv_bfloat16* __restrict__ out) { + const int P = K / kStepK; + const size_t T = (size_t)(N / 8) * P; + const int lane = threadIdx.x & 31; + const uint64_t rawq = reinterpret_cast(X + bf16x_raw_off(T) + 16 * lane) - (1ull << 40); + for (size_t tile = (blockIdx.x * (size_t)blockDim.x + threadIdx.x) >> 5; tile < T; + tile += ((size_t)gridDim.x * blockDim.x) >> 5) { + const uint32_t h = reinterpret_cast(X + T * 384)[tile]; + uint4 v = ldg_bf16x(h, reinterpret_cast(rawq + (uint64_t)h * 512), X + tile * 256 + 8 * lane, + X + T * 256 + tile * 128 + 4 * lane); + if ((int)h >= 0) v = bf16x_dec(v.x, v.y, v.z, h); + const size_t n8 = tile / P, ps = tile % P; + const size_t row = n8 * 8 + (lane >> 2), col = ps * kStepK + 8 * (lane & 3); + *reinterpret_cast(out + row * K + col) = v; + } +} + +template +void launch_mi(const Params& p, int nblk, bool pdl, cudaStream_t st) { + using C = Cfg; + auto kern = k_wide; // its shared-memory attribute is set by prepare() at load time + cudaLaunchConfig_t cfg{}; + cfg.gridDim = dim3(nblk, p.S); + cfg.blockDim = dim3(C::NT); + cfg.dynamicSmemBytes = C::SMEM; + cfg.stream = st; + cudaLaunchAttribute attr[1]; + attr[0].id = cudaLaunchAttributeProgrammaticStreamSerialization; + attr[0].val.programmaticStreamSerializationAllowed = 1; + cfg.attrs = attr; + cfg.numAttrs = pdl ? 1 : 0; + C10_CUDA_CHECK(cudaLaunchKernelEx(&cfg, kern, p)); +} + +// The m16-tile buckets: rows up to 16, 32, 48, 64, 96, 128, 192, 256. +constexpr int kBuckets[] = {1, 2, 3, 4, 6, 8, 12, 16}; + +int bucket_of(int M) { + const int need = (M + 15) / 16; + for (int b : kBuckets) + if (b >= need) return b; + return -1; +} + +// The kernel of a bucket: mt 0 = default_mt; buckets 12 and 16 also exist with the other MT; buckets 6 and 8 also +// with two warp groups along M (mg 2). +int mt_of(int MI, int mt) { return MI >= 12 && (mt == 1 || mt == 2) ? mt : default_mt(MI); } +int mg_of(int MI, int mg) { return (MI == 6 || MI == 8) && mg == 2 ? 2 : 1; } +int key_of(int MI, int mt, int mg) { return MI * 16 + mt_of(MI, mt) * 4 + mg_of(MI, mg); } +constexpr int kkey(int MI, int MT, int MG) { return MI * 16 + MT * 4 + MG; } + +#define WIDE_KERNELS(X, FMT) \ + X(FMT, 1, 2, 1) X(FMT, 2, 2, 1) X(FMT, 3, 2, 1) X(FMT, 4, 2, 1) X(FMT, 6, 2, 1) X(FMT, 6, 2, 2) X(FMT, 8, 2, 1) \ + X(FMT, 8, 2, 2) X(FMT, 12, 1, 1) X(FMT, 12, 2, 1) X(FMT, 16, 1, 1) X(FMT, 16, 2, 1) + +template +void launch_fmt(const Params& p, int nblk, bool pdl, int mt, int mg, cudaStream_t st) { + const int MI = bucket_of(p.M); + TORCH_CHECK(MI > 0, "inkling_wide: M=", p.M, " not in [1, ", kMaxM, "]"); + const int key = key_of(MI, mt, mg); +#define WIDE_LAUNCH(F, MI_, MT_, MG_) \ + if (key == kkey(MI_, MT_, MG_)) return launch_mi(p, nblk, pdl, st); + WIDE_KERNELS(WIDE_LAUNCH, FMT) +#undef WIDE_LAUNCH + TORCH_CHECK(false, "inkling_wide: no kernel for M=", p.M); +} + +template +void prepare_fmt() { + // cudaFuncSetAttribute for every instantiation at load time (outside any graph capture) +#define WIDE_ATTR(F, MI, MT, MG) \ + C10_CUDA_CHECK(cudaFuncSetAttribute(k_wide, cudaFuncAttributeMaxDynamicSharedMemorySize, \ + Cfg::SMEM)); + WIDE_KERNELS(WIDE_ATTR, FMT) +#undef WIDE_ATTR +} + +// ---- bindings + +void check_x(const torch::Tensor& x, int64_t M, int64_t K, const torch::Tensor& ref) { + TORCH_CHECK(x.is_cuda() && x.scalar_type() == at::kBFloat16 && x.dim() == 2, "inkling_wide: x must be CUDA bf16 [M, K]"); + TORCH_CHECK(x.device() == ref.device(), "inkling_wide: x on another device"); + TORCH_CHECK(x.size(0) >= M && x.size(1) == K && x.stride(1) == 1, "inkling_wide: x must be [>= M, K] with unit column stride"); + TORCH_CHECK(x.stride(0) % 8 == 0 && reinterpret_cast(x.data_ptr()) % 16 == 0, + "inkling_wide: x rows must be 16-byte aligned"); +} + +// out[roff(n) + m, n] = sum_k x_src(n)[m, k] W[n, k] for m < M, every column n; see Params. +// fmt 0: W is the BF16 weight [N, K] (contiguous); fmt 2: W is the bf16x coded uint8 buffer of [N, K]. +void gemm(const torch::Tensor& x0, const torch::Tensor& x1, const torch::Tensor& x2, int64_t M, const torch::Tensor& W, + int64_t fmt, int64_t N, int64_t K, int64_t rb1, int64_t rb2, int64_t rb3, int64_t roff1, int64_t roff2, + const torch::Tensor& out, int64_t S, const torch::Tensor& ws, const torch::Tensor& cnt, bool pdl, int64_t mt, int64_t mg, + int64_t pfd) { + TORCH_CHECK(M >= 1 && M <= kMaxM, "inkling_wide: M=", M, " not in [1, 256]"); + TORCH_CHECK(N % 8 == 0 && N > 0 && K % 64 == 0 && K > 0 && N <= INT32_MAX && K <= INT32_MAX, + "inkling_wide: N=", N, " K=", K, " (N a multiple of 8, K of 64)"); + check_x(x0, M, K, W); + check_x(x1, M, K, W); + check_x(x2, M, K, W); + TORCH_CHECK(x0.stride(0) == x1.stride(0) && x0.stride(0) == x2.stride(0), "inkling_wide: sources differ in row stride"); + TORCH_CHECK(W.is_cuda() && W.is_contiguous() && W.device() == x0.device(), "inkling_wide: bad weight"); + if (fmt == kRaw) { + TORCH_CHECK(W.scalar_type() == at::kBFloat16 && W.dim() == 2 && W.size(0) == N && W.size(1) == K, + "inkling_wide: raw weight must be bf16 [N, K]"); + } else { + TORCH_CHECK(fmt == kBF16X && W.scalar_type() == at::kByte && W.dim() == 1, "inkling_wide: fmt ", fmt); + const size_t T = (size_t)(N / 8) * (K / 32); + TORCH_CHECK(T < (1ull << 31) && (size_t)W.numel() >= bf16x_raw_off(T), "inkling_wide: coded buffer too small"); + TORCH_CHECK(K <= 96 * 32, "inkling_wide: bf16x needs K <= 3072 (headers held in 3 registers a lane)"); + } + TORCH_CHECK(reinterpret_cast(W.data_ptr()) % 16 == 0, "inkling_wide: weight not 16-byte aligned"); + const bool f32 = out.scalar_type() == at::kFloat; + TORCH_CHECK(out.is_cuda() && out.device() == x0.device() && out.dim() == 2 && + (f32 || out.scalar_type() == at::kBFloat16), + "inkling_wide: out must be CUDA fp32 / bf16 [rows, N]"); + TORCH_CHECK(out.size(1) == N && out.stride(1) == 1 && out.stride(0) >= N && out.stride(0) % 2 == 0 && + reinterpret_cast(out.data_ptr()) % (f32 ? 8 : 4) == 0, + "inkling_wide: out rows must hold N contiguous, aligned values"); + TORCH_CHECK(roff1 >= 0 && roff2 >= 0 && out.size(0) >= M && roff1 <= out.size(0) - M && roff2 <= out.size(0) - M, + "inkling_wide: out has ", out.size(0), " rows, row offsets ", roff1, ", ", roff2, " with M=", M); + auto overlaps = [](const torch::Tensor& a, const torch::Tensor& b) { + const auto a0 = reinterpret_cast(a.data_ptr()), b0 = reinterpret_cast(b.data_ptr()); + const auto a1 = a0 + (uintptr_t)((a.size(0) - 1) * a.stride(0) + a.size(1)) * a.element_size(); + const auto b1 = b0 + (uintptr_t)((b.size(0) - 1) * b.stride(0) + b.size(1)) * b.element_size(); + return a0 < b1 && b0 < a1; + }; + TORCH_CHECK(!overlaps(out, x0) && !overlaps(out, x1) && !overlaps(out, x2), "inkling_wide: out overlaps x"); + auto bound_ok = [&](int64_t b) { return b >= N || (b >= 0 && b % kBN == 0); }; + TORCH_CHECK(bound_ok(rb1) && bound_ok(rb2) && bound_ok(rb3) && rb1 <= rb2 && rb2 <= rb3, + "inkling_wide: column regions must be multiples of ", kBN, " (or >= N)"); + const int nblk = (int)((N + kBN - 1) / kBN); + const int64_t NB = K / 64; + TORCH_CHECK(S >= 1 && S <= NB && S <= 64, "inkling_wide: split-K S=", S, " not in [1, ", NB, "]"); + if (S > 1) { + TORCH_CHECK(ws.is_cuda() && ws.device() == x0.device() && ws.scalar_type() == at::kFloat && ws.is_contiguous() && + ws.numel() >= S * M * N && reinterpret_cast(ws.data_ptr()) % 16 == 0, + "inkling_wide: split-K workspace too small, misaligned or on another device"); + TORCH_CHECK(cnt.is_cuda() && cnt.device() == x0.device() && cnt.scalar_type() == at::kInt && cnt.is_contiguous() && + cnt.numel() >= nblk, + "inkling_wide: split-K counters too few or on another device"); + } + const c10::cuda::CUDAGuard guard(x0.device()); + Params p{}; + p.x0 = reinterpret_cast(x0.data_ptr()); + p.x1 = reinterpret_cast(x1.data_ptr()); + p.x2 = reinterpret_cast(x2.data_ptr()); + p.ldx = x0.stride(0); + p.M = (int)M; + p.rb1 = (int)std::min(rb1, INT32_MAX); + p.rb2 = (int)std::min(rb2, INT32_MAX); + p.rb3 = (int)std::min(rb3, INT32_MAX); + p.roff1 = roff1; + p.roff2 = roff2; + p.W = reinterpret_cast(W.data_ptr()); + p.N = (int)N; + p.K = (int)K; + p.out = out.data_ptr(); + p.ldo = out.stride(0); + p.f32 = f32 ? 1 : 0; + p.S = (int)S; + p.ws = S > 1 ? ws.data_ptr() : nullptr; + p.cnt = S > 1 ? cnt.data_ptr() : nullptr; + TORCH_CHECK(pfd >= 0 && pfd <= 64, "inkling_wide: prefetch distance ", pfd); + p.pfd = (int)pfd; + const auto st = at::cuda::getCurrentCUDAStream(); + if (fmt == kRaw) + launch_fmt(p, nblk, pdl, (int)mt, (int)mg, st); + else + launch_fmt(p, nblk, pdl, (int)mt, (int)mg, st); +} + +// S=1 head only. Use exactly the same weight decoder, fragment order, and +// accumulation loop as the dense launch, with a compact column map. +#define CERT_WIDE_BUCKETS(X) \ + X(2, 2) X(3, 2) X(4, 2) X(6, 2) X(8, 2) X(12, 1) + +void prepare_certwide(int64_t device) { + const c10::cuda::CUDAGuard guard((c10::DeviceIndex)device); +#define CERT_ATTR(MI, MT) \ + C10_CUDA_CHECK(cudaFuncSetAttribute(k_wide, \ + cudaFuncAttributeMaxDynamicSharedMemorySize, Cfg::SMEM)); + CERT_WIDE_BUCKETS(CERT_ATTR) +#undef CERT_ATTR +} + +// Both exact branches and the Triton reducer read this state after validation. +// The caller keeps the state and workspace exclusive through reduction. +__global__ void k_validate_certwide(int* state, const int* tiles, const int* groups, + int slots, int ntiles, int live_tiles, unsigned row_groups) { + constexpr int kInvalid = 4; + __shared__ int count; + __shared__ unsigned seen; + if (threadIdx.x == 0) { + const int reason = state[0], n = state[1]; + count = reason == 0 && n > 0 && n <= slots && n < ntiles ? n : 0; + if ((!count && reason == 0) || (unsigned)reason > kInvalid) state[0] = kInvalid; + seen = 0; + } + __syncthreads(); + if (!count) return; + unsigned mask = 0; + for (int i = threadIdx.x; i < count; i += blockDim.x) { + const unsigned group = groups[i]; + if ((unsigned)tiles[i] >= (unsigned)live_tiles || !group || (group & ~row_groups)) mask |= 1u << 31; + mask |= group; + } + mask = __reduce_or_sync(0xffffffffu, mask); + if ((threadIdx.x & 31) == 0) atomicOr(&seen, mask); + __syncthreads(); + if (threadIdx.x == 0 && seen != row_groups) state[0] = kInvalid; +} + +void certwide_exact(const torch::Tensor& x, const torch::Tensor& W, + const torch::Tensor& dense, const torch::Tensor& compact, + const torch::Tensor& state, const torch::Tensor& tiles, + const torch::Tensor& groups, int64_t N, int64_t v_real, int64_t mt, int64_t mg, int64_t pfd) { + constexpr int K = 2304; + TORCH_CHECK(x.dim() == 2, "inkling_certwide: x must be [M, K]"); + const int64_t M = x.size(0), slots = tiles.numel(); + TORCH_CHECK(M >= 17 && M <= 192 && N > 0 && N % 16 == 0 && N <= INT32_MAX && v_real > 0 && v_real <= N, + "inkling_certwide: bad head shape"); + check_x(x, M, K, W); + auto same = [&](const torch::Tensor& t, at::ScalarType dt) { + return t.is_cuda() && t.device() == x.device() && t.is_contiguous() && t.scalar_type() == dt; + }; + const size_t T = (size_t)(N / 8) * (K / 32); + TORCH_CHECK(same(W, at::kByte) && W.dim() == 1 && T < (1ull << 31) && + (size_t)W.numel() >= bf16x_raw_off(T) && reinterpret_cast(W.data_ptr()) % 16 == 0, + "inkling_certwide: bad packed weight"); + TORCH_CHECK(same(state, at::kInt) && state.numel() == 2 && + same(tiles, at::kInt) && same(groups, at::kInt) && groups.numel() == slots && + slots > 0 && slots <= N / 16 && + same(dense, at::kFloat) && dense.dim() == 2 && dense.size(0) == M && dense.size(1) == N && + same(compact, at::kFloat) && compact.dim() == 2 && compact.size(0) == M && compact.size(1) == slots * 16 && + reinterpret_cast(dense.data_ptr()) % 8 == 0 && + reinterpret_cast(compact.data_ptr()) % 8 == 0, + "inkling_certwide: bad exact workspace"); + TORCH_CHECK(mt >= 0 && mt <= 2 && mg >= 1 && mg <= 2 && pfd >= 0 && pfd <= 64, + "inkling_certwide: bad kernel settings"); + // Disjoint address ranges, even when the caller takes views of one storage. + const torch::Tensor* buffers[] = {&x, &W, &dense, &compact, &state, &tiles, &groups}; + TORCH_CHECK(x.is_contiguous(), "inkling_certwide: x must be contiguous"); + for (int i = 0; i < 7; ++i) { + const auto a = reinterpret_cast(buffers[i]->data_ptr()); + for (int j = 0; j < i; ++j) { + const auto b = reinterpret_cast(buffers[j]->data_ptr()); + TORCH_CHECK(a + buffers[i]->nbytes() <= b || b + buffers[j]->nbytes() <= a, + "inkling_certwide: aliased exact buffers"); + } + } + const c10::cuda::CUDAGuard guard(x.device()); + const auto st = at::cuda::getCurrentCUDAStream(); + k_validate_certwide<<<1, 256, 0, st>>>(state.data_ptr(), tiles.data_ptr(), groups.data_ptr(), + slots, N / 16, (v_real + 15) / 16, (1u << ((M + 15) / 16)) - 1u); + C10_CUDA_KERNEL_LAUNCH_CHECK(); + Params p{}; + p.x0 = reinterpret_cast(x.data_ptr()); + p.ldx = x.stride(0); + p.M = (int)M; + p.rb1 = p.rb2 = p.rb3 = INT32_MAX; + p.W = W.data_ptr(); + p.N = (int)N; + p.K = K; + p.f32 = p.S = 1; + p.pfd = (int)pfd; + p.cert_state = state.data_ptr(); + p.out = dense.data_ptr(); + p.ldo = N; + launch_fmt(p, (N + kBN - 1) / kBN, false, (int)mt, (int)mg, st); + + p.out = compact.data_ptr(); + p.ldo = slots * 16; + p.cert_tiles = tiles.data_ptr(); + p.cert_groups = groups.data_ptr(); + const int nblk = (p.ldo + kBN - 1) / kBN; + const int mi = bucket_of(p.M); +#define CERT_LAUNCH(MI, MT) \ + if (mi == MI) return launch_mi(p, nblk, false, st); + CERT_WIDE_BUCKETS(CERT_LAUNCH) +#undef CERT_LAUNCH + TORCH_CHECK(false, "inkling_certwide: unsupported M=", M); +} +#undef CERT_WIDE_BUCKETS + +torch::Tensor decode(const torch::Tensor& X, int64_t N, int64_t K) { + TORCH_CHECK(X.is_cuda() && X.scalar_type() == at::kByte && X.is_contiguous(), "inkling_wide: bad coded buffer"); + TORCH_CHECK(N > 0 && K > 0 && N % 8 == 0 && K % 32 == 0 && N <= INT32_MAX && K <= INT32_MAX, "inkling_wide: N=", N, + " K=", K); + TORCH_CHECK(reinterpret_cast(X.data_ptr()) % 16 == 0, "inkling_wide: coded buffer not 16-byte aligned"); + const size_t T = (size_t)(N / 8) * (K / 32); + TORCH_CHECK(T < (1ull << 31) && (size_t)X.numel() >= bf16x_raw_off(T), "inkling_wide: coded buffer too small"); + const c10::cuda::CUDAGuard guard(X.device()); + auto out = torch::empty({N, K}, X.options().dtype(at::kBFloat16)); + k_decode<<<1024, 256, 0, at::cuda::getCurrentCUDAStream()>>>(X.data_ptr(), (int)N, (int)K, + reinterpret_cast<__nv_bfloat16*>(out.data_ptr())); + C10_CUDA_KERNEL_LAUNCH_CHECK(); + return out; +} + +void prepare(int64_t device) { + const c10::cuda::CUDAGuard guard((c10::DeviceIndex)device); + prepare_fmt(); + prepare_fmt(); +} + +// (registers, local bytes, max threads) of the kernel at fmt / bucket, for the build log +std::tuple kernel_info(int64_t fmt, int64_t M, int64_t mt, int64_t mg) { + cudaFuncAttributes a{}; + const int MI = bucket_of((int)M); + TORCH_CHECK(MI > 0, "inkling_wide: M=", M); + const int key = key_of(MI, (int)mt, (int)mg); + const void* f = nullptr; +#define WIDE_INFO(F, MI_, MT_, MG_) \ + if (key == kkey(MI_, MT_, MG_)) f = (const void*)k_wide; + if (fmt == kRaw) { + WIDE_KERNELS(WIDE_INFO, kRaw) + } else { + WIDE_KERNELS(WIDE_INFO, kBF16X) + } +#undef WIDE_INFO + TORCH_CHECK(f != nullptr, "inkling_wide: no kernel for M=", M, " mt=", mt, " mg=", mg); + C10_CUDA_CHECK(cudaFuncGetAttributes(&a, f)); + return {a.numRegs, (int64_t)a.localSizeBytes, a.maxThreadsPerBlock}; +} + +} // namespace wide + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.doc() = "inkling_wide: weight-streaming BF16 GEMM for 17..256 rows on raw or pico-coded (bf16x) weights"; + m.def("gemm", &wide::gemm, "out[roff + m, n] = x_src[m] . W[n] (see wide_ext.cu)"); + m.def("decode", &wide::decode, "bf16x coded buffer -> natural [N, K] bf16 (the kernel's reader)"); + m.def("prepare_certwide", &wide::prepare_certwide, "prepare the sparse packed head kernels"); + m.def("certwide_exact", &wide::certwide_exact, "guarded dense or compact packed head with FP32 outputs"); + m.def("prepare", &wide::prepare, "set the kernels' shared-memory attribute on a device (load time)"); + m.def("bucket", &wide::bucket_of, "m16 tiles of the kernel taking M rows"); + m.def("kernel_info", &wide::kernel_info, "(regs, local bytes, max threads) of a kernel"); + m.attr("max_rows") = wide::kMaxM; + m.attr("block_n") = wide::kBN; +} diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/ops.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/ops.py new file mode 100644 index 0000000000000000000000000000000000000000..85008324ad6a60f55f93a1f2c8f439d60a6b6920 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/ops.py @@ -0,0 +1,313 @@ +"""Weights registered for the wide GEMM and the per-call paths (17..MAX_M rows). + +A Wide entry points at the bytes the kernel streams: the layer's own BF16 weight (fmt RAW, natural [N, K] +layout, no copy) or inkling_pico12's exactly coded copy of it (fmt BF16X, pico's `bf16x` format, ~0.775 of the +bytes; read in place, never copied). Both formats give the same output bits (the decode restores the BF16 +values exactly and the MMA sequence is the same). + +Math: out[m, n] = sum_k x[m, k] W[n, k], BF16 operands, FP32 accumulation over K in a fixed order (per 32-value +step: two m16n8k16 MMAs; split-K slices summed in slice order), FP32 out or one rounding to BF16. Against the stock +path (cuBLAS) only the FP32 summation order differs. + +Per call: torch.empty outputs (the graph pool under capture), one launch on the current stream, no host sync, no +host-device copy, a path chosen by shapes only; the split-K workspace and counters are allocated at load time. +""" + +import torch + +MAX_ROWS = 256 # rows the kernel takes (dsk-style buckets of 16..256) +BLOCK_N = 128 # weight rows per CTA: stacked-region bounds must be multiples of it +RAW, BF16X = 0, 2 +NO_REGION = 2**31 - 1 + + +class Settings: + min_m = 17 # rows of a call taken (plain calls; per source for stacked q/k/v calls) + max_m = 256 + # per weight kind: rows up to which wide beats cuBLAS on GB10 (gpu_check_wide, 2026-11-21, L2-cold): qkvr + # 1.02x at 96 rows (stacked 1.13x at 85 per source), wo_ud 1.06x at 32 / 1.00x at 48, the head 1.18x at 256 + max_m_kind = {"qkvr": 96, "wo": 32, "head": 256} + pdl = True + fmt = "auto" # auto: pico's coded copy when inkling_pico12 made one, else the raw weight; raw: always raw + splitk = {} # kind -> forced split-K slices (env INKLING_WIDE_SPLITK) + sms = 48 + mt = 0 # tiles per warp above 128 rows: 0 = the kernel's default (1), 1 or 2 (env INKLING_WIDE_MT) + mg = 2 # warp groups along M at 65..128 rows: 2 (default; wo 96 rows 89 -> 76 us, qkvr flat) or 1 (env INKLING_WIDE_MG) + scope = "verify" # verify: only inside target decode / target-verify forwards (env INKLING_WIDE_SCOPE); all + pfd = 1 # L2 prefetch distance in 64-value batches (env INKLING_WIDE_PFD; 0 = off): 1 best or flat everywhere + require_cuda = True # CPU tests turn this off and install a stand-in EXT + + +SET = Settings() +EXT = None +_batch_invariant = None +_warned = set() +LOG = None +WS = {"ws": None, "cnt": None} +# True while the target model runs a decode or target-verify forward (set by the patched +# Inkling2ForConditionalGeneration.forward from forward_batch.forward_mode, a Python attribute fixed at CUDA-graph +# capture). With SET.scope == "verify" wide takes calls only then: prefill / extend chunks keep the stock path. +IN_SCOPE = [False] # split-K workspace (FP32) and counters (int32), shared by every call + + +class WideFatal(BaseException): + """A broken patch target or an impossible state: not caught by `except Exception`.""" + + +def _warn_once(key, msg): + if key not in _warned: + _warned.add(key) + if LOG is not None: + LOG(msg) + + +def bucket(m): + """m16 tiles of the kernel for m rows (the kernel's buckets).""" + need = (m + 15) // 16 + for b in (1, 2, 3, 4, 6, 8, 12, 16): + if b >= need: + return b + raise ValueError(f"inkling_wide: {m} rows > {MAX_ROWS}") + + +def ctas_per_sm(m): + """The occupancy the kernel is built for at m rows (launch bounds: 2 CTAs up to 64 rows).""" + return 2 if bucket(m) <= 4 else 1 + + +def choose_split(n, k, m, kind=None): + """Split-K slices for an [n, k] weight at m rows: forced per kind (INKLING_WIDE_SPLITK), else from the GB10 sweep + (gpu_check_wide --sweep, 2026-11-21): no split once the column blocks (128 rows each) cover the SMs (qkvr: 68 + blocks, the head: 1571; every split measured slower); below that, enough slices for one CTA per SM up to 64 + rows (wo_ud, 18 blocks: 3 slices; 4 measured within 2 %) and two thirds of that above (2 slices), where the + FP32 partials' traffic starts to cost more than idle SMs. The partials must fit in L2.""" + nb = k // 64 + if kind is not None and kind in SET.splitk: + return max(1, min(SET.splitk[kind], nb)) + nblk = -(-n // BLOCK_N) + if nblk >= SET.sms: + return 1 + want = SET.sms / nblk if m <= 64 else SET.sms / nblk / 1.5 + s = max(1, min(-(-int(want * 1000) // 1000), nb // 4, 16)) + while s > 1 and s * m * n * 4 > 24 * 2**20: + s -= 1 + return s + + +def shape_reason(n, k): + if n % 8: + return f"N={n} not a multiple of 8" + if k % 64: + return f"K={k} not a multiple of 64" + if n >= 2**31 or k >= 2**31: + return f"[{n}, {k}] too large" + return None + + +class Wide: + """One weight the wide GEMM reads: RAW (the BF16 tensor) or BF16X (pico's Pack, read through .buf).""" + + __slots__ = ("n", "k", "fmt", "weight", "pack", "wptr", "label", "kind") + + def __init__(self, weight, label, kind, pack=None): + n, k = weight.shape + self.n, self.k, self.label, self.kind = n, k, label, kind + self.fmt = BF16X if pack is not None else RAW + self.weight, self.pack = weight, pack + self.wptr = weight.data_ptr() + + def workspace_floats(self, min_m, max_m): + """FP32 partials the largest split call of min_m..max_m rows needs (0: never splits).""" + need = 0 + for m in range(min_m, max_m + 1): + s = choose_split(self.n, self.k, m, self.kind) + if s > 1: + need = max(need, s * m * self.n) + return need + + @property + def buf(self): + return self.pack.buf if self.fmt == BF16X else self.weight + + @property + def nbytes(self): + return self.buf.numel() * self.buf.element_size() + + def __repr__(self): + return f"Wide({self.label} [{self.n}x{self.k}] {'bf16x' if self.fmt == BF16X else 'raw'} {self.kind})" + + +def make(weight, label, kind, pico_pack=None): + """Register [N, K] BF16 `weight`; pico_pack (inkling_pico12's Pack of the same storage) selects BF16X.""" + w = weight.detach() + if w.dtype != torch.bfloat16 or w.dim() != 2: + raise ValueError(f"inkling_wide: {label}: not a BF16 matrix") + why = shape_reason(*w.shape) + if why is not None: + raise ValueError(f"inkling_wide: {label}: {why}") + if not w.is_contiguous() or w.data_ptr() % 16: + raise ValueError(f"inkling_wide: {label}: weight not contiguous or not 16-byte aligned") + # the kernel holds a bf16x tile row's headers in 3 registers a lane: K <= 3072 (larger K reads the raw weight) + use_pack = pico_pack is not None and SET.fmt == "auto" and w.shape[1] <= 3072 + if use_pack and ((pico_pack.n, pico_pack.k) != tuple(w.shape) or pico_pack.wptr != w.data_ptr()): + raise WideFatal(f"inkling_wide: {label}: inkling_pico12's pack is not of this weight") + return Wide(w, label, kind, pico_pack if use_pack else None) + + +def ensure_workspace(entries, min_m, max_m, device, grow=False, floats=0): + """Allocate (load time) the split-K workspace (FP32) and counters (int32, zero) for every entry that may split + in min_m..max_m rows. The buffers are process-wide and referenced by captured CUDA graphs: they are never + replaced unless `grow` (offline tools); a reload that needs more raises WideFatal (restart the server). + Calls must not run concurrently on two streams (SGLang's forward runs on one).""" + need = max([floats] + [e.workspace_floats(min_m, max_m) for e in entries]) + nblk = max([1] + [-(-e.n // BLOCK_N) for e in entries]) + ws, cnt = WS["ws"], WS["cnt"] + if ws is None or (grow and (ws.numel() < need or cnt.numel() < nblk)): + WS["ws"] = torch.empty(max(need, 4), dtype=torch.float32, device=device) + WS["cnt"] = torch.zeros(max(nblk, 64), dtype=torch.int32, device=device) + elif ws.numel() < need or cnt.numel() < nblk: + raise WideFatal(f"inkling_wide: split-K workspace of {ws.numel()} floats / {cnt.numel()} counters (captured in " + f"CUDA graphs) cannot hold {need} / {nblk} after a reload: restart the server") + return 4 * WS["ws"].numel() + + +def mode_ok(): + if torch.compiler.is_compiling(): + return False + return not (_batch_invariant is not None and _batch_invariant()) + + +def rows_of(x): + return x.numel() // x.shape[-1] if x.dim() >= 1 and x.shape[-1] else 0 + + +def x_ok(x, k): + return ( + x.dtype == torch.bfloat16 + and x.dim() >= 1 + and x.shape[-1] == k + and (x.is_cuda or not SET.require_cuda) + and not x.requires_grad + ) + + +def in_range(m, kind=None): + if SET.scope == "verify" and not IN_SCOPE[0]: + return False + return SET.min_m <= m <= min(SET.max_m, SET.max_m_kind.get(kind, SET.max_m)) + + +def weight_current(weight, entry): + if weight.data_ptr() == entry.wptr and (entry.fmt == RAW or entry.pack.wptr == entry.wptr): + return True + _warn_once(("wptr", entry.label), f"{entry.label}: weight storage changed since registration; stock path from now on") + return False + + +def eligible(x, entry): + return ( + in_range(rows_of(x), entry.kind) + and x_ok(x, entry.k) + and (x.device == entry.weight.device or not SET.require_cuda) + and mode_ok() + ) + + +def as_rows(x, k): + """x[..., K] as [M, K] with unit column stride and 16-byte aligned rows (a copy only when x is not).""" + x2 = x.reshape(-1, k) + if x2.stride(-1) != 1 or (x2.shape[0] > 1 and x2.stride(0) != k): + x2 = x2.contiguous() + if x2.data_ptr() % 16: + x2 = x2.clone() + return x2 + + +def out_ok(out, m, entry, dtype, device): + return ( + out.dtype == dtype + and out.device == device + and out.dim() == 2 + and tuple(out.shape) == (m, entry.n) + and out.stride(-1) == 1 + and (m == 1 or out.stride(0) == entry.n) + and out.data_ptr() % (8 if dtype == torch.float32 else 4) == 0 + ) + + +def gemm(x2, entry, out, m, x1=None, x2b=None, regions=(NO_REGION, NO_REGION, NO_REGION), roffs=(0, 0)): + s = choose_split(entry.n, entry.k, m, entry.kind) + EXT.gemm( + x2, x2 if x1 is None else x1, x2 if x2b is None else x2b, m, entry.buf, entry.fmt, entry.n, entry.k, + regions[0], regions[1], regions[2], roffs[0], roffs[1], out, s, WS["ws"], WS["cnt"], SET.pdl, SET.mt, SET.mg, SET.pfd, + ) + return out + + +def linear(x, entry, out_dtype, out=None): + """x[..., K] @ W^T in out_dtype, into `out` ([M, N], checked by the caller) when given.""" + lead = x.shape[:-1] + x2 = as_rows(x, entry.k) + m = x2.shape[0] + if out is None: + out = torch.empty((m, entry.n), dtype=out_dtype, device=x.device) + gemm(x2, entry, out, m) + return out.view(*lead, entry.n) + + +# ---- stacked qkvr --------------------------------------------------------------------------------------- + + +def regions_of(split_sizes): + """Column regions (k_lo, v_lo, v_hi) of the k and v outputs of the qkvr projection (split order q, k, v, ...), + or None if a bound is not a multiple of BLOCK_N (a CTA must serve one source).""" + if len(split_sizes) < 3: + return None + a = int(split_sizes[0]) + b = a + int(split_sizes[1]) + c = b + int(split_sizes[2]) + if a % BLOCK_N or b % BLOCK_N or c % BLOCK_N or not 0 < a < b < c: + return None + return a, b, c + + +def stacked_eligible(sources, entry, regions): + q, k, v = sources + if regions is None or q.dim() != 2 or not (q.shape == k.shape == v.shape): + return False + if not (q.dtype == k.dtype == v.dtype == torch.bfloat16) or not (q.device == k.device == v.device): + return False + return ( + in_range(q.shape[0], entry.kind) + and x_ok(q, entry.k) + and (q.device == entry.weight.device or not SET.require_cuda) + and not k.requires_grad + and not v.requires_grad + and mode_ok() + ) + + +def _rows(x, k): + """x as [M, K] with rows of stride K (the three sources must share one row stride).""" + if x.stride(-1) != 1 or (x.shape[0] > 1 and x.stride(0) != k) or x.data_ptr() % 16: + x = x.contiguous() + if x.data_ptr() % 16: + x = x.clone() + return x + + +def stacked_project(q, k, v, entry, regions): + """BF16 [3M, N] with what qkvr(cat(q, k, v))[0] holds on every element Inkling2Attention._project_sources + keeps: rows [0, M) on every column outside [k_lo, v_hi), rows [M, 2M) on the k columns, rows [2M, 3M) on + the v columns, from one read of the weight. The other elements are left unwritten (never read).""" + m = q.shape[0] + q2, k2, v2 = _rows(q, entry.k), _rows(k, entry.k), _rows(v, entry.k) + out = torch.empty((3 * m, entry.n), dtype=torch.bfloat16, device=q.device) + return gemm(q2, entry, out, m, x1=k2, x2b=v2, regions=regions, roffs=(m, 2 * m)) + + +def split_like_stock(out, split_sizes): + """The (q, k, v, r, gate, sinks) views _project_sources returns for a stacked [3M, N] projection.""" + q_proj, k_proj, v_proj = (chunk.split(split_sizes, dim=-1)[:6] for chunk in out.chunk(3)) + q, _, _, r, gate, sinks = q_proj + return q, k_proj[1], v_proj[2], r, gate, sinks diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/patches.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/patches.py new file mode 100644 index 0000000000000000000000000000000000000000..4b7b93005798fe608295568d7fb550cec6115494 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/patches.py @@ -0,0 +1,397 @@ +"""The SGLang patch points of inkling_wide (README.md has the list and the exactness argument). + + unquant UnquantizedLinearMethod: a per-layer subclass (of whatever method class the layer has then, + e.g. inkling_pico12's) whose apply / apply_into send calls of MIN_M..MAX_M rows of a registered + layer to the wide GEMM; sm12x_fp32_lm_head(_applies): the FP32 LM head at MIN_M..MAX_M rows + inkling2_attn Inkling2Attention._project_sources: the stacked q/k/v case (three distinct [M, K] sources) + inkling2 Inkling2ForConditionalGeneration.post_load_weights: register the weights after every (re)load + (after inkling_pico12 coded them, when it is armed: install inkling_wide after it) + +Every patch falls back to the function it replaced for anything it does not take. +""" + +import copy +import functools +import importlib +import sys +import time + +import torch + +from . import build, ops + +UNQUANT = "sglang.srt.layers.quantization.unquant" +ATTN = "sglang.srt.models.inkling_common.inkling2_attn" +MODEL = "sglang.srt.models.inkling2" + +STATE = {"levers": (), "cfg": None, "log": None, "patched": []} +HEADS = {} # weight data_ptr -> Wide of the BF16 LM head +EXIT = None # tests replace it; default os._exit + + +def _log(msg): + (STATE["log"] or (lambda m: sys.stderr.write(m + "\n")))(msg) + + +def _exit(code): + import os + + (EXIT or os._exit)(code) + + +def _need(owner, names, where): + missing = [n for n in names if getattr(owner, n, None) is None] + if missing: + raise ops.WideFatal(f"inkling_wide: patch target {where} lacks {missing}") + + +def _guarded(fn): + """Run load-time work; any failure ends the process with code 78 (a half-armed overlay must not serve).""" + + @functools.wraps(fn) + def run(*args, **kwargs): + try: + return fn(*args, **kwargs) + except (KeyboardInterrupt, SystemExit): + raise + except BaseException as exc: # noqa: BLE001 + _log(f"FATAL in {fn.__name__}: {exc!r}") + sys.stderr.flush() + _exit(78) + raise + + return run + + +def _ext(): + if ops.EXT is None: + cfg = STATE["cfg"] + ext = build.load(cfg["cache_dir"], verbose=cfg["verbose"]) + ext.prepare(torch.cuda.current_device()) + ops.EXT = ext + return ops.EXT + + +_MARKERS = ("inkling_cfg", "inkling_pico12", "inkling_prefill_qkvr_split") + + +def _forward_markers(new, inner): + """Keep the other _project_sources overlays' markers visible through our wrapper (as inkling_prefill does), so + that none of them wraps a second time.""" + for attr in _MARKERS: + if hasattr(inner, attr): + setattr(new, attr, getattr(inner, attr)) + + +# ---- quant method subclass ---------------------------------------------------------------------------- + +_METHOD_CLASSES = {} + + +def method_class(base): + """Subclass of a linear method class whose apply / apply_into run the wide GEMM for a registered layer.""" + if getattr(base, "_wide_class", False): + return base + sub = _METHOD_CLASSES.get(base) + if sub is not None: + return sub + base_apply = base.apply + base_apply_into = getattr(base, "apply_into", None) + + def apply(self, layer, x, bias=None): + entry = layer.__dict__.get("_wide") + if entry is not None and bias is None and ops.eligible(x, entry) and ops.weight_current(layer.weight, entry): + return ops.linear(x, entry, x.dtype) + return base_apply(self, layer, x, bias) + + ns = {"apply": apply, "_wide_class": True, "__module__": __name__} + if base_apply_into is not None: + + def apply_into(self, layer, x, output, bias=None): + entry = layer.__dict__.get("_wide") + if ( + entry is not None + and bias is None + and x.dim() == 2 + and ops.eligible(x, entry) + and ops.out_ok(output, x.shape[0], entry, torch.bfloat16, x.device) + and ops.weight_current(layer.weight, entry) + ): + ops.gemm(ops.as_rows(x, entry.k), entry, output, x.shape[0]) + return output + return base_apply_into(self, layer, x, output, bias=bias) + + ns["apply_into"] = apply_into + sub = type("Wide" + base.__name__, (base,), ns) + _METHOD_CLASSES[base] = sub + return sub + + +def _unquantized_class(): + mod = sys.modules.get(UNQUANT) or importlib.import_module(UNQUANT) + cls = getattr(mod, "UnquantizedLinearMethod", None) + if cls is None: + raise ops.WideFatal(f"inkling_wide: {UNQUANT}.UnquantizedLinearMethod is missing") + return cls + + +def linear_reason(layer): + w = getattr(layer, "weight", None) + if not isinstance(w, torch.Tensor) or w.dim() != 2 or w.dtype != torch.bfloat16: + return "weight is not a BF16 matrix" + if getattr(layer, "bias", None) is not None: + return "has a bias" + method = getattr(layer, "quant_method", None) + if method is None or not isinstance(method, _unquantized_class()): + return f"quant method {type(method).__name__}" + if not w.is_contiguous(): + return "weight not contiguous" + return ops.shape_reason(*w.shape) + + +def _pico_wants(layer): + """True if inkling_pico12 is armed for the target's dense layers (its pack must then exist).""" + pico = sys.modules.get("inkling_pico12") + return pico is not None and "dense" in tuple(getattr(pico, "STATE", {}).get("levers", ())) + + +def register_linear(layer, label, kind): + """Register layer.weight for the wide GEMM and give the layer the wide method. Returns (entry, reason).""" + why = linear_reason(layer) + if why is not None: + layer.__dict__.pop("_wide", None) + return None, why + pack = layer.__dict__.get("_pico12") + if pack is None and ops.SET.fmt == "auto" and _pico_wants(layer): + raise ops.WideFatal( + f"inkling_wide: {label} has no inkling_pico12 pack although inkling_pico12 dense is armed: install " + "inkling_wide after inkling_pico12 (its post_load_weights wrapper must run after pico's)" + ) + entry = ops.make(layer.weight, label, kind, pack) + layer.__dict__["_wide"] = entry + method = layer.quant_method + if not getattr(type(method), "_wide_class", False): + new = copy.copy(method) + new.__class__ = method_class(type(method)) + for attr in ("apply", "apply_into"): # instance-level wrappers would shadow ours + new.__dict__.pop(attr, None) + layer.quant_method = new + return entry, None + + +# ---- unquant: LM head --------------------------------------------------------------------------------- + + +def make_lm_head(inner_fn, inner_applies): + def entry_for(x, weight, out): + if not isinstance(weight, torch.Tensor) or weight.dim() != 2: + return None + entry = HEADS.get(weight.data_ptr()) + if entry is None or tuple(weight.shape) != (entry.n, entry.k) or not ops.eligible(x, entry): + return None + if out is not None and not ops.out_ok(out, ops.rows_of(x), entry, torch.float32, x.device): + return None + if not ops.weight_current(weight, entry): + return None + return entry + + def sm12x_fp32_lm_head_applies(x, weight, out): + return entry_for(x, weight, out) is not None or inner_applies(x, weight, out) + + def sm12x_fp32_lm_head(x, weight, out): + entry = entry_for(x, weight, out) + if entry is None: + return inner_fn(x, weight, out) + return ops.linear(x, entry, torch.float32, out=out) + + sm12x_fp32_lm_head.__wrapped__ = inner_fn + sm12x_fp32_lm_head_applies.__wrapped__ = inner_applies + sm12x_fp32_lm_head._wide = sm12x_fp32_lm_head_applies._wide = True + return sm12x_fp32_lm_head, sm12x_fp32_lm_head_applies + + +def patch_unquant(mod): + levers = STATE["levers"] + _need(mod, ["UnquantizedLinearMethod", "is_batch_invariant_mode_enabled"], UNQUANT) + _need(mod.UnquantizedLinearMethod, ["apply", "apply_into"], f"{UNQUANT}.UnquantizedLinearMethod") + ops._batch_invariant = mod.is_batch_invariant_mode_enabled + if "lmhead" in levers: + _need(mod, ["sm12x_fp32_lm_head", "sm12x_fp32_lm_head_applies"], UNQUANT) + if not getattr(mod.sm12x_fp32_lm_head, "_wide", False): + fn, applies = make_lm_head(mod.sm12x_fp32_lm_head, mod.sm12x_fp32_lm_head_applies) + mod.sm12x_fp32_lm_head, mod.sm12x_fp32_lm_head_applies = fn, applies + STATE["patched"].append("unquant.sm12x_fp32_lm_head") + + +# ---- inkling2_attn: stacked qkvr ------------------------------------------------------------------------ + + +def make_project_sources(inner): + def _project_sources(self, sources): + plan = self.__dict__.get("_wide_qkvr") + if plan is not None: + entry, regions = plan + q, k, v = sources.q, sources.k, sources.v + if ( + len({id(q), id(k), id(v)}) == 3 + and ops.stacked_eligible((q, k, v), entry, regions) + and ops.weight_current(self.qkvr.weight, entry) + ): + out = ops.stacked_project(q, k, v, entry, regions) + return ops.split_like_stock(out, self.split_sizes) + return inner(self, sources) + + _project_sources.__wrapped__ = inner + _project_sources.inkling_wide = True + _forward_markers(_project_sources, inner) + return _project_sources + + +def patch_attn(mod): + _need(mod, ["Inkling2Attention", "AttentionSources"], ATTN) + cls = mod.Inkling2Attention + _need(cls, ["_project_sources", "_project_qkvr"], f"{ATTN}.Inkling2Attention") + if getattr(cls._project_sources, "inkling_wide", False): + return + cls._project_sources = make_project_sources(cls._project_sources) + STATE["patched"].append("Inkling2Attention._project_sources") + + +# ---- inkling2: register the target's weights after every load ------------------------------------------- + + +def _mb(n): + return f"{n / 1e6:.1f} MB" + + +def _settings_text(): + s = ops.SET + caps = ",".join(f"{k}={v}" for k, v in s.max_m_kind.items()) + return (f"min_m={s.min_m} max_m={s.max_m} ({caps}) scope={s.scope} fmt={s.fmt} pdl={int(s.pdl)} mg={s.mg} " + f"pfd={s.pfd} " + f"splitk={s.splitk or 'auto'}") + + +def prepare_target(model): + levers = STATE["levers"] + t0 = time.monotonic() + _ext() + t_ext = time.monotonic() - t0 + entries, parts, skipped = [], [], {} + device = None + if "dense" in levers: + attn_cls = getattr(sys.modules.get(ATTN), "Inkling2Attention", None) + if attn_cls is None: + raise ops.WideFatal(f"inkling_wide: {ATTN} not imported at weight load") + n_q = n_wo = n_st = n_x = 0 + for name, mod in model.named_modules(): + if not isinstance(mod, attn_cls): + continue + e, why = register_linear(mod.qkvr, f"{name}.qkvr", "qkvr") + if e is None: + skipped[f"{name}.qkvr"] = why + mod.__dict__.pop("_wide_qkvr", None) + else: + n_q += 1 + n_x += e.fmt == ops.BF16X + entries.append(e) + device = e.weight.device + regions = ops.regions_of(mod.split_sizes) + if regions is not None: + mod.__dict__["_wide_qkvr"] = (e, regions) + n_st += 1 + else: + mod.__dict__.pop("_wide_qkvr", None) + e, why = register_linear(mod.wo_ud, f"{name}.wo_ud", "wo") + if e is None: + skipped[f"{name}.wo_ud"] = why + else: + n_wo += 1 + n_x += e.fmt == ops.BF16X + entries.append(e) + device = e.weight.device + if n_q + n_wo == 0: + raise ops.WideFatal("inkling_wide: dense is on but no Inkling2Attention qkvr / wo_ud was registered") + parts.append(f"dense: qkvr {n_q} (stacked {n_st}) wo_ud {n_wo}, bf16x {n_x}/{n_q + n_wo}") + if "lmhead" in levers: + lm_head = getattr(getattr(model, "llm", None), "lm_head", None) + w = getattr(lm_head, "weight", None) + if not isinstance(w, torch.Tensor) or w.dim() != 2 or w.dtype != torch.bfloat16: + raise ops.WideFatal(f"inkling_wide: lm head weight is {type(w).__name__} {getattr(w, 'dtype', '')}, " + "not a BF16 matrix") + pico_heads = getattr(sys.modules.get("inkling_pico12.patches"), "HEADS", {}) or {} + pack = pico_heads.get(w.data_ptr()) + pico = sys.modules.get("inkling_pico12") + pico_head = pico is not None and {"lmhead", "drafthead"} & set(getattr(pico, "STATE", {}).get("levers", ())) + if pack is None and ops.SET.fmt == "auto" and pico_head: + raise ops.WideFatal("inkling_wide: the LM head has no inkling_pico12 pack although inkling_pico12 " + "lmhead is armed: install inkling_wide after inkling_pico12") + e = ops.make(w, "lm_head", "head", pack) + HEADS.clear() + HEADS[e.wptr] = e + entries.append(e) + device = e.weight.device + parts.append(f"head [{e.n}x{e.k}] {'bf16x' if e.fmt == ops.BF16X else 'raw'}") + if device is not None and device.type == "cuda": + ops.SET.sms = torch.cuda.get_device_properties(device).multi_processor_count + ws_bytes = ops.ensure_workspace(entries, ops.SET.min_m, ops.SET.max_m, device) if device is not None else 0 + skip = "" + if skipped: + first = "; ".join(f"{k}: {v}" for k, v in list(skipped.items())[:3]) + skip = f"; skipped {len(skipped)} ({first}{' ...' if len(skipped) > 3 else ''})" + info = build.INFO + how = f"ext {'reused' if info.get('cached') else 'built'} in {t_ext:.1f} s ({info.get('build_dir')})" if info \ + else "ext stand-in" + _log( + f"active (target): {', '.join(parts)}; split-K workspace {_mb(ws_bytes)}{skip}; patched " + f"{', '.join(STATE['patched']) or 'nothing'}; {how}; {_settings_text()}" + ) + + +def is_in_scope(forward_batch): + """Decode or target-verify forward (the forward modes wide is built for).""" + mode = getattr(forward_batch, "forward_mode", None) + if mode is None: + return False + try: + return bool(mode.is_decode() or mode.is_target_verify()) + except AttributeError: + return False + + +def make_forward(inner): + """Mark the target forward's scope for ops.in_range (restored afterwards, also on error).""" + + @functools.wraps(inner) + def forward(self, input_ids, positions, forward_batch, *args, **kwargs): + prev = ops.IN_SCOPE[0] + ops.IN_SCOPE[0] = is_in_scope(forward_batch) + try: + return inner(self, input_ids, positions, forward_batch, *args, **kwargs) + finally: + ops.IN_SCOPE[0] = prev + + forward._wide = True + return forward + + +def patch_model(mod): + _need(mod, ["Inkling2ForConditionalGeneration"], MODEL) + cls = mod.Inkling2ForConditionalGeneration + _need(cls, ["post_load_weights", "forward"], f"{MODEL}.Inkling2ForConditionalGeneration") + if not getattr(cls.forward, "_wide", False): + cls.forward = make_forward(cls.forward) + STATE["patched"].append("Inkling2ForConditionalGeneration.forward (scope)") + orig = cls.post_load_weights + if getattr(orig, "_wide", False): + return + + @functools.wraps(orig) + def post_load_weights(self, *args, **kwargs): + result = orig(self, *args, **kwargs) + _guarded(prepare_target)(self) + return result + + post_load_weights._wide = True + cls.post_load_weights = post_load_weights + STATE["patched"].append("Inkling2ForConditionalGeneration.post_load_weights") diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tests/fake_wide_ext.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tests/fake_wide_ext.py new file mode 100644 index 0000000000000000000000000000000000000000..d15b14441ece89785ea640f0098bb7a5ae4a0f16 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tests/fake_wide_ext.py @@ -0,0 +1,65 @@ +"""CPU stand-in of the built inkling_wide extension: the call contract of wide_ext.cu's gemm() (rows, strides, +regions, split-K workspace) with reference math (BF16 operands, FP32 sums, one rounding), and a call log. + +fmt 2 (bf16x) reads the weight through inkling_pico12's CPU stand-in buffer (the weight's own bytes, then pad).""" +import torch + +NO_REGION = 2**31 - 1 + + +class FakeWideExt: + max_rows = 256 + block_n = 128 + + def __init__(self): + self.calls = [] # (M, N, K, fmt, out dtype, S, stacked) + + @staticmethod + def bucket(m): + need = (m + 15) // 16 + for b in (1, 2, 3, 4, 6, 8, 12, 16): + if b >= need: + return b + return -1 + + def prepare(self, device=0): + pass + + @staticmethod + def weight_of(W, fmt, n, k): + if fmt == 0: + assert W.dtype == torch.bfloat16 and tuple(W.shape) == (n, k) and W.is_contiguous() + return W + assert fmt == 2 and W.dtype == torch.uint8 and W.dim() == 1 + return W[: n * k * 2].view(torch.bfloat16).view(n, k) + + def gemm(self, x0, x1, x2, M, W, fmt, N, K, rb1, rb2, rb3, roff1, roff2, out, S, ws, cnt, pdl, mt, mg, pfd): + assert mt in (0, 1, 2) and mg in (0, 1, 2) and 0 <= pfd <= 64 + assert 1 <= M <= 256, M + assert N % 8 == 0 and K % 64 == 0 + for x in (x0, x1, x2): + assert x.dtype == torch.bfloat16 and x.dim() == 2 and x.shape[0] >= M and x.shape[1] == K + assert x.stride(1) == 1 and x.stride(0) % 8 == 0 and x.data_ptr() % 16 == 0 + assert x0.stride(0) == x1.stride(0) == x2.stride(0) + assert out.dim() == 2 and out.shape[1] == N and out.stride(1) == 1 and out.stride(0) >= N + assert out.dtype in (torch.float32, torch.bfloat16) + assert out.shape[0] >= M + max(0, roff1, roff2) + for b in (rb1, rb2, rb3): + assert b >= N or b % 128 == 0, b + assert rb1 <= rb2 <= rb3 + assert 1 <= S <= K // 64 + if S > 1: + assert ws.dtype == torch.float32 and ws.numel() >= S * M * N + nblk = -(-N // 128) + assert cnt.dtype == torch.int32 and cnt.numel() >= nblk and int(cnt[:nblk].abs().sum()) == 0 + w = self.weight_of(W, fmt, N, K).float() + for c0 in range(0, N, 128): + src = 1 if rb1 <= c0 < rb2 else 2 if rb2 <= c0 < rb3 else 0 + x = (x0, x1, x2)[src][:M].float() + r0 = (0, roff1, roff2)[src] + c1 = min(N, c0 + 128) + out[r0 : r0 + M, c0:c1] = (x @ w[c0:c1].T).to(out.dtype) + self.calls.append((M, N, K, fmt, out.dtype, S, rb1 < N)) + + def reset(self): + self.calls.clear() diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tests/test_wide.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tests/test_wide.py new file mode 100644 index 0000000000000000000000000000000000000000..d7d0a81541a25156fe0d03e1506c1dbecce9106e --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tests/test_wide.py @@ -0,0 +1,508 @@ +"""CPU unit tests of inkling_wide's Python side (torch CPU; no GPU, no nvcc, no sglang). + + python3 -m unittest discover -s inkling_wide/tests -v (from overlay/) + +The CUDA kernel is not run here (inkling_wide/tools/gpu_check_wide.py checks it on the Spark). A stand-in extension +(fake_wide_ext.py) keeps the kernel's call contract and computes reference math; the stand-in sglang package and +pico extension of tests/pico12 carry the stock code of the patched functions and inkling_pico12's packs. Covered: +lever / settings parsing, the source checks, bucket and split-K choice, stacked regions, the dispatch of every +patch point (row range, bias, grad, batch-invariant mode, out shapes), the stacked view layout, the LM head +wrapper, the composition with inkling_pico12 (pico <= 16 rows, wide above, bf16x buffers shared) and the wrong +install order (exit 78), reloads, and the no-op contract. +""" + +import os +import sys +import types +import unittest + +import torch + +HERE = os.path.dirname(os.path.abspath(__file__)) +OVERLAY = os.path.dirname(os.path.dirname(HERE)) +PICO_TESTS = os.path.join(OVERLAY, "tests", "pico12") +FAKE_ROOT = os.path.join(PICO_TESTS, "fake_sglang") +for p in (OVERLAY, FAKE_ROOT, PICO_TESTS, HERE): + if p not in sys.path: + sys.path.insert(0, p) + +import inkling_pico12 # noqa: E402 +import inkling_wide # noqa: E402 +from fake_ext import FakeExt # noqa: E402 (inkling_pico12's stand-in) +from fake_wide_ext import FakeWideExt # noqa: E402 +from inkling_pico12 import ops as pops # noqa: E402 +from inkling_pico12 import patches as ppatches # noqa: E402 +from inkling_wide import ops, patches # noqa: E402 +from sglang.srt import batch_invariant_ops # noqa: E402 +from sglang.srt.layers.quantization import unquant as uq # noqa: E402 +from sglang.srt.models import inkling2 # noqa: E402 +from sglang.srt.models.inkling_common import inkling2_attn as attn_mod # noqa: E402 + +STOCK_PROJECT = attn_mod.Inkling2Attention._project_sources +STOCK_HEAD = (uq.sm12x_fp32_lm_head, uq.sm12x_fp32_lm_head_applies) +STOCK_POST_LOAD = inkling2.Inkling2ForConditionalGeneration.post_load_weights +STOCK_FORWARD = inkling2.Inkling2ForConditionalGeneration.forward +WEXT = FakeWideExt() +PEXT = FakeExt() +LOGS = [] +EXITS = [] + + +def restore_sglang(): + attn_mod.Inkling2Attention._project_sources = STOCK_PROJECT + uq.sm12x_fp32_lm_head, uq.sm12x_fp32_lm_head_applies = STOCK_HEAD + inkling2.Inkling2ForConditionalGeneration.post_load_weights = STOCK_POST_LOAD + inkling2.Inkling2ForConditionalGeneration.forward = STOCK_FORWARD + + +def configure(levers=("dense", "lmhead"), min_m=17, max_m=256, fmt="auto", splitk=None, scope="all"): + restore_sglang() + ops.SET.scope = scope + ops.IN_SCOPE[0] = False + ops.EXT = WEXT + ops.SET.require_cuda = False + ops.SET.min_m, ops.SET.max_m, ops.SET.fmt = min_m, max_m, fmt + ops.SET.max_m_kind = {} + ops.SET.splitk = dict(splitk or {}) + ops.SET.sms = 48 + ops.SET.pdl = True + ops.LOG = LOGS.append + ops._batch_invariant = batch_invariant_ops.is_batch_invariant_mode_enabled + ops._warned.clear() + ops.WS.update(ws=None, cnt=None) + patches.STATE.update(levers=tuple(levers), cfg={"cache_dir": "/nonexistent", "verbose": False}, + log=LOGS.append, patched=[]) + patches.HEADS.clear() + patches.EXIT = EXITS.append + WEXT.reset() + for key in uq.CALLS: + uq.CALLS[key] = 0 + uq.STOCK_GEMV[0] = True + batch_invariant_ops.ENABLED[0] = False + inkling_pico12.STATE["levers"] = () + + +def configure_pico(levers=("dense", "lmhead")): + pops.EXT = PEXT + pops.SET.require_cuda = False + pops.SET.max_m = pops.SET.stacked_max_m = 16 + pops.SET.wk = 1 + pops.LOG = LOGS.append + pops._batch_invariant = batch_invariant_ops.is_batch_invariant_mode_enabled + pops._warned.clear() + ppatches.STATE.update(levers=tuple(levers), cfg={"cache_dir": "/x", "std": "c++20", "verbose": False}, + log=LOGS.append, patched=[]) + ppatches.HEADS.clear() + PEXT.reset() + PEXT.pad = 64 + inkling_pico12.STATE["levers"] = tuple(levers) + + +def model(layers=1, **kw): + kw.setdefault("hidden", 64) + kw.setdefault("heads_dim", 128) + return inkling2.Inkling2ForConditionalGeneration(layers=layers, **kw) + + +def bf16(*shape, seed=0): + g = torch.Generator().manual_seed(seed) + return torch.randn(shape, generator=g).to(torch.bfloat16) + + +def ref(x, w, dtype=torch.bfloat16): + return (x.reshape(-1, x.shape[-1]).float() @ w.float().T).to(dtype).view(*x.shape[:-1], w.shape[0]) + + +def bits_equal(a, b): + if a.dtype != b.dtype or a.shape != b.shape: + return False + view = torch.int16 if a.dtype == torch.bfloat16 else torch.int32 + return torch.equal(a.contiguous().view(view), b.contiguous().view(view)) + + +class Settings(unittest.TestCase): + def test_levers(self): + self.assertEqual(inkling_wide.parse_levers(""), ()) + self.assertEqual(inkling_wide.parse_levers(" dense , lmhead,dense"), ("dense", "lmhead")) + self.assertEqual(inkling_wide.parse_levers("all"), ("dense", "lmhead")) + self.assertEqual(inkling_wide.parse_levers("off"), ()) + for bad in ("dense,draft", "off,dense"): + with self.assertRaises(RuntimeError): + inkling_wide.parse_levers(bad) + + def test_config(self): + cfg = inkling_wide.config_from_env({}) + self.assertEqual((cfg["min_m"], cfg["max_m"], cfg["pdl"], cfg["fmt"], cfg["splitk"]), (17, 256, True, "auto", {})) + self.assertTrue(cfg["cache_dir"].endswith(os.path.join(".cache", "inkling-wide"))) + cfg = inkling_wide.config_from_env({"INKLING_WIDE_MIN_M": "9", "INKLING_WIDE_MAX_M": "128", + "INKLING_WIDE_PDL": "0", "INKLING_WIDE_FORMAT": "raw", + "INKLING_WIDE_SPLITK": "wo=4, head=1"}) + self.assertEqual((cfg["min_m"], cfg["max_m"], cfg["pdl"], cfg["fmt"], cfg["splitk"]), + (9, 128, False, "raw", {"wo": 4, "head": 1})) + for env in ({"INKLING_WIDE_MAX_M": "257"}, {"INKLING_WIDE_MIN_M": "0"}, + {"INKLING_WIDE_MIN_M": "64", "INKLING_WIDE_MAX_M": "32"}, {"INKLING_WIDE_FORMAT": "fp8"}, + {"INKLING_WIDE_SPLITK": "wo"}, {"INKLING_WIDE_SPLITK": "lm=2"}, {"INKLING_WIDE_SPLITK": "wo=0"}): + with self.assertRaises(ValueError, msg=str(env)): + inkling_wide.config_from_env(env) + + def test_kind_caps(self): + cfg = inkling_wide.config_from_env({"INKLING_WIDE_MAX_M_KIND": "wo=64"}) + self.assertEqual(cfg["max_m_kind"], {"qkvr": 96, "wo": 64, "head": 256}) + with self.assertRaises(ValueError): + inkling_wide.config_from_env({"INKLING_WIDE_MAX_M_KIND": "wo=300"}) + configure() + ops.SET.max_m_kind = {"wo": 32} + self.assertTrue(ops.in_range(32, "wo") and not ops.in_range(33, "wo") and ops.in_range(200, "qkvr")) + + def test_source_checks(self): + import shutil + import tempfile + + # the stand-in sglang of tests/pico12 plus the strings the scope patch needs + with tempfile.TemporaryDirectory() as tmp: + root = os.path.join(tmp, "sglang") + shutil.copytree(os.path.join(FAKE_ROOT, "sglang"), root) + with open(os.path.join(root, "srt", "models", "inkling2.py"), "a") as f: + f.write("\n# forward_batch: ForwardBatch,\n") + os.makedirs(os.path.join(root, "srt", "model_executor"), exist_ok=True) + with open(os.path.join(root, "srt", "model_executor", "forward_mode.py"), "w") as f: + f.write("def is_decode(self):\ndef is_target_verify(self):\n") + inkling_wide.check_sources(("dense", "lmhead"), root) + with self.assertRaises(RuntimeError): + inkling_wide.check_sources(("dense", "lmhead"), os.path.join(FAKE_ROOT, "sglang")) + with self.assertRaises(RuntimeError): + inkling_wide.check_sources(("dense",), os.path.join(HERE)) + + def test_noop_without_switch(self): + saved = dict(inkling_wide.STATE) + try: + inkling_wide.STATE.update(installed=False, levers=(), cfg=None) + self.assertEqual(inkling_wide.install(env={}), ()) + finally: + inkling_wide.STATE.update(saved) + + +class Shapes(unittest.TestCase): + def setUp(self): + configure() + + def test_bucket(self): + for m, b in ((1, 1), (16, 1), (17, 2), (32, 2), (33, 3), (48, 3), (49, 4), (64, 4), (65, 6), (96, 6), + (97, 8), (128, 8), (129, 12), (192, 12), (193, 16), (256, 16)): + self.assertEqual(ops.bucket(m), b, m) + self.assertEqual(WEXT.bucket(m), b, m) + with self.assertRaises(ValueError): + ops.bucket(257) + + def test_split(self): + self.assertEqual(ops.choose_split(8600, 2304, 64, "qkvr"), 1) + self.assertEqual(ops.choose_split(201024, 2304, 256, "head"), 1) + self.assertEqual([ops.choose_split(2304, 3072, m, "wo") for m in (17, 32, 48, 64, 128, 256)], [3, 3, 3, 3, 2, 2]) + self.assertEqual(ops.choose_split(8600, 2304, 256, "qkvr"), 1) + ops.SET.splitk = {"wo": 3} + self.assertEqual(ops.choose_split(2304, 3072, 64, "wo"), 3) + ops.SET.splitk = {"wo": 99} + self.assertEqual(ops.choose_split(2304, 3072, 64, "wo"), 3072 // 64) + + def test_regions(self): + self.assertEqual(ops.regions_of([3072, 1024, 1024, 384, 3072, 24]), (3072, 4096, 5120)) + self.assertIsNone(ops.regions_of([3000, 1024, 1024])) + self.assertIsNone(ops.regions_of([3072, 1000, 1024])) + self.assertIsNone(ops.regions_of([3072, 1024])) + + def test_shape_reason(self): + self.assertIsNone(ops.shape_reason(8600, 2304)) + self.assertIsNotNone(ops.shape_reason(8601, 2304)) + self.assertIsNotNone(ops.shape_reason(8600, 2336)) + + +class Dense(unittest.TestCase): + def setUp(self): + configure() + patches.patch_attn(attn_mod) + self.model = model() + patches.prepare_target(self.model) + self.attn = self.model.llm.layers[0].attn + + def tearDown(self): + restore_sglang() + + def test_registered(self): + self.assertEqual(type(self.attn.qkvr.quant_method).__name__, "WideUnquantizedLinearMethod") + self.assertEqual(self.attn.qkvr.__dict__["_wide"].fmt, ops.RAW) + self.assertIn("_wide", self.attn.wo_ud.__dict__) + self.assertEqual(self.attn.__dict__["_wide_qkvr"][1], (3072, 4096, 5120)) + self.assertTrue(any("active (target)" in m for m in LOGS)) + + def test_rows_range(self): + w = self.attn.qkvr.weight + for m, wide in ((8, False), (16, False), (17, True), (64, True), (256, True), (257, False)): + WEXT.reset() + uq.CALLS["apply"] = 0 + x = bf16(m, 64, seed=m) + y, _ = self.attn.qkvr(x) + self.assertEqual(len(WEXT.calls), int(wide), m) + self.assertEqual(uq.CALLS["apply"], int(not wide), m) + self.assertTrue(bits_equal(y, ref(x, w)), m) + + def test_3d_input_and_wo(self): + x = bf16(3, 8, 128, seed=1) + y, _ = self.attn.wo_ud(x) + self.assertEqual(tuple(y.shape), (3, 8, 64)) + self.assertTrue(bits_equal(y, ref(x, self.attn.wo_ud.weight))) + self.assertEqual(WEXT.calls[-1][:3], (24, 64, 128)) + + def test_falls_back(self): + x = bf16(32, 64) + batch_invariant_ops.ENABLED[0] = True + self.attn.qkvr(x) + batch_invariant_ops.ENABLED[0] = False + self.attn.qkvr(x) + self.assertEqual(len(WEXT.calls), 1) + self.assertEqual(uq.CALLS["apply"], 1) + self.attn.qkvr.quant_method.apply(self.attn.qkvr, x, bias=torch.zeros(8600, dtype=torch.bfloat16)) + self.assertEqual(uq.CALLS["apply"], 2) + + def test_apply_into(self): + x = bf16(40, 128, seed=2) + out = torch.empty((40, 64), dtype=torch.bfloat16) + self.attn.wo_ud(x, output_tensor=out) + self.assertEqual(len(WEXT.calls), 1) + self.assertTrue(bits_equal(out, ref(x, self.attn.wo_ud.weight))) + bad = torch.empty((40, 128), dtype=torch.bfloat16)[:, :64] # rows not contiguous + self.attn.wo_ud(x, output_tensor=bad) + self.assertEqual(uq.CALLS["apply_into"], 1) + + def test_stacked_layout_and_values(self): + m = 20 + q, k, v = bf16(m, 64, seed=3), bf16(m, 64, seed=4), bf16(m, 64, seed=5) + src = attn_mod.AttentionSources(q, k, v) + got = self.attn._project_sources(src) + self.assertEqual(len(WEXT.calls), 1) + self.assertTrue(WEXT.calls[0][-1]) # stacked + stock = STOCK_PROJECT(self.attn, src) + for a, b in zip(got, stock): + self.assertEqual((a.shape, a.stride(), a.storage_offset()), (b.shape, b.stride(), b.storage_offset())) + self.assertTrue(bits_equal(a, b)) + + def test_stacked_falls_back(self): + for m in (8, 300): + WEXT.reset() + q, k, v = bf16(m, 64, seed=3), bf16(m, 64, seed=4), bf16(m, 64, seed=5) + self.attn._project_sources(attn_mod.AttentionSources(q, k, v)) + self.assertFalse(any(c[-1] for c in WEXT.calls), m) + WEXT.reset() # shared sources go through the plain linear + q = bf16(24, 64, seed=3) + self.attn._project_sources(attn_mod.AttentionSources(q, q, q)) + self.assertEqual([c[-1] for c in WEXT.calls], [False]) + + def test_reload_and_replaced_storage(self): + w = self.attn.qkvr.weight + w.data.copy_(bf16(*w.shape, seed=7)) # in place: still current + x = bf16(32, 64, seed=8) + y, _ = self.attn.qkvr(x) + self.assertTrue(bits_equal(y, ref(x, w))) + self.assertEqual(len(WEXT.calls), 1) + self.attn.qkvr.weight = torch.nn.Parameter(bf16(*w.shape, seed=9), requires_grad=False) + y, _ = self.attn.qkvr(x) + self.assertEqual(len(WEXT.calls), 1) + self.assertTrue(any("storage changed" in m for m in LOGS)) + patches.prepare_target(self.model) # re-registration picks the new storage up + self.attn.qkvr(x) + self.assertEqual(len(WEXT.calls), 2) + + def test_split_workspace(self): + configure(splitk={"wo": 1, "qkvr": 2}) + m2 = model(hidden=128) + patches.prepare_target(m2) + self.assertGreaterEqual(ops.WS["ws"].numel(), 2 * 256 * 8600) + with self.assertRaises(ops.WideFatal): # a reload needing more cannot replace graph-referenced buffers + ops.ensure_workspace(list(patches.HEADS.values()), 17, 256, "cpu", floats=10**9) + x = bf16(48, 128, seed=10) + y, _ = m2.llm.layers[0].attn.qkvr(x) + self.assertEqual(WEXT.calls[-1][5], 2) + self.assertTrue(bits_equal(y, ref(x, m2.llm.layers[0].attn.qkvr.weight))) + + +class Scope(unittest.TestCase): + """INKLING_WIDE_SCOPE=verify: wide takes calls only inside a target decode / target-verify forward.""" + + class Mode: + def __init__(self, name): + self.name = name + + def is_decode(self): + return self.name == "decode" + + def is_target_verify(self): + return self.name == "verify" + + def setUp(self): + configure(scope="verify") + self.model = model() + patches.prepare_target(self.model) + self.attn = self.model.llm.layers[0].attn + + def tearDown(self): + restore_sglang() + + def run_in(self, mode, m=32): + used = [] + + def inner(model_self, input_ids, positions, forward_batch, *a, **kw): + WEXT.reset() + self.attn.qkvr(bf16(m, 64, seed=1)) + used.append(len(WEXT.calls)) + return "out" + + fwd = patches.make_forward(inner) + fb = types.SimpleNamespace(forward_mode=self.Mode(mode)) if mode else types.SimpleNamespace() + self.assertEqual(fwd(self.model, None, None, fb), "out") + self.assertFalse(ops.IN_SCOPE[0]) # restored + return used[0] + + def test_scope(self): + self.assertEqual(self.run_in("verify"), 1) + self.assertEqual(self.run_in("decode"), 1) + self.assertEqual(self.run_in("extend"), 0) + self.assertEqual(self.run_in(None), 0) + WEXT.reset() + self.attn.qkvr(bf16(32, 64)) # outside any forward + self.assertEqual(len(WEXT.calls), 0) + + def test_restored_on_error(self): + def inner(*a, **kw): + raise RuntimeError("boom") + + fwd = patches.make_forward(inner) + with self.assertRaises(RuntimeError): + fwd(self.model, None, None, types.SimpleNamespace(forward_mode=self.Mode("verify"))) + self.assertFalse(ops.IN_SCOPE[0]) + + def test_patch_model_wraps_forward(self): + patches.patch_model(inkling2) + self.assertTrue(getattr(inkling2.Inkling2ForConditionalGeneration.forward, "_wide", False)) + + def test_config(self): + self.assertEqual(inkling_wide.config_from_env({})["scope"], "verify") + self.assertEqual(inkling_wide.config_from_env({"INKLING_WIDE_SCOPE": "all"})["scope"], "all") + with self.assertRaises(ValueError): + inkling_wide.config_from_env({"INKLING_WIDE_SCOPE": "prefill"}) + + +class Head(unittest.TestCase): + def setUp(self): + configure() + patches.patch_unquant(uq) + self.model = model() + patches.prepare_target(self.model) + self.w = self.model.llm.lm_head.weight + + def test_head(self): + for m, wide in ((4, False), (20, True), (256, True)): + WEXT.reset() + uq.CALLS["lm_head"] = 0 + x = bf16(m, 64, seed=m) + self.assertTrue(uq.sm12x_fp32_lm_head_applies(x, self.w, None)) + y = uq.sm12x_fp32_lm_head(x, self.w, None) + self.assertEqual(y.dtype, torch.float32) + self.assertTrue(bits_equal(y, ref(x, self.w, torch.float32))) + self.assertEqual(len(WEXT.calls), int(wide)) + self.assertEqual(uq.CALLS["lm_head"], int(not wide)) + self.assertFalse(uq.sm12x_fp32_lm_head_applies(bf16(300, 64), self.w, None)) + + def test_head_out(self): + x = bf16(33, 64, seed=1) + out = torch.empty((33, 256), dtype=torch.float32) + y = uq.sm12x_fp32_lm_head(x, self.w, out) + self.assertEqual(y.data_ptr(), out.data_ptr()) + self.assertTrue(bits_equal(out, ref(x, self.w, torch.float32))) + wrong = torch.empty((33, 255), dtype=torch.float32) + self.assertFalse(uq.sm12x_fp32_lm_head_applies(x, self.w, wrong)) + + +class WithPico(unittest.TestCase): + """inkling_pico12 installed first (as sitecustomize does): pico <= 16 rows, wide 17..256 on pico's buffers.""" + + def setUp(self): + configure() + configure_pico() + ppatches.patch_unquant(uq) + patches.patch_unquant(uq) + ppatches.patch_attn(attn_mod) + patches.patch_attn(attn_mod) + ppatches.patch_model(inkling2) + patches.patch_model(inkling2) + self.model = model() + self.model.post_load_weights() + self.attn = self.model.llm.layers[0].attn + + def tearDown(self): + restore_sglang() + + def test_formats_and_split_of_work(self): + e = self.attn.qkvr.__dict__["_wide"] + self.assertEqual(e.fmt, ops.BF16X) + self.assertIs(e.pack, self.attn.qkvr.__dict__["_pico12"]) + self.assertEqual(type(self.attn.qkvr.quant_method).__name__, "WidePico12UnquantizedLinearMethod") + for m, who in ((8, "pico"), (16, "pico"), (17, "wide"), (128, "wide"), (257, "stock")): + PEXT.reset(), WEXT.reset() + uq.CALLS["apply"] = 0 + x = bf16(m, 64, seed=m) + y, _ = self.attn.qkvr(x) + self.assertTrue(bits_equal(y, ref(x, self.attn.qkvr.weight)), m) + self.assertEqual((len(PEXT.calls) > 0, len(WEXT.calls) > 0, uq.CALLS["apply"] > 0), + (who == "pico", who == "wide", who == "stock"), m) + self.attn.qkvr(bf16(40, 64)) + self.assertEqual(WEXT.calls[-1][3], 2) + + def test_head_bf16x(self): + w = self.model.llm.lm_head.weight + self.assertEqual(patches.HEADS[w.data_ptr()].fmt, ops.BF16X) + x = bf16(40, 64, seed=3) + y = uq.sm12x_fp32_lm_head(x, w, None) + self.assertEqual(WEXT.calls[-1][3], 2) + self.assertTrue(bits_equal(y, ref(x, w, torch.float32))) + PEXT.reset() + uq.sm12x_fp32_lm_head(bf16(8, 64), w, None) + self.assertEqual(len(PEXT.calls), 1) + + def test_stacked_order(self): + for m, who in ((4, "pico"), (17, "wide")): + PEXT.reset(), WEXT.reset() + q, k, v = bf16(m, 64, seed=3), bf16(m, 64, seed=4), bf16(m, 64, seed=5) + src = attn_mod.AttentionSources(q, k, v) + got = self.attn._project_sources(src) + for a, b in zip(got, STOCK_PROJECT(self.attn, src)): + self.assertTrue(bits_equal(a, b), m) + self.assertEqual((len(PEXT.calls) > 0, len(WEXT.calls) > 0), (who == "pico", who == "wide"), m) + self.assertTrue(getattr(attn_mod.Inkling2Attention._project_sources, "inkling_pico12", False)) + + def test_raw_format_forced(self): + configure(fmt="raw") + configure_pico() + m2 = model() + ppatches.prepare_target(m2) + patches.prepare_target(m2) + self.assertEqual(m2.llm.layers[0].attn.qkvr.__dict__["_wide"].fmt, ops.RAW) + + +class WrongOrder(unittest.TestCase): + def tearDown(self): + restore_sglang() + + def test_wide_before_pico_exits(self): + configure() + configure_pico() + EXITS.clear() + patches.patch_model(inkling2) # wide's wrapper inside ... + ppatches.patch_model(inkling2) # ... pico's: wide registers before pico coded anything + ppatches.EXIT = lambda code: EXITS.append(("pico", code)) + with self.assertRaises(BaseException): + model().post_load_weights() + self.assertIn(78, EXITS) + self.assertTrue(any("install inkling_wide after inkling_pico12" in m for m in LOGS)) + + +if __name__ == "__main__": + unittest.main() diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/third_party/pico/LICENSE b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/third_party/pico/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..2ad02b957d30613b210feda7d3b9ee80653b5adc --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/third_party/pico/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Andy Shu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tools/gpu_check_wide.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tools/gpu_check_wide.py new file mode 100644 index 0000000000000000000000000000000000000000..b8f012567d396271ec01f11e8f95e3c22cc2431f --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tools/gpu_check_wide.py @@ -0,0 +1,407 @@ +#!/usr/bin/env python3 +"""GPU check + microbenchmark of inkling_wide (weight-streaming BF16 GEMM, 17..256 rows) on a Spark. Run inside the +SGLang container with the server STOPPED (peak ~5 GB of GPU memory, for the head): + + docker run --rm --gpus all --ipc=host -v /overlay:/opt/inkling-overlay:ro -v :/model:ro \ + -v :/root/.cache -e PYTHONPATH=/opt/inkling-overlay --entrypoint python3 \ + lmsysorg/sglang:inkling-2-mini /opt/inkling-overlay/inkling_wide/tools/gpu_check_wide.py + + options: --model /model --layer 0 --check-ms ... --ms ... --iters 20 --no-real --no-time --sweep --quick + +What it does: + 1. builds (or reuses) inkling_wide's and inkling_pico12's extensions; prints registers / local memory per kernel; + 2. for qkvr [8600 x 2304], wo [2304 x 3072] and the head [201024 x 2304] (real layer-L / unembed weights when + /model is mounted, else random), codes the weight with inkling_pico12 (pico's bf16x) and [gated]: + - the wide reader's decode of the coded buffer == the BF16 weight bit for bit; + - at every --check-ms M: wide on the coded weight == wide on the raw weight bit for bit; PDL on == off; + CUDA-graph replay == eager; split-K 1 and the default split both within the FP32-sum bound of an FP64 + reference; wide's max error vs FP64 no worse than cuBLAS's (x1.25 slack, BF16 ulps for BF16 outputs); + [reported]: max abs / max rel error vs FP64 of wide and cuBLAS, max |wide - cuBLAS|; + 3. the stacked qkvr case (three distinct sources) [gated]: every kept element == the per-source plain call bit + for bit, the views have the stock layout; [reported] vs cuBLAS on the 3M stacked rows; + 4. times (median of --iters, L2 evicted before each call by READING a 256 MiB buffer) cuBLAS, pico (16-row calls of + its packed GEMV, i.e. ceil(M/16) weight reads), wide packed and wide raw, and the stacked call; GB/s of the + bytes one pass reads; summed dense time at M=64 (kill line: cuBLAS / wide >= 1.15); + 5. --sweep: split-K sweep per shape and M. +Last line: `wide gpu_check result PASS|FAIL (...)`; exit 0 on PASS, 1 on FAIL, 3 when refused by the memory guard. +""" + +import argparse +import glob +import os +import statistics +import sys +import time + +OVERLAY = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +if OVERLAY not in sys.path: + sys.path.insert(0, OVERLAY) + +FAILS = [] +SPLITS = [3072, 1024, 1024, 384, 3072, 24] +PROJ = ("wq_du", "wk_dv", "wv_dv", "wr_du", "gate_attn", "attn_sink_proj") + + +def log(*a): + print(*a, flush=True) + + +def gate(name, ok, detail=""): + log(f"{name} {detail} {'PASS' if ok else 'FAIL'}") + if not ok: + FAILS.append(name) + + +def mem_available_gib(): + try: + with open("/proc/meminfo") as f: + for line in f: + if line.startswith("MemAvailable:"): + return int(line.split()[1]) / 1048576 + except OSError: + pass + return float("nan") + + +def load_real(model_dir, layer, dev, torch): + from safetensors import safe_open + + where = {} + for path in sorted(glob.glob(os.path.join(model_dir, "*.safetensors"))): + with safe_open(path, framework="pt", device="cpu") as h: + for key in h.keys(): + where.setdefault(key, path) + + def get(name): + if name not in where: + raise SystemExit(f"wide real weights: {name} not in {model_dir}") + with safe_open(where[name], framework="pt", device="cpu") as h: + t = h.get_tensor(name) + if t.dtype != torch.bfloat16 or t.dim() != 2: + raise SystemExit(f"wide real weights: {name} is {t.dtype} {tuple(t.shape)}") + return t + + base = f"model.llm.layers.{layer}.attn." + parts = [get(f"{base}{p}.weight") for p in PROJ] + qkvr = torch.cat(parts).to(dev) + splits = [t.shape[0] for t in parts] + wo = get(f"{base}wo_ud.weight").to(dev) + head = get("model.llm.unembed.weight").to(dev) + log(f"wide real weights layer={layer} qkvr={tuple(qkvr.shape)} splits={splits} wo={tuple(wo.shape)} " + f"head={tuple(head.shape)}") + return [("qkvr", qkvr, splits), ("wo", wo, None), ("head", head, None)] + + +def main(): + p = argparse.ArgumentParser() + p.add_argument("--model", default="/model") + p.add_argument("--layer", type=int, default=0) + p.add_argument("--check-ms", default="17,24,40,64,65,80,96,100,128,160,192,256") + p.add_argument("--head-check-ms", default="17,64,256") + p.add_argument("--ms", default="9,16,17,24,32,48,64,96,128,192,256") + p.add_argument("--stacked-ms", default="17,24,32,64,85") + p.add_argument("--iters", type=int, default=20) + p.add_argument("--warmup", type=int, default=3) + p.add_argument("--flush-mib", type=int, default=256) + p.add_argument("--min-avail-gib", type=float, default=12.0) + p.add_argument("--no-real", action="store_true") + p.add_argument("--no-time", action="store_true") + p.add_argument("--sweep", action="store_true") + p.add_argument("--quick", action="store_true", help="first run: few M, no head timing sweep") + p.add_argument("--shapes", default="qkvr,wo,head") + args = p.parse_args() + if args.quick: + args.check_ms, args.head_check_ms, args.ms, args.stacked_ms = "17,64,256", "17,256", "24,64,256", "24,64" + + avail = mem_available_gib() + log(f"wide memguard MemAvailable_GiB={avail:.1f} need_GiB={args.min_avail_gib:.1f}") + if avail == avail and avail < args.min_avail_gib: + log("wide gpu_check REFUSED: not enough MemAvailable (stop the server first)") + sys.exit(3) + + import torch + import torch.nn.functional as F + + import inkling_pico12 + import inkling_wide + from inkling_pico12 import build as pbuild + from inkling_pico12 import ops as pops + from inkling_wide import build, ops + + dev = torch.device("cuda", torch.cuda.current_device()) + prop = torch.cuda.get_device_properties(dev) + log(f"wide device={prop.name} cc={prop.major}.{prop.minor} sms={prop.multi_processor_count} " + f"torch={torch.__version__} cuda={torch.version.cuda}") + wcfg = inkling_wide.config_from_env() + t0 = time.monotonic() + ext = build.load(wcfg["cache_dir"], verbose=wcfg["verbose"]) + ext.prepare(dev.index) + log(f"wide ext {'reused' if build.INFO['cached'] else 'built'} in {time.monotonic() - t0:.1f} s at " + f"{build.INFO['build_dir']}") + for fmt in (0, 2): + for m in (16, 32, 48, 64, 96, 128, 192, 256): + for mt, mg in (((1, 1), (2, 1)) if m > 128 else ((0, 1), (0, 2)) if m in (96, 128) else ((0, 1),)): + regs, local, thr = ext.kernel_info(fmt, m, mt, mg) + log(f"wide kernel fmt={'bf16x' if fmt else 'raw'} M<={m} mt={mt or 2} mg={mg} regs={regs} " + f"local_bytes={local} threads={thr}") + if local > 64: # a few bytes of header spill (bf16x, M <= 64) are tolerated and reported + FAILS.append(f"spill fmt={fmt} M={m} mt={mt} mg={mg}") + pcfg = inkling_pico12.config_from_env() + pops.EXT = pbuild.load(pcfg["cache_dir"], pcfg["std"], verbose=False) + pops.SET.wk, pops.SET.pdl = pcfg["wk"], pcfg["pdl"] + ops.EXT = ext + ops.SET.sms = prop.multi_processor_count + ops.SET.min_m, ops.SET.max_m = 1, 256 + + flush = torch.empty(args.flush_mib * (1 << 20) // 4, device=dev, dtype=torch.float32).fill_(1.0) + sink = torch.empty((), device=dev) + + def timeit(fn, iters=None): + iters = iters or args.iters + for _ in range(args.warmup): + fn() + torch.cuda.synchronize() + st = [torch.cuda.Event(enable_timing=True) for _ in range(iters)] + en = [torch.cuda.Event(enable_timing=True) for _ in range(iters)] + for i in range(iters): + sink.copy_(flush.sum()) # reads 256 MiB: L2 (24 MiB) holds no weight afterwards + st[i].record() + fn() + en[i].record() + torch.cuda.synchronize() + return statistics.median(s.elapsed_time(e) * 1000.0 for s, e in zip(st, en)) + + def gauss(n, k, seed): + g = torch.Generator(device=dev).manual_seed(seed) + sigma = 0.01 + 0.04 * (torch.arange(n, device=dev, dtype=torch.float32) * 0.618034 % 1.0) + return (torch.randn((n, k), device=dev, generator=g) * sigma[:, None]).to(torch.bfloat16) + + def acts(m, k, seed): + g = torch.Generator(device=dev).manual_seed(seed) + return (torch.rand((m, k), device=dev, generator=g) * 4 - 2).to(torch.bfloat16) + + def bits_equal(a, b): + view = torch.int16 if a.dtype == torch.bfloat16 else torch.int32 + return a.shape == b.shape and torch.equal(a.contiguous().view(view), b.contiguous().view(view)) + + def ref64(x, w, chunk=16384): + xd, xa = x.double(), x.double().abs() + outs, mags = [], [] + for r0 in range(0, w.shape[0], chunk): + wd = w[r0 : r0 + chunk].double() + outs.append(xd @ wd.T) + mags.append(xa @ wd.abs().T) + return torch.cat(outs, 1), torch.cat(mags, 1) + + def bound_worst(y, ref, mag, k): + tol = mag * 2.0**-23 * (k / 16 + 32) + 1e-30 + if y.dtype == torch.bfloat16: + tol = tol + ref.abs() * 2.0**-8 + return float(((y.double() - ref).abs() / tol).max()) + + def errs(y, ref): + e = (y.double() - ref).abs() + return float(e.max()), float(e.max() / ref.abs().max().clamp_min(1e-30)), float(e.mean()) + + def cublas(x, w, f32): + return torch.mm(x, w.T, out_dtype=torch.float32) if f32 else F.linear(x, w) + + def pico_multi(x, pack, out): + for r0 in range(0, x.shape[0], 16): + r1 = min(x.shape[0], r0 + 16) + pops.gemv(x[r0:r1], pack, out[r0:r1]) + return out + + if not args.no_real and os.path.isdir(args.model): + weights = load_real(args.model, args.layer, dev, torch) + else: + log("wide note no real weights: random Gaussian weights") + weights = [("qkvr", gauss(sum(SPLITS), 2304, 1), list(SPLITS)), ("wo", gauss(2304, 3072, 2), None), + ("head", gauss(201024, 2304, 3), None)] + shapes = set(args.shapes.split(",")) + weights = [wt for wt in weights if wt[0] in shapes] + + rows = [] # timing table + dense64 = {} + while weights: + name, w, splits = weights.pop(0) + n, k = w.shape + f32 = name == "head" + out_dtype = torch.float32 if f32 else torch.bfloat16 + kind = {"qkvr": "qkvr", "wo": "wo", "head": "head"}[name] + pack = pops.encode(w, name) + dec = ext.decode(pack.buf, n, k) + same = bits_equal(dec, w) + del dec + gate(f"wide decode {name}", same, + f"[{n}x{k}] raw_MB={n * k * 2 / 1e6:.1f} packed_MB={pack.nbytes / 1e6:.1f} " + f"ratio={pack.nbytes / (n * k * 2):.4f} raw_tiles={pack.raw_tiles}/{pack.tiles} decoded==weight") + e_raw = ops.make(w, name, kind, None) + ops.SET.fmt = "auto" + e_x = ops.make(w, name, kind, pack) + alt_max = 2 if f32 else 12 # forced splits below (check: 1 and alt; sweep up to 12, head up to 2) + ops.ensure_workspace([e_raw, e_x], 1, 256, dev, grow=True, floats=alt_max * 256 * n) + cms = [int(v) for v in (args.head_check_ms if f32 else args.check_ms).split(",") if v] + for m in cms: + x = acts(m, k, 100 + m) + s_def = ops.choose_split(n, k, m, kind) + y_x = torch.full((m, n), float("nan"), device=dev, dtype=out_dtype) + ops.gemm(x, e_x, y_x, m) + y_r = torch.full_like(y_x, float("nan")) + ops.gemm(x, e_raw, y_r, m) + ops.SET.pdl = False + y_np = torch.full_like(y_x, float("nan")) + ops.gemm(x, e_x, y_np, m) + ops.SET.pdl = True + ops.SET.splitk = {kind: 1} + y_s1 = torch.full_like(y_x, float("nan")) + ops.gemm(x, e_x, y_s1, m) + s_alt = (2 if f32 else 3) if s_def == 1 else 1 + ops.SET.splitk = {kind: s_alt} + y_s2 = torch.full_like(y_x, float("nan")) + ops.gemm(x, e_x, y_s2, m) + ops.SET.splitk = {} + y_mt = y_x + if m > 64: # the bucket's other kernel (MT 2 above 128 rows, two warp groups at 65..128): same bits + ops.SET.mt, ops.SET.mg = (2, 0) if m > 128 else (0, 2) + y_mt = torch.full_like(y_x, float("nan")) + ops.gemm(x, e_x, y_mt, m) + ops.SET.mt = ops.SET.mg = 0 + pfd0 = ops.SET.pfd + ops.SET.pfd = 0 + y_pf = torch.full_like(y_x, float("nan")) + ops.gemm(x, e_x, y_pf, m) + ops.SET.pfd = pfd0 + yg = torch.full_like(y_x, float("nan")) + side = torch.cuda.Stream() + side.wait_stream(torch.cuda.current_stream()) + with torch.cuda.stream(side): + ops.gemm(x, e_x, yg, m) + torch.cuda.current_stream().wait_stream(side) + g = torch.cuda.CUDAGraph() + with torch.cuda.graph(g): + ops.gemm(x, e_x, yg, m) + yg.fill_(float("nan")) + g.replay() + g.replay() # twice: the split-K counters must be back at zero + y_c = cublas(x, w, f32) + torch.cuda.synchronize() + ref, mag = ref64(x, w) + wb = max(bound_worst(y_x, ref, mag, k), bound_worst(y_s1, ref, mag, k), bound_worst(y_s2, ref, mag, k)) + ea, er, em = errs(y_x, ref) + ca, cr, cm = errs(y_c, ref) + nan = bool(torch.isnan(y_x).any() or torch.isnan(y_s1).any() or torch.isnan(y_s2).any()) + no_worse = ea <= 1.25 * ca + (0 if f32 else 0) + gate(f"wide bits {name} M={m}", + bits_equal(y_x, y_r) and bits_equal(y_x, y_np) and bits_equal(y_x, yg) and bits_equal(y_x, y_mt) + and bits_equal(y_x, y_pf) + and wb <= 1.0 and not nan, + f"split={s_def}/alt{s_alt} packed_vs_raw={'IDENTICAL' if bits_equal(y_x, y_r) else 'DIFFERENT'} " + f"pdl_on_vs_off={'IDENTICAL' if bits_equal(y_x, y_np) else 'DIFFERENT'} " + f"graph_vs_eager={'IDENTICAL' if bits_equal(y_x, yg) else 'DIFFERENT'} " + f"variant={'IDENTICAL' if bits_equal(y_x, y_mt) else 'DIFFERENT'} " + f"prefetch_off={'IDENTICAL' if bits_equal(y_x, y_pf) else 'DIFFERENT'} fp64_bound_worst={wb:.3f}") + gate(f"wide accuracy {name} M={m}", no_worse, + f"err_vs_fp64 wide max_abs={ea:.3e} max_rel={er:.3e} mean={em:.3e} | cublas max_abs={ca:.3e} " + f"max_rel={cr:.3e} mean={cm:.3e} | max|wide-cublas|={float((y_x.double() - y_c.double()).abs().max()):.3e}") + del ref, mag, y_x, y_r, y_np, y_s1, y_s2, yg, y_c, g, y_mt, y_pf + torch.cuda.empty_cache() + + if name == "qkvr" and splits is not None: + regions = ops.regions_of(splits) + gate("wide stacked regions", regions is not None, f"{regions}") + for m in [int(v) for v in args.stacked_ms.split(",") if v]: + q, kk, v = acts(m, k, 7), acts(m, k, 8), acts(m, k, 9) + out = ops.stacked_project(q, kk, v, e_x, regions) + views = ops.split_like_stock(out, splits) + plain = [ops.linear(src, e_x, torch.bfloat16) for src in (q, kk, v)] + st_out = cublas(torch.cat([q, kk, v]), w, False) + st_views = ops.split_like_stock(st_out, splits) + pq = plain[0].split(splits, dim=-1) + exp = (pq[0], plain[1].split(splits, dim=-1)[1], plain[2].split(splits, dim=-1)[2], pq[3], pq[4], pq[5]) + same = all(bits_equal(a, b) for a, b in zip(views, exp)) + layout = all((a.shape, a.stride(), a.storage_offset()) == (b.shape, b.stride(), b.storage_offset()) + for a, b in zip(views, st_views)) + dmax = max(float((a.double() - b.double()).abs().max()) for a, b in zip(views, st_views)) + gate(f"wide stacked M={m}", same and layout, + f"kept==per-source {'IDENTICAL' if same else 'DIFFERENT'} layout={'stock' if layout else 'OTHER'} " + f"max|wide-cublas_stacked|={dmax:.3e}") + if not args.no_time: + t_c = timeit(lambda: cublas(torch.cat([q, kk, v]), w, False)) + t_x = timeit(lambda: ops.stacked_project(q, kk, v, e_x, regions)) + t_r = timeit(lambda: ops.stacked_project(q, kk, v, e_raw, regions)) + log(f"wide time stacked M={m}x3 cublas(cat+3M)_us={t_c:.1f} wide_x_us={t_x:.1f} " + f"({pack.nbytes / t_x / 1e3:.0f} GB/s) wide_raw_us={t_r:.1f} ({n * k * 2 / t_r / 1e3:.0f} GB/s) " + f"speedup_x={t_c / t_x:.2f}") + rows.append(("qkvr-stacked", m, t_c, float("nan"), t_x, t_r, pack.nbytes, n * k * 2)) + if m == 64: + dense64["stacked"] = (t_c, t_x) + + if not args.no_time: + for m in [int(v) for v in args.ms.split(",") if v]: + x = acts(m, k, 200 + m) + y = torch.empty((m, n), device=dev, dtype=out_dtype) + yp = torch.empty((m, n), device=dev, dtype=out_dtype) + it = max(5, args.iters // 4) if f32 else args.iters + t_c = timeit(lambda: cublas(x, w, f32), it) + t_p = timeit(lambda: pico_multi(x, pack, yp), it) + t_x = timeit(lambda: ops.gemm(x, e_x, y, m), it) + t_r = timeit(lambda: ops.gemm(x, e_raw, y, m), it) + rows.append((name, m, t_c, t_p, t_x, t_r, pack.nbytes, n * k * 2)) + log(f"wide time {name} M={m} split={ops.choose_split(n, k, m, kind)} cublas_us={t_c:.1f} " + f"({n * k * 2 / t_c / 1e3:.0f} GB/s) pico16x{-(-m // 16)}_us={t_p:.1f} wide_x_us={t_x:.1f} " + f"({pack.nbytes / t_x / 1e3:.0f} GB/s packed, {n * k * 2 / t_x / 1e3:.0f} eff) wide_raw_us={t_r:.1f} " + f"({n * k * 2 / t_r / 1e3:.0f} GB/s) speedup_x={t_c / t_x:.2f}") + if m == 64 and name in ("qkvr", "wo"): + dense64[name] = (t_c, t_x) + if args.sweep: + for m in ((24, 64, 96, 128, 256) if name != "head" else (64, 256)): + x = acts(m, k, 300 + m) + y = torch.empty((m, n), device=dev, dtype=out_dtype) + res = [] + for s in (1, 2, 3, 4, 6, 8, 12): + if s > k // 64 or (name == "head" and s > 2): + continue + ops.SET.splitk = {kind: s} + res.append((timeit(lambda: ops.gemm(x, e_x, y, m), max(5, args.iters // 2)), s)) + ops.SET.splitk = {} + log(f"wide sweep {name} M={m} " + " ".join(f"S{s}={t:.1f}" for t, s in res) + + f" best=S{min(res)[1]} default=S{ops.choose_split(n, k, m, kind)}") + pf = [] + for d in (0, 1, 2, 4, 8, 16): + ops.SET.pfd = d + pf.append((timeit(lambda: ops.gemm(x, e_x, y, m), max(5, args.iters // 2)), d)) + if name != "head": + ops.SET.fmt = "raw" + t_raw = timeit(lambda: ops.gemm(x, e_raw, y, m), max(5, args.iters // 2)) + pf[-1] = pf[-1] + (t_raw,) + ops.SET.pfd = 4 + log(f"wide sweep {name} M={m} pfd " + " ".join( + f"P{v[1]}={v[0]:.1f}" + (f"/raw{v[2]:.1f}" if len(v) > 2 else "") for v in pf)) + if m > 64: + for mt, mg in ((((1, 0), (2, 0)) if m > 128 else ((0, 1), (0, 2)))): + ops.SET.mt, ops.SET.mg = mt, mg + t_mt = timeit(lambda: ops.gemm(x, e_x, y, m), max(5, args.iters // 2)) + log(f"wide sweep {name} M={m} mt={mt} mg={mg} us={t_mt:.1f} " + f"split={ops.choose_split(n, k, m, kind)}") + ops.SET.mt = ops.SET.mg = 0 + del w, pack, e_raw, e_x + torch.cuda.empty_cache() + + if rows: + log("wide summary (us, L2 cold; GB/s of one pass's bytes: packed for wide_x, raw BF16 for the others)") + log("shape M cublas pico16x wide_x wide_raw GB/s:cublas wide_x wide_raw wide_x/cublas") + for name, m, t_c, t_p, t_x, t_r, pb, rb in rows: + log(f"{name:13s} {m:4d} {t_c:8.1f} {t_p:8.1f} {t_x:8.1f} {t_r:9.1f} {rb / t_c / 1e3:10.0f} " + f"{pb / t_x / 1e3:6.0f} {rb / t_r / 1e3:8.0f} {t_c / t_x:12.2f}") + if "qkvr" in dense64 and "wo" in dense64: + c = dense64["qkvr"][0] + dense64["wo"][0] + x = dense64["qkvr"][1] + dense64["wo"][1] + log(f"wide dense M=64 (qkvr + wo) cublas_us={c:.1f} wide_x_us={x:.1f} ratio={c / x:.2f} " + f"kill_line(>=1.15)={'MET' if c / x >= 1.15 else 'MISSED'}") + log(f"wide gpu_check result {'PASS' if not FAILS else 'FAIL'} ({len(FAILS)} failed: {', '.join(FAILS[:8])})") + sys.exit(0 if not FAILS else 1) + + +if __name__ == "__main__": + main() diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tools/gpu_integration_wide.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tools/gpu_integration_wide.py new file mode 100644 index 0000000000000000000000000000000000000000..99a7651c12154768bf5e062f971151fa91edb968 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/inkling_wide/tools/gpu_integration_wide.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python3 +"""Integration check of inkling_wide with the REAL sglang modules of the image (patch targets, hook order with +inkling_pico12, dispatch), on stand-in layer objects that carry real UnquantizedLinearMethod instances and real +layer-0 / unembed weights. GPU, server stopped, ~3 GB. + + PYTHONPATH= python3 inkling_wide/tools/gpu_integration_wide.py [--model /model] [--no-pico] + +Gated: install() of inkling_pico12 then inkling_wide applies every patch to the real modules; after both packages' +prepare_target, qkvr / wo_ud / the head are served by pico at <= 16 rows and by wide at 17..256 (on pico's coded +buffers), by stock above; results match cuBLAS within the BF16 / FP32 summation tolerance; the real patched +Inkling2Attention._project_sources returns the stock view layout for three sources at M = 24 and 64; captured in a +CUDA graph, the stacked call replays bit for bit. Last line `wide integration result PASS|FAIL`. +""" + +import argparse +import os +import sys +import types + +OVERLAY = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +if OVERLAY not in sys.path: + sys.path.insert(0, OVERLAY) + +FAILS = [] + + +def log(*a): + print(*a, flush=True) + + +def gate(name, ok, detail=""): + log(f"{name} {detail} {'PASS' if ok else 'FAIL'}") + if not ok: + FAILS.append(name) + + +def main(): + p = argparse.ArgumentParser() + p.add_argument("--model", default="/model") + p.add_argument("--no-pico", action="store_true") + args = p.parse_args() + os.environ["INKLING_WIDE"] = "dense,lmhead" + if not args.no_pico: + os.environ["INKLING_PICO12"] = "dense,lmhead" + + import inkling_pico12 + import inkling_wide + + if not args.no_pico: + gate("wide integ pico install", inkling_pico12.install() == ("dense", "lmhead")) + gate("wide integ install", inkling_wide.install() == ("dense", "lmhead")) + + import torch + import torch.nn.functional as F + from torch import nn + + from sglang.srt.layers.quantization import unquant as uq + from sglang.srt.models.inkling_common import inkling2_attn as am + import sglang.srt.models.inkling2 as mm + + from inkling_pico12 import patches as ppatches + from inkling_wide import ops, patches + + gate("wide integ patched lm head", getattr(uq.sm12x_fp32_lm_head, "_wide", False) + and getattr(uq.sm12x_fp32_lm_head_applies, "_wide", False)) + gate("wide integ patched _project_sources", getattr(am.Inkling2Attention._project_sources, "inkling_wide", False) + and (args.no_pico or getattr(am.Inkling2Attention._project_sources, "inkling_pico12", False))) + gate("wide integ patched post_load_weights + forward (scope)", + getattr(mm.Inkling2ForConditionalGeneration.post_load_weights, "_wide", False) + and getattr(mm.Inkling2ForConditionalGeneration.forward, "_wide", False)) + # the scope marker on a real ForwardMode + from sglang.srt.model_executor.forward_mode import ForwardMode + + sc = [patches.is_in_scope(types.SimpleNamespace(forward_mode=fm)) for fm in + (ForwardMode.DECODE, ForwardMode.TARGET_VERIFY, ForwardMode.EXTEND)] + gate("wide integ scope modes", sc == [True, True, False], f"decode/verify/extend={sc}") + ops.SET.scope = "all" # the direct layer calls below run outside a model forward + log(f"wide integ patched: {patches.STATE['patched']}") + + dev = torch.device("cuda", torch.cuda.current_device()) + from safetensors import safe_open + import glob + + where = {} + for path in sorted(glob.glob(os.path.join(args.model, "*.safetensors"))): + with safe_open(path, framework="pt", device="cpu") as h: + for key in h.keys(): + where.setdefault(key, path) + + def get(name): + with safe_open(where[name], framework="pt", device="cpu") as h: + return h.get_tensor(name).to(dev) + + base = "model.llm.layers.0.attn." + parts = [get(base + n + ".weight") for n in ("wq_du", "wk_dv", "wv_dv", "wr_du", "gate_attn", "attn_sink_proj")] + splits = [t.shape[0] for t in parts] + w_qkvr = torch.cat(parts) + del parts + w_wo = get(base + "wo_ud.weight") + w_head = get("model.llm.unembed.weight") + + class Lin(nn.Module): + def __init__(self, w): + super().__init__() + self.weight = nn.Parameter(w, requires_grad=False) + self.bias = None + self.quant_method = uq.UnquantizedLinearMethod() + + def forward(self, x): + return self.quant_method.apply(self, x, None), None + + attn = am.Inkling2Attention.__new__(am.Inkling2Attention) + nn.Module.__init__(attn) + attn.qkvr, attn.wo_ud, attn.split_sizes = Lin(w_qkvr), Lin(w_wo), list(splits) + model = nn.Module() + model.llm = nn.Module() + model.llm.layers = nn.ModuleList([nn.Module()]) + model.llm.layers[0].attn = attn + model.llm.lm_head = nn.Module() + model.llm.lm_head.weight = nn.Parameter(w_head, requires_grad=False) + if not args.no_pico: + ppatches.prepare_target(model) + patches.prepare_target(model) # the order the stacked post_load_weights wrappers give + log(f"wide integ qkvr method {type(attn.qkvr.quant_method).__name__}, fmt " + f"{'bf16x' if attn.qkvr.__dict__['_wide'].fmt == ops.BF16X else 'raw'}") + gate("wide integ formats", all(e.fmt == (ops.RAW if args.no_pico else ops.BF16X) for e in + (attn.qkvr.__dict__["_wide"], attn.wo_ud.__dict__["_wide"], + next(iter(patches.HEADS.values()))))) + + calls = {"wide": 0} + real_ext = ops.EXT + + class Counting: + def __getattr__(self, name): + return getattr(real_ext, name) + + def gemm(self, *a): + calls["wide"] += 1 + return real_ext.gemm(*a) + + ops.EXT = Counting() + + def close(y, ref, bf): + tol = (2.0**-7 if bf else 2.0**-12) * float(ref.abs().max()) + 1e-6 + d = float((y.float() - ref.float()).abs().max()) + if d > tol: + log(f"wide integ mismatch max_abs={d:.3e} tol={tol:.3e} ref_max={float(ref.abs().max()):.3e}") + return d <= tol + + g = torch.Generator(device=dev).manual_seed(1) + ops.SET.max_m_kind = {} # every kind to 256 here (the dispatch, not the per-kind caps, is under test) + for m, who in ((8, "pico"), (16, "pico"), (17, "wide"), (64, "wide"), (256, "wide"), (300, "stock")): + if args.no_pico and who == "pico": + who = "stock" + x = (torch.rand((m, 2304), device=dev, generator=g) * 2 - 1).to(torch.bfloat16) + xo = (torch.rand((m, 3072), device=dev, generator=g) * 2 - 1).to(torch.bfloat16) + calls["wide"] = 0 + y, _ = attn.qkvr(x) + yo, _ = attn.wo_ud(xo) + yh = uq.sm12x_fp32_lm_head(x, model.llm.lm_head.weight, None) if uq.sm12x_fp32_lm_head_applies( + x, model.llm.lm_head.weight, None) else torch.mm(x, w_head.T, out_dtype=torch.float32) + torch.cuda.synchronize() + used = calls["wide"] + # FP32 references (cuBLAS's own BF16 wo at 40..64 rows errs 2x more than wide vs FP64: not a reference) + ok = (close(y, x.float() @ w_qkvr.float().T, True) and close(yo, xo.float() @ w_wo.float().T, True) + and close(yh, x.float() @ w_head.float().T, False)) + gate(f"wide integ dispatch M={m}", ok and (used == 3) == (who == "wide"), f"expected={who} wide_calls={used}") + + for m in (24, 64): + q, k, v = ((torch.rand((m, 2304), device=dev, generator=g) * 2 - 1).to(torch.bfloat16) for _ in range(3)) + src = am.AttentionSources(q, k, v) + calls["wide"] = 0 + got = am.Inkling2Attention._project_sources(attn, src) + used = calls["wide"] + st = F.linear(torch.cat([q, k, v]), w_qkvr) + q_p, k_p, v_p = (c.split(splits, dim=-1)[:6] for c in st.chunk(3)) + exp = (q_p[0], k_p[1], v_p[2], q_p[3], q_p[4], q_p[5]) + layout = all((a.shape, a.stride(), a.storage_offset()) == (b.shape, b.stride(), b.storage_offset()) + for a, b in zip(got, exp)) + vals = all(close(a, b, True) for a, b in zip(got, exp)) + gate(f"wide integ stacked M={m}", layout and vals and used == 1, f"layout={'stock' if layout else 'OTHER'} " + f"close={vals} wide_calls={used}") + side = torch.cuda.Stream() + side.wait_stream(torch.cuda.current_stream()) + with torch.cuda.stream(side): + am.Inkling2Attention._project_sources(attn, src) + torch.cuda.current_stream().wait_stream(side) + graph = torch.cuda.CUDAGraph() + with torch.cuda.graph(graph): + gout = am.Inkling2Attention._project_sources(attn, src) + graph.replay() + torch.cuda.synchronize() + same = all(torch.equal(a.contiguous().view(torch.int16), b.contiguous().view(torch.int16)) + for a, b in zip(gout, got)) + gate(f"wide integ stacked graph M={m}", same) + log(f"wide integration result {'PASS' if not FAILS else 'FAIL'} ({', '.join(FAILS)})") + sys.exit(0 if not FAILS else 1) + + +if __name__ == "__main__": + main() diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/sitecustomize.py b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/sitecustomize.py new file mode 100644 index 0000000000000000000000000000000000000000..9ac0c9a0956b96a5ea8ffc1e519ab80e47fb7e11 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/overlay/sitecustomize.py @@ -0,0 +1,98 @@ +"""Combined loader for the Inkling-2-Mini SGLang overlays (verify cap, draft bytes, kernels, pico12, prefill). +Each overlay activates only when its environment switch is set; with none set nothing is imported. +A failing overlay stops the process (site.py would otherwise only print a warning and run the stock path).""" +import os +import sys + + +def _on(name): + return os.environ.get(name, "").strip().lower() not in ("", "0", "off", "none", "false", "no") + + +try: + if _on("INKLING_KV12") and _on("INKLING_KV12S"): + raise RuntimeError("INKLING_KV12S and INKLING_KV12 are mutually exclusive") + if _on("INKLING_VERIFY_CAP"): + from inkling_vcap import activate + activate() + if _on("INKLING_DRAFT_BYTES"): + import inkling_draftbytes + inkling_draftbytes.install() + if _on("INKLING_KERNELS"): + import inkling_kernels + inkling_kernels.install() + if _on("INKLING_MOE2"): # after inkling_kernels: per-token tile tables over moe_tiles' _tiles wrapper + import inkling_moe2 + inkling_moe2.install() + if _on("INKLING_SCODES"): # NVFP4 expert scale codes (exact; wraps nvfp4_expert_matmul) + import inkling_scodes + inkling_scodes.install() + if _on("INKLING_PICO12"): # after inkling_kernels: its _project_sources wrapper goes outside qkvr_gemv's + import inkling_pico12 + inkling_pico12.install() + if _on("INKLING_PREFILL"): # last: its _project_sources wrapper (large M only) goes outermost + import inkling_prefill + inkling_prefill.install() + if _on("INKLING_PFUSE"): # prefill glue fusion: Inkling2DecoderLayer._forward, extend only + import inkling_pfuse + inkling_pfuse.install() + if _on("INKLING_PROLOGUE"): # SWA prefill: K conv + L2 clip, V conv + value norm fused (FP32-order class) + import inkling_prologue + inkling_prologue.install() + if _on("INKLING_PFUSE_HOIST"): # prefill loop-bank hoist over pfuse's loop_mix (FP32-order class; needs PFUSE) + import inkling_phoist + inkling_phoist.install() + if _on("INKLING_WIDE"): # after pico12 (reads its packs) and prefill: outermost _project_sources for 17..256 rows + import inkling_wide + inkling_wide.install() + if _on("INKLING_CERT_HEAD"): # after pico12 and wide: outermost lm-head wrapper (<= 16 rows), reads pico's coded head + import inkling_cert + inkling_cert.install() + if _on("INKLING_ATTN") and not _on("INKLING_KV12S"): # fused relative-bias prefill attention (falls back to the stock FA4 path per call) + import inkling_attn + inkling_attn.install() + if _on("INKLING_KV12S_VATTN_TRACE"): # diagnostic: log compact verify attention arguments + from inkling_kv12s.patch import register_vattn_trace + register_vattn_trace() + if _on("INKLING_VATTN"): # target-verify attention: split-KV relative-bias kernel for all batch sizes + import inkling_vattn + inkling_vattn.install() + if _on("INKLING_KV12"): # after vattn: global-layer KV read from a packed 12-bit side pool (exact) + import inkling_kv12 + inkling_kv12.install() + if _on("INKLING_KV12S"): + import inkling_kv12s + inkling_kv12s.install() + elif _on("INKLING_DSPARK_EAGER_COMMIT"): # diagnostic: KV12S's eager draft commit on stock pools + from inkling_kv12s.patch import register_eager_commit_only + register_eager_commit_only() + if _on("INKLING_NOEXP"): # dead verify rows get no experts (exact for live rows; needs INKLING_VERIFY_CAP) + import inkling_noexp + inkling_noexp.install() + if _on("INKLING_PADX"): # after noexp: CUDA-graph padding rows route to the phantom expert (exact for live rows) + import inkling_padx + inkling_padx.install() + if _on("INKLING_DFLASH_BYTES") or _on("INKLING_DFLASH_CTX8"): # DFlash2 drafter byte cuts / MXFP8 context projections (draft-only; SPEC=dflash2) + import inkling_dfbytes + inkling_dfbytes.install() + if _on("INKLING_DFLASH_FUSED_ACCEPT"): # DFLASH sampled accept from the logits with sparse q (same law) + import inkling_dfaccept + inkling_dfaccept.install() + if _on("INKLING_DFLASH_PCOPY"): # DFLASH: prompt-copy forced drafts (draft proposals only; after the verify cap) + import inkling_pcopy + inkling_pcopy.install() + if _on("INKLING_DFLASH_PREFIX_TAIL") or _on("INKLING_DFLASH_TAIL_SNAPSHOTS"): # DFLASH draft ring on prefix hits: (A) re-prefill the last N input tokens, (B) restore a prompt-end draft window snapshot + import inkling_dftail + inkling_dftail.install() + if _on("INKLING_PROMPT_TOUCH"): # cache LRU order only: refresh a finished request's prompt-end checkpoint + import inkling_ptouch + inkling_ptouch.install() + if _on("INKLING_RSFIX"): # exact residual / bonus lane rule (+ SGLang PR #51681 / #51692 fixes) + import inkling_rsfix + inkling_rsfix.install() + import inkling_mixdraft + inkling_mixdraft.install() +except BaseException as exc: # noqa: BLE001 + sys.stderr.write("[inkling-overlay pid=%d] FATAL at startup: %r\n" % (os.getpid(), exc)) + sys.stderr.flush() + os._exit(78) diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_attn.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_attn.py new file mode 100644 index 0000000000000000000000000000000000000000..1e1ad830ffcca0a0082b6b6750e8cba09b744e1b --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_attn.py @@ -0,0 +1,780 @@ +import logging +import os +import sys +from functools import partial +from typing import NamedTuple + +import torch +import torch.nn.functional as F +from torch import nn + +from sglang.kernels.ops.attention.inkling2_attn import ( + combine_gate_sink, + compute_log_scaling_tau, + gate_sink, + pad_head_groups, +) +from sglang.kernels.ops.attention.inkling2_attn_prologue import attention_prologue +from sglang.kernels.ops.communication.inkling2_comm import ( + all_reduce, + oneshot_all_reduce, + oneshot_all_reduce_input, +) +from sglang.kernels.ops.gemm.inkling2_linear import ( + linear, + linear_k_group_partials_pair, + uses_k_groups, +) +from sglang.srt.environ import envs +from sglang.srt.layers.linear import MergedColumnParallelLinear, RowParallelLinear +from sglang.srt.layers.radix_attention import RadixAttention +from sglang.srt.layers.utils.common import add_prefix, set_weight_attrs +from sglang.srt.model_executor.forward_context import get_attn_backend +from sglang.srt.models.inkling_common.attn import ( + RelLogitsProj, + get_inkling_relative_attention_score_mod, + serving_attention_backend, +) +from sglang.srt.models.inkling_common.inkling2_sconv import ShortConvolution +from sglang.srt.models.inkling_common.sconv import SconvType +from sglang.srt.runtime_context import get_model, get_parallel, get_platform +from sglang.srt.utils import get_device_core_count + +PADDED_DECODE_MIN_TOKENS = 8 + + +def _ink_attn_visit(): + """n218 k1: True inside a layer visit the inkling_attn package has taken (False when it is not loaded).""" + m = sys.modules.get("inkling_attn.patch") + return m is not None and m._CTX.get() is not None + + +# n2 (inkling2-spark prefill seat): per-source qkvr projection for 3-source visits at prefill sizes. +_INK_SPLIT_PROJ = os.environ.get("SGLANG_INKLING_SPLIT_PROJ", "0") == "1" +_INK_SPLIT_PROJ_MIN_TOKENS = int(os.environ.get("SGLANG_INKLING_SPLIT_PROJ_MIN_TOKENS", "512")) +_INK_SPLIT_PROJ_WRAPPED = os.environ.get("INKLING_SPLIT_PROJ_WRAPPED", "0") == "1" + + +def _is_unquant_method(method): + from sglang.srt.layers.quantization.unquant import UnquantizedLinearMethod + + return isinstance(method, UnquantizedLinearMethod) +# linear() sums split-K partials up to this many rows (its tiles < 256 branch). +PAIRED_PARTIALS_MAX_TOKENS = 2048 +VERIFY_REL_BIAS_MAX_TOKENS = 32 + + +def wave_fill_splits(tiles, sms, max_splits=128, min_fill=0.9): + """Smallest KV split count whose CTAs fill at least ``min_fill`` of the last + SM wave; the fullest count up to ``max_splits`` otherwise.""" + best, best_fill = 1, 0.0 + for splits in range(1, max_splits + 1): + ctas = tiles * splits + fill = ctas / (-(-ctas // sms) * sms) + if fill >= min_fill: + return splits + if fill > best_fill: + best, best_fill = splits, fill + return best + + +class AttentionSources(NamedTuple): + q: torch.Tensor + k: torch.Tensor + v: torch.Tensor + + +def _stacked(sources): + """torch.cat(sources) without a copy when the sources are adjacent in memory.""" + q = sources.q + storage = q.untyped_storage().data_ptr() + adjacent = all( + x.is_contiguous() + and x.shape == q.shape + and x.dtype == q.dtype + and x.untyped_storage().data_ptr() == storage + and x.data_ptr() == q.data_ptr() + i * q.nbytes + for i, x in enumerate(sources) + ) + if adjacent and q.ndim == 2: + return q.as_strided((3 * q.shape[0], q.shape[1]), q.stride()) + return torch.cat(sources) + + +class QKL2Clip(nn.Module): + def __init__(self, dim, threshold, eps, num_heads, learnable_scale, *, tp_rank=0): + super().__init__() + self.threshold = threshold + self.eps = eps + self.tp_rank = tp_rank + if learnable_scale: + self.scale = nn.Parameter(torch.empty(num_heads, dim), requires_grad=False) + set_weight_attrs(self.scale, {"weight_loader": self.weight_loader}) + else: + self.register_parameter("scale", None) + + def weight_loader(self, param, loaded_weight): + if loaded_weight.shape != param.shape: + loaded_weight = loaded_weight.narrow( + 0, self.tp_rank * param.shape[0], param.shape[0] + ) + assert loaded_weight.shape == param.shape + param.data.copy_(loaded_weight) + + def forward(self, x, *, output_scale=None): + from sglang.kernels.ops.layernorm.inkling2_qk_l2_clip import ( + qk_l2_clip_fwd_cutedsl, + ) + + output = qk_l2_clip_fwd_cutedsl( + x, self.threshold, self.eps, scale=self.scale, output_scale=output_scale + ) + return output.view(x.shape) + + +class Inkling2Attention(nn.Module): + def __init__(self, config, layer_id, is_local, prefix=""): + super().__init__() + parallel = get_parallel() + self.tp_rank, self.tp_size = parallel.attn_tp_rank, parallel.attn_tp_size + self.hidden_size = config.hidden_size + self.num_total_heads = ( + config.swa_num_attention_heads if is_local else config.num_attention_heads + ) + self.num_total_kv_heads = ( + config.swa_num_key_value_heads if is_local else config.num_key_value_heads + ) + self.head_dim = config.swa_head_dim if is_local else config.head_dim + assert self.num_total_heads % self.tp_size == 0 + assert self.num_total_kv_heads % self.tp_size == 0, ( + "Attention TP must divide the number of KV heads" + ) + self.num_tp_heads = self.num_total_heads // self.tp_size + self.num_tp_kv_heads = self.num_total_kv_heads // self.tp_size + self.d_rel = config.d_rel + self.is_local = is_local + self.layer_id = layer_id + self.scaling = self.head_dim**-0.5 + self.rel_extent = config.sliding_window_size if is_local else config.rel_extent + self.log_scaling_n_floor = config.log_scaling_n_floor + self.log_scaling_alpha = config.log_scaling_alpha + self.split_sizes = [ + self.num_tp_heads * self.head_dim, + self.num_tp_kv_heads * self.head_dim, + self.num_tp_kv_heads * self.head_dim, + self.num_tp_heads * self.d_rel, + self.num_tp_heads * self.head_dim, + self.num_tp_heads, + ] + qkvr_pad_size = -sum(self.split_sizes) % 8 + if qkvr_pad_size: + self.split_sizes.append(qkvr_pad_size) + self.qkvr = MergedColumnParallelLinear( + config.hidden_size, + [size * self.tp_size for size in self.split_sizes], + bias=config.q_bias, + parallel_group="attn_tp", + prefix=add_prefix("qkvr", prefix), + ) + if self.qkvr.bias is not None: + self.qkvr.bias.data.zero_() + self.wo_ud = RowParallelLinear( + self.head_dim * self.num_total_heads, + config.hidden_size, + bias=config.o_bias, + parallel_group="attn_tp", + reduce_results=False, + use_dp_attention_reduce=True, + prefix=add_prefix("wo_ud", prefix), + ) + self.rel_logits_proj = RelLogitsProj(self.d_rel, self.rel_extent) + self.q_l2_clip = QKL2Clip( + self.head_dim, + config.qk_l2_clip_threshold, + 1e-6, + self.num_tp_heads, + True, + tp_rank=self.tp_rank, + ) + self.k_l2_clip = QKL2Clip( + self.head_dim, + config.qk_l2_clip_threshold, + 1e-6, + self.num_tp_kv_heads, + False, + ) + self.rel_l2_clip = QKL2Clip( + self.d_rel, + config.rel_l2_clip_threshold, + 1e-6, + self.num_tp_heads, + True, + tp_rank=self.tp_rank, + ) + if config.use_value_norm_no_gamma: + from sglang.srt.models.inkling_common.inkling2_norm import RMSNorm + + self.v_norm = RMSNorm( + self.head_dim, config.rms_norm_eps, elementwise_affine=False + ) + else: + self.v_norm = None + conv_args = { + "hidden_size": self.head_dim * self.num_tp_kv_heads, + "kernel_size": config.sconv_kernel_size, + "layer_id": layer_id, + "tp_rank": self.tp_rank, + "tp_size": self.tp_size, + "is_dynamic": not is_local, + "dynamic_input_size": config.hidden_size, + "n_heads": self.num_tp_kv_heads, + } + self.k_sconv = ShortConvolution( + sconv_type=SconvType.K_LOCAL if is_local else SconvType.K_FULL, **conv_args + ) + self.v_sconv = ShortConvolution( + sconv_type=SconvType.V_LOCAL if is_local else SconvType.V_FULL, **conv_args + ) + # A looped core layer visits num_passes times. Each visit keeps its own + # conv state; KV is per pass too unless the passes share the cache. + num_passes = ( + config.loop_config["num_passes"] + if layer_id in config.loop_core_layers + else 1 + ) + self.conv_layer_ids = tuple( + config.conv_layer_id(layer_id, pass_idx) for pass_idx in range(num_passes) + ) + pass_cache_layer_ids = [ + config.cache_layer_id(layer_id, pass_idx) for pass_idx in range(num_passes) + ] + cache_layer_ids = list(dict.fromkeys(pass_cache_layer_ids)) + self.pass_attn_index = tuple( + cache_layer_ids.index(cache_layer_id) + for cache_layer_id in pass_cache_layer_ids + ) + attention = [ + RadixAttention( + self.num_tp_heads, + self.head_dim, + self.scaling, + self.num_tp_kv_heads, + cache_layer_id, + sliding_window_size=config.sliding_window_size - 1 if is_local else -1, + prefix=add_prefix("attn", prefix), + out_dtype=torch.float32, + num_splits=1, + pack_gqa=False, + strided_lse=True, + ) + for cache_layer_id in cache_layer_ids + ] + self.attn = attention[0] if len(attention) == 1 else nn.ModuleList(attention) + # FA4 packs GQA heads only for group sizes dividing 128, so decode pads + # each KV group with zero query heads up to the next power of two. + group = self.num_tp_heads // self.num_tp_kv_heads + self.padded_group = 1 << (group - 1).bit_length() + kv_heads = self.num_tp_kv_heads + pad_rows = kv_heads * (self.padded_group - group) + self.fused_decode_prologue = ( + self.head_dim == 128 + and self.d_rel == 16 + and self.rel_extent % 128 == 0 + and kv_heads & (kv_heads - 1) == 0 + and pad_rows & (pad_rows - 1) == 0 + and self.v_norm is not None + and self.v_norm.weight is None + and self.v_norm.pre_weight is None + and self.q_l2_clip.threshold == self.k_l2_clip.threshold + and self.q_l2_clip.eps == self.k_l2_clip.eps == self.rel_l2_clip.eps + and self.k_sconv.use_residual + and self.v_sconv.use_residual + ) + self.attn_padded = ( + nn.ModuleList( + RadixAttention( + self.num_tp_kv_heads * self.padded_group, + self.head_dim, + self.scaling, + self.num_tp_kv_heads, + cache_layer_id, + sliding_window_size=( + config.sliding_window_size - 1 if is_local else -1 + ), + prefix=add_prefix("attn_padded", prefix), + out_dtype=torch.float32, + num_splits=0 if get_platform().is_sm90 else 1, + pack_gqa=True, + strided_lse=True, + ) + for cache_layer_id in cache_layer_ids + ) + if group > 1 and 128 % group + else None + ) + self.verify_wave_splits = not get_platform().is_sm90 + self.verify_max_splits = ( + -(-config.sliding_window_size // 128) + 1 if is_local else 128 + ) + # SM120 has no NVLink multicast. + self.group_all_reduce = get_platform().is_sm120 + + def _pad_heads(self, x): + return pad_head_groups( + x, self.num_tp_heads // self.num_tp_kv_heads, self.padded_group + ) + + def _prologue(self, q, k, v, r, sources, positions, forward_batch): + tokens = q.shape[0] + k = self.k_sconv( + k, + positions, + forward_batch, + dynamic_input=None if self.is_local else sources.k, + ) + v = self.v_sconv( + v, + positions, + forward_batch, + dynamic_input=None if self.is_local else sources.v, + ) + tau = ( + compute_log_scaling_tau( + positions, self.log_scaling_n_floor, self.log_scaling_alpha + ) + if not self.is_local and self.log_scaling_n_floor is not None + else None + ) + q = self.q_l2_clip( + q.reshape(tokens, self.num_tp_heads, self.head_dim), output_scale=tau + ) + k = self.k_l2_clip(k.reshape(tokens, self.num_tp_kv_heads, self.head_dim)) + v = v.reshape(tokens, self.num_tp_kv_heads, self.head_dim) + if self.v_norm is not None: + v = self.v_norm(v) + r = self.rel_l2_clip( + r.reshape(tokens, self.num_tp_heads, self.d_rel), output_scale=tau + ) + return q, k, v, r + + def _decode_prologue( + self, + q, + k, + v, + r, + sources, + positions, + forward_batch, + padded, + *, + verify=False, + shear=None, + ): + """_prologue and rel_logits_proj in one kernel; q and the rel bias come out + padded when padded. With verify (MTP verify tokens), the K/V conv windows + are saved instead of updating the conv cache; shear: see attention_prologue.""" + meta = self.k_sconv._conv_state(forward_batch) + if self.is_local: + k_weight, v_weight = self.k_sconv._weight_2d(), self.v_sconv._weight_2d() + k_dynamic = v_dynamic = None + else: + k_weight, v_weight = self.k_sconv.static_w, self.v_sconv.static_w + k_source, v_source = sources.k.to(k.dtype), sources.v.to(v.dtype) + k_proj = self.k_sconv.weight_proj.to(k.dtype) + v_proj = self.v_sconv.weight_proj.to(v.dtype) + if ( + uses_k_groups(k_source, k_proj) + and k_source.shape[0] <= PAIRED_PARTIALS_MAX_TOKENS + and k_source.stride() == v_source.stride() + and k_proj.stride() == v_proj.stride() + ): + k_dynamic, v_dynamic = linear_k_group_partials_pair( + k_source, k_proj, v_source, v_proj + ) + else: + k_dynamic = linear(k_source, k_proj) + v_dynamic = linear(v_source, v_proj) + tau = not self.is_local and self.log_scaling_n_floor is not None + group = self.num_tp_heads // self.num_tp_kv_heads + return attention_prologue( + q, + k, + v, + r, + self.num_tp_heads, + self.num_tp_kv_heads, + self.d_rel, + self.padded_group if padded else group, + k_weight, + v_weight, + self.k_sconv._sconv_cache(), + self.v_sconv._sconv_cache(), + meta.precomputed, + self.q_l2_clip.scale, + self.rel_l2_clip.scale, + self.rel_logits_proj.proj, + forward_batch.seq_lens, + self.is_local, + self.q_l2_clip.threshold, + self.rel_l2_clip.threshold, + self.q_l2_clip.eps, + self.v_norm.eps, + k_dynamic=k_dynamic, + v_dynamic=v_dynamic, + positions=positions if tau else None, + tau_floor=self.log_scaling_n_floor, + tau_alpha=self.log_scaling_alpha, + track_mask=None if verify else forward_batch.mamba_track_mask, + track_indices=None if verify else meta.track_cache_indices, + shear=shear, + verify_windows=( + ( + self.k_sconv._intermediate_window(), + self.v_sconv._intermediate_window(), + ) + if verify + else None + ), + ) + + def _split_proj_ok(self): + ok = getattr(self, "_split_proj_ok_cached", None) + if ok is None: + weight = getattr(self.qkvr, "weight", None) + ok = ( + weight is not None + and weight.dim() == 2 + and weight.dtype in (torch.bfloat16, torch.float16, torch.float32) + and self.qkvr.bias is None + and ( + type(self.qkvr.quant_method).__name__ == "UnquantizedLinearMethod" + # n324 (c4cache): WIDE / PICO12 swap in per-layer subclasses (WidePico12UnquantizedLinearMethod) + # that keep the BF16 weight; the split reads only that weight, so accept them (env-gated). + or (_INK_SPLIT_PROJ_WRAPPED and _is_unquant_method(self.qkvr.quant_method)) + ) + and weight.shape[0] == sum(self.split_sizes) + ) + self._split_proj_ok_cached = ok + logging.getLogger(__name__).info( + "INK_SPLIT_PROJ layer %s enabled=%s (quant %s, weight %s)", + self.layer_id, ok, type(self.qkvr.quant_method).__name__, + None if weight is None else (tuple(weight.shape), weight.dtype), + ) + return ok + + def _project_qkvr(self, x): + projected, _ = self.qkvr(x) + return projected.split(self.split_sizes, dim=-1)[:6] + + def _project_sources(self, sources): + if ( + _INK_SPLIT_PROJ + and len({id(sources.q), id(sources.k), id(sources.v)}) == 3 + and sources.q.dim() == 2 + and sources.q.shape[0] >= _INK_SPLIT_PROJ_MIN_TOKENS + and self._split_proj_ok() + ): + # n2 (inkling2-spark prefill seat): three distinct sources (loop passes 2-3, global + # layers). The stacked form below runs all 3T rows through the full qkvr weight and keeps a + # third of each output; at prefill sizes that GEMM is FLOP-bound, so project each source + # only onto the rows it uses (q/r/gate/sinks from q's source, k from k's, v from v's). + weight = self.qkvr.weight + sq, sk, sv, sr, sg, ss = self.split_sizes[:6] + o_k, o_v, o_r = sq, sq + sk, sq + sk + sv + end = o_r + sr + sg + ss + q = F.linear(sources.q, weight[:o_k]) + r, gate, sinks = F.linear(sources.q, weight[o_r:end]).split([sr, sg, ss], dim=-1) + k = F.linear(sources.k, weight[o_k:o_v]) + v = F.linear(sources.v, weight[o_v:o_r]) + return q, k, v, r, gate, sinks + if len({id(sources.q), id(sources.k), id(sources.v)}) == 3: + q_proj, k_proj, v_proj = ( + projected.split(self.split_sizes, dim=-1)[:6] + for projected in self.qkvr(_stacked(sources))[0].chunk(3) + ) + q, _, _, r, gate, sinks = q_proj + return q, k_proj[1], v_proj[2], r, gate, sinks + q_proj = self._project_qkvr(sources.q) + k_proj = q_proj if sources.k is sources.q else self._project_qkvr(sources.k) + v_proj = ( + q_proj + if sources.v is sources.q + else k_proj + if sources.v is sources.k + else self._project_qkvr(sources.v) + ) + q, _, _, r, gate, sinks = q_proj + return q, k_proj[1], v_proj[2], r, gate, sinks + + def forward(self, hidden_states, positions, forward_batch, *, pass_idx=0): + index = self.pass_attn_index[pass_idx] + attn = self.attn[index] if isinstance(self.attn, nn.ModuleList) else self.attn + attn_padded = None if self.attn_padded is None else self.attn_padded[index] + conv_layer_id = self.conv_layer_ids[pass_idx] + with ( + self.k_sconv.state_layer_override(conv_layer_id), + self.v_sconv.state_layer_override(conv_layer_id), + ): + return self._forward( + hidden_states, + positions, + forward_batch, + attn=attn, + attn_padded=attn_padded, + ) + + def _forward(self, hidden_states, positions, forward_batch, *, attn, attn_padded): + assert serving_attention_backend(forward_batch) == "fa4", ( + "Inkling2 requires FA4 attention" + ) + mxfp8 = get_model().kv_cache_dtype == "mxfp8" + sources = ( + AttentionSources(hidden_states, hidden_states, hidden_states) + if isinstance(hidden_states, torch.Tensor) + else hidden_states + ) + q, k, v, r, gate, sinks = self._project_sources(sources) + tokens = q.shape[0] + mode = forward_batch.forward_mode + verify = mode.is_target_verify() + compact = ( + not mxfp8 + and self.fused_decode_prologue + and ( + mode.is_decode() + or verify + and ( + get_platform().is_sm90 + or envs.SGLANG_OPT_INKLING2_VERIFY_REL_BIAS_KERNEL.get() + and tokens <= VERIFY_REL_BIAS_MAX_TOKENS + ) + ) + ) + padded = ( + attn_padded is not None + and not compact + and (get_platform().is_sm90 or tokens >= PADDED_DECODE_MIN_TOKENS) + and (mode.is_decode() or verify) + ) + presheared = False + if compact: + q, k, v, rel_bias = self._decode_prologue( + q, k, v, r, sources, positions, forward_batch, False, verify=verify + ) + elif padded and verify and self.fused_decode_prologue: + fa_meta = get_attn_backend().forward_metadata + # The MXFP8 score modifier consumes the unsheared relative-bias row; + # SM120 FA4 tiles differ from the 128-row preshear layout, so it shears. + presheared = ( + not mxfp8 + and not get_platform().is_sm90 + and not get_platform().is_sm120 + and fa_meta.swa_spec_metadata is None + and fa_meta.max_seq_len_q * self.padded_group <= 128 + ) + shear = ( + ( + fa_meta.cache_seqlens_int32, + attn.sliding_window_size if self.is_local else None, + ) + if presheared + else None + ) + q, k, v, rel_bias = self._decode_prologue( + q, + k, + v, + r, + sources, + positions, + forward_batch, + True, + verify=True, + shear=shear, + ) + else: + q, k, v, r = self._prologue(q, k, v, r, sources, positions, forward_batch) + # n32 (inkling2-spark attn-bias seat): a sliding-layer EXTEND rel bias is built inside the FA4 SM120 kernel + # (n32_attn_local.py); every other path gets self.rel_logits_proj(r) as before. + # n218 k1: a visit taken by the knapcio v2.9.3 inkling_attn package keeps the image's own line (its source pin). + if not _ink_attn_visit() and _n32_attn_local.wants( + self, r, mode.name, padded, mxfp8 + ): + rel_bias = _n32_attn_local.N32RelBias(r, self.rel_logits_proj) + else: + rel_bias = self.rel_logits_proj(r) + if padded: + q, rel_bias = self._pad_heads(q), self._pad_heads(rel_bias) + bias_kwargs = {"rel_bias_presheared": True} if presheared else {} + output_dtype = q.dtype + if mxfp8: + from sglang.kernels.ops.quantization.mxfp8_quant import to_mxfp8 + + quantized_q = to_mxfp8(q.reshape(tokens, -1, self.head_dim)) + q = quantized_q.data + # MXFP8 dequant buffers leave no room for shared-memory bias staging. + attention_kwargs = dict( + score_mod=get_inkling_relative_attention_score_mod(self.rel_extent), + aux_tensors=[rel_bias], + q_descale=quantized_q.scale.view(torch.float8_e8m0fnu), + ) + else: + attention_kwargs = dict(rel_bias=rel_bias, **bias_kwargs) + if compact: + output = attn( + q, + k, + v, + forward_batch, + rel_bias=rel_bias, + rel_bias_compact_decode=True, + rel_bias_decode_epilogue=partial( + combine_gate_sink, gate=gate, sinks=sinks + ), + ) + elif padded: + if self.verify_wave_splits: + num_splits = 1 + if verify and (not self.is_local or forward_batch.batch_size == 1): + num_splits = wave_fill_splits( + forward_batch.batch_size + * self.num_tp_kv_heads + * -( + -tokens + * self.padded_group + // (128 * forward_batch.batch_size) + ), + get_device_core_count(q.device.index), + self.verify_max_splits, + ) + attn_padded.num_splits = num_splits + output, lse = attn_padded( + q, + k, + v, + forward_batch, + return_lse=True, + **attention_kwargs, + ) + head_groups = (self.num_tp_heads // self.num_tp_kv_heads, self.padded_group) + else: + output, lse = attn( + q, + k, + v, + forward_batch, + return_lse=True, + **attention_kwargs, + ) + head_groups = None + if not compact: + output = gate_sink( + output.reshape(tokens, -1), + gate, + lse, + sinks, + output_dtype=output_dtype, + head_groups=head_groups, + ) + parallel = get_parallel() + multicast = parallel.moe_ep_size > 1 + if self.group_all_reduce or ( + multicast + and (mode.is_decode() or verify) + and envs.SGLANG_OPT_INKLING2_ATTN_PUSH_ALL_REDUCE.get() + ): + output, _ = self.wo_ud(output) + return parallel.attn_tp_group.all_reduce(output) + buffer = ( + oneshot_all_reduce_input( + parallel.attn_tp_group, tokens, self.hidden_size, output.dtype + ) + if multicast + else None + ) + if buffer is not None: + self.wo_ud(output, output_tensor=buffer) + return oneshot_all_reduce(buffer, parallel.attn_tp_group) + output, _ = self.wo_ud(output) + return all_reduce(output, parallel.attn_tp_group, multicast=multicast) + + +# n13 (inkling2-spark attn-global seat, 2026-11-21): the global-layer rel-bias prefill FA4 SM120 kernel is built as +# FlashAttentionForwardSm120BandSplit (fa4_sm120/n13_fwd.py, mounted): the only change to this file is this hook install. +from sglang.srt.models.inkling_common import n13_attn_global as _n13_attn_global # noqa: E402 + +_n13_attn_global.install() + + +# n32 (inkling2-spark attn-bias seat, 2026-11-21): the sliding-layer prefill rel bias is computed inside the FA4 SM120 kernel +# (fa4_sm120/n32_fwd.py + n32_attn_local.py, mounted), bitwise equal to the served path: this hook install and the guarded +# rel_bias line in _forward are the only changes to n21's file. +from sglang.srt.models.inkling_common import n32_attn_local as _n32_attn_local # noqa: E402 + +_n32_attn_local.install() + + +# n64 (inkling2-spark attn seat, 2026-11-22): global-layer prefill attention as kernel A (n54's band part + state store, +# fa4_sm120/n64a_fwd.py) then kernel B (8 consumer warps on the far blocks, fa4_sm120/n64b_fwd.py), bitwise equal to n54's +# kernel (hook n64_attn_global.py, after n32's; switch SGLANG_INKLING_N64). The only change to this file is this hook install. +from sglang.srt.models.inkling_common import n64_attn_global as _n64_attn_global # noqa: E402 + +_n64_attn_global.install() + + +# n35 (inkling2-spark decode seat, 2026-11-21): MXFP8 W8A16 qkvr / wo_ud (and optionally the LM head) on decode / verify +# forwards only (patch/n35_w8.py, selected by N35_W8; prefill unchanged). The only change to this file is this hook install. +from sglang.srt.models.inkling_common import n35_w8 as _n35_w8 # noqa: E402 + +_n35_w8.install() + + +# n37 (inkling2-spark decode seat, 2026-11-21): NVFP4 grouped-GEMM decode tile_k 256 (patch/n37_tiles.py, bitwise equal). +from sglang.srt.models.inkling_common import n37_tiles as _n37_tiles # noqa: E402 + +_n37_tiles.install() + +# n14 (inkling2-spark moe seat, 2026-11-21): SM120 MoE prefill visits with token-major quantize-once and a BF16-direct combine +# (patch/n14_moe.py + patch/n14_quant.cuh, mounted), bitwise equal to the image path; calls under 512 tokens keep the image path. +# The only change to this file is this hook install. +from sglang.srt.models.inkling_common import n14_moe as _n14_moe # noqa: E402 + +_n14_moe.install() + +# n52 (inkling2-spark moe seat, 2026-11-23): on NVFP4 MoE prefill calls of >= 3,073 tokens, the gate_up grouped GEMM does the +# swiglu + NVFP4 quantization per 128-row band from L2 (patch/n52_moe.py + patch/n52_band.cuh, mounted), bitwise equal to S3's +# visit; installed after n14 (it wraps the method n14 installed; every other call goes to n14's path). Knobs N52_BAND (2 = on, +# 0 = off), N52_RASTER, N52_LEAN. The only change to this file is this hook install. +from sglang.srt.models.inkling_common import n52_moe as _n52_moe # noqa: E402 + +_n52_moe.install() + +# n75 (inkling2-spark packed seat, 2026-11-22): exact 12-bit packed BF16 qkvr / wo_ud / LM head on the served small-M GEMV route +# (patch/n75_install.py + patch/n75_c12.py, mounted; knob N75_C12 attn,lm | empty = off). The only change to this file is this +# hook install. +from sglang.srt.models.inkling_common import n75_install as _n75_install # noqa: E402 + +_n75_install.install() + +# n86 (inkling2-spark stack seat, 2026-11-23): S1 riders G1 (MLP sconv + residual) and G2 (AttnRes + RMSNorm) on the served +# decoder-layer extend path, and the n75 M / shape / build-2 gate (patch/n86_riders.py + n71_sconvres.py + n71_resnorm.py, +# mounted; knobs N86_G1 / N86_G2, default off = the n54 code path). The only change to this file after n75's block is this install. +from sglang.srt.models.inkling_common import n86_riders as _n86_riders # noqa: E402 + +_n86_riders.install() + +# n78 certified greedy LM head, S8 (inkling2-spark packed seat, 2026-11-23): patch/n78_head.py + patch/n78_kern.py, mounted. Knob +# N78_CERT 1 | empty = off (n54's path exactly); N78_CHECK 1 = check boot only. The only change to this file is this install. +from sglang.srt.models.inkling_common import n78_head as _n78_head # noqa: E402 + +_n78_head.install() + +# n80 exact 12-bit DSpark drafter linears (decode seat's rider; composed into S7 by the stack seat, tree n151, 2026-11-24): patch/n80_draft.py + +# patch/n80_cuda.py + patch/n140_kern.py (n140's INT6 screen of n78_head.py), mounted. Knob N80_DRAFT ('' = off; B = qkv / o / gate_up on n75's build 2 +# and down_proj on c12mk); it needs n75 on (N75_C12 non-empty) and replaces n75_install._prepare with a wrapper that calls the original first, so it +# installs after n75's and n86's installs (its draft classes pass the n86 gate only with patch/n86_riders.py = n86_riders_s7.py ecc4992b). +# The only change to this file after n78's block is this install. +from sglang.srt.models.inkling_common import n80_draft as _n80_draft # noqa: E402 + +_n80_draft.install() diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_loop.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_loop.py new file mode 100644 index 0000000000000000000000000000000000000000..1e483db5621eadd85012ca90133163fafc8b1255 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_loop.py @@ -0,0 +1,280 @@ +import functools + +import torch +import triton +import triton.language as tl +from triton.language.extra import libdevice + +from sglang.kernels.jit.utils import is_arch_support_pdl + + +@triton.jit +def _controller_norm( + Dest, + Message, + Normed, + T, + DEST_STRIDE, + MESSAGE_STRIDE, + eps, + W: tl.constexpr, + BLOCK: tl.constexpr, + USE_PDL: tl.constexpr, +): + if USE_PDL: + tl.extra.cuda.gdc_wait() + tl.extra.cuda.gdc_launch_dependents() + t = tl.program_id(0).to(tl.int64) + m = tl.program_id(1).to(tl.int64) + cols = tl.arange(0, BLOCK) + valid = cols < W + dest = tl.load(Dest + m * DEST_STRIDE + t * W + cols, valid, other=0) + message = tl.load(Message + m * MESSAGE_STRIDE + t * W + cols, valid, other=0) + dest_rstd = libdevice.rsqrt(tl.div_rn(tl.sum(dest * dest), W) + eps) + message_rstd = libdevice.rsqrt(tl.div_rn(tl.sum(message * message), W) + eps) + out = Normed + (m * T + t) * (2 * W) + tl.store(out + cols, (dest * dest_rstd).to(tl.bfloat16), valid) + tl.store(out + W + cols, (message * message_rstd).to(tl.bfloat16), valid) + + +@triton.jit +def _controller_down( + Normed, + Down, + Partials, + T, + R: tl.constexpr, + K: tl.constexpr, + SPLIT: tl.constexpr, + BLOCK_M: tl.constexpr, + BLOCK_N: tl.constexpr, + BLOCK_K: tl.constexpr, + USE_PDL: tl.constexpr, +): + """Per 1024-wide K group partials of normed @ down.T, summed in group order + unless SPLIT, where each program writes one group's partial.""" + if USE_PDL: + tl.extra.cuda.gdc_wait() + tl.extra.cuda.gdc_launch_dependents() + GROUPS: tl.constexpr = (K + 1023) // 1024 + rows = tl.program_id(0) * BLOCK_M + tl.arange(0, BLOCK_M) + cols = tl.program_id(1) * BLOCK_N + tl.arange(0, BLOCK_N) + z = tl.program_id(2) + if SPLIT: + m = z // GROUPS + first = z % GROUPS + count = 1 + else: + m = z + first = 0 + count = GROUPS + out = Partials + (z.to(tl.int64) * T) * R + X = Normed + (m.to(tl.int64) * T) * K + Wd = Down + m.to(tl.int64) * R * K + ks = tl.arange(0, BLOCK_K) + total = tl.zeros((BLOCK_M, BLOCK_N), tl.float32) + for group in range(first, first + count): + partial = tl.zeros((BLOCK_M, BLOCK_N), tl.float32) + for tile in range(1024 // BLOCK_K): + k = group * 1024 + tile * BLOCK_K + ks + x = tl.load( + X + rows[:, None].to(tl.int64) * K + k[None, :], + (rows[:, None] < T) & (k[None, :] < K), + other=0, + ) + w = tl.load( + Wd + cols[None, :] * K + k[:, None], + (cols[None, :] < R) & (k[:, None] < K), + other=0, + ) + partial = tl.dot(x, w, partial) + if group == first: + total = partial + else: + total = total + partial + tl.store( + out + rows[:, None].to(tl.int64) * R + cols[None, :], + total, + (rows[:, None] < T) & (cols[None, :] < R), + ) + + +@triton.jit +def _controller_mix( + Partials, + Gain, + Forget, + Dest, + Message, + Out, + T, + DEST_STRIDE, + MESSAGE_STRIDE, + W: tl.constexpr, + R: tl.constexpr, + BLOCK_R: tl.constexpr, + GROUPS: tl.constexpr, + BLOCK_M: tl.constexpr, + BLOCK_N: tl.constexpr, + COLS: tl.constexpr, + STAGES: tl.constexpr, + USE_PDL: tl.constexpr, +): + """Rows BLOCK_M x columns [pid2 * COLS, (pid2 + 1) * COLS) of controller pid1.""" + if USE_PDL: + tl.extra.cuda.gdc_wait() + tl.extra.cuda.gdc_launch_dependents() + rows = tl.program_id(0) * BLOCK_M + tl.arange(0, BLOCK_M) + m = tl.program_id(1).to(tl.int64) + first = tl.program_id(2) * COLS + rank = tl.arange(0, BLOCK_R) + row_ok = rows[:, None] < T + hidden_ok = row_ok & (rank[None, :] < R) + p = Partials + (m * GROUPS * T + rows[:, None]) * R + rank[None, :] + hidden = tl.load(p, hidden_ok, other=0) + for group in tl.static_range(1, GROUPS): + hidden = hidden + tl.load(p + group * T * R, hidden_ok, other=0) + hidden = hidden.to(tl.bfloat16) + for start in tl.range(first, first + COLS, BLOCK_N, num_stages=STAGES): + cols = start + tl.arange(0, BLOCK_N) + col_ok = cols[None, :] < W + weight_ok = col_ok & (rank[:, None] < R) + weights = m * W * R + cols[None, :] * R + rank[:, None] + offsets = rows[:, None].to(tl.int64) * W + cols[None, :] + mask = row_ok & col_ok + dest = tl.load(Dest + m * DEST_STRIDE + offsets, mask, other=0) + message = tl.load(Message + m * MESSAGE_STRIDE + offsets, mask, other=0) + gain = tl.dot(hidden, tl.load(Gain + weights, weight_ok, other=0)) + forget = tl.dot(hidden, tl.load(Forget + weights, weight_ok, other=0)) + output = (1.0 - libdevice.tanh(forget)) * dest + libdevice.tanh(gain) * message + tl.store(Out + m * T * W + offsets, output, mask) + + +@functools.cache +def _sm_count(device_index: int) -> int: + return torch.cuda.get_device_properties(device_index).multi_processor_count + + +@functools.cache +def _max_shared_mem(device_index: int) -> int: + props = triton.runtime.driver.active.utils.get_device_properties(device_index) + return props["max_shared_mem"] + + +def _stacked(rows: tuple[torch.Tensor, ...]) -> tuple[torch.Tensor, int]: + """Base tensor and per-module element stride of equally shaped fp32 rows, + without a copy when they already sit at a constant stride (0 for repeats).""" + base = rows[0] + assert base.dtype == torch.float32 and base.ndim == 2 and base.is_contiguous() + assert all( + r.shape == base.shape and r.dtype == base.dtype and r.is_contiguous() + for r in rows + ) + if len(rows) == 1: + return base, 0 + step = rows[1].data_ptr() - base.data_ptr() + if step % 4 == 0 and all( + r.data_ptr() == base.data_ptr() + i * step for i, r in enumerate(rows) + ): + return base, step // 4 + return torch.stack(rows), base.numel() + + +def message_controllers(dests, messages, down, gain, forget, eps=1e-6): + """Mix messages[i] into dests[i] with controller i of the stacked weights into + row i of the (len(dests), tokens, width) output: + (1 - tanh(h @ forget.T)) * dest + tanh(h @ gain.T) * message, where h is the + bf16 down projection of the bf16 RMS-normalized (dest, message) pair.""" + num, rank, k = down.shape + assert len(dests) == len(messages) == num + assert gain.shape == forget.shape == (num, k // 2, rank) + assert down.dtype == gain.dtype == forget.dtype == torch.bfloat16 + assert down.is_contiguous() and gain.is_contiguous() and forget.is_contiguous() + dest, dest_stride = _stacked(tuple(dests)) + message, message_stride = _stacked(tuple(messages)) + tokens, width = dests[0].shape + assert width * 2 == k and messages[0].shape == dests[0].shape + out = torch.empty((num, tokens, width), dtype=torch.float32, device=dest.device) + if not tokens: + return out + pdl = is_arch_support_pdl() + launch = {"launch_pdl": True} if pdl else {} + normed = torch.empty((num, tokens, k), dtype=torch.bfloat16, device=dest.device) + _controller_norm[(tokens, num)]( + dest, + message, + normed, + tokens, + dest_stride, + message_stride, + eps, + width, + triton.next_power_of_2(width), + pdl, + num_warps=8, + enable_fp_fusion=False, + **launch, + ) + groups = triton.cdiv(k, 1024) + decode = tokens <= 16 + split = tokens <= 4096 + block_m = 16 if decode else 64 + block_n = 16 if decode else 64 + block_k = 256 if tokens <= 1024 else 64 + # 64 x 64 tiles with 256-wide K stages need 128 KB of shared memory; SM120 has 99 KB. + if not decode and block_k == 256 and _max_shared_mem(dest.device.index) < 1 << 17: + block_k = 128 + partial_groups = groups if split else 1 + partials = torch.empty( + (num, partial_groups, tokens, rank), dtype=torch.float32, device=dest.device + ) + _controller_down[ + (triton.cdiv(tokens, block_m), triton.cdiv(rank, block_n), num * partial_groups) + ]( + normed, + down, + partials, + tokens, + rank, + k, + split, + block_m, + block_n, + block_k, + pdl, + num_warps=4, + num_stages=3, + enable_fp_fusion=False, + **launch, + ) + mix_m, mix_n = (16, 64) if decode else (32, 64) + row_blocks, col_tiles = triton.cdiv(tokens, mix_m), triton.cdiv(width, mix_n) + tiles_per_program = ( + 1 + if decode + else max(1, col_tiles * row_blocks * num // (12 * _sm_count(dest.device.index))) + ) + _controller_mix[(row_blocks, num, triton.cdiv(col_tiles, tiles_per_program))]( + partials, + gain, + forget, + dest, + message, + out, + tokens, + dest_stride, + message_stride, + width, + rank, + max(16, triton.next_power_of_2(rank)), + partial_groups, + mix_m, + mix_n, + tiles_per_program * mix_n, + 1 if decode else 3, + pdl, + num_warps=4 if decode else 8, + enable_fp_fusion=False, + **launch, + ) + return out diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_loop_model.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_loop_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ab1028368edab7708adc4f6dab621b268bccfa64 --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/inkling2_loop_model.py @@ -0,0 +1,68 @@ +from typing import Literal + +import torch +from torch import nn + +from sglang.kernels.ops.elementwise.inkling2_loop import message_controllers + +CONTROLLER_MODULES = ("attn", "k", "v", "mlp") +_SIDE_ROWS = {"attn": slice(0, 3), "mlp": slice(3, 4)} + + +class Inkling2MessageController(nn.Module): + def __init__(self, width: int, rank: int): + super().__init__() + self.down_weight = nn.Parameter( + torch.empty(rank, 2 * width, dtype=torch.bfloat16) + ) + self.gain_weight = nn.Parameter(torch.empty(width, rank, dtype=torch.bfloat16)) + self.forget_weight = nn.Parameter( + torch.empty(width, rank, dtype=torch.bfloat16) + ) + + +def stack_controller_weights(controllers: nn.ModuleDict) -> tuple[torch.Tensor, ...]: + """Stack each weight of the CONTROLLER_MODULES controllers into one tensor and + point the parameters at its rows, so reloads update the stacked copy.""" + stacked = [] + for name in ("down_weight", "gain_weight", "forget_weight"): + params = [getattr(controllers[m], name) for m in CONTROLLER_MODULES] + weight = torch.stack([p.data for p in params]) + for param, row in zip(params, weight): + param.data = row + stacked.append(weight) + return tuple(stacked) + + +def scaled_loop_queries(queries: torch.Tensor, kv_queries: torch.Tensor): + """(core layers, CONTROLLER_MODULES, width) message queries times width**-0.5.""" + stacked = torch.stack( + (queries[0::2], kv_queries[0::2], kv_queries[1::2], queries[1::2]), dim=1 + ) + return stacked.float() * (stacked.shape[-1] ** -0.5) + + +class LoopMessageBank: + def __init__(self, blocks: tuple[torch.Tensor, ...], scaled_queries: torch.Tensor): + assert blocks and scaled_queries.dtype == torch.float32 + self.blocks = [x.contiguous() for x in blocks] + self.scaled_queries = scaled_queries + + def mix( + self, + layer: int, + destinations: tuple[torch.Tensor, ...], + weights: tuple[torch.Tensor, ...], + side: Literal["attn", "mlp"], + ) -> torch.Tensor: + from sglang.kernels.ops.attention.inkling2_attn_res import attn_res + + rows = _SIDE_ROWS[side] + messages = attn_res( + self.blocks, None, self.scaled_queries[layer, rows], normalize_values=True + ) + return message_controllers( + tuple(d.float() for d in destinations), + messages, + *(w[rows] for w in weights), + ) diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n105_rnnhoist.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n105_rnnhoist.py new file mode 100644 index 0000000000000000000000000000000000000000..1fcbf3e741629bca782fcbcb697e0b6f8128ddef --- /dev/null +++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n105_rnnhoist.py @@ -0,0 +1,1783 @@ +"""n105 Build 3: Fast Certified 90%-Hoisted Exact Bitwise DSpark Markov RNN Projection (Inkling-2-Mini, GB10 sm_121). + +Evolution from Build 2 (mb2 proved 100% bitwise exactness across 65,280 gates, 537,600 direct outputs, and +22.5M full-walk logits, but hit NO_KEEP at -167.8 us due to (1) TwoSum + 208 subnormal branches in precompute += 102 us, and (2) 1-halfwarp/SM serial inline fixup = 130 us across 7 steps): + +Build 3 (FAST-CERT90) fixes BOTH bottlenecks while keeping the mathematical bitwise-exact theorem: +1. Precompute (init_state): Plain __fmaf_rn + |acc| running bound (ZERO TwoSum, ZERO subnormal branches!). + By IEEE-754 FMA semantics, |fl_fma(w,x,a) - (a+w*x)| <= u*|fl| + eta unconditionally for ALL finite w,x,a + (even subnormal w*x!), and Inf/NaN makes err_abs non-finite -> pre_err = INF -> exact fixup runs! + Stores compact float2(pre_val, pre_err) (43 KB) and zeroes 7-step fix_cnts[7] in-place. + Provides: + - pre_bf16_sep: 2 rows/warp (384 warps), W_f once + W_h x7, 2-ahead ld.cs. + - pre_bf16_splitg: 1 row/warp (768 warps = 16 warps/SM!), ty=0 g=0..8 & ty=1 g=9..17, 1 shuffle combine! + - pre_c12_splitg: same 16 warps/SM split-g over lossless C12 (5.31 MB, BASE=109, 99.925% in-window). +2. Step (x7 in walk, W_s = 0.786 MB L2-hot + parallel high-MLP exact stride-16 fixup on ~9% tripped rows): + - step_fused_coop6 (128x96, 6 rows/block, 1 kernel/step): all 6 half-warps cooperatively prefetch 6 chunks/wave + with double-buffering into 1.5 KB smem -> 6 waves instead of 36! Fuses _rnn_inputs + exact _rnn_gates.ptx. + - step_fused_coop6_1t (256x96, 3 rows/block = 1 triple/block, 1 kernel/step): eliminates 2-tripped-rows/block + straggler tail while keeping all 6 half-warps cooperating on any tripped row (6 waves!). + - step_fast + step_fixup_coop8 + fast_gates (split 2/3-kernel): step_fast (192x64, ~2 us, zero fixup code) + + step_fixup_coop8 (64x128 persistent blocks, 8 half-warps/tripped row -> 5 waves, zero block straggler!) + + 1-block 256-thread exact _rnn_gates (~1.5 us). + - step_proj_4ahead (192x64, 4-ahead register prefetch inline fixup, 0 barriers) + 1-block exact _rnn_gates. + +Pointer-offset walk-step recovery adapts MIT-licensed code from knapcio/Inkling-2-Mini-1x-DGX-Spark +(Copyright (c) 2026 Zbigniew Majewski, MIT License). Non-matching calls (bs != 1, etc.) fall back cleanly to stock. +""" +from __future__ import annotations + +import json +import logging +import os +import sys +import threading +import time +from dataclasses import dataclass +from typing import Optional + +import torch + +logger = logging.getLogger(__name__) + +RANK = 256 +HIDDEN = 2304 +K_TOTAL = 2 * RANK + 2 * HIDDEN # 5120 +N_OUT = 3 * RANK # 768 +GAMMA = 7 +C12_BASE = 109 # [109..123] covers 99.925% of real rnn_proj.weight + +CUDA_SRC = r''' +#include +#include +#include +#include +#include + +static constexpr float U_F32 = 5.9604644775390625e-8f; // 2^-24 +static constexpr float A288_U = 5.9605668e-8f; // (1/(1-u))^288 * u + +__device__ __forceinline__ uint4 ld_cs_u4(const uint4* ptr) { + uint4 v; + asm volatile("ld.global.cs.v4.u32 {%0, %1, %2, %3}, [%4];\n" + : "=r"(v.x), "=r"(v.y), "=r"(v.z), "=r"(v.w) + : "l"(ptr)); + return v; +} + +__device__ __forceinline__ uint2 ld_cs_u2(const uint2* ptr) { + uint2 v; + asm volatile("ld.global.cs.v2.u32 {%0, %1}, [%2];\n" + : "=r"(v.x), "=r"(v.y) + : "l"(ptr)); + return v; +} + +__device__ __forceinline__ uint32_t ld_cs_u32(const uint32_t* ptr) { + uint32_t v; + asm volatile("ld.global.cs.u32 %0, [%1];\n" + : "=r"(v) + : "l"(ptr)); + return v; +} + +__device__ __forceinline__ float bf16_u16_to_f32(uint16_t bits) { + return __uint_as_float((uint32_t)bits << 16); +} + +// Exact 8-step ascending FFMA (gemvx stride=16 order!) +__device__ __forceinline__ float fma8_stride16(uint4 wv, const uint16_t* __restrict__ x_base, int tx, float acc) { + uint32_t ww; + ww = wv.x; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 0 * 16 + tx)), acc); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 1 * 16 + tx)), acc); + ww = wv.y; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 2 * 16 + tx)), acc); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 3 * 16 + tx)), acc); + ww = wv.z; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 4 * 16 + tx)), acc); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 5 * 16 + tx)), acc); + ww = wv.w; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 6 * 16 + tx)), acc); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 7 * 16 + tx)), acc); + return acc; +} + +// Plain FFMA + running |acc| bound (ZERO TwoSum, ZERO branches, unconditional FMA theorem!) +__device__ __forceinline__ void fma8_bound(uint4 wv, const uint16_t* __restrict__ x_base, int tx, + float& acc, float& err) { + uint32_t ww; + ww = wv.x; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 0 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 1 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + ww = wv.y; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 2 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 3 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + ww = wv.z; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 4 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 5 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + ww = wv.w; + acc = __fmaf_rn(__uint_as_float(ww << 16), bf16_u16_to_f32(__ldg(x_base + 6 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); + acc = __fmaf_rn(__uint_as_float(ww & 0xFFFF0000u), bf16_u16_to_f32(__ldg(x_base + 7 * 16 + tx)), acc); err = __fadd_rn(err, fabsf(acc)); +} + +// Decode 8 C12 weights (BASE=109, escape nibble 15 -> W_raw) +__device__ __forceinline__ void decode_c12_8(uint2 sm, uint32_t e4, + const uint16_t* __restrict__ w_raw_row, + int k_base, int tx, float out[8]) { + uint32_t has_esc = e4 & (e4 >> 1); + has_esc = (has_esc & (has_esc >> 2)) & 0x11111111u; + uint32_t sm_lo = sm.x, sm_hi = sm.y; + #pragma unroll + for (int i = 0; i < 4; ++i) { + uint32_t s = (sm_lo >> (i * 8)) & 0xFFu; + uint32_t c = (e4 >> (i * 4)) & 0xFu; + out[i] = __uint_as_float(((s & 0x80u) << 24) | ((c + 109u) << 23) | ((s & 0x7Fu) << 16)); + } + #pragma unroll + for (int i = 0; i < 4; ++i) { + uint32_t s = (sm_hi >> (i * 8)) & 0xFFu; + uint32_t c = (e4 >> ((i + 4) * 4)) & 0xFu; + out[i + 4] = __uint_as_float(((s & 0x80u) << 24) | ((c + 109u) << 23) | ((s & 0x7Fu) << 16)); + } + if (__builtin_expect(has_esc != 0u, 0)) { + #pragma unroll + for (int i = 0; i < 8; ++i) { + if (((e4 >> (i * 4)) & 0xFu) == 15u) { + out[i] = bf16_u16_to_f32(__ldg(w_raw_row + k_base + i * 16 + tx)); + } + } + } +} + +__device__ __forceinline__ float reduce16_sum(float v, unsigned int rmask) { + v = __fadd_rn(v, __shfl_down_sync(rmask, v, 8, 16)); + v = __fadd_rn(v, __shfl_down_sync(rmask, v, 4, 16)); + v = __fadd_rn(v, __shfl_down_sync(rmask, v, 2, 16)); + v = __fadd_rn(v, __shfl_down_sync(rmask, v, 1, 16)); + return v; +} + +// --------------------------------------------------------------------------- +// Exact Triton _rnn_gates.ptx math (__CUDA_FTZ=1 libdevice.exp / libdevice.tanh) +// Proven 0/65,280 mismatches in mb2! +// --------------------------------------------------------------------------- +__device__ __forceinline__ float triton_expf(float x) { + float res; + asm("{\n" + " .reg .f32 fa, fk, fb, fc, fd, fsc;\n" + " .reg .b32 bk, bsc;\n" + " fma.rn.ftz.f32 fa, %1, 0f3BBB989D, 0f3F000000;\n" + " cvt.ftz.sat.f32.f32 fa, fa;\n" + " fma.rm.ftz.f32 fk, fa, 0f437C0000, 0f4B400001;\n" + " add.rn.f32 fb, fk, 0fCB40007F;\n" + " neg.f32 fb, fb;\n" + " fma.rn.ftz.f32 fc, %1, 0f3FB8AA3B, fb;\n" + " fma.rn.ftz.f32 fc, %1, 0f32A57060, fc;\n" + " ex2.approx.ftz.f32 fd, fc;\n" + " mov.b32 bk, fk;\n" + " shl.b32 bsc, bk, 23;\n" + " mov.b32 fsc, bsc;\n" + " mul.rn.f32 %0, fd, fsc;\n" + "}\n" + : "=f"(res) : "f"(x)); + return res; +} + +__device__ __forceinline__ float triton_tanhf(float x) { + float ax; + asm("abs.ftz.f32 %0, %1;\n" : "=f"(ax) : "f"(x)); + if (ax < __uint_as_float(0x3F19999Au)) { + float x2 = __fmul_rn(x, x); + float p; + asm("fma.rn.ftz.f32 %0, 0f3C80F082, %1, 0fBD563CAE;\n" + "fma.rn.ftz.f32 %0, %0, %1, 0f3E085941;\n" + "fma.rn.ftz.f32 %0, %0, %1, 0fBEAAA9ED;\n" + "fma.rn.ftz.f32 %0, %0, %1, 0f00000000;\n" + "fma.rn.ftz.f32 %0, %0, %2, %2;\n" + : "=f"(p) : "f"(x2), "f"(x)); + return p; + } else { + float t = __fmul_rn(ax, __uint_as_float(0x4038AA3Bu)); + float r; + asm("ex2.approx.ftz.f32 %0, %1;\n" + "add.rn.f32 %0, %0, 0f3F800000;\n" + "rcp.approx.ftz.f32 %0, %0;\n" + "fma.rn.ftz.f32 %0, %0, 0fC0000000, 0f3F800000;\n" + : "=f"(r) : "f"(t)); + if (ax >= __uint_as_float(0x41102CB4u)) r = 1.0f; + return __uint_as_float(__float_as_uint(r) | (__float_as_uint(x) & 0x80000000u)); + } +} + +__device__ __forceinline__ void apply_triton_gates( + __nv_bfloat16 gate_b, __nv_bfloat16 cand_b, __nv_bfloat16 out_b, __nv_bfloat16 st_b, + __nv_bfloat16& new_st, __nv_bfloat16& lat) { + float gate_raw = __bfloat162float(gate_b); + float cand_raw = __bfloat162float(cand_b); + float out_raw = __bfloat162float(out_b); + float st = __bfloat162float(st_b); + float ex = triton_expf(-gate_raw); + float gate_f = __fdiv_rn(1.0f, __fadd_rn(1.0f, ex)); + float gate = __bfloat162float(__float2bfloat16_rn(gate_f)); + float kept = __bfloat162float(__float2bfloat16_rn(__fmul_rn(gate, st))); + float one_mg = __bfloat162float(__float2bfloat16_rn(__fsub_rn(1.0f, gate))); + float cand = __bfloat162float(__float2bfloat16_rn(triton_tanhf(cand_raw))); + float blend = __bfloat162float(__float2bfloat16_rn(__fmul_rn(one_mg, cand))); + new_st = __float2bfloat16_rn(__fadd_rn(kept, blend)); + lat = __float2bfloat16_rn(triton_tanhf(out_raw)); +} + +// --------------------------------------------------------------------------- +// Precompute 1A: Plain-FMA BF16 separated (2 rows/warp = 384 warps, 0 branches!) +// Output pre_out: [7, 768] float2 = (pre_val_plus_bias, pre_err). +// Also zeroes optional fix_cnts[7] for split-step kernels! +// --------------------------------------------------------------------------- +template +__global__ void __launch_bounds__(NW * 32) +n105_pre_bf16_sep_kernel( + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const uint16_t* __restrict__ hidden_7, + const uint16_t* __restrict__ f_rnn, + float2* __restrict__ pre_out, + int* __restrict__ fix_cnts, + int hidden_step_bf16) { + if (fix_cnts && blockIdx.x == 0 && threadIdx.x < 7) fix_cnts[threadIdx.x] = 0; + const int warp = threadIdx.x >> 5; + const int lane = threadIdx.x & 31; + const int ty = lane >> 4; + const int tx = lane & 15; + const int n = (blockIdx.x * NW + warp) * 2 + ty; + if (n >= 768) return; + const unsigned int rmask = (ty == 0) ? 0x0000FFFFu : 0xFFFF0000u; + + // Phase 1: W_f @ f_rnn (1x, 2-ahead ld.cs) + const uint4* wf_row = w_f + (size_t)n * 288 + tx; + float f_acc = 0.f, f_err = 0.f; + uint4 wf0 = ld_cs_u4(wf_row + 0 * 16); + uint4 wf1 = ld_cs_u4(wf_row + 1 * 16); + #pragma unroll + for (int g = 0; g < 18; ++g) { + uint4 wcur = wf0; + wf0 = wf1; + if (g + 2 < 18) wf1 = ld_cs_u4(wf_row + (g + 2) * 16); + fma8_bound(wcur, f_rnn + g * 128, tx, f_acc, f_err); + } + float f_end_abs = fabsf(f_acc); + float rf = reduce16_sum(f_acc, rmask); + float sum_f_err = reduce16_sum(f_err, rmask); + float l1_f_end = reduce16_sum(f_end_abs, rmask); + float b_val = (tx == 0) ? __bfloat162float(__ldg(bias + n)) : 0.f; + + // Phase 2: W_h @ hidden_7 (7 steps, 2-ahead ld.cs) + const uint4* wh_row = w_h + (size_t)n * 288 + tx; + float h_acc[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + float h_err[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + uint4 wh0 = ld_cs_u4(wh_row + 0 * 16); + uint4 wh1 = ld_cs_u4(wh_row + 1 * 16); + #pragma unroll 2 + for (int g = 0; g < 18; ++g) { + uint4 wcur = wh0; + wh0 = wh1; + if (g + 2 < 18) wh1 = ld_cs_u4(wh_row + (g + 2) * 16); + const uint16_t* hb = hidden_7 + g * 128; + #pragma unroll + for (int s = 0; s < 7; ++s) { + fma8_bound(wcur, hb + s * hidden_step_bf16, tx, h_acc[s], h_err[s]); + } + } + + #pragma unroll + for (int s = 0; s < 7; ++s) { + float h_end_abs = fabsf(h_acc[s]); + float rh = reduce16_sum(h_acc[s], rmask); + float sum_h_err = reduce16_sum(h_err[s], rmask); + float l1_h_end = reduce16_sum(h_end_abs, rmask); + if (tx == 0) { + float pre_val = __fadd_rn(__fadd_rn(rh, rf), b_val); + float e_lanes = A288_U * (144.0f * l1_h_end + 2.0f * (sum_h_err + sum_f_err)); + float pre_err = 1.02f * (e_lanes + 9.05f * U_F32 * (l1_h_end + l1_f_end) + + 4.05f * U_F32 * e_lanes + U_F32 * fabsf(pre_val)) + 1e-30f; + if (!isfinite(pre_val) || !isfinite(pre_err)) pre_err = INFINITY; + pre_out[s * 768 + n] = make_float2(pre_val, pre_err); + } + } +} + +// --------------------------------------------------------------------------- +// Precompute 1B: Plain-FMA BF16 split-g (1 row/warp = 768 warps = 16 warps/SM!) +// ty=0 processes g=0..8, ty=1 processes g=9..17 -> 2x occupancy + 0 branches! +// --------------------------------------------------------------------------- +template +__global__ void __launch_bounds__(NW * 32) +n105_pre_bf16_splitg_kernel( + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const uint16_t* __restrict__ hidden_7, + const uint16_t* __restrict__ f_rnn, + float2* __restrict__ pre_out, + int* __restrict__ fix_cnts, + int hidden_step_bf16) { + if (fix_cnts && blockIdx.x == 0 && threadIdx.x < 7) fix_cnts[threadIdx.x] = 0; + const int warp = threadIdx.x >> 5; + const int lane = threadIdx.x & 31; + const int ty = lane >> 4; // 0 -> g=0..8, 1 -> g=9..17 + const int tx = lane & 15; + const int n = blockIdx.x * NW + warp; + if (n >= 768) return; + const unsigned int rmask = (ty == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const int g0 = ty * 9; + + // Phase 1: W_f half (9 chunks, 4-ahead ld.cs to saturate DRAM!) + const uint4* wf_row = w_f + (size_t)n * 288 + g0 * 16 + tx; + float f_acc = 0.f, f_err = 0.f; + uint4 wf0 = ld_cs_u4(wf_row + 0 * 16); + uint4 wf1 = ld_cs_u4(wf_row + 1 * 16); + uint4 wf2 = ld_cs_u4(wf_row + 2 * 16); + uint4 wf3 = ld_cs_u4(wf_row + 3 * 16); + #pragma unroll + for (int k = 0; k < 9; ++k) { + uint4 wcur = wf0; wf0 = wf1; wf1 = wf2; wf2 = wf3; + if (k + 4 < 9) wf3 = ld_cs_u4(wf_row + (k + 4) * 16); + fma8_bound(wcur, f_rnn + (g0 + k) * 128, tx, f_acc, f_err); + } + float f_end_abs = fabsf(f_acc); + float rf_half = reduce16_sum(f_acc, rmask); + float sum_f_err_h = reduce16_sum(f_err, rmask); + float l1_f_end_h = reduce16_sum(f_end_abs, rmask); + // Combine ty=0 and ty=1 on lane 0 (ty=0, tx=0) + float rf_hi = __shfl_down_sync(0xFFFFFFFFu, rf_half, 16); + float sum_f_err_2 = __shfl_down_sync(0xFFFFFFFFu, sum_f_err_h, 16); + float l1_f_end_2 = __shfl_down_sync(0xFFFFFFFFu, l1_f_end_h, 16); + float rf = __fadd_rn(rf_half, rf_hi); + float sum_f_err = __fadd_rn(sum_f_err_h, sum_f_err_2); + float l1_f1 = l1_f_end_h; + float l1_f_tot = __fadd_rn(l1_f_end_h, l1_f_end_2); + float b_val = (lane == 0) ? __bfloat162float(__ldg(bias + n)) : 0.f; + + // Phase 2: W_h half (9 chunks x 7 steps, 2-ahead ld.cs) + const uint4* wh_row = w_h + (size_t)n * 288 + g0 * 16 + tx; + float h_acc[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + float h_err[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + uint4 wh0 = ld_cs_u4(wh_row + 0 * 16); + uint4 wh1 = ld_cs_u4(wh_row + 1 * 16); + #pragma unroll + for (int k = 0; k < 9; ++k) { + uint4 wcur = wh0; + wh0 = wh1; + if (k + 2 < 9) wh1 = ld_cs_u4(wh_row + (k + 2) * 16); + const uint16_t* hb = hidden_7 + (g0 + k) * 128; + #pragma unroll + for (int s = 0; s < 7; ++s) { + fma8_bound(wcur, hb + s * hidden_step_bf16, tx, h_acc[s], h_err[s]); + } + } + + #pragma unroll + for (int s = 0; s < 7; ++s) { + float h_end_abs = fabsf(h_acc[s]); + float rh_half = reduce16_sum(h_acc[s], rmask); + float sum_h_err_h = reduce16_sum(h_err[s], rmask); + float l1_h_end_h = reduce16_sum(h_end_abs, rmask); + float rh_hi = __shfl_down_sync(0xFFFFFFFFu, rh_half, 16); + float sum_h_err_2 = __shfl_down_sync(0xFFFFFFFFu, sum_h_err_h, 16); + float l1_h_end_2 = __shfl_down_sync(0xFFFFFFFFu, l1_h_end_h, 16); + if (lane == 0) { + float rh = __fadd_rn(rh_half, rh_hi); + float pre_val = __fadd_rn(__fadd_rn(rh, rf), b_val); + float sum_h_err = __fadd_rn(sum_h_err_h, sum_h_err_2); + float l1_h1 = l1_h_end_h; + float l1_h2 = l1_h_end_2; + // Gronwall over j=32..319 with split at j=104 (h1) and j=248 (f1): + float e_lanes = A288_U * (216.0f * l1_h1 + 144.0f * l1_h2 + 72.0f * l1_f1 + + 2.0f * (sum_h_err + sum_f_err)); + float pre_err = 1.02f * (e_lanes + 10.05f * U_F32 * (l1_h1 + l1_h2 + l1_f_tot) + + 4.05f * U_F32 * e_lanes + U_F32 * fabsf(pre_val)) + 1e-30f; + if (!isfinite(pre_val) || !isfinite(pre_err)) pre_err = INFINITY; + pre_out[s * 768 + n] = make_float2(pre_val, pre_err); + } + } +} + +// --------------------------------------------------------------------------- +// Precompute 1C: Plain-FMA C12 split-g (16 warps/SM, lossless 5.31 MB, 0 TwoSum!) +// --------------------------------------------------------------------------- +template +__global__ void __launch_bounds__(NW * 32) +n105_pre_c12_splitg_kernel( + const uint2* __restrict__ wh_sm, + const uint32_t* __restrict__ wh_e4, + const uint2* __restrict__ wf_sm, + const uint32_t* __restrict__ wf_e4, + const uint16_t* __restrict__ w_raw, + const __nv_bfloat16* __restrict__ bias, + const uint16_t* __restrict__ hidden_7, + const uint16_t* __restrict__ f_rnn, + float2* __restrict__ pre_out, + int* __restrict__ fix_cnts, + int hidden_step_bf16) { + if (fix_cnts && blockIdx.x == 0 && threadIdx.x < 7) fix_cnts[threadIdx.x] = 0; + const int warp = threadIdx.x >> 5; + const int lane = threadIdx.x & 31; + const int ty = lane >> 4; + const int tx = lane & 15; + const int n = blockIdx.x * NW + warp; + if (n >= 768) return; + const unsigned int rmask = (ty == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const int g0 = ty * 9; + const uint16_t* wraw_row = w_raw + (size_t)n * 5120; + + // Phase 1: W_f half (C12, 9 chunks, 2-ahead) + const uint2* wfsm = wf_sm + (size_t)n * 288 + g0 * 16 + tx; + const uint32_t* wfe4 = wf_e4 + (size_t)n * 288 + g0 * 16 + tx; + float f_acc = 0.f, f_err = 0.f; + uint2 sm0 = ld_cs_u2(wfsm + 0 * 16); uint32_t e0 = ld_cs_u32(wfe4 + 0 * 16); + uint2 sm1 = ld_cs_u2(wfsm + 1 * 16); uint32_t e1 = ld_cs_u32(wfe4 + 1 * 16); + #pragma unroll + for (int k = 0; k < 9; ++k) { + uint2 smc = sm0; uint32_t ec = e0; + sm0 = sm1; e0 = e1; + if (k + 2 < 9) { sm1 = ld_cs_u2(wfsm + (k + 2) * 16); e1 = ld_cs_u32(wfe4 + (k + 2) * 16); } + float w8[8]; + decode_c12_8(smc, ec, wraw_row, 2816 + (g0 + k) * 128, tx, w8); + const uint16_t* xb = f_rnn + (g0 + k) * 128; + #pragma unroll + for (int i = 0; i < 8; ++i) { + f_acc = __fmaf_rn(w8[i], bf16_u16_to_f32(__ldg(xb + i * 16 + tx)), f_acc); + f_err = __fadd_rn(f_err, fabsf(f_acc)); + } + } + float f_end_abs = fabsf(f_acc); + float rf_half = reduce16_sum(f_acc, rmask); + float sum_f_err_h = reduce16_sum(f_err, rmask); + float l1_f_end_h = reduce16_sum(f_end_abs, rmask); + float rf_hi = __shfl_down_sync(0xFFFFFFFFu, rf_half, 16); + float sum_f_err_2 = __shfl_down_sync(0xFFFFFFFFu, sum_f_err_h, 16); + float l1_f_end_2 = __shfl_down_sync(0xFFFFFFFFu, l1_f_end_h, 16); + float rf = __fadd_rn(rf_half, rf_hi); + float sum_f_err = __fadd_rn(sum_f_err_h, sum_f_err_2); + float l1_f1 = l1_f_end_h; + float l1_f_tot = __fadd_rn(l1_f_end_h, l1_f_end_2); + float b_val = (lane == 0) ? __bfloat162float(__ldg(bias + n)) : 0.f; + + // Phase 2: W_h half (C12, 9 chunks x 7 steps) + const uint2* whsm = wh_sm + (size_t)n * 288 + g0 * 16 + tx; + const uint32_t* whe4 = wh_e4 + (size_t)n * 288 + g0 * 16 + tx; + float h_acc[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + float h_err[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + sm0 = ld_cs_u2(whsm + 0 * 16); e0 = ld_cs_u32(whe4 + 0 * 16); + sm1 = ld_cs_u2(whsm + 1 * 16); e1 = ld_cs_u32(whe4 + 1 * 16); + for (int k = 0; k < 9; ++k) { + uint2 smc = sm0; uint32_t ec = e0; + sm0 = sm1; e0 = e1; + if (k + 2 < 9) { sm1 = ld_cs_u2(whsm + (k + 2) * 16); e1 = ld_cs_u32(whe4 + (k + 2) * 16); } + float w8[8]; + decode_c12_8(smc, ec, wraw_row, 512 + (g0 + k) * 128, tx, w8); + const uint16_t* hb = hidden_7 + (g0 + k) * 128; + #pragma unroll + for (int s = 0; s < 7; ++s) { + const uint16_t* xb = hb + s * hidden_step_bf16; + #pragma unroll + for (int i = 0; i < 8; ++i) { + h_acc[s] = __fmaf_rn(w8[i], bf16_u16_to_f32(__ldg(xb + i * 16 + tx)), h_acc[s]); + h_err[s] = __fadd_rn(h_err[s], fabsf(h_acc[s])); + } + } + } + + #pragma unroll + for (int s = 0; s < 7; ++s) { + float h_end_abs = fabsf(h_acc[s]); + float rh_half = reduce16_sum(h_acc[s], rmask); + float sum_h_err_h = reduce16_sum(h_err[s], rmask); + float l1_h_end_h = reduce16_sum(h_end_abs, rmask); + float rh_hi = __shfl_down_sync(0xFFFFFFFFu, rh_half, 16); + float sum_h_err_2 = __shfl_down_sync(0xFFFFFFFFu, sum_h_err_h, 16); + float l1_h_end_2 = __shfl_down_sync(0xFFFFFFFFu, l1_h_end_h, 16); + if (lane == 0) { + float rh = __fadd_rn(rh_half, rh_hi); + float pre_val = __fadd_rn(__fadd_rn(rh, rf), b_val); + float sum_h_err = __fadd_rn(sum_h_err_h, sum_h_err_2); + float l1_h1 = l1_h_end_h; + float l1_h2 = l1_h_end_2; + float e_lanes = A288_U * (216.0f * l1_h1 + 144.0f * l1_h2 + 72.0f * l1_f1 + + 2.0f * (sum_h_err + sum_f_err)); + float pre_err = 1.02f * (e_lanes + 10.05f * U_F32 * (l1_h1 + l1_h2 + l1_f_tot) + + 4.05f * U_F32 * e_lanes + U_F32 * fabsf(pre_val)) + 1e-30f; + if (!isfinite(pre_val) || !isfinite(pre_err)) pre_err = INFINITY; + pre_out[s * 768 + n] = make_float2(pre_val, pre_err); + } + } +} + +// Shared fast-path helper: W_s exact a_31 + certificate check (0 TwoSum, 0 W_h/W_f loads!) +__device__ __forceinline__ int eval_ws_cert( + const uint4* __restrict__ w_s, + const float2* __restrict__ pre_s, + const uint16_t* __restrict__ state, + const uint16_t* __restrict__ emb, + int n, int tx, unsigned int rmask, + float& acc_out, __nv_bfloat16& bf_out) { + const uint4* ws = w_s + (size_t)n * 64 + tx; + uint4 w0 = __ldg(ws + 0 * 16); + uint4 w1 = __ldg(ws + 1 * 16); + uint4 w2 = __ldg(ws + 2 * 16); + uint4 w3 = __ldg(ws + 3 * 16); + float acc = 0.f; + acc = fma8_stride16(w0, state + 0, tx, acc); + acc = fma8_stride16(w1, state + 128, tx, acc); + acc = fma8_stride16(w2, emb + 0, tx, acc); + acc = fma8_stride16(w3, emb + 128, tx, acc); + acc_out = acc; + + float l1_a31 = reduce16_sum(fabsf(acc), rmask); + float r_a31 = reduce16_sum(acc, rmask); + int need_fix = 0; + if (tx == 0) { + float2 p = __ldg(pre_s + n); // (pre_val, pre_err) + float y_cand = __fadd_rn(p.x, r_a31); + float e_dyn = (288.0f * A288_U + 8.05f * U_F32) * l1_a31; + float delta = 1.02f * (p.y + e_dyn + 4.0f * U_F32 * fabsf(y_cand)) + 1e-29f; + __nv_bfloat16 bf_lo = __float2bfloat16_rn(__fsub_rn(y_cand, delta)); + __nv_bfloat16 bf_hi = __float2bfloat16_rn(__fadd_rn(y_cand, delta)); + int cert = isfinite(y_cand) && isfinite(delta) && (fabsf(y_cand) > 1e-28f) + && (*reinterpret_cast(&bf_lo) == *reinterpret_cast(&bf_hi)); + need_fix = !cert; + bf_out = bf_lo; + } + return __shfl_sync(rmask, need_fix, 0, 16); +} + +// --------------------------------------------------------------------------- +// Step 2A: FUSED 1-kernel/step with 6-halfwarp cooperative double-buffered smem fixup +// Grid = 128 blocks x 96 threads (6 rows = 2 triples/block). 6 waves instead of 36! +// --------------------------------------------------------------------------- +__global__ void __launch_bounds__(96) +n105_step_fused_coop6_kernel( + const uint4* __restrict__ w_s, + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const float2* __restrict__ pre_s, + const uint16_t* __restrict__ state, + const int64_t* __restrict__ prev_tok, + const uint16_t* __restrict__ w1, + const uint16_t* __restrict__ hidden, + const uint16_t* __restrict__ f_rnn, + __nv_bfloat16* __restrict__ new_state_out, + __nv_bfloat16* __restrict__ latent_out, + int* __restrict__ fix_cnt) { + __shared__ uint4 sm_w[6][16]; + __shared__ __nv_bfloat16 sm_out[6]; + __shared__ int sm_need[6]; + + const int hw = threadIdx.x >> 4; // 0..5 + const int tx = threadIdx.x & 15; // 0..15 + const int g = hw >> 1; // 0, 1, 2 + const int ty = hw & 1; // 0, 1 + const int c = blockIdx.x * 2 + ty; + const int n = g * 256 + c; + const unsigned int rmask = (ty == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const uint16_t* emb = w1 + (size_t)(__ldg(prev_tok)) * 256; + + float acc = 0.f; + __nv_bfloat16 bf_v = __float2bfloat16_rn(0.f); + int need_fix = eval_ws_cert(w_s, pre_s, state, emb, n, tx, rmask, acc, bf_v); + if (tx == 0) { + sm_out[hw] = bf_v; + sm_need[hw] = need_fix; + } + __syncthreads(); + + uint32_t mask = (uint32_t)(sm_need[0]) | ((uint32_t)(sm_need[1]) << 1) + | ((uint32_t)(sm_need[2]) << 2) | ((uint32_t)(sm_need[3]) << 3) + | ((uint32_t)(sm_need[4]) << 4) | ((uint32_t)(sm_need[5]) << 5); + if (__builtin_expect(mask != 0u, 0)) { + for (int r = 0; r < 6; ++r) { + if (!(mask & (1u << r))) continue; + if (fix_cnt && threadIdx.x == 0) atomicAdd(fix_cnt, 1); + const int nr = (r >> 1) * 256 + blockIdx.x * 2 + (r & 1); + const uint4* wh_r = w_h + (size_t)nr * 288 + tx; + const uint4* wf_r = w_f + (size_t)nr * 288 + tx; + uint4 nxt = ld_cs_u4(wh_r + hw * 16); + #pragma unroll + for (int w = 0; w < 18; w += 6) { + sm_w[hw][tx] = nxt; + nxt = (w + 6 < 18) ? ld_cs_u4(wh_r + (w + 6 + hw) * 16) : ld_cs_u4(wf_r + hw * 16); + __syncthreads(); + if (hw == r) { + #pragma unroll + for (int k = 0; k < 6; ++k) acc = fma8_stride16(sm_w[k][tx], hidden + (w + k) * 128, tx, acc); + } + __syncthreads(); + } + #pragma unroll + for (int w = 0; w < 18; w += 6) { + sm_w[hw][tx] = nxt; + if (w + 6 < 18) nxt = ld_cs_u4(wf_r + (w + 6 + hw) * 16); + __syncthreads(); + if (hw == r) { + #pragma unroll + for (int k = 0; k < 6; ++k) acc = fma8_stride16(sm_w[k][tx], f_rnn + (w + k) * 128, tx, acc); + } + __syncthreads(); + } + if (hw == r) { + float v = reduce16_sum(acc, rmask); + if (tx == 0) { + float b = __bfloat162float(__ldg(bias + nr)); + sm_out[r] = __float2bfloat16_rn(__fadd_rn(__fmaf_rn(1.0f, v, b), 0.0f)); + } + } + } + __syncthreads(); + } + + if (threadIdx.x < 2) { + const int cc = blockIdx.x * 2 + threadIdx.x; + const __nv_bfloat16* st_ptr = reinterpret_cast(state); + __nv_bfloat16 ns, la; + apply_triton_gates(sm_out[0 + threadIdx.x], sm_out[2 + threadIdx.x], sm_out[4 + threadIdx.x], + __ldg(st_ptr + cc), ns, la); + new_state_out[cc] = ns; + latent_out[cc] = la; + } +} + +// --------------------------------------------------------------------------- +// Step 2B: FUSED 1-kernel/step, 1 triple (3 rows) per block! +// Grid = 256 blocks x 96 threads (6 half-warps). Only 3 rows/block -> eliminates +// 2-tripped-rows/block straggler tail, while ALL 6 half-warps cooperate on fixup! +// --------------------------------------------------------------------------- +__global__ void __launch_bounds__(96) +n105_step_fused_coop6_1t_kernel( + const uint4* __restrict__ w_s, + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const float2* __restrict__ pre_s, + const uint16_t* __restrict__ state, + const int64_t* __restrict__ prev_tok, + const uint16_t* __restrict__ w1, + const uint16_t* __restrict__ hidden, + const uint16_t* __restrict__ f_rnn, + __nv_bfloat16* __restrict__ new_state_out, + __nv_bfloat16* __restrict__ latent_out, + int* __restrict__ fix_cnt) { + __shared__ uint4 sm_w[6][16]; + __shared__ __nv_bfloat16 sm_out[3]; + __shared__ int sm_need[3]; + + const int hw = threadIdx.x >> 4; // 0..5 + const int tx = threadIdx.x & 15; // 0..15 + const int c = blockIdx.x; // 0..255 + const unsigned int rmask = ((hw & 1) == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const uint16_t* emb = w1 + (size_t)(__ldg(prev_tok)) * 256; + + float acc = 0.f; + if (hw < 3) { + const int n = hw * 256 + c; + __nv_bfloat16 bf_v = __float2bfloat16_rn(0.f); + int need_fix = eval_ws_cert(w_s, pre_s, state, emb, n, tx, rmask, acc, bf_v); + if (tx == 0) { + sm_out[hw] = bf_v; + sm_need[hw] = need_fix; + } + } + __syncthreads(); + + uint32_t mask = (uint32_t)(sm_need[0]) | ((uint32_t)(sm_need[1]) << 1) | ((uint32_t)(sm_need[2]) << 2); + if (__builtin_expect(mask != 0u, 0)) { + for (int r = 0; r < 3; ++r) { + if (!(mask & (1u << r))) continue; + if (fix_cnt && threadIdx.x == 0) atomicAdd(fix_cnt, 1); + const int nr = r * 256 + c; + const uint4* wh_r = w_h + (size_t)nr * 288 + tx; + const uint4* wf_r = w_f + (size_t)nr * 288 + tx; + uint4 nxt = ld_cs_u4(wh_r + hw * 16); + #pragma unroll + for (int w = 0; w < 18; w += 6) { + sm_w[hw][tx] = nxt; + nxt = (w + 6 < 18) ? ld_cs_u4(wh_r + (w + 6 + hw) * 16) : ld_cs_u4(wf_r + hw * 16); + __syncthreads(); + if (hw == r) { + #pragma unroll + for (int k = 0; k < 6; ++k) acc = fma8_stride16(sm_w[k][tx], hidden + (w + k) * 128, tx, acc); + } + __syncthreads(); + } + #pragma unroll + for (int w = 0; w < 18; w += 6) { + sm_w[hw][tx] = nxt; + if (w + 6 < 18) nxt = ld_cs_u4(wf_r + (w + 6 + hw) * 16); + __syncthreads(); + if (hw == r) { + #pragma unroll + for (int k = 0; k < 6; ++k) acc = fma8_stride16(sm_w[k][tx], f_rnn + (w + k) * 128, tx, acc); + } + __syncthreads(); + } + if (hw == r) { + float v = reduce16_sum(acc, rmask); + if (tx == 0) { + float b = __bfloat162float(__ldg(bias + nr)); + sm_out[r] = __float2bfloat16_rn(__fadd_rn(__fmaf_rn(1.0f, v, b), 0.0f)); + } + } + } + __syncthreads(); + } + + if (threadIdx.x == 0) { + const __nv_bfloat16* st_ptr = reinterpret_cast(state); + __nv_bfloat16 ns, la; + apply_triton_gates(sm_out[0], sm_out[1], sm_out[2], __ldg(st_ptr + c), ns, la); + new_state_out[c] = ns; + latent_out[c] = la; + } +} + +// --------------------------------------------------------------------------- +// Step 2C: Split 2-kernel (step_fast + step_fixup_coop8) + 1-block exact gates +// Zero block-straggler tail! 8 half-warps/tripped row -> 5 waves! +// --------------------------------------------------------------------------- +__global__ void __launch_bounds__(64) +n105_step_fast_kernel( + const uint4* __restrict__ w_s, + const float2* __restrict__ pre_s, + const uint16_t* __restrict__ state, + const int64_t* __restrict__ prev_tok, + const uint16_t* __restrict__ w1, + __nv_bfloat16* __restrict__ proj_out, + int* __restrict__ fix_cnt_step, + int* __restrict__ fix_rows, + float* __restrict__ fix_a31, + int* __restrict__ fix_total_stat) { + const int hw = threadIdx.x >> 4; + const int tx = threadIdx.x & 15; + const int n = blockIdx.x * 4 + hw; + if (n >= 768) return; + const unsigned int rmask = ((hw & 1) == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const uint16_t* emb = w1 + (size_t)(__ldg(prev_tok)) * 256; + + float acc = 0.f; + __nv_bfloat16 bf_v = __float2bfloat16_rn(0.f); + int need_fix = eval_ws_cert(w_s, pre_s, state, emb, n, tx, rmask, acc, bf_v); + if (!need_fix) { + if (tx == 0) proj_out[n] = bf_v; + } else { + int slot = 0; + if (tx == 0) { + slot = atomicAdd(fix_cnt_step, 1); + fix_rows[slot] = n; + if (fix_total_stat) atomicAdd(fix_total_stat, 1); + } + slot = __shfl_sync(rmask, slot, 0, 16); + fix_a31[slot * 16 + tx] = acc; + } +} + +__global__ void __launch_bounds__(128) +n105_step_fixup_coop8_kernel( + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const uint16_t* __restrict__ hidden, + const uint16_t* __restrict__ f_rnn, + const int* __restrict__ fix_cnt_step, + const int* __restrict__ fix_rows, + const float* __restrict__ fix_a31, + __nv_bfloat16* __restrict__ proj_out) { + __shared__ uint4 sm_w[8][16]; + const int nfix = *fix_cnt_step; + if (blockIdx.x >= nfix) return; + + const int hw = threadIdx.x >> 4; // 0..7 + const int tx = threadIdx.x & 15; // 0..15 + + for (int idx = blockIdx.x; idx < nfix; idx += gridDim.x) { + const int nr = fix_rows[idx]; + float acc = (hw == 0) ? fix_a31[idx * 16 + tx] : 0.f; + const uint4* wh_r = w_h + (size_t)nr * 288 + tx; + const uint4* wf_r = w_f + (size_t)nr * 288 + tx; + + // 36 chunks total (0..17 in W_h, 18..35 in W_f) -> 4 full waves of 8 + 1 tail wave of 4! + uint4 nxt = ld_cs_u4(wh_r + hw * 16); + #pragma unroll + for (int w = 0; w < 32; w += 8) { + sm_w[hw][tx] = nxt; + const int g_nxt = w + 8 + hw; + if (g_nxt < 18) nxt = ld_cs_u4(wh_r + g_nxt * 16); + else if (g_nxt < 36) nxt = ld_cs_u4(wf_r + (g_nxt - 18) * 16); + __syncthreads(); + if (hw == 0) { + #pragma unroll + for (int k = 0; k < 8; ++k) { + const int g = w + k; + const uint16_t* xb = (g < 18) ? (hidden + g * 128) : (f_rnn + (g - 18) * 128); + acc = fma8_stride16(sm_w[k][tx], xb, tx, acc); + } + } + __syncthreads(); + } + if (hw < 4) sm_w[hw][tx] = nxt; + __syncthreads(); + if (hw == 0) { + #pragma unroll + for (int k = 0; k < 4; ++k) { + acc = fma8_stride16(sm_w[k][tx], f_rnn + (14 + k) * 128, tx, acc); + } + float v = reduce16_sum(acc, 0x0000FFFFu); + if (tx == 0) { + float b = __bfloat162float(__ldg(bias + nr)); + proj_out[nr] = __float2bfloat16_rn(__fadd_rn(__fmaf_rn(1.0f, v, b), 0.0f)); + } + } + __syncthreads(); + } +} + +// --------------------------------------------------------------------------- +// Step 2D: 4-ahead inline register-pipelined proj kernel (192x64, 0 barriers!) +// --------------------------------------------------------------------------- +__global__ void __launch_bounds__(64) +n105_step_proj_4ahead_kernel( + const uint4* __restrict__ w_s, + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const float2* __restrict__ pre_s, + const uint16_t* __restrict__ state, + const int64_t* __restrict__ prev_tok, + const uint16_t* __restrict__ w1, + const uint16_t* __restrict__ hidden, + const uint16_t* __restrict__ f_rnn, + __nv_bfloat16* __restrict__ proj_out, + int* __restrict__ fix_cnt) { + const int hw = threadIdx.x >> 4; + const int tx = threadIdx.x & 15; + const int n = blockIdx.x * 4 + hw; + if (n >= 768) return; + const unsigned int rmask = ((hw & 1) == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const uint16_t* emb = w1 + (size_t)(__ldg(prev_tok)) * 256; + + float acc = 0.f; + __nv_bfloat16 bf_v = __float2bfloat16_rn(0.f); + int need_fix = eval_ws_cert(w_s, pre_s, state, emb, n, tx, rmask, acc, bf_v); + if (__builtin_expect(need_fix != 0, 0)) { + if (fix_cnt && tx == 0) atomicAdd(fix_cnt, 1); + const uint4* wh = w_h + (size_t)n * 288 + tx; + const uint4* wf = w_f + (size_t)n * 288 + tx; + // 4-ahead pipelined streaming over 36 chunks (0..17 W_h, 18..35 W_f) + uint4 q0 = ld_cs_u4(wh + 0 * 16); + uint4 q1 = ld_cs_u4(wh + 1 * 16); + uint4 q2 = ld_cs_u4(wh + 2 * 16); + uint4 q3 = ld_cs_u4(wh + 3 * 16); + #pragma unroll 2 + for (int g = 0; g < 18; ++g) { + uint4 cur = q0; q0 = q1; q1 = q2; q2 = q3; + const int gn = g + 4; + q3 = (gn < 18) ? ld_cs_u4(wh + gn * 16) : ld_cs_u4(wf + (gn - 18) * 16); + acc = fma8_stride16(cur, hidden + g * 128, tx, acc); + } + #pragma unroll 2 + for (int g = 0; g < 18; ++g) { + uint4 cur = q0; q0 = q1; q1 = q2; q2 = q3; + const int gn = g + 4; + if (gn < 18) q3 = ld_cs_u4(wf + gn * 16); + acc = fma8_stride16(cur, f_rnn + g * 128, tx, acc); + } + float v = reduce16_sum(acc, rmask); + if (tx == 0) { + float b = __bfloat162float(__ldg(bias + n)); + bf_v = __float2bfloat16_rn(__fadd_rn(__fmaf_rn(1.0f, v, b), 0.0f)); + } + } + if (tx == 0) proj_out[n] = bf_v; +} + +// Fast 1-block 256-thread exact Triton _rnn_gates kernel (16 regs, 0 spills!) +__global__ void __launch_bounds__(256) +n105_gates_kernel( + const __nv_bfloat16* __restrict__ proj, + const __nv_bfloat16* __restrict__ st, + __nv_bfloat16* __restrict__ ns_out, + __nv_bfloat16* __restrict__ la_out, + int n) { + int i = blockIdx.x * blockDim.x + threadIdx.x; + if (i >= n) return; + __nv_bfloat16 ns, la; + apply_triton_gates(proj[i], proj[n + i], proj[2 * n + i], st[i], ns, la); + ns_out[i] = ns; + la_out[i] = la; +} + +// --------------------------------------------------------------------------- +// Diagnostic / non-bitwise fallback (per supervisor note: draft-only lever): +// FAST90_nocert: plain-FMA 90% split-g precompute (ZERO err_abs, 16 warps/SM) +// + W_s-only fused step (ZERO fixup, exact _rnn_gates.ptx). ~44 us total! +// --------------------------------------------------------------------------- +template +__global__ void __launch_bounds__(NW * 32) +n105_pre_bf16_nocert_kernel( + const uint4* __restrict__ w_h, + const uint4* __restrict__ w_f, + const __nv_bfloat16* __restrict__ bias, + const uint16_t* __restrict__ hidden_7, + const uint16_t* __restrict__ f_rnn, + float* __restrict__ pre_out, + int hidden_step_bf16) { + const int warp = threadIdx.x >> 5; + const int lane = threadIdx.x & 31; + const int ty = lane >> 4; + const int tx = lane & 15; + const int n = blockIdx.x * NW + warp; + if (n >= 768) return; + const unsigned int rmask = (ty == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const int g0 = ty * 9; + + const uint4* wf_row = w_f + (size_t)n * 288 + g0 * 16 + tx; + float f_acc = 0.f; + uint4 wf0 = ld_cs_u4(wf_row + 0 * 16); + uint4 wf1 = ld_cs_u4(wf_row + 1 * 16); + #pragma unroll + for (int k = 0; k < 9; ++k) { + uint4 wcur = wf0; wf0 = wf1; + if (k + 2 < 9) wf1 = ld_cs_u4(wf_row + (k + 2) * 16); + f_acc = fma8_stride16(wcur, f_rnn + (g0 + k) * 128, tx, f_acc); + } + float rf_half = reduce16_sum(f_acc, rmask); + float rf = __fadd_rn(rf_half, __shfl_down_sync(0xFFFFFFFFu, rf_half, 16)); + float b_val = (lane == 0) ? __bfloat162float(__ldg(bias + n)) : 0.f; + float rf_b = __fadd_rn(rf, b_val); + + const uint4* wh_row = w_h + (size_t)n * 288 + g0 * 16 + tx; + float h_acc[7] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + uint4 wh0 = ld_cs_u4(wh_row + 0 * 16); + uint4 wh1 = ld_cs_u4(wh_row + 1 * 16); + #pragma unroll + for (int k = 0; k < 9; ++k) { + uint4 wcur = wh0; wh0 = wh1; + if (k + 2 < 9) wh1 = ld_cs_u4(wh_row + (k + 2) * 16); + const uint16_t* hb = hidden_7 + (g0 + k) * 128; + #pragma unroll + for (int s = 0; s < 7; ++s) { + h_acc[s] = fma8_stride16(wcur, hb + s * hidden_step_bf16, tx, h_acc[s]); + } + } + #pragma unroll + for (int s = 0; s < 7; ++s) { + float rh_half = reduce16_sum(h_acc[s], rmask); + float rh = __fadd_rn(rh_half, __shfl_down_sync(0xFFFFFFFFu, rh_half, 16)); + if (lane == 0) pre_out[s * 768 + n] = __fadd_rn(rh, rf_b); + } +} + +__global__ void __launch_bounds__(96) +n105_step_fused_nocert_kernel( + const uint4* __restrict__ w_s, + const float* __restrict__ pre_s, + const uint16_t* __restrict__ state, + const int64_t* __restrict__ prev_tok, + const uint16_t* __restrict__ w1, + __nv_bfloat16* __restrict__ new_state_out, + __nv_bfloat16* __restrict__ latent_out) { + __shared__ __nv_bfloat16 sm_out[6]; + const int hw = threadIdx.x >> 4; + const int tx = threadIdx.x & 15; + const int g = hw >> 1; + const int ty = hw & 1; + const int c = blockIdx.x * 2 + ty; + const int n = g * 256 + c; + const unsigned int rmask = (ty == 0) ? 0x0000FFFFu : 0xFFFF0000u; + const uint16_t* emb = w1 + (size_t)(__ldg(prev_tok)) * 256; + const uint4* ws = w_s + (size_t)n * 64 + tx; + uint4 w0 = __ldg(ws + 0 * 16); + uint4 w1v = __ldg(ws + 1 * 16); + uint4 w2 = __ldg(ws + 2 * 16); + uint4 w3 = __ldg(ws + 3 * 16); + float acc = 0.f; + acc = fma8_stride16(w0, state + 0, tx, acc); + acc = fma8_stride16(w1v, state + 128, tx, acc); + acc = fma8_stride16(w2, emb + 0, tx, acc); + acc = fma8_stride16(w3, emb + 128, tx, acc); + float v = reduce16_sum(acc, rmask); + if (tx == 0) sm_out[hw] = __float2bfloat16_rn(__fadd_rn(__ldg(pre_s + n), v)); + __syncthreads(); + if (threadIdx.x < 2) { + const int cc = blockIdx.x * 2 + threadIdx.x; + const __nv_bfloat16* st_ptr = reinterpret_cast(state); + __nv_bfloat16 ns, la; + apply_triton_gates(sm_out[0 + threadIdx.x], sm_out[2 + threadIdx.x], sm_out[4 + threadIdx.x], + __ldg(st_ptr + cc), ns, la); + new_state_out[cc] = ns; + latent_out[cc] = la; + } +} + +// ---- C++ launchers ---- +void pre_bf16_sep(at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor hidden_7, + at::Tensor f_rnn, at::Tensor pre_out, at::optional fix_cnts, int64_t nw) { + auto stream = at::cuda::getCurrentCUDAStream(); + int step_bf16 = (int)hidden_7.stride(1); + int* fcp = fix_cnts.has_value() ? fix_cnts->data_ptr() : nullptr; + const auto* wh = reinterpret_cast(w_h.data_ptr()); + const auto* wf = reinterpret_cast(w_f.data_ptr()); + const auto* bi = reinterpret_cast(bias.data_ptr()); + const auto* h7 = reinterpret_cast(hidden_7.data_ptr()); + const auto* fr = reinterpret_cast(f_rnn.data_ptr()); + auto* po = reinterpret_cast(pre_out.data_ptr()); + if (nw == 2) n105_pre_bf16_sep_kernel<2><<<192, 64, 0, stream>>>(wh, wf, bi, h7, fr, po, fcp, step_bf16); + else if (nw == 4) n105_pre_bf16_sep_kernel<4><<<96, 128, 0, stream>>>(wh, wf, bi, h7, fr, po, fcp, step_bf16); + else TORCH_CHECK(false, "n105 pre_bf16_sep: unsupported nw ", nw); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void pre_bf16_splitg(at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor hidden_7, + at::Tensor f_rnn, at::Tensor pre_out, at::optional fix_cnts, int64_t nw) { + auto stream = at::cuda::getCurrentCUDAStream(); + int step_bf16 = (int)hidden_7.stride(1); + int* fcp = fix_cnts.has_value() ? fix_cnts->data_ptr() : nullptr; + const auto* wh = reinterpret_cast(w_h.data_ptr()); + const auto* wf = reinterpret_cast(w_f.data_ptr()); + const auto* bi = reinterpret_cast(bias.data_ptr()); + const auto* h7 = reinterpret_cast(hidden_7.data_ptr()); + const auto* fr = reinterpret_cast(f_rnn.data_ptr()); + auto* po = reinterpret_cast(pre_out.data_ptr()); + if (nw == 4) n105_pre_bf16_splitg_kernel<4><<<192, 128, 0, stream>>>(wh, wf, bi, h7, fr, po, fcp, step_bf16); + else if (nw == 8) n105_pre_bf16_splitg_kernel<8><<<96, 256, 0, stream>>>(wh, wf, bi, h7, fr, po, fcp, step_bf16); + else TORCH_CHECK(false, "n105 pre_bf16_splitg: unsupported nw ", nw); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void pre_c12_splitg(at::Tensor wh_sm, at::Tensor wh_e4, at::Tensor wf_sm, at::Tensor wf_e4, + at::Tensor w_raw, at::Tensor bias, at::Tensor hidden_7, at::Tensor f_rnn, + at::Tensor pre_out, at::optional fix_cnts, int64_t nw) { + auto stream = at::cuda::getCurrentCUDAStream(); + int step_bf16 = (int)hidden_7.stride(1); + int* fcp = fix_cnts.has_value() ? fix_cnts->data_ptr() : nullptr; + const auto* hsm = reinterpret_cast(wh_sm.data_ptr()); + const auto* he4 = reinterpret_cast(wh_e4.data_ptr()); + const auto* fsm = reinterpret_cast(wf_sm.data_ptr()); + const auto* fe4 = reinterpret_cast(wf_e4.data_ptr()); + const auto* wr = reinterpret_cast(w_raw.data_ptr()); + const auto* bi = reinterpret_cast(bias.data_ptr()); + const auto* h7 = reinterpret_cast(hidden_7.data_ptr()); + const auto* fr = reinterpret_cast(f_rnn.data_ptr()); + auto* po = reinterpret_cast(pre_out.data_ptr()); + if (nw == 4) n105_pre_c12_splitg_kernel<4><<<192, 128, 0, stream>>>(hsm, he4, fsm, fe4, wr, bi, h7, fr, po, fcp, step_bf16); + else if (nw == 8) n105_pre_c12_splitg_kernel<8><<<96, 256, 0, stream>>>(hsm, he4, fsm, fe4, wr, bi, h7, fr, po, fcp, step_bf16); + else TORCH_CHECK(false, "n105 pre_c12_splitg: unsupported nw ", nw); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void step_fused_coop6(at::Tensor w_s, at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor pre_s, + at::Tensor state, at::Tensor prev_tok, at::Tensor w1, at::Tensor hidden, at::Tensor f_rnn, + at::Tensor new_state, at::Tensor latent, at::optional fix_cnt) { + auto stream = at::cuda::getCurrentCUDAStream(); + int* fc = fix_cnt.has_value() ? fix_cnt->data_ptr() : nullptr; + n105_step_fused_coop6_kernel<<<128, 96, 0, stream>>>( + reinterpret_cast(w_s.data_ptr()), + reinterpret_cast(w_h.data_ptr()), + reinterpret_cast(w_f.data_ptr()), + reinterpret_cast(bias.data_ptr()), + reinterpret_cast(pre_s.data_ptr()), + reinterpret_cast(state.data_ptr()), + prev_tok.data_ptr(), + reinterpret_cast(w1.data_ptr()), + reinterpret_cast(hidden.data_ptr()), + reinterpret_cast(f_rnn.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(new_state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(latent.data_ptr()), + fc); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void step_fused_coop6_1t(at::Tensor w_s, at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor pre_s, + at::Tensor state, at::Tensor prev_tok, at::Tensor w1, at::Tensor hidden, at::Tensor f_rnn, + at::Tensor new_state, at::Tensor latent, at::optional fix_cnt) { + auto stream = at::cuda::getCurrentCUDAStream(); + int* fc = fix_cnt.has_value() ? fix_cnt->data_ptr() : nullptr; + n105_step_fused_coop6_1t_kernel<<<256, 96, 0, stream>>>( + reinterpret_cast(w_s.data_ptr()), + reinterpret_cast(w_h.data_ptr()), + reinterpret_cast(w_f.data_ptr()), + reinterpret_cast(bias.data_ptr()), + reinterpret_cast(pre_s.data_ptr()), + reinterpret_cast(state.data_ptr()), + prev_tok.data_ptr(), + reinterpret_cast(w1.data_ptr()), + reinterpret_cast(hidden.data_ptr()), + reinterpret_cast(f_rnn.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(new_state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(latent.data_ptr()), + fc); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void step_split_coop8(at::Tensor w_s, at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor pre_s, + at::Tensor state, at::Tensor prev_tok, at::Tensor w1, at::Tensor hidden, at::Tensor f_rnn, + at::Tensor proj_buf, at::Tensor fix_cnt_step, at::Tensor fix_rows, at::Tensor fix_a31, + at::Tensor new_state, at::Tensor latent, at::optional fix_total_stat) { + auto stream = at::cuda::getCurrentCUDAStream(); + int* fstat = fix_total_stat.has_value() ? fix_total_stat->data_ptr() : nullptr; + n105_step_fast_kernel<<<192, 64, 0, stream>>>( + reinterpret_cast(w_s.data_ptr()), + reinterpret_cast(pre_s.data_ptr()), + reinterpret_cast(state.data_ptr()), + prev_tok.data_ptr(), + reinterpret_cast(w1.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(proj_buf.data_ptr()), + fix_cnt_step.data_ptr(), + fix_rows.data_ptr(), + fix_a31.data_ptr(), + fstat); + n105_step_fixup_coop8_kernel<<<96, 128, 0, stream>>>( + reinterpret_cast(w_h.data_ptr()), + reinterpret_cast(w_f.data_ptr()), + reinterpret_cast(bias.data_ptr()), + reinterpret_cast(hidden.data_ptr()), + reinterpret_cast(f_rnn.data_ptr()), + fix_cnt_step.data_ptr(), + fix_rows.data_ptr(), + fix_a31.data_ptr(), + reinterpret_cast<__nv_bfloat16*>(proj_buf.data_ptr())); + n105_gates_kernel<<<1, 256, 0, stream>>>( + reinterpret_cast(proj_buf.data_ptr()), + reinterpret_cast(state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(new_state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(latent.data_ptr()), + 256); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void step_proj_4ahead_gates(at::Tensor w_s, at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor pre_s, + at::Tensor state, at::Tensor prev_tok, at::Tensor w1, at::Tensor hidden, at::Tensor f_rnn, + at::Tensor proj_buf, at::Tensor new_state, at::Tensor latent, at::optional fix_cnt) { + auto stream = at::cuda::getCurrentCUDAStream(); + int* fc = fix_cnt.has_value() ? fix_cnt->data_ptr() : nullptr; + n105_step_proj_4ahead_kernel<<<192, 64, 0, stream>>>( + reinterpret_cast(w_s.data_ptr()), + reinterpret_cast(w_h.data_ptr()), + reinterpret_cast(w_f.data_ptr()), + reinterpret_cast(bias.data_ptr()), + reinterpret_cast(pre_s.data_ptr()), + reinterpret_cast(state.data_ptr()), + prev_tok.data_ptr(), + reinterpret_cast(w1.data_ptr()), + reinterpret_cast(hidden.data_ptr()), + reinterpret_cast(f_rnn.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(proj_buf.data_ptr()), + fc); + n105_gates_kernel<<<1, 256, 0, stream>>>( + reinterpret_cast(proj_buf.data_ptr()), + reinterpret_cast(state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(new_state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(latent.data_ptr()), + 256); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void test_gates(at::Tensor proj, at::Tensor st, at::Tensor ns_out, at::Tensor la_out) { + auto stream = at::cuda::getCurrentCUDAStream(); + int n = (int)st.numel(); + n105_gates_kernel<<<(n + 255) / 256, 256, 0, stream>>>( + reinterpret_cast(proj.data_ptr()), + reinterpret_cast(st.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(ns_out.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(la_out.data_ptr()), + n); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void pre_bf16_nocert(at::Tensor w_h, at::Tensor w_f, at::Tensor bias, at::Tensor hidden_7, + at::Tensor f_rnn, at::Tensor pre_out, int64_t nw) { + auto stream = at::cuda::getCurrentCUDAStream(); + int step_bf16 = (int)hidden_7.stride(1); + const auto* wh = reinterpret_cast(w_h.data_ptr()); + const auto* wf = reinterpret_cast(w_f.data_ptr()); + const auto* bi = reinterpret_cast(bias.data_ptr()); + const auto* h7 = reinterpret_cast(hidden_7.data_ptr()); + const auto* fr = reinterpret_cast(f_rnn.data_ptr()); + auto* po = pre_out.data_ptr(); + if (nw == 4) n105_pre_bf16_nocert_kernel<4><<<192, 128, 0, stream>>>(wh, wf, bi, h7, fr, po, step_bf16); + else if (nw == 8) n105_pre_bf16_nocert_kernel<8><<<96, 256, 0, stream>>>(wh, wf, bi, h7, fr, po, step_bf16); + else TORCH_CHECK(false, "n105 pre_bf16_nocert: unsupported nw ", nw); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +void step_fused_nocert(at::Tensor w_s, at::Tensor pre_s, at::Tensor state, at::Tensor prev_tok, + at::Tensor w1, at::Tensor new_state, at::Tensor latent) { + auto stream = at::cuda::getCurrentCUDAStream(); + n105_step_fused_nocert_kernel<<<128, 96, 0, stream>>>( + reinterpret_cast(w_s.data_ptr()), + pre_s.data_ptr(), + reinterpret_cast(state.data_ptr()), + prev_tok.data_ptr(), + reinterpret_cast(w1.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(new_state.data_ptr()), + reinterpret_cast<__nv_bfloat16*>(latent.data_ptr())); + C10_CUDA_KERNEL_LAUNCH_CHECK(); +} + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("pre_bf16_sep", &pre_bf16_sep); + m.def("pre_bf16_splitg", &pre_bf16_splitg); + m.def("pre_c12_splitg", &pre_c12_splitg); + m.def("step_fused_coop6", &step_fused_coop6); + m.def("step_fused_coop6_1t", &step_fused_coop6_1t); + m.def("step_split_coop8", &step_split_coop8); + m.def("step_proj_4ahead_gates", &step_proj_4ahead_gates); + m.def("pre_bf16_nocert", &pre_bf16_nocert); + m.def("step_fused_nocert", &step_fused_nocert); + m.def("test_gates", &test_gates); +} +''' + +_EXT = None + + +def build_ext(verbose: bool = False, build_dir: Optional[str] = None): + global _EXT + if _EXT is None: + from torch.utils.cpp_extension import load_inline + arch = os.environ.get("N105_CUDA_ARCH", "121a") + kw = {} + if build_dir: + os.makedirs(build_dir, exist_ok=True) + kw["build_directory"] = build_dir + _EXT = load_inline( + "n105_rnnhoist_b3_ext", + cpp_sources="", + cuda_sources=CUDA_SRC, + verbose=verbose, + with_cuda=True, + extra_cuda_cflags=[ + "-O3", + f"-gencode=arch=compute_{arch},code=sm_{arch}", + "-Xptxas=-v", + ], + **kw, + ) + return _EXT + + +@dataclass +class RnnHoistPacks: + w_s: torch.Tensor # [768, 4, 16, 8] BF16 (0.786 MB) + w_h: torch.Tensor # [768, 18, 16, 8] BF16 (3.539 MB) + w_f: torch.Tensor # [768, 18, 16, 8] BF16 (3.539 MB) + wh_sm: Optional[torch.Tensor] # [768, 18, 16, 2] int32 (1.769 MB) + wh_e4: Optional[torch.Tensor] # [768, 18, 16] int32 (0.885 MB) + wf_sm: Optional[torch.Tensor] # [768, 18, 16, 2] int32 (1.769 MB) + wf_e4: Optional[torch.Tensor] # [768, 18, 16] int32 (0.885 MB) + w_raw: torch.Tensor # [768, 5120] BF16 (view of rnn_proj.weight) + bias: torch.Tensor # [768] BF16 contiguous + + def nbytes(self) -> int: + tot = (self.w_s.numel() + self.w_h.numel() + self.w_f.numel() + self.bias.numel()) * 2 + if self.wh_sm is not None: + tot += (self.wh_sm.numel() + self.wh_e4.numel() + self.wf_sm.numel() + self.wf_e4.numel()) * 4 + return tot + + +@dataclass +class WalkCtx: + pre: torch.Tensor # [7, 768, 2] FP32 + fix_cnts: Optional[torch.Tensor] # [7] int32 (used by split_coop8) + fix_rows: Optional[torch.Tensor] # [768] int32 + fix_a31: Optional[torch.Tensor] # [768, 16] FP32 + proj_buf: Optional[torch.Tensor] # [1, 768] BF16 + base_ptr: int + step_bytes: int + f_ptr: int + gamma: int + + +def _pack_c12_block(w_block_bf16: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + u16 = w_block_bf16.view(torch.uint16).to(torch.int64) + sign = (u16 >> 15) & 1 + exp = (u16 >> 7) & 0xFF + mant = u16 & 0x7F + sm_byte = (sign << 7) | mant + in_win = (exp >= C12_BASE) & (exp <= C12_BASE + 14) + e4_nib = torch.where(in_win, exp - C12_BASE, torch.full_like(exp, 15)) + sm_lo = (sm_byte[..., 0] | (sm_byte[..., 1] << 8) | (sm_byte[..., 2] << 16) | (sm_byte[..., 3] << 24)) + sm_hi = (sm_byte[..., 4] | (sm_byte[..., 5] << 8) | (sm_byte[..., 6] << 16) | (sm_byte[..., 7] << 24)) + sm = torch.stack([sm_lo, sm_hi], dim=-1).to(torch.uint32).view(torch.int32).contiguous() + e4 = torch.zeros_like(e4_nib[..., 0]) + for i in range(8): + e4 = e4 | (e4_nib[..., i] << (i * 4)) + e4 = e4.to(torch.uint32).view(torch.int32).contiguous() + return sm, e4 + + +def unpack_c12_check(sm: torch.Tensor, e4: torch.Tensor, w_raw_slice: torch.Tensor) -> torch.Tensor: + sm_u = sm.view(torch.uint32).to(torch.int64) + e4_u = e4.view(torch.uint32).to(torch.int64) + raw_u = w_raw_slice.view(torch.uint16).to(torch.int64) + cols = [] + for i in range(8): + word = sm_u[..., 0] if i < 4 else sm_u[..., 1] + s = (word >> ((i % 4) * 8)) & 0xFF + c = (e4_u >> (i * 4)) & 0xF + dec = ((s & 0x80) << 8) | ((c + C12_BASE) << 7) | (s & 0x7F) + dec = torch.where(c == 15, raw_u[..., i], dec) + cols.append(dec) + return torch.stack(cols, dim=-1).to(torch.uint16).view(torch.bfloat16) + + +def pack_rnn_weights( + weight: torch.Tensor, + bias: Optional[torch.Tensor], + include_c12: bool = False, +) -> RnnHoistPacks: + assert weight.shape == (N_OUT, K_TOTAL) and weight.dtype == torch.bfloat16, (weight.shape, weight.dtype) + w = weight.detach().contiguous() + w3 = w.view(N_OUT, 320, 16) + w_s = w3[:, :32, :].view(N_OUT, 4, 8, 16).permute(0, 1, 3, 2).contiguous() + w_h = w3[:, 32:176, :].view(N_OUT, 18, 8, 16).permute(0, 1, 3, 2).contiguous() + w_f = w3[:, 176:, :].view(N_OUT, 18, 8, 16).permute(0, 1, 3, 2).contiguous() + wh_sm = wh_e4 = wf_sm = wf_e4 = None + if include_c12: + wh_sm, wh_e4 = _pack_c12_block(w_h) + wf_sm, wf_e4 = _pack_c12_block(w_f) + if bias is None: + b = torch.zeros(N_OUT, dtype=torch.bfloat16, device=w.device) + else: + assert bias.shape == (N_OUT,) and bias.dtype == torch.bfloat16 + b = bias.detach().contiguous() + return RnnHoistPacks(w_s=w_s, w_h=w_h, w_f=w_f, wh_sm=wh_sm, wh_e4=wh_e4, wf_sm=wf_sm, wf_e4=wf_e4, w_raw=w, bias=b) + + +def unpack_check(packs: RnnHoistPacks) -> torch.Tensor: + ws = packs.w_s.permute(0, 1, 3, 2).reshape(N_OUT, 32, 16) + wh = packs.w_h.permute(0, 1, 3, 2).reshape(N_OUT, 144, 16) + wf = packs.w_f.permute(0, 1, 3, 2).reshape(N_OUT, 144, 16) + return torch.cat([ws, wh, wf], dim=1).reshape(N_OUT, K_TOTAL) + + +# ---- Pure-Python CPU reference (matches plain-FMA FAST-CERT90 + gemvx stride-16) ---- +def _get_fmaf(): + import ctypes + libm = ctypes.CDLL("libm.so.6") + fn = libm.fmaf + fn.argtypes = (ctypes.c_float, ctypes.c_float, ctypes.c_float) + fn.restype = ctypes.c_float + return fn + + +def gemvx_cpu_exact_stride16(w_bf16: torch.Tensor, b_bf16: torch.Tensor, x_bf16: torch.Tensor, nrows: int = N_OUT) -> torch.Tensor: + import struct + fmaf = _get_fmaf() + wf = w_bf16[:nrows].float().tolist() + xf = x_bf16.float().tolist() + bf = b_bf16[:nrows].float().tolist() + f32 = lambda v: struct.unpack(" tuple[torch.Tensor, int]: + import math + import struct + fmaf = _get_fmaf() + f32 = lambda v: struct.unpack(" 1e-28 and b_lo == b_hi: + row_out.append(f32(yc - delta)) + else: + n_fix += 1 + lanes = list(a31) + for tx in range(16): + a = lanes[tx] + for j in range(144): a = fmaf(wn[512 + j * 16 + tx], hs[j * 16 + tx], a) + for j in range(144): a = fmaf(wn[2816 + j * 16 + tx], fr[j * 16 + tx], a) + lanes[tx] = a + for stride in (8, 4, 2, 1): + for tx in range(stride): + lanes[tx] = f32(lanes[tx] + lanes[tx + stride]) + row_out.append(f32(fmaf(1.0, lanes[0], bf[n]) + 0.0)) + outs.append(row_out) + return torch.tensor(outs, dtype=torch.float32).to(torch.bfloat16), n_fix + + +# ---- Serving hook for S3 Inkling2MTPHead ---- +_STATE = { + "installed": False, + "mode": "bf16_splitg_coop6_1t", #
_
+    "pre_nw": 8,
+    "check": False,
+    "reach": {"hoist_walks": 0, "hoist_steps": 0, "fallback_steps": 0, "captured_walks": 0},
+    "logged_hoist": False,
+    "logged_capture": False,
+    "logged_fallback": False,
+    "chk_dev": None,      # [4] int64: steps, state_mism, latent_mism, ctl_latent_mism
+    "fix_dev": None,      # [1] int32: fixup rows (check mode)
+}
+
+
+def run_pre(packs: RnnHoistPacks, draft_hidden: torch.Tensor, f_rnn: torch.Tensor, pre_kind: str, pre_nw: int,
+            need_split_bufs: bool) -> WalkCtx:
+    dev = draft_hidden.device
+    ext = build_ext()
+    if pre_kind == "bf16_nocert":
+        pre = torch.empty((GAMMA, N_OUT), dtype=torch.float32, device=dev)
+        ext.pre_bf16_nocert(packs.w_h, packs.w_f, packs.bias, draft_hidden, f_rnn, pre, pre_nw)
+        return WalkCtx(pre=pre, fix_cnts=None, fix_rows=None, fix_a31=None, proj_buf=None,
+                       base_ptr=draft_hidden.data_ptr(),
+                       step_bytes=draft_hidden.stride(1) * draft_hidden.element_size(),
+                       f_ptr=f_rnn.data_ptr(), gamma=GAMMA)
+    pre = torch.empty((GAMMA, N_OUT, 2), dtype=torch.float32, device=dev)
+    fix_cnts = torch.empty((GAMMA,), dtype=torch.int32, device=dev) if need_split_bufs else None
+    fix_rows = torch.empty((N_OUT,), dtype=torch.int32, device=dev) if need_split_bufs else None
+    fix_a31 = torch.empty((N_OUT, 16), dtype=torch.float32, device=dev) if need_split_bufs else None
+    proj_buf = torch.empty((1, N_OUT), dtype=torch.bfloat16, device=dev) if need_split_bufs else None
+    if pre_kind == "bf16_sep":
+        ext.pre_bf16_sep(packs.w_h, packs.w_f, packs.bias, draft_hidden, f_rnn, pre, fix_cnts, pre_nw)
+    elif pre_kind == "bf16_splitg":
+        ext.pre_bf16_splitg(packs.w_h, packs.w_f, packs.bias, draft_hidden, f_rnn, pre, fix_cnts, pre_nw)
+    elif pre_kind == "c12_splitg":
+        ext.pre_c12_splitg(packs.wh_sm, packs.wh_e4, packs.wf_sm, packs.wf_e4, packs.w_raw,
+                           packs.bias, draft_hidden, f_rnn, pre, fix_cnts, pre_nw)
+    else:
+        raise ValueError(f"Unknown pre_kind {pre_kind}")
+    return WalkCtx(
+        pre=pre, fix_cnts=fix_cnts, fix_rows=fix_rows, fix_a31=fix_a31, proj_buf=proj_buf,
+        base_ptr=draft_hidden.data_ptr(),
+        step_bytes=draft_hidden.stride(1) * draft_hidden.element_size(),
+        f_ptr=f_rnn.data_ptr(),
+        gamma=GAMMA,
+    )
+
+
+def run_step(packs: RnnHoistPacks, walk: WalkCtx, step_idx: int, state: torch.Tensor, prev_tokens: torch.Tensor,
+             w1: torch.Tensor, hidden: torch.Tensor, f_rnn: torch.Tensor, step_kind: str,
+             pre_override: Optional[torch.Tensor] = None, fix_cnt: Optional[torch.Tensor] = None):
+    ext = build_ext()
+    pre_s = walk.pre[step_idx] if pre_override is None else pre_override
+    new_state = torch.empty((1, RANK), dtype=torch.bfloat16, device=state.device)
+    latent = torch.empty((1, RANK), dtype=torch.bfloat16, device=state.device)
+    if step_kind == "nocert":
+        ext.step_fused_nocert(packs.w_s, pre_s, state, prev_tokens, w1, new_state, latent)
+        return new_state, latent
+    if step_kind == "coop6":
+        ext.step_fused_coop6(packs.w_s, packs.w_h, packs.w_f, packs.bias, pre_s,
+                             state, prev_tokens, w1, hidden, f_rnn, new_state, latent, fix_cnt)
+    elif step_kind == "coop6_1t":
+        ext.step_fused_coop6_1t(packs.w_s, packs.w_h, packs.w_f, packs.bias, pre_s,
+                                state, prev_tokens, w1, hidden, f_rnn, new_state, latent, fix_cnt)
+    elif step_kind == "split_coop8":
+        fc_step = walk.fix_cnts[step_idx:step_idx + 1] if pre_override is None else torch.zeros((1,), dtype=torch.int32, device=state.device)
+        ext.step_split_coop8(packs.w_s, packs.w_h, packs.w_f, packs.bias, pre_s,
+                             state, prev_tokens, w1, hidden, f_rnn, walk.proj_buf,
+                             fc_step, walk.fix_rows, walk.fix_a31, new_state, latent, fix_cnt)
+    elif step_kind == "proj4a":
+        pbuf = walk.proj_buf if walk.proj_buf is not None else torch.empty((1, N_OUT), dtype=torch.bfloat16, device=state.device)
+        ext.step_proj_4ahead_gates(packs.w_s, packs.w_h, packs.w_f, packs.bias, pre_s,
+                                   state, prev_tokens, w1, hidden, f_rnn, pbuf, new_state, latent, fix_cnt)
+    else:
+        raise ValueError(f"Unknown step_kind {step_kind}")
+    return new_state, latent
+
+
+def parse_mode(mode: str) -> tuple[str, str]:
+    if mode == "bf16_nocert":
+        return "bf16_nocert", "nocert"
+    for pk in ("bf16_sep", "bf16_splitg", "c12_splitg"):
+        if mode.startswith(pk + "_"):
+            return pk, mode[len(pk) + 1:]
+    raise ValueError(f"Invalid N105_MODE: {mode}")
+
+
+def _begin_walk(packs: RnnHoistPacks, draft_hidden: Optional[torch.Tensor], f_rnn: torch.Tensor) -> Optional[WalkCtx]:
+    if (
+        draft_hidden is None
+        or not draft_hidden.is_cuda
+        or draft_hidden.dim() != 3
+        or draft_hidden.dtype != torch.bfloat16
+        or f_rnn.dtype != torch.bfloat16
+    ):
+        return None
+    bs, gamma, hid = draft_hidden.shape
+    if (
+        bs != 1
+        or gamma != GAMMA
+        or hid != HIDDEN
+        or f_rnn.shape != (1, HIDDEN)
+        or draft_hidden.stride(2) != 1
+        or draft_hidden.stride(1) % 8 != 0
+        or draft_hidden.data_ptr() % 16 != 0
+        or not f_rnn.is_contiguous()
+        or f_rnn.data_ptr() % 16 != 0
+    ):
+        return None
+    pre_kind, step_kind = parse_mode(_STATE["mode"])
+    return run_pre(packs, draft_hidden, f_rnn, pre_kind, _STATE["pre_nw"], need_split_bufs=(step_kind in ("split_coop8", "proj4a")))
+
+
+def _match_step(walk: Optional[WalkCtx], hidden: torch.Tensor, f_rnn: torch.Tensor, state: torch.Tensor,
+                prev_tokens: torch.Tensor, w1: torch.Tensor) -> int:
+    if (
+        walk is None
+        or hidden.dim() != 2
+        or hidden.shape != (1, HIDDEN)
+        or hidden.stride(1) != 1
+        or hidden.data_ptr() % 16 != 0
+        or f_rnn.data_ptr() != walk.f_ptr
+        or state.shape != (1, RANK)
+        or state.dtype != torch.bfloat16
+        or not state.is_contiguous()
+        or state.data_ptr() % 16 != 0
+        or prev_tokens.numel() != 1
+        or prev_tokens.dtype != torch.int64
+        or not w1.is_contiguous()
+        or w1.dtype != torch.bfloat16
+        or w1.data_ptr() % 16 != 0
+    ):
+        return -1
+    off = hidden.data_ptr() - walk.base_ptr
+    if off < 0 or off % walk.step_bytes != 0:
+        return -1
+    s = off // walk.step_bytes
+    return s if 0 <= s < walk.gamma else -1
+
+
+def install(mtp_mod) -> bool:
+    if os.environ.get("N105_RNNHOIST", "") != "1":
+        return False
+    if _STATE["installed"]:
+        return True
+
+    _STATE["mode"] = os.environ.get("N105_MODE") or "bf16_splitg_coop6_1t"
+    _STATE["pre_nw"] = int(os.environ.get("N105_PRE_NW") or "8")
+    _STATE["check"] = os.environ.get("N105_CHECK", "") == "1"
+    pre_kind, step_kind = parse_mode(_STATE["mode"])
+
+    head_cls = mtp_mod.Inkling2MTPHead
+    model_cls = mtp_mod.Inkling2ForConditionalGenerationMTP
+    orig_attach = model_cls.attach_shared_modules
+    orig_init = head_cls.init_state
+    orig_rnn = head_cls._rnn_step
+
+    def attach_shared_modules(self, *args, **kwargs):
+        out = orig_attach(self, *args, **kwargs)
+        mh = self.markov_head
+        if (
+            mh.markov_rank == RANK
+            and mh.hidden_size == HIDDEN
+            and mh.rnn_proj.weight.is_cuda
+            and mh.rnn_proj.weight.dtype == torch.bfloat16
+            and mh.rnn_proj.weight.shape == (N_OUT, K_TOTAL)
+        ):
+            t0 = time.time()
+            cache_dir = os.environ.get("N105_BUILD_DIR") or "/root/.cache/n105_rnnhoist_b3"
+            build_ext(build_dir=cache_dir)
+            packs = pack_rnn_weights(mh.rnn_proj.weight, mh.rnn_proj.bias, include_c12=pre_kind.startswith("c12"))
+            mh._n105_packs = packs
+            mh._n105_walk = None
+            dev = mh.rnn_proj.weight.device
+            wh = torch.zeros((1, GAMMA, HIDDEN), dtype=torch.bfloat16, device=dev)
+            wf = torch.zeros((1, HIDDEN), dtype=torch.bfloat16, device=dev)
+            ws = torch.zeros((1, RANK), dtype=torch.bfloat16, device=dev)
+            wt = torch.zeros((1,), dtype=torch.int64, device=dev)
+            walk = _begin_walk(packs, wh, wf)
+            assert walk is not None
+            run_step(packs, walk, 0, ws, wt, mh.markov_w1.weight, wh[:, 0], wf, step_kind)
+            if _STATE["check"]:
+                _STATE["chk_dev"] = torch.zeros(4, dtype=torch.int64, device=dev)
+                _STATE["fix_dev"] = torch.zeros(1, dtype=torch.int32, device=dev)
+                _start_check_reporter()
+            print(
+                "N105RNN " + json.dumps({
+                    "state": "ready",
+                    "mode": _STATE["mode"],
+                    "pre_nw": _STATE["pre_nw"],
+                    "check": _STATE["check"],
+                    "packed_mb": round(packs.nbytes() / 1e6, 2),
+                    "prepare_s": round(time.time() - t0, 2),
+                }, sort_keys=True),
+                file=sys.stderr,
+                flush=True,
+            )
+        else:
+            print("N105RNN " + json.dumps({"state": "skipped", "shape": list(mh.rnn_proj.weight.shape)}),
+                  file=sys.stderr, flush=True)
+        return out
+
+    def init_state(self, hidden_states):
+        st = orig_init(self, hidden_states)
+        packs = getattr(self, "_n105_packs", None)
+        self._n105_walk = None
+        if packs is not None and isinstance(st, tuple) and len(st) == 2:
+            walk = _begin_walk(packs, hidden_states, st[1])
+            self._n105_walk = walk
+            if walk is not None:
+                _STATE["reach"]["hoist_walks"] += 1
+                if torch.cuda.is_current_stream_capturing():
+                    _STATE["reach"]["captured_walks"] += 1
+                    if not _STATE["logged_capture"]:
+                        _STATE["logged_capture"] = True
+                        print("N105RNN " + json.dumps({"state": "captured", "mode": _STATE["mode"],
+                                                       "reach": dict(_STATE["reach"])}, sort_keys=True),
+                              file=sys.stderr, flush=True)
+        return st
+
+    def _rnn_step(self, state, prev_tokens, hidden, f_rnn):
+        packs = getattr(self, "_n105_packs", None)
+        walk = getattr(self, "_n105_walk", None)
+        s = _match_step(walk, hidden, f_rnn, state, prev_tokens, self.markov_w1.weight) if packs is not None else -1
+        if s < 0:
+            _STATE["reach"]["fallback_steps"] += 1
+            if not _STATE["logged_fallback"]:
+                _STATE["logged_fallback"] = True
+                print("N105RNN " + json.dumps({"state": "fallback_active", "bs": int(state.shape[0]),
+                                               "in_capture": bool(torch.cuda.is_current_stream_capturing())},
+                                              sort_keys=True),
+                      file=sys.stderr, flush=True)
+            return orig_rnn(self, state, prev_tokens, hidden, f_rnn)
+        _STATE["reach"]["hoist_steps"] += 1
+        if not _STATE["logged_hoist"] and _STATE["reach"]["hoist_steps"] >= GAMMA:
+            _STATE["logged_hoist"] = True
+            print("N105RNN " + json.dumps({"state": "hoist_active", "mode": _STATE["mode"],
+                                           "in_capture": bool(torch.cuda.is_current_stream_capturing()),
+                                           "reach": dict(_STATE["reach"])}, sort_keys=True),
+                  file=sys.stderr, flush=True)
+        ns, lat = run_step(
+            packs, walk, s, state, prev_tokens, self.markov_w1.weight, hidden, f_rnn,
+            step_kind, fix_cnt=_STATE["fix_dev"] if _STATE["check"] else None,
+        )
+        if _STATE["check"] and _STATE["chk_dev"] is not None:
+            ref_ns, ref_lat = orig_rnn(self, state, prev_tokens, hidden, f_rnn)
+            ctl_ns, ctl_lat = run_step(
+                packs, walk, s, state, prev_tokens, self.markov_w1.weight, hidden, f_rnn,
+                step_kind, pre_override=torch.zeros_like(walk.pre[s]),
+            )
+            c = _STATE["chk_dev"]
+            c[0] += 1
+            c[1] += (ns.view(torch.int16) != ref_ns.view(torch.int16)).sum()
+            c[2] += (lat.view(torch.int16) != ref_lat.view(torch.int16)).sum()
+            c[3] += (ctl_lat.view(torch.int16) != ref_lat.view(torch.int16)).sum()
+        return ns, lat
+
+    model_cls.attach_shared_modules = attach_shared_modules
+    head_cls.init_state = init_state
+    head_cls._rnn_step = _rnn_step
+    _STATE["installed"] = True
+    print("N105RNN " + json.dumps({"state": "installed", "mode": _STATE["mode"],
+                                   "pre_nw": _STATE["pre_nw"], "check": _STATE["check"]}, sort_keys=True),
+          file=sys.stderr, flush=True)
+    return True
+
+
+def _start_check_reporter():
+    def _loop():
+        while True:
+            time.sleep(20)
+            c = _STATE["chk_dev"]
+            fc = _STATE["fix_dev"]
+            if c is None:
+                continue
+            try:
+                v = c.cpu().tolist()
+                fv = int(fc.cpu().item()) if fc is not None else 0
+                tot_rows = max(1, v[0] * N_OUT)
+                print(
+                    "N105CHECK " + json.dumps({
+                        "steps": v[0],
+                        "state_mism": v[1],
+                        "latent_mism": v[2],
+                        "ctl_latent_mism": v[3],
+                        "fixup_rows": fv,
+                        "fixup_pct": round(100.0 * fv / tot_rows, 2) if v[0] > 0 else 0.0,
+                        "reach": dict(_STATE["reach"]),
+                    }, sort_keys=True),
+                    file=sys.stderr,
+                    flush=True,
+                )
+            except Exception:
+                pass
+    t = threading.Thread(target=_loop, daemon=True, name="n105_check_reporter")
+    t.start()
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n13_attn_global.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n13_attn_global.py
new file mode 100644
index 0000000000000000000000000000000000000000..6e95b6d0f2784b2954c82fcae9c7ede045d80d20
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n13_attn_global.py
@@ -0,0 +1,37 @@
+"""n13 (inkling2-spark attn-global seat): route the global-layer (non-local) rel-bias prefill FA4 SM120 kernel to
+FlashAttentionForwardSm120BandSplit (n13_fwd.py). Scope: has_bias, not is_local, not pack_gqa, plain
+FlashAttentionForwardSm120 only, any split count (the served call is a 1-split split-KV launch: FP32 output) (sliding
+layers, padded/packed verify and decode kernels are untouched). No switch: the
+kernel file is mounted as fa4_sm120/n13_fwd.py, which changes the FA4 CuTe AOT cache fingerprint (it hashes the fa4_sm120
+sources, not this file), so a switch would let two different kernels share one cache key. Control = the parent recipe.
+Imported once from the patched inkling2_attn.py."""
+import logging
+
+_INSTALLED = False
+logger = logging.getLogger(__name__)
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED:
+        return
+    from sglang.kernels.ops.attention.fa4_sm120 import runtime as _rt
+    from sglang.kernels.ops.attention.fa4_sm120.flash_fwd import FlashAttentionForwardSm120
+    from sglang.kernels.ops.attention.fa4_sm120.n13_fwd import FlashAttentionForwardSm120BandSplit
+
+    orig = _rt.Sm120ForwardPolicy.make_kernel
+
+    def make_kernel(**kw):
+        k = orig(**kw)
+        if (type(k) is FlashAttentionForwardSm120 and kw.get("has_bias") and not kw.get("is_local")
+                and not kw.get("pack_gqa") and not k._uses_split_pv_warps()):
+            k.__class__ = FlashAttentionForwardSm120BandSplit
+            make_kernel.hits += 1
+            logger.warning("n13: FA4 SM120 band-split kernel built (global rel-bias prefill, tile %s x %s, hit %d)",
+                           k.tile_m, k.tile_n, make_kernel.hits)
+        return k
+
+    make_kernel.hits = 0
+    _rt.Sm120ForwardPolicy.make_kernel = staticmethod(make_kernel)
+    _INSTALLED = True
+    logger.warning("n13: global-layer band-split FA4 hook installed")
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n13_fwd.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n13_fwd.py
new file mode 100644
index 0000000000000000000000000000000000000000..407e0b558153c2e8dd39aedce934a372bdbd34c3
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n13_fwd.py
@@ -0,0 +1,655 @@
+# Generated by work_attng/gen_n13.py from the image's sglang/kernels/ops/attention/fa4_sm120/flash_fwd.py (md5 f7161e38).
+"""n13 (inkling2-spark attn-global seat): FlashAttentionForwardSm120BandSplit = the image's SM120 FA4 forward kernel with the
+relative-bias specialization's unmasked-key loop split in two: the blocks inside the bias band (apply_bias True as a compile-time
+constant) and the far blocks (apply_bias False as a compile-time constant). The served kernel keeps apply_bias as a runtime branch
+in one loop, which keeps the bias path's state live across the far blocks (ptxas: 255 registers, spill reloads in the far loop
+body). Every block is visited in the same order with the same instructions on its values, so outputs are meant to be bitwise
+equal to the served kernel's (checked on the GPU). Only mma() is replaced; everything else is inherited."""
+from sglang.kernels.ops.attention.fa4_sm120 import flash_fwd as _base
+globals().update({k: v for k, v in vars(_base).items() if not k.startswith("__")})
+from sglang.kernels.ops.attention.fa4_sm120.flash_fwd import FlashAttentionForwardSm120
+
+N13_BIAS_PLAIN = True  # frozen (mb2/mb3 choice n13ep)
+N13_FAR_ADDR = True  # frozen
+
+
+class FlashAttentionForwardSm120BandSplit(FlashAttentionForwardSm120):
+    """SM120 FA4 forward with the bias-band / far-key mainloop split (n13)."""
+
+    def _setup_attributes(self):
+        super()._setup_attributes()
+        if const_expr(self.has_bias and N13_BIAS_PLAIN):
+            # n13: unswizzled row-major bias tile (same values; TMA SWIZZLE_NONE). Each thread's 64 bias reads become
+            # immediate offsets from two row bases instead of 64 hoisted swizzled addresses held across the mainloop.
+            atom = cute.make_composed_layout(
+                cute.make_swizzle(0, 4, 3), 0, cute.make_layout((8, self.tile_n), stride=(self.tile_n, 1))
+            )
+            self.sBias_layout = cute.tile_to_shape(
+                atom, (self.bias_block_size, self.tile_n, self.num_stages), (0, 1, 2)
+            )
+
+    @cute.jit
+    def mma(
+        self,
+        mQ: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        sQ: cute.Tensor,
+        sK: cute.Tensor,
+        sV: cute.Tensor,
+        sO: cute.Tensor,
+        sP: Optional[cute.Tensor],
+        sRowScale: Optional[cute.Tensor],
+        sLSE: Optional[cute.Tensor],
+        learnable_sink: Optional[cute.Tensor],
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        gmem_tiled_copy_Q: cute.TiledCopy,
+        gmem_tiled_copy_O: cute.TiledCopy,
+        tiled_mma_qk: cute.TiledMma,
+        tiled_mma_pv: cute.TiledMma,
+        tidx: Int32,
+        softmax_scale_log2: Float32,
+        softmax_scale: Optional[Float32],
+        consumer_state: PipelineState,
+        block_info: BlockInfo,
+        seqlen: SeqlenInfoQK,
+        n_block_min: Int32,
+        n_block_max: Int32,
+        m_block: Int32,
+        head_idx: Int32,
+        batch_idx: Int32,
+        split_idx: Int32,
+        is_qk_owner: cutlass.Constexpr[bool],
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+        sBias: Optional[cute.Tensor] = None,
+        pipeline_bias: Optional[PipelineAsync] = None,
+        base_softmax_scale: Optional[Float32] = None,
+    ):
+        mQ_cur = seqlen.offset_batch_Q(mQ, batch_idx, dim=3)[None, None, head_idx]
+        if const_expr(not self.pack_gqa):
+            gQ = cute.local_tile(mQ_cur, (self.tile_m, self.tile_hdim), (m_block, 0))
+        num_bias_loads = Int32(0)
+        if const_expr(self.has_bias):
+            _, num_bias_loads = self._get_bias_load_info(
+                block_info,
+                seqlen,
+                m_block,
+                n_block_min,
+                n_block_max,
+            )
+
+        split_pv_warps = self._uses_split_pv_warps()
+        thr_mma_pv = tiled_mma_pv.get_slice(tidx)
+        acc_shape_O = thr_mma_pv.partition_shape_C((self.tile_m, self.tile_hdimv))
+        acc_O = cute.make_rmem_tensor(acc_shape_O, Float32)
+        acc_O.fill(0.0)
+
+        smem_copy_atom_QK = cute.make_copy_atom(
+            warp.LdMatrix8x8x16bOp(transpose=False, num_matrices=4), self.dtype
+        )
+        smem_copy_atom_V = cute.make_copy_atom(
+            warp.LdMatrix8x8x16bOp(transpose=True, num_matrices=4), self.dtype
+        )
+        smem_thr_copy_V = utils.make_tiled_copy_B(
+            smem_copy_atom_V, tiled_mma_pv
+        ).get_slice(tidx)
+        if const_expr(split_pv_warps):
+            tOrV = thr_mma_pv.make_fragment_B(thr_mma_pv.partition_B(sV[None, None, 0]))
+            tOsV = smem_thr_copy_V.partition_S(sV)
+            smem_thr_copy_P = utils.make_tiled_copy_A(
+                smem_copy_atom_QK, tiled_mma_pv
+            ).get_slice(tidx)
+            tPsP = smem_thr_copy_P.partition_S(sP)
+            tOrP = thr_mma_pv.make_fragment_A(thr_mma_pv.partition_A(sP[None, None, 0]))
+        if const_expr(not split_pv_warps or is_qk_owner):
+            thr_mma_qk = tiled_mma_qk.get_slice(tidx)
+            smem_thr_copy_Q = utils.make_tiled_copy_A(
+                smem_copy_atom_QK, tiled_mma_qk
+            ).get_slice(tidx)
+            smem_thr_copy_K = utils.make_tiled_copy_B(
+                smem_copy_atom_QK, tiled_mma_qk
+            ).get_slice(tidx)
+            if const_expr(split_pv_warps):
+                tSrQ = thr_mma_qk.make_fragment_A(thr_mma_qk.partition_A(sQ))
+                tSrK = thr_mma_qk.make_fragment_B(
+                    thr_mma_qk.partition_B(sK[None, None, 0])
+                )
+                tSsQ = smem_thr_copy_Q.partition_S(sQ)
+                tSsK = smem_thr_copy_K.partition_S(sK)
+                smem_store_atom_P = utils.get_smem_store_atom(
+                    120,
+                    self.dtype,
+                )
+                smem_thr_store_P = cute.make_tiled_copy_C(
+                    smem_store_atom_P, tiled_mma_qk
+                ).get_slice(tidx)
+                tPsP_store = smem_thr_store_P.partition_D(sP)
+
+        if const_expr(not split_pv_warps or is_qk_owner):
+            gmem_thr_copy_Q = gmem_tiled_copy_Q.get_slice(tidx)
+            if const_expr(not self.pack_gqa):
+                self.load_Q(
+                    gmem_thr_copy_Q,
+                    gQ,
+                    sQ,
+                    m_block,
+                    seqlen=seqlen.seqlen_q,
+                    headdim=mQ.shape[1],
+                )
+            else:
+                PackGQA(
+                    self.tile_m,
+                    self.tile_hdim,
+                    self.check_hdim_oob,
+                    self.qhead_per_kvhead,
+                ).load_Q(
+                    mQ_cur,
+                    sQ,
+                    gmem_tiled_copy_Q,
+                    tidx,
+                    m_block,
+                    seqlen.seqlen_q,
+                )
+            cute.arch.cp_async_commit_group()
+            cute.arch.cp_async_wait_group(0)
+            cute.arch.barrier(
+                barrier_id=1,
+                number_of_threads=self.num_Q_load_threads,
+            )
+
+        if const_expr(not split_pv_warps or is_qk_owner):
+            if const_expr(self._uses_n_distributed_qk()):
+                softmax = None
+                mma_params = SimpleNamespace(
+                    thr_mma_qk=thr_mma_qk,
+                    thr_mma_pv=thr_mma_pv,
+                    tSrQ=tSrQ,
+                    tSrK=tSrK,
+                    tOrV=tOrV,
+                    acc_O=acc_O,
+                    tOrP=tOrP,
+                    tidx=tidx,
+                )
+                smem_copy_params = SimpleNamespace(
+                    smem_thr_copy_Q=smem_thr_copy_Q,
+                    smem_thr_copy_K=smem_thr_copy_K,
+                    smem_thr_copy_V=smem_thr_copy_V,
+                    tOsV=tOsV,
+                    smem_thr_copy_P=smem_thr_copy_P,
+                    tPsP=tPsP,
+                    smem_thr_store_P=(
+                        smem_thr_store_P if const_expr(self.split_qk_n) else None
+                    ),
+                    tPsP_store=(tPsP_store if const_expr(self.split_qk_n) else None),
+                    sQ=sQ,
+                    sK=sK,
+                    sP=sP,
+                    sRowScale=sRowScale,
+                    sLSE=sLSE,
+                    softmax_scale_log2=softmax_scale_log2,
+                    softmax_scale=softmax_scale,
+                )
+                if const_expr(self.split_qk_n):
+                    mask = AttentionMask(
+                        self.tile_m,
+                        self.tile_n,
+                        seqlen,
+                        block_info.window_size_left,
+                        block_info.window_size_right,
+                        (self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1),
+                        enable_r2p_optimization=False,
+                    )
+                    mask_fn = partial(
+                        mask.apply_mask,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        thr_mma=thr_mma_qk,
+                        mask_causal=self.is_causal,
+                        mask_local=self.is_local,
+                        aux_data=aux_data,
+                        fastdiv_mods=(
+                            fastdiv_mods
+                            if const_expr(self.mask_mod is not None)
+                            else None
+                        ),
+                    )
+                else:
+                    mask_fn = None
+            else:
+                softmax = Softmax.create(
+                    softmax_scale_log2,
+                    num_rows=acc_O.shape[0][0] * acc_O.shape[1],
+                    softmax_scale=softmax_scale,
+                )
+                softmax.reset()
+                if const_expr(split_pv_warps):
+                    mma_params = SimpleNamespace(
+                        thr_mma_qk=thr_mma_qk,
+                        thr_mma_pv=thr_mma_pv,
+                        tSrQ=tSrQ,
+                        tSrK=tSrK,
+                        tOrV=tOrV,
+                        acc_O=acc_O,
+                        tOrP=tOrP,
+                    )
+                    smem_copy_params = SimpleNamespace(
+                        smem_thr_copy_Q=smem_thr_copy_Q,
+                        smem_thr_copy_K=smem_thr_copy_K,
+                        smem_thr_copy_V=smem_thr_copy_V,
+                        tSsQ=tSsQ,
+                        tSsK=tSsK,
+                        tOsV=tOsV,
+                        smem_thr_store_P=smem_thr_store_P,
+                        tPsP_store=tPsP_store,
+                        smem_thr_copy_P=smem_thr_copy_P,
+                        tPsP=tPsP,
+                        sRowScale=sRowScale,
+                        sLSE=sLSE,
+                    )
+                else:
+                    mma_params = SimpleNamespace(
+                        thr_mma_qk=thr_mma_qk,
+                        thr_mma_pv=thr_mma_pv,
+                        acc_O=acc_O,
+                    )
+                    smem_copy_params = SimpleNamespace(
+                        smem_thr_copy_Q=smem_thr_copy_Q,
+                        smem_thr_copy_K=smem_thr_copy_K,
+                        smem_thr_copy_V=smem_thr_copy_V,
+                        sQ=sQ,
+                        sK=sK,
+                        sV=sV,
+                    )
+                mask = AttentionMask(
+                    self.tile_m,
+                    self.tile_n,
+                    seqlen,
+                    block_info.window_size_left,
+                    block_info.window_size_right,
+                    self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1,
+                )
+                mask_fn = partial(
+                    mask.apply_mask,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    thr_mma=thr_mma_qk,
+                    mask_causal=self.is_causal,
+                    mask_local=self.is_local,
+                    aux_data=aux_data,
+                    fastdiv_mods=(
+                        fastdiv_mods if const_expr(self.mask_mod is not None) else None
+                    ),
+                )
+        else:
+            softmax = None
+            mma_params = SimpleNamespace(
+                thr_mma_pv=thr_mma_pv,
+                tOrV=tOrV,
+                acc_O=acc_O,
+                tOrP=tOrP,
+            )
+            smem_copy_params = SimpleNamespace(
+                smem_thr_copy_V=smem_thr_copy_V,
+                tOsV=tOsV,
+                smem_thr_copy_P=smem_thr_copy_P,
+                tPsP=tPsP,
+                sRowScale=sRowScale,
+                sLSE=sLSE,
+            )
+            mask_fn = None
+        if const_expr(split_pv_warps and not self._uses_n_distributed_qk()):
+            compute_one_n_block = (
+                self.compute_one_n_block_split_pv_owner
+                if const_expr(is_qk_owner)
+                else self.compute_one_n_block_split_pv_helper
+            )
+        elif const_expr(not self._uses_n_distributed_qk()):
+            compute_one_n_block = self.compute_one_n_block
+        if const_expr(not split_pv_warps or is_qk_owner):
+            mask_fn_seqlen = partial(mask_fn, mask_mod=self.mask_mod, mask_seqlen=True)
+            mask_fn_no_seqlen = partial(
+                mask_fn, mask_mod=self.mask_mod, mask_seqlen=False
+            )
+        else:
+            mask_fn_seqlen = None
+            mask_fn_no_seqlen = None
+        n_block = cutlass.max(n_block_max - 1, 0)
+        if const_expr(self._uses_n_distributed_qk()):
+            consumer_state = self.compute_one_n_block_split_pv_distributed_qk(
+                n_block,
+                consumer_state,
+                mma_params,
+                smem_copy_params,
+                None,
+                pipeline_k,
+                pipeline_v,
+                score_mod=self.score_mod,
+                batch_idx=batch_idx,
+                head_idx=head_idx,
+                m_block=m_block,
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+                mask_fn=mask_fn_seqlen,
+                is_first_n_block=True,
+                is_last_n_block=n_block == n_block_min,
+                learnable_sink=learnable_sink,
+                split_idx=split_idx,
+            )
+            for n_tile in cutlass.range(n_block - n_block_min, unroll=1):
+                consumer_state = self.compute_one_n_block_split_pv_distributed_qk(
+                    n_block - n_tile - 1,
+                    consumer_state,
+                    mma_params,
+                    smem_copy_params,
+                    None,
+                    pipeline_k,
+                    pipeline_v,
+                    score_mod=self.score_mod,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    seqlen=seqlen,
+                    aux_data=aux_data,
+                    fastdiv_mods=fastdiv_mods,
+                    mask_fn=mask_fn_no_seqlen,
+                    is_last_n_block=n_block - n_tile - 1 == n_block_min,
+                    learnable_sink=learnable_sink,
+                    split_idx=split_idx,
+                )
+        else:
+            consumer_state = compute_one_n_block(
+                n_block,
+                consumer_state,
+                mma_params,
+                smem_copy_params,
+                softmax,
+                pipeline_k,
+                pipeline_v,
+                score_mod=self.score_mod,
+                sBias=sBias,
+                pipeline_bias=pipeline_bias,
+                base_softmax_scale=base_softmax_scale,
+                apply_bias=n_block >= n_block_max - num_bias_loads,
+                batch_idx=batch_idx,
+                head_idx=head_idx,
+                m_block=m_block,
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+                mask_fn=mask_fn_seqlen,
+                is_first_n_block=True,
+            )
+            n_block_upper = n_block
+            if const_expr(self.is_causal or self.is_local):
+                n_block_min_causal_local_mask = (
+                    block_info.get_n_block_min_causal_local_mask(
+                        seqlen, m_block, n_block_min
+                    )
+                )
+                for n_tile in cutlass.range(
+                    n_block_max - 1 - n_block_min_causal_local_mask, unroll=1
+                ):
+                    n_block = n_block_max - 2 - n_tile
+                    consumer_state = compute_one_n_block(
+                        n_block,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=n_block >= n_block_max - num_bias_loads,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_seqlen,
+                    )
+                n_block_upper = cutlass.min(
+                    n_block_upper, n_block_min_causal_local_mask
+                )
+            n_block_min_before_local_mask = (
+                block_info.get_n_block_min_before_local_mask(
+                    seqlen, m_block, n_block_min
+                )
+            )
+            if const_expr(self.has_bias):
+                # n13: blocks [n_far_top, n_block_upper) are inside the bias band (apply_bias True for every one of
+                # them in the served loop), blocks below n_far_top are outside it (apply_bias False). Same blocks,
+                # same order, same arithmetic; the bias branch is resolved at compile time in each loop.
+                n_far_top = cutlass.max(
+                    cutlass.min(n_block_upper, n_block_max - num_bias_loads),
+                    n_block_min_before_local_mask,
+                )
+                for n_tile in cutlass.range(n_block_upper - n_far_top, unroll=1):
+                    consumer_state = compute_one_n_block(
+                        n_block_upper - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=True,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+                smem_copy_params_far = smem_copy_params
+                if const_expr(N13_FAR_ADDR):
+                    # n13: fresh ldmatrix address set for the far loop. tidx_far == tidx at run time (seqlen_k < 2**30),
+                    # but ptxas cannot prove it, so these addresses are not the band loops' (spilled) values.
+                    tidx_far = tidx + (seqlen.seqlen_k >> 30)
+                    smem_copy_params_far = SimpleNamespace(
+                        smem_thr_copy_Q=utils.make_tiled_copy_A(smem_copy_atom_QK, tiled_mma_qk).get_slice(tidx_far),
+                        smem_thr_copy_K=utils.make_tiled_copy_B(smem_copy_atom_QK, tiled_mma_qk).get_slice(tidx_far),
+                        smem_thr_copy_V=utils.make_tiled_copy_B(smem_copy_atom_V, tiled_mma_pv).get_slice(tidx_far),
+                        sQ=sQ,
+                        sK=sK,
+                        sV=sV,
+                    )
+                for n_tile in cutlass.range(
+                    n_far_top - n_block_min_before_local_mask, unroll=1
+                ):
+                    consumer_state = compute_one_n_block(
+                        n_far_top - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params_far,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=False,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+            else:
+                for n_tile in cutlass.range(
+                    n_block_upper - n_block_min_before_local_mask, unroll=1
+                ):
+                    consumer_state = compute_one_n_block(
+                        n_block_upper - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=(n_block_upper - n_tile - 1 >= n_block_max - num_bias_loads),
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+            if const_expr(self.is_local and block_info.window_size_left is not None):
+                n_block_upper = cutlass.min(
+                    n_block_upper, n_block_min_before_local_mask
+                )
+                for n_tile in cutlass.range(n_block_upper - n_block_min, unroll=1):
+                    consumer_state = compute_one_n_block(
+                        n_block_upper - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=(
+                            n_block_upper - n_tile - 1 >= n_block_max - num_bias_loads
+                        ),
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+
+        if const_expr(self._uses_n_distributed_qk()):
+            cO = cute.make_identity_tensor((self.tile_m, self.tile_hdimv))
+            tOcO_mn_finalize = layout_utils.reshape_acc_to_mn(
+                thr_mma_pv.partition_C(cO)
+            )
+            num_rows_pv = acc_O.shape[0][0] * acc_O.shape[1]
+            row_scale_pv = cute.make_rmem_tensor(num_rows_pv, Float32)
+            lse = cute.make_rmem_tensor(num_rows_pv, Float32)
+            for r in cutlass.range(cute.size(row_scale_pv), unroll_full=True):
+                row = tOcO_mn_finalize[r, 0][0]
+                row_scale_pv[r] = sRowScale[0, row]
+                lse[r] = sLSE[row]
+            self._rescale_O(acc_O, row_scale_pv)
+        elif const_expr(split_pv_warps):
+            if const_expr(is_qk_owner):
+                sink_val = None
+                if const_expr(learnable_sink is not None):
+                    if const_expr(not self.pack_gqa):
+                        sink_val = Float32(learnable_sink[head_idx])
+                    else:
+                        sink_val = cute.make_rmem_tensor_like(softmax.row_max, Float32)
+                        cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                        tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                            thr_mma_qk.partition_C(cS)
+                        )
+                        for r in cutlass.range(cute.size(sink_val), unroll_full=True):
+                            row = m_block * self.tile_m + tScS_mn_finalize[r][0]
+                            q_head_idx = (
+                                row % self.qhead_per_kvhead
+                                + head_idx * self.qhead_per_kvhead
+                            )
+                            sink_val[r] = Float32(learnable_sink[q_head_idx])
+                if const_expr(self.is_split_kv and learnable_sink is not None):
+                    if const_expr(not self.pack_gqa):
+                        sink_val = sink_val if split_idx == 0 else -Float32.inf
+                    elif split_idx != 0:
+                        sink_val.fill(-Float32.inf)
+                row_scale_qk = softmax.finalize(sink_val=sink_val)
+                cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                    thr_mma_qk.partition_C(cS)
+                )
+                if tScS_mn_finalize[0][1] == 0:
+                    for r in cutlass.range(cute.size(row_scale_qk), unroll_full=True):
+                        row = tScS_mn_finalize[r][0]
+                        sRowScale[2, row] = row_scale_qk[r]
+                        sLSE[row] = softmax.row_sum[r]
+                cute.arch.fence_view_async_shared()
+            cute.arch.barrier(
+                barrier_id=int(NamedBarrierFwd.PFull),
+                number_of_threads=self.num_mma_threads,
+            )
+            cO = cute.make_identity_tensor((self.tile_m, self.tile_hdimv))
+            tOcO_mn_finalize = layout_utils.reshape_acc_to_mn(
+                thr_mma_pv.partition_C(cO)
+            )
+            num_rows_pv = acc_O.shape[0][0] * acc_O.shape[1]
+            row_scale_pv = cute.make_rmem_tensor(num_rows_pv, Float32)
+            lse = cute.make_rmem_tensor(num_rows_pv, Float32)
+            for r in cutlass.range(cute.size(row_scale_pv), unroll_full=True):
+                row = tOcO_mn_finalize[r, 0][0]
+                row_scale_pv[r] = sRowScale[2, row]
+                lse[r] = sLSE[row]
+            self._rescale_O(acc_O, row_scale_pv)
+        else:
+            sink_val = None
+            if const_expr(learnable_sink is not None):
+                if const_expr(not self.pack_gqa):
+                    sink_val = Float32(learnable_sink[head_idx])
+                else:
+                    sink_val = cute.make_rmem_tensor_like(softmax.row_max, Float32)
+                    cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                    tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                        thr_mma_qk.partition_C(cS)
+                    )
+                    for r in cutlass.range(cute.size(sink_val), unroll_full=True):
+                        row = m_block * self.tile_m + tScS_mn_finalize[r][0]
+                        q_head_idx = (
+                            row % self.qhead_per_kvhead
+                            + head_idx * self.qhead_per_kvhead
+                        )
+                        sink_val[r] = Float32(learnable_sink[q_head_idx])
+            if const_expr(self.is_split_kv and learnable_sink is not None):
+                if const_expr(not self.pack_gqa):
+                    sink_val = sink_val if split_idx == 0 else -Float32.inf
+                elif split_idx != 0:
+                    sink_val.fill(-Float32.inf)
+            row_scale = softmax.finalize(sink_val=sink_val)
+            softmax.rescale_O(acc_O, row_scale)
+            lse = softmax.row_sum
+
+        self.epilogue(
+            acc_O,
+            lse,
+            mO,
+            mLSE,
+            sO,
+            seqlen,
+            gmem_tiled_copy_O,
+            None,
+            tiled_mma_pv,
+            tidx,
+            m_block,
+            head_idx,
+            batch_idx,
+            split_idx,
+        )
+        return consumer_state
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n140_kern.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n140_kern.py
new file mode 100644
index 0000000000000000000000000000000000000000..6e4165665d179127a529cf70cc2a7bfe203e07a8
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n140_kern.py
@@ -0,0 +1,641 @@
+"""n140: INT6 screen for n78's certified greedy verify LM head (inkling2-spark decode seat, 2026-11-24).
+
+WHAT CHANGES vs n78 S8 (work_packed/n78/n78_kern.py 77ba2186, served in S3 .. S5b): only K1, the screen. n78's K0 (x group norms),
+K2 (reduce), the served softcap, K3 (select) and K4 (E1 exact pass = the served _gemv_kernel body) run unchanged, on the same
+buffers, so the certificate argument of 'RULE n78 mb' + amendments 1-2 carries over word for word:
+  - the quantized head D is the one n78's pack(W, 6) makes (q in [-31, 31], FP16 scale per (id, 192-group) rounded up), and the
+    bound tables R (FP16 ||W_vg - D_vg|| rounded up) and N (FP32 max(||W_v||, ||D_v||) rounded up) are n78's: pack6f() builds them
+    with the same arithmetic and tests/test_n140_cpu.py T1 checks them bitwise against n78_kern.pack(W, 6). mb2's S6 row (the same
+    D / R / N on 1,649 real bs-1 verify slots: 0 bound violations, 0 token misses, tiles p50 9 / p90 64 / max 5,868 / mean 47.3,
+    not certifiable 0) is therefore the real-row tile evidence for this form;
+  - the bound formula is n78 K1's: B = (qterm * sum_g ||x_g|| R_vg + cn N_v ||x||) (1 + 2^-18), slop = (|S| + B) 2^-20 + 1e-30,
+    lo = S - B - slop, hi = S + B + slop, cn = 2 C_ACC(K); per (row, 32-id tile) FB = max hi over real ids, LOC = max lo over
+    real ids, BAD = any non-finite S or B; ADDED guard: BAD also when ||x|| (K0's rounded-up norm) of a live row is outside
+    [2^-10, 2^20] (DESIGN.md sec 2: below 2^-10 the absolute slop no longer covers squares that underflow in K0).
+  - only S changes: FP32 S = sum_g sc_g * (MMA chain over the group's 12 k16 steps), a shorter-chain order than S6's Triton dot,
+    inside the same C_ACC model (DESIGN.md sec 2 (ii)); the mb re-checks S against FP64 x.D on every row and id.
+
+THE SCREEN (CUDA, built at prepare time with torch load_inline like n75 build 2): one CTA per 32-id tile (grid V / 32), 12 warps,
+warp g = the 192-value group g, 4 n8 sub-tiles x 3 64-K steps x 4 mma.sync.m16n8k16 (BF16 in, FP32 acc) per warp; A = x rows
+(rows >= M zero), B = the INT6 weights decoded in registers: (0x4300 | u) is the BF16 128 + u (u = q + 32 in [1, 63]) and one
+bf16x2 subtract of 160 gives q exactly. Stream in B-fragment order: per (tile, group) a 4,608-byte block of 9 x 512-byte warp
+loads (16 B per lane): chunks 0-5 the low nibbles, chunks 6-8 the high 2-bit pairs. Inside each 16-wide MMA the k slots of lane
+quad t are mapped to 16 contiguous k (base + 16 t + 4 j4 + {0, 1, 2, 3}) for both A and B, so each lane's x and weights are
+contiguous (the dot is order-free; the bound covers any order). Weights read once (ld.global.cs), x through the read-only path.
+Bytes: 347.4 MB stream + n78's tables (sc 4.8, R 4.8, N 0.8) = 357.8 MB, vs S8's 473.6 MB.
+
+E3 (second exact form, carried into the mb): n78's select stays; a one-CTA compaction writes the ascending list of needed tiles,
+and the exact kernel's CTA p computes LIST[p] (p < count) with the served body and writes -inf on tile p when NEED[p] is 0: the
+needed tiles start in the first wave instead of wherever their tile id falls in the 6,282-CTA sweep. Flag 0: LIST = 0..T-1, so
+CTA p computes tile p: the served schedule.
+
+CPU: build_emu() compiles the SAME source with g++ (no __CUDACC__): the per-lane fragment / decode / epilogue code is shared, the
+warp MMA is emulated from the PTX fragment layout. TESTF32 Cert6 runs the emulator screen + n78's Triton kernels interpreted."""
+import math
+import os
+
+import torch
+import triton
+import triton.language as tl
+
+try:  # served layout
+    from sglang.srt.models.inkling_common import n78_kern as K78
+except Exception:  # CPU tests / mb kit: n78_kern.py on sys.path
+    import n78_kern as K78
+
+GROUP, NG, TILE, KDIM = 192, 12, 32, 2304
+X_LO, X_HI = 2.0 ** -10, 2.0 ** 20   # live-row ||x|| domain of the certificate (outside: BAD -> every tile)
+
+CUDA_SRC = r'''
+// ============================================================ n140 INT6 screen: shared host / device part
+#include 
+#include 
+#ifdef __CUDACC__
+#include 
+#define N140_HD __host__ __device__ __forceinline__
+#else
+#include 
+#define N140_HD static inline
+struct uint4 { uint32_t x, y, z, w; };
+#endif
+
+namespace n140 {
+constexpr int KD = 2304, GROUP = 192, NG = 12, TILE = 32, SUB = 4, STEPS = 3, UNITS = 12, CHUNKS = 9, NWARP = 12, NT = 384;
+constexpr int RS = 40;   // smem floats per (group, row): 32 ids + 8 pad
+
+// uint4 index of chunk c of lane `lane` in the (tile, group) block of the B-fragment stream
+N140_HD size_t chunk_index(long tile, int g, int c, int lane) { return ((((size_t)tile * NG + g) * CHUNKS + c) << 5) + lane; }
+// unit U = 4 u + i (64-K step u, sub-tile i; step-major, so one step reads chunks 2u, 2u + 1 and 6 + u): nibble words in chunk
+// U >> 1, words 2 (U & 1) + {0, 1}; high word: chunk 6 + U / 4, word U % 4. Pair P = 0..7 of a unit holds values 2P, 2P + 1
+// (value j <-> k = 192 g + 64 u + 16 t + j, t = lane & 3; id = 32 tile + 8 i + lane / 4).
+N140_HD int unit_of(int i, int u) { return 4 * u + i; }
+N140_HD int nib_chunk(int U) { return U >> 1; }
+N140_HD int nib_word(int U, int P) { return 2 * (U & 1) + (P >> 2); }
+N140_HD int hi_chunk(int U) { return 6 + (U >> 2); }
+N140_HD int hi_word(int U) { return U & 3; }
+// bf16x2 (128 + u_{2P}, 128 + u_{2P+1}): low nibbles at bits 4p / 16 + 4p of the nibble word, high pairs at bits 2P / 16 + 2P
+N140_HD uint32_t magic_pair(uint32_t nib, uint32_t hiw, int P) {
+  const uint32_t lo = (nib >> (4 * (P & 3))) & 0x000F000Fu;
+  const uint32_t h2 = ((hiw >> (2 * P)) & 0x00030003u) << 4;
+  return lo | h2 | 0x43004300u;
+}
+N140_HD uint32_t word_of(const uint4& v, int w) { return w == 0 ? v.x : (w == 1 ? v.y : (w == 2 ? v.z : v.w)); }
+// x words of one 64-K step for one row: xa = values 0..7, xb = values 8..15 of the lane's 16; MMA j4: a_lo = word 2 j4, a_hi = 2 j4 + 1
+N140_HD uint32_t xword(const uint4& xa, const uint4& xb, int wi) { return wi < 4 ? word_of(xa, wi) : word_of(xb, wi - 4); }
+
+#if defined(__CUDA_ARCH__)
+N140_HD float mul_rn(float a, float b) { return __fmul_rn(a, b); }
+N140_HD float add_rn(float a, float b) { return __fadd_rn(a, b); }
+N140_HD float fma_rn(float a, float b, float c) { return __fmaf_rn(a, b, c); }
+#else
+N140_HD float mul_rn(float a, float b) { return a * b; }
+N140_HD float add_rn(float a, float b) { return a + b; }
+N140_HD float fma_rn(float a, float b, float c) { return std::fma(a, b, c); }
+#endif
+N140_HD float h2f(uint16_t h) {   // FP16 bits -> float (exact), no intrinsics: shared by host and device
+  const uint32_t s = (uint32_t)(h & 0x8000u) << 16, e = (h >> 10) & 0x1Fu, m = h & 0x3FFu;
+  float v;
+  if (e == 0) v = (float)m * 5.9604644775390625e-08f;                 // subnormal: m * 2^-24 (exact)
+  else if (e == 31) v = m ? NAN : INFINITY;
+  else { union { uint32_t u; float f; } c; c.u = ((e + 112u) << 23) | (m << 13); v = c.f; }
+  union { uint32_t u; float f; } r; r.f = v; r.u |= s; return r.f;
+}
+
+struct Epi { float s, b, lo, hi; int fin; };
+// The bound per (row, id), n78 K1's formula; explicit roundings so host and device agree bit for bit.
+N140_HD Epi epilogue(const float* part, const float* sc, const float* xg, const float* rr, float xn, float nv, float qterm, float cn) {
+  float s = 0.f, bq = 0.f;
+  for (int g = 0; g < NG; ++g) s = fma_rn(part[g], sc[g], s);
+  for (int g = 0; g < NG; ++g) bq = fma_rn(xg[g], rr[g], bq);
+  const float b = mul_rn(add_rn(mul_rn(qterm, bq), mul_rn(cn, mul_rn(xn, nv))), 1.0f + 3.814697265625e-06f);   // (1 + 2^-18)
+  const float slop = add_rn(mul_rn(add_rn(fabsf(s), b), 9.5367431640625e-07f), 1e-30f);                       // 2^-20
+  Epi r;
+  r.s = s; r.b = b;
+  r.lo = add_rn(add_rn(s, -b), -slop);
+  r.hi = add_rn(add_rn(s, b), slop);
+  r.fin = (s == s) && (fabsf(s) < INFINITY) && (b == b) && (fabsf(b) < INFINITY);
+  return r;
+}
+N140_HD int xn_in_domain(float xn) { return (xn >= 9.765625e-04f) && (xn <= 1048576.0f); }   // [2^-10, 2^20], NaN -> 0
+}  // namespace n140
+
+#ifdef __CUDACC__
+// ============================================================ device
+#include 
+#include 
+#include 
+
+namespace n140 {
+__device__ __forceinline__ void mma16816(float (&c)[4], uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t b0, uint32_t b1) {
+  asm volatile("mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, {%8,%9}, {%0,%1,%2,%3};\n"
+               : "+f"(c[0]), "+f"(c[1]), "+f"(c[2]), "+f"(c[3])
+               : "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(b0), "r"(b1));
+}
+// volatile asm loads keep program order against the volatile mma: the 9 weight loads issue first, each step's x loads are not
+// hoisted above the previous step's MMAs (register pressure: 2 CTAs of 384 threads per SM need <= 80 registers)
+__device__ __forceinline__ uint4 ld_cs_v4(const void* p) {
+  uint4 r;
+  asm volatile("ld.global.cs.v4.u32 {%0,%1,%2,%3}, [%4];\n" : "=r"(r.x), "=r"(r.y), "=r"(r.z), "=r"(r.w) : "l"(p));
+  return r;
+}
+__device__ __forceinline__ uint4 ld_nc_v4(const void* p) {
+  uint4 r;
+  asm volatile("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];\n" : "=r"(r.x), "=r"(r.y), "=r"(r.z), "=r"(r.w) : "l"(p));
+  return r;
+}
+__device__ __forceinline__ uint32_t sub160(uint32_t v) {   // bf16x2 (128 + u) - 160 = q, exact (|q| <= 31)
+  __nv_bfloat162 a = *reinterpret_cast<__nv_bfloat162*>(&v);
+  __nv_bfloat162 r = __hsub2(a, __floats2bfloat162_rn(160.f, 160.f));
+  return *reinterpret_cast(&r);
+}
+
+// MT 1: rows 0-7 (M <= 8); MT 2: rows 0-15. Grid = V / 32 CTAs (one per 32-id tile), NT threads.
+template 
+__global__ void __launch_bounds__(NT, 2) screen_kernel(
+    const uint16_t* __restrict__ x, int SX, int M, const uint4* __restrict__ Qf, const uint16_t* __restrict__ SC,
+    const uint16_t* __restrict__ R, const float* __restrict__ NV, const float* __restrict__ XG, const float* __restrict__ XN,
+    const int* __restrict__ FLAG, float* __restrict__ FB, int T1, float* __restrict__ LOC, int NCTA, int* __restrict__ BAD,
+    float* __restrict__ DS, float* __restrict__ DLO, float* __restrict__ DHI, int dbg, int V, int NREAL, float qterm, float cn) {
+  if (*FLAG == 0) return;   // flag 0: n78's select computes every tile; nothing here is read
+  constexpr int MR = 8 * MT;
+  __shared__ float red[NG][MR][RS];
+  __shared__ int bad_s;
+  const int tile = blockIdx.x, warp = threadIdx.x >> 5, lane = threadIdx.x & 31, gid = lane >> 2, tq = lane & 3;
+  if (threadIdx.x == 0) bad_s = 0;
+  uint4 w[CHUNKS];
+#pragma unroll
+  for (int c = 0; c < CHUNKS; ++c) w[c] = ld_cs_v4(Qf + chunk_index(tile, warp, c, lane));
+  float acc[SUB][4];
+#pragma unroll
+  for (int i = 0; i < SUB; ++i) acc[i][0] = acc[i][1] = acc[i][2] = acc[i][3] = 0.f;
+  const int kb = warp * GROUP + 16 * tq;
+  const bool live0 = gid < M, live1 = MT == 2 && gid + 8 < M;
+#pragma unroll
+  for (int u = 0; u < STEPS; ++u) {
+    uint4 xa0 = make_uint4(0, 0, 0, 0), xb0 = xa0, xa1 = xa0, xb1 = xa0;
+    if (live0) {
+      const uint4* p = reinterpret_cast(x + (size_t)gid * SX + kb + 64 * u);
+      xa0 = ld_nc_v4(p); xb0 = ld_nc_v4(p + 1);
+    }
+    if (live1) {
+      const uint4* p = reinterpret_cast(x + (size_t)(gid + 8) * SX + kb + 64 * u);
+      xa1 = ld_nc_v4(p); xb1 = ld_nc_v4(p + 1);
+    }
+#pragma unroll
+    for (int j4 = 0; j4 < 4; ++j4) {
+      const uint32_t a0 = xword(xa0, xb0, 2 * j4), a2 = xword(xa0, xb0, 2 * j4 + 1);
+      const uint32_t a1 = MT == 2 ? xword(xa1, xb1, 2 * j4) : 0u, a3 = MT == 2 ? xword(xa1, xb1, 2 * j4 + 1) : 0u;
+#pragma unroll
+      for (int i = 0; i < SUB; ++i) {
+        const int U = unit_of(i, u);
+        const uint32_t hiw = word_of(w[hi_chunk(U)], hi_word(U));
+        const uint32_t b0 = sub160(magic_pair(word_of(w[nib_chunk(U)], nib_word(U, 2 * j4)), hiw, 2 * j4));
+        const uint32_t b1 = sub160(magic_pair(word_of(w[nib_chunk(U)], nib_word(U, 2 * j4 + 1)), hiw, 2 * j4 + 1));
+        mma16816(acc[i], a0, a1, a2, a3, b0, b1);
+      }
+    }
+  }
+#pragma unroll
+  for (int i = 0; i < SUB; ++i) {
+    const int col = 8 * i + 2 * tq;
+    red[warp][gid][col] = acc[i][0];
+    red[warp][gid][col + 1] = acc[i][1];
+    if (MT == 2) {
+      red[warp][gid + 8][col] = acc[i][2];
+      red[warp][gid + 8][col + 1] = acc[i][3];
+    }
+  }
+  __syncthreads();
+  for (int e = threadIdx.x; e < MR * 32; e += NT) {   // warp-uniform rows: NT is a multiple of 32
+    const int m = e >> 5, c = e & 31, n = tile * TILE + c;
+    if (m >= M) continue;
+    float part[NG], sc[NG], rr[NG], xg[NG];
+#pragma unroll
+    for (int g = 0; g < NG; ++g) {
+      part[g] = red[g][m][c];
+      sc[g] = h2f(__ldg(SC + (size_t)n * NG + g));
+      rr[g] = h2f(__ldg(R + (size_t)n * NG + g));
+      xg[g] = __ldg(XG + m * NG + g);
+    }
+    const float xn = __ldg(XN + m);
+    const Epi r = epilogue(part, sc, xg, rr, xn, __ldg(NV + n), qterm, cn);
+    if (!r.fin || !xn_in_domain(xn)) atomicOr(&bad_s, 1);   // shared atomic: no write-write race for racecheck
+    const bool real = n < NREAL;
+    float hm = real ? r.hi : -INFINITY, lm = real ? r.lo : -INFINITY;
+#pragma unroll
+    for (int o = 16; o >= 1; o >>= 1) {
+      hm = fmaxf(hm, __shfl_xor_sync(0xffffffffu, hm, o));
+      lm = fmaxf(lm, __shfl_xor_sync(0xffffffffu, lm, o));
+    }
+    if (c == 0) {
+      FB[(size_t)m * T1 + tile] = hm;
+      LOC[(size_t)m * NCTA + tile] = lm;
+    }
+    if (dbg) {
+      DS[(size_t)m * V + n] = r.s;
+      DLO[(size_t)m * V + n] = r.lo;
+      DHI[(size_t)m * V + n] = r.hi;
+    }
+  }
+  __syncthreads();
+  if (threadIdx.x == 0) BAD[tile] = bad_s;
+}
+}  // namespace n140
+
+static void chk(const torch::Tensor& t, at::ScalarType dt, int64_t numel, const torch::Tensor& like, const char* what) {
+  TORCH_CHECK(t.is_cuda() && t.device() == like.device() && t.scalar_type() == dt && t.is_contiguous() && t.numel() >= numel, "n140: bad ", what);
+}
+
+void screen(torch::Tensor x, torch::Tensor qf, torch::Tensor sc, torch::Tensor R, torch::Tensor nv, torch::Tensor xg, torch::Tensor xn,
+            torch::Tensor flag, torch::Tensor fb, torch::Tensor loc, torch::Tensor bad, torch::Tensor ds, torch::Tensor dlo,
+            torch::Tensor dhi, int64_t dbg, int64_t V, int64_t nreal, double qterm, double cn) {
+  TORCH_CHECK(x.is_cuda() && x.scalar_type() == at::kBFloat16 && x.dim() == 2 && x.size(1) == n140::KD && x.stride(1) == 1, "n140: x");
+  const int64_t M = x.size(0);
+  TORCH_CHECK(M >= 1 && M <= 16 && (M == 1 || x.stride(0) % 8 == 0) && reinterpret_cast(x.data_ptr()) % 16 == 0, "n140: x rows / alignment");
+  TORCH_CHECK(V % n140::TILE == 0 && nreal > 0 && nreal <= V, "n140: V");
+  const int64_t T = V / n140::TILE;
+  chk(qf, at::kByte, T * n140::NG * n140::CHUNKS * 32 * 16, x, "qf");
+  TORCH_CHECK(reinterpret_cast(qf.data_ptr()) % 16 == 0, "n140: qf alignment");
+  chk(sc, at::kHalf, V * n140::NG, x, "sc"); chk(R, at::kHalf, V * n140::NG, x, "R"); chk(nv, at::kFloat, V, x, "nv");
+  chk(xg, at::kFloat, 16 * n140::NG, x, "xg"); chk(xn, at::kFloat, 16, x, "xn"); chk(flag, at::kInt, 1, x, "flag");
+  TORCH_CHECK(fb.is_cuda() && fb.scalar_type() == at::kFloat && fb.dim() == 2 && fb.size(0) >= M && fb.size(1) == T + 1 && fb.is_contiguous(), "n140: fb");
+  TORCH_CHECK(loc.is_cuda() && loc.scalar_type() == at::kFloat && loc.dim() == 2 && loc.size(0) >= M && loc.size(1) == T && loc.is_contiguous(), "n140: loc");
+  chk(bad, at::kInt, T, x, "bad");
+  float *pds = nullptr, *plo = nullptr, *phi = nullptr;
+  if (dbg) {
+    chk(ds, at::kFloat, M * V, x, "ds"); chk(dlo, at::kFloat, M * V, x, "dlo"); chk(dhi, at::kFloat, M * V, x, "dhi");
+    pds = ds.data_ptr(); plo = dlo.data_ptr(); phi = dhi.data_ptr();
+  }
+  const c10::cuda::CUDAGuard guard(x.device());
+  auto st = at::cuda::getCurrentCUDAStream();
+  auto* xp = reinterpret_cast(x.data_ptr());
+  auto* qp = reinterpret_cast(qf.data_ptr());
+  auto* scp = reinterpret_cast(sc.data_ptr());
+  auto* rp = reinterpret_cast(R.data_ptr());
+  const int SX = M == 1 ? n140::KD : (int)x.stride(0);
+  if (M <= 8)
+    n140::screen_kernel<1><<<(unsigned)T, n140::NT, 0, st>>>(xp, SX, (int)M, qp, scp, rp, nv.data_ptr(), xg.data_ptr(),
+        xn.data_ptr(), flag.data_ptr(), fb.data_ptr(), (int)(T + 1), loc.data_ptr(), (int)T, bad.data_ptr(),
+        pds, plo, phi, (int)dbg, (int)V, (int)nreal, (float)qterm, (float)cn);
+  else
+    n140::screen_kernel<2><<<(unsigned)T, n140::NT, 0, st>>>(xp, SX, (int)M, qp, scp, rp, nv.data_ptr(), xg.data_ptr(),
+        xn.data_ptr(), flag.data_ptr(), fb.data_ptr(), (int)(T + 1), loc.data_ptr(), (int)T, bad.data_ptr(),
+        pds, plo, phi, (int)dbg, (int)V, (int)nreal, (float)qterm, (float)cn);
+  C10_CUDA_KERNEL_LAUNCH_CHECK();
+}
+
+PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { m.def("screen", &screen, "n140 INT6 screen (n78 K1 interface)"); }
+
+#else
+// ============================================================ host emulator (CPU tests only): same per-lane code, warp MMA emulated
+#include 
+#include 
+#include 
+
+namespace n140 {
+static float bf2f(uint16_t h) { uint32_t u = (uint32_t)h << 16; float f; std::memcpy(&f, &u, 4); return f; }
+static uint16_t f2bf_exact(float f) { uint32_t u; std::memcpy(&u, &f, 4); return (uint16_t)(u >> 16); }   // exact values only
+static uint32_t sub160_host(uint32_t v) {
+  const float lo = bf2f((uint16_t)(v & 0xFFFFu)) - 160.f, hi = bf2f((uint16_t)(v >> 16)) - 160.f;   // exact: integers |q| <= 31
+  return (uint32_t)f2bf_exact(lo) | ((uint32_t)f2bf_exact(hi) << 16);
+}
+// one warp-wide mma.sync.m16n8k16 (row.col, bf16 -> f32) from the 32 lanes' fragments (PTX ISA fragment layout); FP32 sums in
+// k order (products of BF16 values are exact in FP32)
+static void warp_mma(float c[32][4], const uint32_t a[32][4], const uint32_t b[32][2]) {
+  float A[16][16], B[16][8];
+  for (int L = 0; L < 32; ++L) {
+    const int g = L >> 2, t = L & 3;
+    for (int h = 0; h < 2; ++h) {
+      A[g][2 * t + h] = bf2f((uint16_t)(a[L][0] >> (16 * h)));
+      A[g + 8][2 * t + h] = bf2f((uint16_t)(a[L][1] >> (16 * h)));
+      A[g][2 * t + 8 + h] = bf2f((uint16_t)(a[L][2] >> (16 * h)));
+      A[g + 8][2 * t + 8 + h] = bf2f((uint16_t)(a[L][3] >> (16 * h)));
+      B[2 * t + h][g] = bf2f((uint16_t)(b[L][0] >> (16 * h)));
+      B[2 * t + 8 + h][g] = bf2f((uint16_t)(b[L][1] >> (16 * h)));
+    }
+  }
+  float C[16][8];
+  for (int L = 0; L < 32; ++L) {
+    const int g = L >> 2, t = L & 3;
+    C[g][2 * t] = c[L][0]; C[g][2 * t + 1] = c[L][1]; C[g + 8][2 * t] = c[L][2]; C[g + 8][2 * t + 1] = c[L][3];
+  }
+  for (int r = 0; r < 16; ++r)
+    for (int n = 0; n < 8; ++n) {
+      float s = C[r][n];
+      for (int k = 0; k < 16; ++k) s = s + A[r][k] * B[k][n];
+      C[r][n] = s;
+    }
+  for (int L = 0; L < 32; ++L) {
+    const int g = L >> 2, t = L & 3;
+    c[L][0] = C[g][2 * t]; c[L][1] = C[g][2 * t + 1]; c[L][2] = C[g + 8][2 * t]; c[L][3] = C[g + 8][2 * t + 1];
+  }
+}
+}  // namespace n140
+
+// q [V, K] int8 from the stream by the kernel's own extraction rule (chunk_index / magic_pair / sub160)
+torch::Tensor emu_decode(torch::Tensor qf, int64_t V) {
+  using namespace n140;
+  auto q = torch::zeros({V, KD}, torch::kInt8);
+  const uint4* s = reinterpret_cast(qf.data_ptr());
+  int8_t* qp = q.data_ptr();
+  for (int64_t t = 0; t < V / TILE; ++t)
+    for (int g = 0; g < NG; ++g)
+      for (int L = 0; L < 32; ++L) {
+        const int gid = L >> 2, tq = L & 3;
+        uint4 w[CHUNKS];
+        for (int c = 0; c < CHUNKS; ++c) w[c] = s[chunk_index(t, g, c, L)];
+        for (int i = 0; i < SUB; ++i)
+          for (int u = 0; u < STEPS; ++u) {
+            const int U = unit_of(i, u);
+            const int64_t n = t * TILE + 8 * i + gid;
+            const uint32_t hiw = word_of(w[hi_chunk(U)], hi_word(U));
+            for (int P = 0; P < 8; ++P) {
+              const uint32_t v = sub160_host(magic_pair(word_of(w[nib_chunk(U)], nib_word(U, P)), hiw, P));
+              const int k = g * GROUP + 64 * u + 16 * tq + 2 * P;
+              qp[n * KD + k] = (int8_t)bf2f((uint16_t)(v & 0xFFFFu));
+              qp[n * KD + k + 1] = (int8_t)bf2f((uint16_t)(v >> 16));
+            }
+          }
+      }
+  return q;
+}
+
+// the screen kernel, warp by warp: returns nothing; writes fb, loc, bad (and ds / dlo / dhi when dbg) like the device kernel
+void emu_screen(torch::Tensor x, torch::Tensor qf, torch::Tensor sc, torch::Tensor R, torch::Tensor nv, torch::Tensor xg, torch::Tensor xn,
+                torch::Tensor flag, torch::Tensor fb, torch::Tensor loc, torch::Tensor bad, torch::Tensor ds, torch::Tensor dlo,
+                torch::Tensor dhi, int64_t dbg, int64_t V, int64_t nreal, double qterm, double cn) {
+  using namespace n140;
+  if (flag.data_ptr()[0] == 0) return;
+  const int M = (int)x.size(0), SX = (int)x.stride(0), MT = M <= 8 ? 1 : 2, MR = 8 * MT;
+  const uint16_t* xp = reinterpret_cast(x.data_ptr());
+  const uint4* s = reinterpret_cast(qf.data_ptr());
+  const uint16_t* scp = reinterpret_cast(sc.data_ptr());
+  const uint16_t* rp = reinterpret_cast(R.data_ptr());
+  const float* nvp = nv.data_ptr(); const float* xgp = xg.data_ptr(); const float* xnp = xn.data_ptr();
+  float* fbp = fb.data_ptr(); float* locp = loc.data_ptr(); int* badp = bad.data_ptr();
+  const int64_t T = V / TILE, T1 = T + 1;
+  std::vector red((size_t)NG * MR * TILE);
+  for (int64_t t = 0; t < T; ++t) {
+    for (int g = 0; g < NG; ++g) {
+      uint4 w[32][CHUNKS];
+      for (int L = 0; L < 32; ++L)
+        for (int c = 0; c < CHUNKS; ++c) w[L][c] = s[chunk_index(t, g, c, L)];
+      float acc[SUB][32][4];
+      std::memset(acc, 0, sizeof(acc));
+      for (int u = 0; u < STEPS; ++u) {
+        uint4 xa[32][2], xb[32][2];
+        for (int L = 0; L < 32; ++L) {
+          const int gid = L >> 2, tq = L & 3, kb = g * GROUP + 16 * tq + 64 * u;
+          for (int h = 0; h < 2; ++h) {
+            const int r = gid + 8 * h;
+            uint4 z = {0, 0, 0, 0};
+            xa[L][h] = z; xb[L][h] = z;
+            if (r < M && (h == 0 || MT == 2)) {
+              std::memcpy(&xa[L][h], xp + (size_t)r * SX + kb, 16);
+              std::memcpy(&xb[L][h], xp + (size_t)r * SX + kb + 8, 16);
+            }
+          }
+        }
+        for (int j4 = 0; j4 < 4; ++j4) {
+          uint32_t a[32][4];
+          for (int L = 0; L < 32; ++L) {
+            a[L][0] = xword(xa[L][0], xb[L][0], 2 * j4);
+            a[L][2] = xword(xa[L][0], xb[L][0], 2 * j4 + 1);
+            a[L][1] = MT == 2 ? xword(xa[L][1], xb[L][1], 2 * j4) : 0u;
+            a[L][3] = MT == 2 ? xword(xa[L][1], xb[L][1], 2 * j4 + 1) : 0u;
+          }
+          for (int i = 0; i < SUB; ++i) {
+            const int U = unit_of(i, u);
+            uint32_t b[32][2];
+            for (int L = 0; L < 32; ++L) {
+              const uint32_t hiw = word_of(w[L][hi_chunk(U)], hi_word(U));
+              b[L][0] = sub160_host(magic_pair(word_of(w[L][nib_chunk(U)], nib_word(U, 2 * j4)), hiw, 2 * j4));
+              b[L][1] = sub160_host(magic_pair(word_of(w[L][nib_chunk(U)], nib_word(U, 2 * j4 + 1)), hiw, 2 * j4 + 1));
+            }
+            warp_mma(acc[i], a, b);
+          }
+        }
+      }
+      for (int L = 0; L < 32; ++L) {
+        const int gid = L >> 2, tq = L & 3;
+        for (int i = 0; i < SUB; ++i) {
+          const int col = 8 * i + 2 * tq;
+          red[((size_t)g * MR + gid) * TILE + col] = acc[i][L][0];
+          red[((size_t)g * MR + gid) * TILE + col + 1] = acc[i][L][1];
+          if (MT == 2) {
+            red[((size_t)g * MR + gid + 8) * TILE + col] = acc[i][L][2];
+            red[((size_t)g * MR + gid + 8) * TILE + col + 1] = acc[i][L][3];
+          }
+        }
+      }
+    }
+    int bad_s = 0;
+    for (int m = 0; m < M; ++m) {
+      float hm = -INFINITY, lm = -INFINITY;
+      for (int c = 0; c < TILE; ++c) {
+        const int64_t n = t * TILE + c;
+        float part[NG], scv[NG], rr[NG], xgv[NG];
+        for (int g = 0; g < NG; ++g) {
+          part[g] = red[((size_t)g * MR + m) * TILE + c];
+          scv[g] = h2f(scp[n * NG + g]); rr[g] = h2f(rp[n * NG + g]); xgv[g] = xgp[m * NG + g];
+        }
+        const Epi r = epilogue(part, scv, xgv, rr, xnp[m], nvp[n], (float)qterm, (float)cn);
+        if (!r.fin || !xn_in_domain(xnp[m])) bad_s = 1;
+        if (n < nreal) { hm = std::fmax(hm, r.hi); lm = std::fmax(lm, r.lo); }
+        if (dbg) {
+          ds.data_ptr()[m * V + n] = r.s; dlo.data_ptr()[m * V + n] = r.lo; dhi.data_ptr()[m * V + n] = r.hi;
+        }
+      }
+      fbp[m * T1 + t] = hm;
+      locp[m * T + t] = lm;
+    }
+    badp[t] = bad_s;
+  }
+}
+
+PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
+  m.def("emu_decode", &emu_decode, "n140 stream decode (kernel rule)");
+  m.def("emu_screen", &emu_screen, "n140 screen, host emulation");
+}
+#endif
+'''
+
+_EXT = None
+_EMU = None
+
+
+def build(verbose=False, build_dir=None, name="n140_i6"):
+    """Compile the device extension (torch cpp_extension, sm_121a). Returns the module."""
+    global _EXT
+    if _EXT is None:
+        from torch.utils.cpp_extension import load_inline
+        arch = os.environ.get("N140_CUDA_ARCH", "121a")
+        kw = {}
+        if build_dir:
+            os.makedirs(build_dir, exist_ok=True)
+            kw["build_directory"] = build_dir
+        _EXT = load_inline(name, cpp_sources="", cuda_sources=CUDA_SRC, verbose=verbose, with_cuda=True,
+                           extra_cuda_cflags=["-O3", f"-gencode=arch=compute_{arch},code=sm_{arch}", "-Xptxas=-v"], **kw)
+    return _EXT
+
+
+def build_emu(verbose=False, build_dir=None):
+    """CPU tests: the same source through g++ (no __CUDACC__), no FP contraction (host = device epilogue bit for bit)."""
+    global _EMU
+    if _EMU is None:
+        from torch.utils.cpp_extension import load_inline
+        kw = {"build_directory": build_dir} if build_dir else {}
+        if build_dir:
+            os.makedirs(build_dir, exist_ok=True)
+        _EMU = load_inline("n140_emu", cpp_sources=CUDA_SRC, verbose=verbose, with_cuda=False,
+                           extra_cflags=["-O2", "-ffp-contract=off", "-fno-fast-math"], **kw)
+    return _EMU
+
+
+# ------------------------------------------------------------------------------------------------ host: packing
+def quant6(w64):
+    """FP64 rows [n, K] -> (q int64 [n, K], s16 FP16 [n, NG], D FP64 [n, K]): n78_kern.pack(W, 6)'s arithmetic, verbatim."""
+    n = w64.shape[0]
+    qmax = 31
+    wg = w64.view(n, NG, GROUP)
+    amax = wg.abs().amax(-1, keepdim=True)
+    s16 = torch.where(amax > 0, K78._up16(torch.where(amax > 0, amax / qmax, torch.ones_like(amax))),
+                      torch.zeros_like(amax, dtype=torch.float16))
+    s = s16.to(torch.float64)
+    q = torch.where(s > 0, torch.clamp(torch.round(wg / torch.where(s > 0, s, torch.ones_like(s))), -qmax, qmax), torch.zeros_like(wg))
+    D = (q * s).view(n, KDIM)
+    return q.view(n, KDIM).to(torch.int64), s16.view(n, NG), D
+
+
+def frag_stream(q):
+    """q int [n, K] (n % 32 == 0, values in [-31, 31]) -> uint8 B-fragment stream [n / 32 * 12 * 9 * 512]."""
+    n = q.shape[0]
+    T = n // TILE
+    u = (q.to(torch.int64) + 32)
+    # [T, i, gid, g, step, tq, j] -> [T, g, U = 4 step + i, lane = 4 gid + tq, j]
+    u = u.view(T, 4, 8, NG, 3, 4, 16).permute(0, 3, 4, 1, 2, 5, 6).reshape(T, NG, 12, 32, 16)
+    lo4, hi2 = u & 0xF, (u >> 4) & 0x3
+    nib = torch.zeros((T, NG, 12, 32, 2), dtype=torch.int64, device=q.device)
+    for h in range(2):
+        for p in range(4):
+            P = 4 * h + p
+            nib[..., h] |= (lo4[..., 2 * P] << (4 * p)) | (lo4[..., 2 * P + 1] << (16 + 4 * p))
+    hiw = torch.zeros((T, NG, 12, 32), dtype=torch.int64, device=q.device)
+    for P in range(8):
+        hiw |= (hi2[..., 2 * P] << (2 * P)) | (hi2[..., 2 * P + 1] << (16 + 2 * P))
+    nibc = nib.view(T, NG, 6, 2, 32, 2).permute(0, 1, 2, 4, 3, 5).reshape(T, NG, 6, 32, 4)   # chunk c: units 2c, 2c + 1
+    hic = hiw.view(T, NG, 3, 4, 32).permute(0, 1, 2, 4, 3)                                  # chunk 6 + c: units 4c .. 4c + 3
+    words = torch.cat([nibc, hic], dim=2)                                                    # [T, NG, 9, 32, 4]
+    by = torch.stack([(words >> (8 * b)) & 0xFF for b in range(4)], dim=-1)
+    return by.to(torch.uint8).reshape(-1)
+
+
+def pack6f(W, chunk=8192, d_out=None):
+    """W [V, K] BF16 -> dict with n78's pack(W, 6) tables (sc, R, N; same arithmetic) and the B-fragment stream qf. No planes.
+    d_out (FP32 [V, K], optional): filled with D = q x sc (exact in FP32; + 0.0 so -0.0 reads +0.0 as the kernel's decode does)."""
+    V, Kd = W.shape
+    assert Kd == KDIM and V % TILE == 0 and chunk % TILE == 0
+    dev = W.device
+    qf = torch.empty(V // TILE * NG * 9 * 512, dtype=torch.uint8, device=dev)
+    sc_all = torch.empty((V, NG), dtype=torch.float16, device=dev)
+    R_all = torch.empty((V, NG), dtype=torch.float16, device=dev)
+    N_all = torch.empty((V,), dtype=torch.float32, device=dev)
+    per = NG * 9 * 512 // TILE   # stream bytes per vocab id
+    for a in range(0, V, chunk):
+        w = W[a:a + chunk].to(torch.float64)
+        n = w.shape[0]
+        q, s16, D = quant6(w)
+        sc_all[a:a + n] = s16
+        R_all[a:a + n] = K78._up16((w - D).view(n, NG, GROUP).pow(2).sum(-1).sqrt() * (1 + 2.0 ** -40) + 1e-300)
+        N_all[a:a + n] = K78._up32(torch.maximum(w.norm(dim=1), D.norm(dim=1)) * (1 + 2.0 ** -40) + 1e-300)
+        qf[a * per:(a + n) * per] = frag_stream(q)
+        if d_out is not None:
+            d_out[a:a + n] = D.float() + 0.0
+        del w, q, D
+    return {"bits": 6, "qf": qf, "sc": sc_all, "R": R_all, "N": N_all, "V": V, "K": KDIM, "NG": NG,
+            "q": torch.zeros(16, dtype=torch.uint8, device=dev), "qb": torch.zeros(16, dtype=torch.uint8, device=dev),
+            "bytes": qf.numel() + sc_all.numel() * 2 + R_all.numel() * 2 + N_all.numel() * 4}
+
+
+# ------------------------------------------------------------------------------------------------ E3: compaction + list exact pass
+@triton.jit
+def _compact_kernel(NEED, LIST, COUNT, T, BLOCK: tl.constexpr):
+    """One CTA: LIST = the needed tile ids in ascending order, COUNT = their number (deterministic, no atomics)."""
+    base = 0
+    for t0 in range(0, T, BLOCK):
+        t = t0 + tl.arange(0, BLOCK)
+        nd = (tl.load(NEED + t, t < T, other=0) != 0).to(tl.int32)
+        pos = base + tl.cumsum(nd, axis=0) - 1
+        tl.store(LIST + pos, t, (nd != 0) & (t < T))
+        base += tl.sum(nd, axis=0)
+    tl.store(COUNT, base)
+
+
+@triton.jit
+def _exact_list_kernel(X, W, Y, NEED, LIST, COUNT, M, N, K, SX, SW, SY, BN: tl.constexpr, BK: tl.constexpr, MP: tl.constexpr,
+                       TESTF32: tl.constexpr = False):
+    """CTA p: the served _gemv_kernel body on tile LIST[p] if p < COUNT; -inf on tile p if NEED[p] == 0 (disjoint tiles)."""
+    pid = tl.program_id(0)
+    rows = tl.arange(0, MP)
+    if pid < tl.load(COUNT):
+        t = tl.load(LIST + pid)
+        cols = t * BN + tl.arange(0, BN)
+        acc = tl.zeros((MP, BN), tl.float32)
+        for k0 in range(0, K, BK):
+            ks = k0 + tl.arange(0, BK)
+            w = tl.load(
+                W + cols[None, :].to(tl.int64) * SW + ks[:, None],
+                (cols[None, :] < N) & (ks[:, None] < K),
+                other=0,
+            )
+            x = tl.load(
+                X + rows[:, None] * SX + ks[None, :],
+                (rows[:, None] < M) & (ks[None, :] < K),
+                other=0,
+            )
+            if TESTF32:
+                acc += tl.dot(x.to(tl.float32), w.to(tl.float32), input_precision="ieee")
+            else:
+                acc += tl.dot(x, w)
+        tl.store(
+            Y + rows[:, None] * SY + cols[None, :],
+            acc.to(Y.dtype.element_ty),
+            (rows[:, None] < M) & (cols[None, :] < N),
+        )
+    if tl.load(NEED + pid) == 0:
+        c0 = pid * BN + tl.arange(0, BN)
+        tl.store(Y + rows[:, None] * SY + c0[None, :], tl.full((MP, BN), float("-inf"), tl.float32),
+                 (rows[:, None] < M) & (c0[None, :] < N))
+
+
+# ------------------------------------------------------------------------------------------------ host: one certified head
+class Cert6(K78.Cert):
+    """n78's Cert with the INT6 CUDA screen (K1) and, for exact='E3', the compacted exact pass. run() is capturable.
+    ext: the device extension (build()); on CPU (testf32) the host emulator (build_emu()) is used for K1."""
+
+    def __init__(self, W, pk6, vocab, e, M, softcap_fn, ext=None, exact="E1", testf32=False, cap=K78.CAP):
+        super().__init__(W, pk6, vocab, e, M, softcap_fn, bn=32, exact="E1", testf32=testf32, cap=cap)
+        assert self.NCTA == self.T
+        self.ext = ext if ext is not None else (build_emu() if testf32 else build())
+        self.form = exact
+        self.list = torch.zeros(self.T, dtype=torch.int32, device=W.device)
+        self.count = torch.zeros(1, dtype=torch.int32, device=W.device)
+
+    def screen(self, x, qterm=1.0, dbg=False):
+        pk = self.pk
+        ds, dlo, dhi = self.dbg if dbg else (self.dummy, self.dummy, self.dummy)
+        K78._xnorm_kernel[(1,)](x, self.xg, self.xn, self.M, x.stride(0), NG=NG, GROUP=GROUP, GP=256, MP=16, num_warps=4)
+        fn = self.ext.emu_screen if self.testf32 else self.ext.screen
+        fn(x, pk["qf"], pk["sc"], pk["R"], pk["N"], self.xg, self.xn, self.flag, self.fb, self.loc, self.bad, ds, dlo, dhi,
+           1 if dbg else 0, self.V, self.vocab, float(qterm), float(self.cn))
+
+    def select(self):
+        super().select()
+        if self.form == "E3":
+            _compact_kernel[(1,)](self.need, self.list, self.count, self.T, BLOCK=1024, num_warps=4)
+
+    def exact_pass(self, x, out, kernel=None):
+        if kernel is not None or self.form != "E3":
+            return super().exact_pass(x, out, kernel)
+        _exact_list_kernel[(self.T,)](x, self.W, out, self.need, self.list, self.count, self.M, self.V, self.K, x.stride(0),
+                                      self.W.stride(0), out.stride(0), BN=32, BK=256, MP=16, TESTF32=self.testf32, num_warps=4)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n14_moe.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n14_moe.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a1b67d8340a0f7d83c3382985e93fd34a028d59
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n14_moe.py
@@ -0,0 +1,216 @@
+"""n14 (inkling2-spark moe seat, 2026-11-21): cheaper SM120 MoE prefill visits, EXACT (same outputs bit for bit).
+Replaces Inkling2Experts._forward_sm120 for calls of >= N14_MIN_TOKENS tokens (default 512: prefill chunks; decode / verify
+calls keep the image path) with the image's own steps except:
+  q: the routed NVFP4 / MXFP8 quantizers read each token row ONCE and store it into its top_k expert-sorted rows
+     (n14_quant.cuh, token-major), instead of re-reading the token for each of its rows (8 gathered passes over x);
+  c: the per-token combine (the image's _routed_partial: FP32 sum in top-k order of the BF16-rounded scaled rows) stores
+     BF16 directly (round to nearest even, as the image's .to(bfloat16) of its FP32 output), so the FP32 tensor and the
+     copy kernel go away.
+N14_MOE (env): letters of the parts on ("qc" default; "" or "0" = the image path, for the control arm).
+N14_GRID (env, default 0 = the image grid rule, 4 x SMs): CTAs of the token-major quantizers."""
+import logging
+import os
+
+import torch
+import triton
+import triton.language as tl
+
+from sglang.kernels.jit.utils import cache_once, load_jit
+from sglang.kernels.ops.moe.inkling2_moe import PDL, _nvfp4_row_scale, _row_expert
+
+logger = logging.getLogger(__name__)
+MODE = os.environ.get("N14_MOE", "qc").strip()
+MODE = "" if MODE == "0" else MODE
+MIN_TOKENS = int(os.environ.get("N14_MIN_TOKENS", "512"))
+GRID = int(os.environ.get("N14_GRID", "0"))
+_INSTALLED = False
+
+
+@cache_once
+def _module(width: int):
+    return load_jit(
+        "n14_quant",
+        str(width),
+        cuda_files=["inkling2/n14_quant.cuh"],
+        cuda_wrappers=[
+            ("nvfp4_quantize_tokens", f"n14_quant::nvfp4_quantize_tokens<{width}>"),
+            ("mxfp8_quantize_tokens", f"n14_quant::mxfp8_quantize_tokens<{width}>"),
+        ],
+    )
+
+
+def _sm_count(device):
+    return torch.cuda.get_device_properties(device).multi_processor_count
+
+
+def nvfp4_token_quantize(x, src2dst, top_k, offsets, grid=None):
+    """= experts_sm120.nvfp4_routed_quantize(x, dst2src, top_k, offsets), from the inverse permutation src2dst."""
+    from sglang.kernels.ops.moe import inkling2_experts_sm120 as ex
+
+    width = x.shape[1]
+    values, scales, amax = ex._nvfp4_outputs(
+        rows=src2dst.numel(), width=width, experts=offsets.numel() - 1, device=x.device
+    )
+    if src2dst.numel():
+        _module(width).nvfp4_quantize_tokens(
+            x, src2dst, values, scales, amax, offsets, top_k, _sm_count(x.device), GRID if grid is None else grid
+        )
+    return values, scales, amax
+
+
+def mxfp8_token_quantize(x, src2dst, top_k, offsets, grid=None):
+    """= experts_sm120.mxfp8_routed_quantize(x, dst2src, top_k, offsets), from the inverse permutation src2dst."""
+    from sglang.kernels.ops.moe import inkling2_experts_sm120 as ex
+
+    rows, width = src2dst.numel(), x.shape[1]
+    values, scales, m_padded = ex._mxfp8_outputs(rows=rows, width=width, experts=offsets.numel() - 1, device=x.device)
+    if rows:
+        _module(width).mxfp8_quantize_tokens(
+            x,
+            src2dst,
+            values.view(torch.uint8),
+            scales,
+            offsets,
+            top_k,
+            m_padded,
+            _sm_count(x.device),
+            GRID if grid is None else grid,
+        )
+    return values, scales.t()
+
+
+@triton.jit
+def _routed_partial_bf16(
+    X,
+    XAmax,
+    WAmax,
+    WDenominator,
+    Offsets,
+    Src2Dst,
+    Y,
+    N: tl.constexpr,
+    E: tl.constexpr,
+    TOP_K: tl.constexpr,
+    SCALED: tl.constexpr,
+    BLOCK: tl.constexpr,
+    SEARCH: tl.constexpr,
+):
+    # The image's _routed_partial (sglang.kernels.ops.moe.inkling2_moe) line for line, except the BF16 store.
+    tl.extra.cuda.gdc_wait()
+    tl.extra.cuda.gdc_launch_dependents()
+    src = tl.program_id(0).to(tl.int64)
+    cols = tl.program_id(1) * BLOCK + tl.arange(0, BLOCK)
+    lo = tl.load(Offsets)
+    hi = tl.load(Offsets + E)
+    total = tl.zeros([BLOCK], dtype=tl.float32)
+    for k in tl.static_range(TOP_K):
+        row = tl.load(Src2Dst + src * TOP_K + k)
+        inside = (row >= lo) & (row < hi)
+        x = tl.load(X + row.to(tl.int64) * N + cols, (cols < N) & inside, other=0)
+        if SCALED:
+            x = x * _nvfp4_row_scale(
+                XAmax, WAmax, WDenominator, _row_expert(Offsets, row, E, SEARCH), row
+            )
+        total += tl.where(inside, x.to(tl.bfloat16).to(tl.float32), 0.0)
+    tl.store(Y + src * N + cols, total.to(tl.bfloat16, fp_downcast_rounding="rtne"), cols < N)
+
+
+
+def routed_partial_bf16(x, offsets, src2dst, top_k, *, nvfp4_scales=None, block=1024):
+    """= routed_partial(x, offsets, src2dst, top_k, nvfp4_scales=...).to(torch.bfloat16) in one kernel."""
+    experts = offsets.numel() - 1
+    out = torch.empty((src2dst.numel() // top_k, x.shape[1]), device=x.device, dtype=torch.bfloat16)
+    if out.numel():
+        x_amax, w_amax, w_denominator = nvfp4_scales or (None, None, None)
+        _routed_partial_bf16[(out.shape[0], triton.cdiv(out.shape[1], block))](
+            x,
+            x_amax,
+            w_amax,
+            w_denominator,
+            offsets,
+            src2dst,
+            out,
+            out.shape[1],
+            experts,
+            top_k,
+            nvfp4_scales is not None,
+            block,
+            experts.bit_length(),
+            launch_pdl=PDL,
+        )
+    return out
+
+
+def forward_sm120(self, x, weights, ids, combine, mode):
+    """Inkling2Experts._forward_sm120 with the parts in mode ('q', 'c') replaced; the rest is the image's code."""
+    from sglang.kernels.ops.gemm import inkling2_grouped_sm120 as grouped_sm120
+    from sglang.kernels.ops.moe import inkling2_experts_sm120 as experts_sm120
+    from sglang.kernels.ops.moe.inkling2_moe import routed_partial
+    from sglang.srt.models.inkling_common.inkling2_moe import RoutedOutput
+
+    tokens, top_k = ids.shape
+    src2dst, dst2src, gammas, offsets = self._sm120_route(ids, weights)
+    x = x.contiguous()
+    if self._routed_kernels == torch.uint8:
+        if "q" in mode:
+            values, scales, amax = nvfp4_token_quantize(x, src2dst, top_k, offsets)
+        else:
+            values, scales, amax = experts_sm120.nvfp4_routed_quantize(x=x, dst2src=dst2src, top_k=top_k, offsets=offsets)
+        gate_up = grouped_sm120.nvfp4_expert_matmul(
+            values=values, scales=scales, weight=self.w13_weight, weight_scales=self.w13_scale, offsets=offsets, tokens=tokens
+        )
+        values, scales, amax = experts_sm120.nvfp4_routed_swiglu_quantize(
+            acc=gate_up,
+            acc_amax=amax,
+            w_amax=self.w13_amax,
+            w_denominator=self.w13_outer_scale_denominator,
+            gammas=gammas,
+            offsets=offsets,
+            gate_cap=self.gate_cap,
+            up_cap=self.up_cap,
+        )
+        down = grouped_sm120.nvfp4_expert_matmul(
+            values=values, scales=scales, weight=self.w2_weight, weight_scales=self.w2_scale, offsets=offsets, tokens=tokens
+        )
+        scales = (amax, self.w2_amax, self.w2_outer_scale_denominator)
+    else:
+        if "q" in mode:
+            values, scales = mxfp8_token_quantize(x, src2dst, top_k, offsets)
+        else:
+            values, scales = experts_sm120.mxfp8_routed_quantize(x=x, dst2src=dst2src, top_k=top_k, offsets=offsets)
+        gate_up = grouped_sm120.mxfp8_expert_matmul(
+            values=values, scales=scales, weight=self.w13_weight, weight_scales=self.w13_cute_scale, offsets=offsets
+        )
+        values, scales = experts_sm120.mxfp8_routed_swiglu_quantize(
+            acc=gate_up, gammas=gammas, offsets=offsets, gate_cap=self.gate_cap, up_cap=self.up_cap
+        )
+        down = grouped_sm120.mxfp8_expert_matmul(
+            values=values, scales=scales, weight=self.w2_weight, weight_scales=self.w2_cute_scale, offsets=offsets
+        )
+        scales = None
+    if "c" in mode and x.dtype == torch.bfloat16:
+        out = routed_partial_bf16(down, offsets, src2dst, top_k, nvfp4_scales=scales)
+    else:
+        out = routed_partial(down, offsets, src2dst, top_k, nvfp4_scales=scales).to(x.dtype)
+    return out if combine else RoutedOutput(out, None, 0)
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED:
+        return
+    _INSTALLED = True
+    if not MODE:
+        logger.warning("n14: N14_MOE empty, image MoE path")
+        return
+    from sglang.srt.models.inkling_common import inkling2_moe as M
+
+    orig = M.Inkling2Experts._forward_sm120
+
+    def _forward_sm120(self, x, weights, ids, combine):
+        if ids.shape[0] < MIN_TOKENS:
+            return orig(self, x, weights, ids, combine)
+        return forward_sm120(self, x, weights, ids, combine, MODE)
+
+    M.Inkling2Experts._forward_sm120 = _forward_sm120
+    logger.warning("n14: SM120 MoE prefill parts %r on calls >= %d tokens (grid %d)", MODE, MIN_TOKENS, GRID)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n14_quant.cuh b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n14_quant.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..f8d7bf76dc6fa6929c40893b3d9d8d09b48a50ef
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n14_quant.cuh
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: Apache-2.0
+// n14 (inkling2-spark moe seat, 2026-11-21): token-major routed NVFP4 / MXFP8 quantization for the SM120 grouped GEMMs.
+// The image kernels (routed_quant_sm120.cuh) walk the expert-sorted rows and re-read token dst2src[row] / top_k for each
+// of its top_k rows (8 gathered passes over x). Every quantity they write for a row (packed values, block scales, the
+// per-row amax) depends only on that token's BF16 row, so these kernels read each token row once, run the same device
+// helpers (part_max, block_max_reduce, quantize_part / mxfp8_half_block) and store the result into each of the token's
+// rows src2dst[token * top_k + k] at the image's offsets (store_part / cute_exponent_offset), zeroing each expert's
+// scale tail where its last row is written, as the image does. Same outputs bit for bit; same PDL behaviour as the
+// kernel each replaces (NVFP4: wait + trigger; MXFP8: wait only, the CuTe GEMM does not wait on its predecessor).
+#include 
+
+#include 
+
+#include "routed_quant_sm120.cuh"
+#include 
+#include 
+
+namespace sglang::n14_quant {
+
+using namespace sglang::inkling2_routed_quant;
+using sglang::inkling2_routed_quant_sm120::cute_exponent_offset;
+using sglang::inkling2_routed_quant_sm120::verify_offsets;
+using sglang::inkling2_routed_quant_sm120::verify_rows;
+using sglang::inkling2_routed_quant_sm120::zero_expert_tail;
+
+template 
+__global__ void __launch_bounds__(split_threads(K)) nvfp4_quantize_tokens_kernel(
+    __nv_bfloat16 const* __restrict__ x,
+    int32_t const* __restrict__ src2dst,
+    uint8_t* values,
+    uint8_t* x_scales,
+    float* amax_out,
+    int32_t const* __restrict__ offsets,
+    int32_t tokens,
+    int32_t top_k,
+    int32_t experts) {
+  constexpr int kThreads = split_threads(K), kSplit = split(K), E = 16 / kSplit;
+  static_assert(K % 64 == 0 && kSplit > 1);
+  __shared__ int32_t s_offsets[kMaxExperts + 1];
+  __shared__ float red[2][kThreads / 32];
+  device::PDLWaitPrimary();
+  device::PDLTriggerSecondary();
+  load_offsets(offsets, experts, s_offsets);
+  int32_t const block = threadIdx.x / kSplit, part = threadIdx.x % kSplit;
+  bool const active = block < K / 16;
+  int32_t const lo = s_offsets[0], hi = s_offsets[experts];
+  int32_t parity = 0;
+  for (int32_t token = blockIdx.x; token < tokens; token += gridDim.x, parity ^= 1) {
+    float v[E];
+#pragma unroll
+    for (int i = 0; i < E; ++i)
+      v[i] = 0.0f;
+    if (active) {
+      __nv_bfloat16 const* src = x + int64_t(token) * K + block * 16 + part * E;
+      if constexpr (E == 8) {
+        uint4 raw = *reinterpret_cast(src);
+        __nv_bfloat16 const* h = reinterpret_cast<__nv_bfloat16 const*>(&raw);
+#pragma unroll
+        for (int i = 0; i < E; ++i)
+          v[i] = __bfloat162float(h[i]);
+      } else {
+        uint2 raw = *reinterpret_cast(src);
+        __nv_bfloat16 const* h = reinterpret_cast<__nv_bfloat16 const*>(&raw);
+#pragma unroll
+        for (int i = 0; i < E; ++i)
+          v[i] = __bfloat162float(h[i]);
+      }
+    }
+    float block_max = part_max(v);
+    float amax = block_max_reduce(block_max, red[parity]);
+    uint32_t packed;
+    uint8_t scale;
+    quantize_part(v, amax, block_max, packed, scale);
+    for (int32_t k = 0; k < top_k; ++k) {
+      int32_t const row = src2dst[int64_t(token) * top_k + k];
+      if (row < lo || row >= hi) continue;
+      int32_t const expert = row_expert(s_offsets, experts, row);
+      if (active) {
+        if (threadIdx.x == 0) amax_out[row] = amax;
+        store_part(values, x_scales, s_offsets, expert, row, block, part, K, packed, scale);
+      }
+      if (row == s_offsets[expert + 1] - 1) zero_expert_tail(s_offsets, expert, x_scales, (K + 63) / 64 * 4);
+    }
+  }
+}
+
+template 
+__global__ void __launch_bounds__(threads(K)) mxfp8_quantize_tokens_kernel(
+    __nv_bfloat16 const* __restrict__ x,
+    int32_t const* __restrict__ src2dst,
+    uint8_t* values,
+    uint8_t* exponents,
+    int32_t const* __restrict__ offsets,
+    int32_t tokens,
+    int32_t experts,
+    int32_t top_k,
+    int32_t m_padded) {
+  static_assert(K % 128 == 0 && K / 16 <= 1024);
+  __shared__ int32_t s_offsets[kMaxExperts + 1];
+  device::PDLWaitPrimary();
+  load_offsets(offsets, experts, s_offsets);
+  int32_t const block = threadIdx.x;
+  bool const active = block < K / 16;
+  int32_t const lo = s_offsets[0], hi = s_offsets[experts];
+  for (int32_t token = blockIdx.x; token < tokens; token += gridDim.x) {
+    float v[16];
+    if (active) {
+      uint4 const* src = reinterpret_cast(x + int64_t(token) * K + block * 16);
+      uint4 raw[2] = {src[0], src[1]};
+      __nv_bfloat16 const* h = reinterpret_cast<__nv_bfloat16 const*>(raw);
+#pragma unroll
+      for (int i = 0; i < 16; ++i)
+        v[i] = __bfloat162float(h[i]);
+    } else {
+#pragma unroll
+      for (int i = 0; i < 16; ++i)
+        v[i] = 0.0f;
+    }
+    uint4 packed;
+    uint8_t exponent;
+    mxfp8_half_block(v, packed, exponent);
+    if (active) {
+      for (int32_t k = 0; k < top_k; ++k) {
+        int32_t const row = src2dst[int64_t(token) * top_k + k];
+        if (row < lo || row >= hi) continue;
+        *reinterpret_cast(values + int64_t(row) * K + block * 16) = packed;
+        if (block % 2 == 0) exponents[cute_exponent_offset(row, block / 2, s_offsets, experts, m_padded)] = exponent;
+      }
+    }
+  }
+}
+
+inline int32_t grid_for(int32_t tokens, int64_t sm_count, int64_t grid) {
+  int64_t const g = grid > 0 ? grid : 4 * sm_count;
+  return static_cast(std::max(1, std::min(tokens, g)));
+}
+
+template 
+void nvfp4_quantize_tokens(
+    tvm::ffi::TensorView x,
+    tvm::ffi::TensorView src2dst,
+    tvm::ffi::TensorView values,
+    tvm::ffi::TensorView x_scales,
+    tvm::ffi::TensorView amax,
+    tvm::ffi::TensorView offsets,
+    int64_t top_k,
+    int64_t sm_count,
+    int64_t grid) {
+  constexpr int64_t kPart = 16 / split(K);
+  auto tokens = host::SymbolicSize{"tokens"};
+  auto rows = host::SymbolicSize{"routed rows"};
+  auto scale_rows = host::SymbolicSize{"scale rows"};
+  auto device = host::SymbolicDevice{};
+  device.set_options();
+  int32_t const experts = verify_offsets(offsets, device);
+  host::TensorMatcher({tokens, K})  //
+      .with_dtype()
+      .with_device(device)
+      .ensure_alignment(kPart * 2)
+      .verify(x);
+  host::TensorMatcher({rows}).with_dtype().with_device(device).verify(src2dst);
+  host::TensorMatcher({rows, K / 2})  //
+      .with_dtype()
+      .with_device(device)
+      .ensure_alignment(kPart / 2)
+      .verify(values);
+  host::TensorMatcher({scale_rows, K / 16}).with_dtype().with_device(device).verify(x_scales);
+  host::TensorMatcher({rows}).with_dtype().with_device(device).verify(amax);
+  CHECK_HOST(top_k > 0) << "top_k must be positive, got " << top_k;
+  int32_t const num_rows = verify_rows(rows);
+  int32_t const num_tokens = verify_rows(tokens);
+  CHECK_HOST(int64_t{num_tokens} * top_k == num_rows) << "src2dst must hold tokens x top_k rows";
+  CHECK_HOST(scale_rows.unwrap() >= host::div_ceil(num_rows + 127 * int64_t{experts}, 128) * 128)
+      << "NVFP4 scales need 128-row blocks per expert, got " << scale_rows.unwrap() << " rows";
+  host::LaunchKernel(grid_for(num_tokens, sm_count, grid), split_threads(K), device.unwrap())
+      .enable_pdl(true)(
+          nvfp4_quantize_tokens_kernel,
+          static_cast<__nv_bfloat16 const*>(x.data_ptr()),
+          static_cast(src2dst.data_ptr()),
+          static_cast(values.data_ptr()),
+          static_cast(x_scales.data_ptr()),
+          static_cast(amax.data_ptr()),
+          static_cast(offsets.data_ptr()),
+          num_tokens,
+          static_cast(top_k),
+          experts);
+}
+
+template 
+void mxfp8_quantize_tokens(
+    tvm::ffi::TensorView x,
+    tvm::ffi::TensorView src2dst,
+    tvm::ffi::TensorView values,
+    tvm::ffi::TensorView exponents,
+    tvm::ffi::TensorView offsets,
+    int64_t top_k,
+    int64_t m_padded,
+    int64_t sm_count,
+    int64_t grid) {
+  auto tokens = host::SymbolicSize{"tokens"};
+  auto rows = host::SymbolicSize{"routed rows"};
+  auto device = host::SymbolicDevice{};
+  device.set_options();
+  int32_t const experts = verify_offsets(offsets, device);
+  host::TensorMatcher({tokens, K})  //
+      .with_dtype()
+      .with_device(device)
+      .ensure_alignment(16)
+      .verify(x);
+  host::TensorMatcher({rows}).with_dtype().with_device(device).verify(src2dst);
+  host::TensorMatcher({rows, K})  //
+      .with_dtype()
+      .with_device(device)
+      .ensure_alignment(16)
+      .verify(values);
+  host::TensorMatcher({K / 128, m_padded}).with_dtype().with_device(device).verify(exponents);
+  CHECK_HOST(top_k > 0) << "top_k must be positive, got " << top_k;
+  int32_t const num_rows = verify_rows(rows);
+  int32_t const num_tokens = verify_rows(tokens);
+  CHECK_HOST(int64_t{num_tokens} * top_k == num_rows) << "src2dst must hold tokens x top_k rows";
+  CHECK_HOST(m_padded >= (num_rows + 3 * int64_t{experts}) / 4 * 4 && m_padded < std::numeric_limits::max())
+      << "MXFP8 scales need 4-row aligned experts, got m_padded " << m_padded;
+  host::LaunchKernel(grid_for(num_tokens, sm_count, grid), threads(K), device.unwrap())
+      .enable_pdl(true)(
+          mxfp8_quantize_tokens_kernel,
+          static_cast<__nv_bfloat16 const*>(x.data_ptr()),
+          static_cast(src2dst.data_ptr()),
+          static_cast(values.data_ptr()),
+          static_cast(exponents.data_ptr()),
+          static_cast(offsets.data_ptr()),
+          num_tokens,
+          experts,
+          static_cast(top_k),
+          static_cast(m_padded));
+}
+
+}  // namespace sglang::n14_quant
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n15_fused.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n15_fused.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc74a7c83439f53422016deaa252218618221672
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n15_fused.py
@@ -0,0 +1,147 @@
+"""n15 fused loop controller (stack seat, 2026-11-22): one Triton kernel for message_controllers' norm + down + mix
+(sglang kernels/ops/elementwise/inkling2_loop.py), meant to be BITWISE equal to the served three kernels by copying each
+order:
+  - row RMS: per row a 1-D tensor load + tl.sum under num_warps 8, as _controller_norm
+    (served ttgir: #blocked sizePerThread [8], warpsPerCTA [8]); rsqrt(div_rn(sum, W) + eps) with libdevice;
+  - normed = (x * rstd).to(bf16), concatenated [dest | message] along K = 2W, never written to memory;
+  - down: K walked in 1024-wide groups of BLOCK_K tiles, each group's tl.dot accumulation from zero, groups summed in
+    group order (served non-split path; the split path sums the same partials in the same order); tiles past K masked
+    to zero exactly as the served loads;
+  - mix: hidden.to(bf16) @ gain / forget tiles (K = rank 64 from zero), out = (1 - tanh(f)) * dest + tanh(g) * message,
+    libdevice tanh, enable_fp_fusion False.
+Grid (NUM, row blocks): the controllers of one row block are adjacent programs, so a stride-0 dest (local layers) is
+read from DRAM once and from L2 by the other two. Passes 2 and 3 re-read the row block's dest / message from L2."""
+import os
+
+import triton
+import triton.language as tl
+from triton.language.extra import libdevice
+
+
+@triton.jit
+def _served_sumsq(ptr, ok, W: tl.constexpr):
+    """sum(x * x) over one row of W fp32 in the served _controller_norm order, read from its PTX (image cache
+    63HJTHLD..., Triton 3.8): thread t = warp * 32 + lane holds x[2048 h + 8 t + 4 g + 2 f + b] (h, g, f, b in {0, 1});
+    its 16 squares are added as a packed f32x2 tree: over f, then g, then h, then the two lanes (b); then the lane
+    butterfly (xor 16, 8, 4, 2, 1) and, via shared memory, the warp tree (xor 4, 2, 1). Each step below is one add over a
+    size-2 axis, so the order does not depend on the layout this kernel gets."""
+    t = tl.arange(0, 256)
+    i = tl.arange(0, 16)
+    off = (i[None, :] // 8) * 2048 + t[:, None] * 8 + (i[None, :] % 8)
+    v = tl.load(ptr + off, ok & (off < W), other=0)
+    q = tl.reshape(v * v, (256, 2, 2, 2, 2))
+    q = tl.sum(q, axis=3)
+    q = tl.sum(q, axis=2)
+    q = tl.sum(q, axis=1)
+    a = tl.sum(q, axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 16)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 8)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 4)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 2)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 1)), axis=1)
+    a = tl.reshape(a, (8,))
+    a = tl.sum(tl.reshape(a, (2, 4)), axis=0)
+    a = tl.sum(tl.reshape(a, (2, 2)), axis=0)
+    return tl.sum(a, axis=0)
+
+
+@triton.jit
+def _fused_controller(
+    Dest, Message, Down, Gain, Forget, Out, T, DEST_STRIDE, MESSAGE_STRIDE, eps,
+    W: tl.constexpr, BLOCK: tl.constexpr, R: tl.constexpr, BLOCK_R: tl.constexpr,
+    BLOCK_M: tl.constexpr, BLOCK_K: tl.constexpr, BLOCK_N: tl.constexpr, INTERP: tl.constexpr = False,
+    SERVED_ORDER: tl.constexpr = True, NUM_STAGES: tl.constexpr = 3,
+):
+    m = tl.program_id(0).to(tl.int64)
+    row0 = tl.program_id(1) * BLOCK_M
+    K: tl.constexpr = 2 * W
+    GROUPS: tl.constexpr = (K + 1023) // 1024
+    cols = tl.arange(0, BLOCK)
+    valid = cols < W
+    ridx = tl.arange(0, BLOCK_M)
+    rstd_d = tl.zeros((BLOCK_M,), tl.float32)
+    rstd_m = tl.zeros((BLOCK_M,), tl.float32)
+    # pass 1: row statistics, one 1-D row at a time (the served reduction shape)
+    for r in tl.static_range(BLOCK_M):
+        t = (row0 + r).to(tl.int64)
+        ok = valid & (t < T)
+        if SERVED_ORDER:  # the served reduction order, layout-independent
+            sd = _served_sumsq(Dest + m * DEST_STRIDE + t * W, t < T, W)
+            sm = _served_sumsq(Message + m * MESSAGE_STRIDE + t * W, t < T, W)
+        else:  # failing control: this kernel's own tl.sum layout (sizePerThread 4 here vs the served 8)
+            dest = tl.load(Dest + m * DEST_STRIDE + t * W + cols, ok, other=0)
+            message = tl.load(Message + m * MESSAGE_STRIDE + t * W + cols, ok, other=0)
+            sd = tl.sum(dest * dest)
+            sm = tl.sum(message * message)
+        if INTERP:  # CPU interpreter only (no div_rn / libdevice there); GPU builds take the served ops
+            dr = tl.rsqrt(sd / W + eps)
+            mr = tl.rsqrt(sm / W + eps)
+        else:
+            dr = libdevice.rsqrt(tl.div_rn(sd, W) + eps)
+            mr = libdevice.rsqrt(tl.div_rn(sm, W) + eps)
+        rstd_d = tl.where(ridx == r, dr, rstd_d)
+        rstd_m = tl.where(ridx == r, mr, rstd_m)
+    rows = row0 + ridx
+    row_ok = rows[:, None] < T
+    rank = tl.arange(0, BLOCK_R)
+    ks = tl.arange(0, BLOCK_K)
+    Wd = Down + m * R * K
+    # pass 2: down projection of the normalized [dest | message] rows
+    total = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+    for group in tl.static_range(GROUPS):
+        partial = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+        for tile in tl.range(0, 1024 // BLOCK_K, num_stages=NUM_STAGES):
+            k = group * 1024 + tile * BLOCK_K + ks
+            in_d = k[None, :] < W
+            # branch-free (pipelinable): both tiles issue under complementary masks, one is fully masked per tile
+            x = tl.load(Dest + m * DEST_STRIDE + rows[:, None].to(tl.int64) * W + k[None, :], row_ok & in_d, other=0)
+            y = tl.load(Message + m * MESSAGE_STRIDE + rows[:, None].to(tl.int64) * W + (k[None, :] - W),
+                        row_ok & (k[None, :] >= W) & (k[None, :] < K), other=0)
+            xn = tl.where(in_d, x * rstd_d[:, None], y * rstd_m[:, None])
+            if not INTERP:
+                xn = xn.to(tl.bfloat16)
+            w = tl.load(Wd + rank[None, :] * K + k[:, None], (rank[None, :] < R) & (k[:, None] < K), other=0)
+            partial = tl.dot(xn, w, partial)
+        if group == 0:
+            total = partial
+        else:
+            total = total + partial
+    hidden = total
+    if not INTERP:  # the CPU interpreter's bf16 dot is broken: its check runs fp32 operands
+        hidden = total.to(tl.bfloat16)
+    # pass 3: gain / forget and the tanh mix
+    for start in tl.range(0, W, BLOCK_N, num_stages=NUM_STAGES):
+        cn = start + tl.arange(0, BLOCK_N)
+        col_ok = cn[None, :] < W
+        weight_ok = col_ok & (rank[:, None] < R)
+        weights = m * W * R + cn[None, :] * R + rank[:, None]
+        offsets = rows[:, None].to(tl.int64) * W + cn[None, :]
+        mask = row_ok & col_ok
+        dest_t = tl.load(Dest + m * DEST_STRIDE + offsets, mask, other=0)
+        message_t = tl.load(Message + m * MESSAGE_STRIDE + offsets, mask, other=0)
+        gain = tl.dot(hidden, tl.load(Gain + weights, weight_ok, other=0))
+        forget = tl.dot(hidden, tl.load(Forget + weights, weight_ok, other=0))
+        if INTERP:
+            tf = 1.0 - 2.0 / (tl.exp(2.0 * forget) + 1.0)
+            tg = 1.0 - 2.0 / (tl.exp(2.0 * gain) + 1.0)
+        else:
+            tf = libdevice.tanh(forget)
+            tg = libdevice.tanh(gain)
+        output = (1.0 - tf) * dest_t + tg * message_t
+        tl.store(Out + m * T * W + offsets, output, mask)
+
+
+def fused_message_controllers(dest, dest_stride, message, message_stride, down, gain, forget, out, eps=1e-6,
+                              block_m=16, block_k=128, block_n=64, num_warps=8, fp_fusion=False, num_stages=2, served_order=True, loop_stages=3):
+    """dest / message: base tensors with element strides between controllers (0 = one shared stream), as
+    inkling2_loop._stacked returns them; out: (num, tokens, width) fp32."""
+    num, rank, k = down.shape
+    tokens, width = out.shape[1], out.shape[2]
+    grid = (num, triton.cdiv(tokens, block_m))
+    _fused_controller[grid](
+        dest, message, down, gain, forget, out, tokens, dest_stride, message_stride, eps,
+        width, triton.next_power_of_2(width), rank, max(16, triton.next_power_of_2(rank)), block_m, block_k, block_n,
+        os.environ.get("TRITON_INTERPRET") == "1", served_order, loop_stages,
+        num_warps=num_warps, num_stages=num_stages, enable_fp_fusion=fp_fusion,
+    )
+    return out
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n32_attn_local.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n32_attn_local.py
new file mode 100644
index 0000000000000000000000000000000000000000..b4e8f279913074f1703018493053befb064ade60
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n32_attn_local.py
@@ -0,0 +1,226 @@
+"""n32 (inkling2-spark attn-bias seat): sliding-layer prefill rel bias computed inside the FA4 SM120 kernel, bitwise equal
+to the served einsum + ShearingBias + FA4 path (FlashAttentionForwardSm120RelProd, fa4_sm120/n32_fwd.py, mounted).
+Model side (patched inkling2_attn.py): on a sliding layer in EXTEND mode the rel bias is handed on as N32RelBias(r, module)
+instead of module(r) [T, H, 1024]. Here: interface._flash_attn_fwd is wrapped; an N32RelBias that reaches it on the call
+this kernel covers (SM12x, paged KV page 128, varlen, window (E - 1, 0), causal, pack_gqa False, 1 split, no
+score/mask mods, sinks, descales or softcap) runs the stock call with a zero-stride presheared-shape stand-in for the
+bias and aux_tensors = [r as int32 pairs, proj^T as int32 pairs]; make_kernel then builds the n32 class (has_bias,
+is_local, has_aux_tensors, no score/mask mod). Any other call gets module(r), the served bias, exactly as served.
+Switch: SGLANG_INKLING_N32=0 keeps the served path (same mounted files). Imported once from the patched inkling2_attn.py."""
+import logging
+import os
+
+import torch
+
+_INSTALLED = False
+ENABLED = os.environ.get("SGLANG_INKLING_N32", "1") == "1"
+# global layers too (n13's band-split kernel fed by the n32 producer); needs a kernel file generated with N32_GLOBAL = 1
+GLOBAL = os.environ.get("SGLANG_INKLING_N32_GLOBAL", "0") == "1"
+logger = logging.getLogger(__name__)
+_P32 = {}
+_BASE = {}
+STATS = {"inline": 0, "materialized": 0, "built": 0}
+
+
+class N32RelBias:
+    """Stands in for the sliding-layer rel bias [T, H, E] = module(r): r [T, H, 16] (clipped, as served) + the
+    RelLogitsProj module (proj [16, E])."""
+
+    __slots__ = ("r", "mod")
+
+    def __init__(self, r, mod):
+        self.r = r
+        self.mod = mod
+
+    @property
+    def shape(self):
+        return (self.r.shape[0], self.r.shape[1], self.mod.proj.shape[1])
+
+    def dim(self):  # n218 k1: tensor-like rank, asked by knapcio's inkling_attn pass-through test (see gen_hook_k1.py)
+        return 3
+
+    def data_ptr(self):  # n218 k1: never the storage of a marker tensor (their _same_storage_rows compares pointers)
+        return -1
+
+    @property
+    def dtype(self):
+        return self.r.dtype
+
+    @property
+    def device(self):
+        return self.r.device
+
+    @property
+    def requires_grad(self):
+        return False
+
+    def __getitem__(self, key):
+        if isinstance(key, tuple):
+            if len(key) != 1:
+                raise TypeError("N32RelBias supports row (dim 0) indexing only")
+            key = key[0]
+        r = self.r[key]
+        if r.dim() != 3:
+            raise TypeError("N32RelBias row index must keep the token dim")
+        return N32RelBias(r, self.mod)
+
+    def materialize(self):
+        return self.mod(self.r)
+
+
+def wants(attn, r, mode_name, padded, mxfp8):
+    """Model-side guard (Inkling2Attention._forward, extend branch)."""
+    return (
+        ENABLED
+        and (attn.is_local or GLOBAL)
+        and not padded
+        and not mxfp8
+        and mode_name == "EXTEND"
+        and r.dim() == 3
+        and r.dtype == torch.bfloat16
+        and r.shape[-1] == 16
+        and r.stride(-1) == 1
+        and tuple(attn.rel_logits_proj.proj.shape) == (16, 1024)
+        and attn.rel_logits_proj.proj.dtype == torch.bfloat16
+    )
+
+
+def _p32(proj):
+    """proj^T as int32 pairs [E, 8], cached per layer. Never built inside a CUDA-graph capture (the transpose kernel
+    would only be recorded, not run): returns None there and the caller serves the materialized bias instead."""
+    key = (id(proj), str(proj.device))  # proj is a module Parameter: one object per layer for the process
+    v = _P32.get(key)
+    if v is None:
+        if torch.cuda.is_current_stream_capturing():
+            return None
+        v = proj.t().contiguous().view(torch.int32)  # [E, 16] BF16 -> [E, 8] int32 pairs (k = 2t, 2t + 1)
+        v.__assumed_align__ = 16
+        v.__leading_dim__ = 1
+        _P32[key] = v
+    return v
+
+
+def _r32(r):
+    v = r.view(torch.int32)  # [T, H, 16] BF16 -> [T, H, 8] int32 pairs
+    v.__assumed_align__ = 4
+    v.__leading_dim__ = 2
+    return v
+
+
+_NONE_KW = ("qv", "score_mod", "mask_mod", "aux_tensors", "aux_scalars", "learnable_sink", "q_descale", "k_descale",
+            "v_descale", "sfq", "sfk", "sfv", "block_sparse_tensors", "gather_kv_indices", "seqused_q", "cu_seqlens_k",
+            "qk_sf_vec_size", "v_sf_vec_size")
+
+
+def eligible(q, k, v, kw, rb):
+    r = rb.r
+    e = rb.mod.proj.shape[1]
+    return (
+        not kw.get("rel_bias_presheared")
+        and q is not None
+        and q.dtype == torch.bfloat16
+        and q.dim() == 3
+        and q.shape[0] == r.shape[0]
+        and q.shape[1] == r.shape[1]
+        and q.shape[2] == 128
+        and k is not None
+        and k.dim() == 4
+        and k.shape[1] == 128
+        and kw.get("cu_seqlens_q") is not None
+        and kw.get("page_table") is not None
+        and kw.get("seqused_k") is not None
+        and (
+            (kw.get("window_size_left") == e - 1 and kw.get("window_size_right") == 0)  # sliding layer
+            or (GLOBAL and kw.get("window_size_left") in (None, -1) and kw.get("window_size_right") in (None, -1))  # global
+        )
+        and kw.get("causal") is True
+        and kw.get("pack_gqa") is False
+        and kw.get("num_splits") == 1
+        and not kw.get("softcap")
+        and all(kw.get(x) is None for x in _NONE_KW)
+        and r.stride(-1) == 1
+        and r.stride(-2) % 2 == 0
+        and r.stride(0) % 2 == 0
+        and r.storage_offset() % 2 == 0
+        and q.is_cuda
+        and _sm12(q.device)
+    )
+
+
+_CAP = {}
+
+
+def _sm12(dev):
+    v = _CAP.get(str(dev))
+    if v is None:
+        v = _CAP[str(dev)] = torch.cuda.get_device_capability(dev)[0] == 12
+    return v
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED:
+        return
+    from sglang.kernels.ops.attention.fa4_sm120 import runtime as _rt
+    from sglang.kernels.ops.attention.fa4_sm120.flash_fwd import FlashAttentionForwardSm120
+    from sglang.kernels.ops.attention.fa4_sm120 import n32_fwd as _n32
+    from sglang.kernels.ops.attention.fa4_sm120.n32_fwd import FlashAttentionForwardSm120RelProd
+
+    band_cls = getattr(_n32, "FlashAttentionForwardSm120BandSplitRelProd", None)
+    assert band_cls is not None or not GLOBAL, "SGLANG_INKLING_N32_GLOBAL=1 needs n32_fwd.py generated with N32_GLOBAL = 1"
+    from sglang.kernels.ops.attention.flash_attn.cute import interface as _itf
+
+    orig_mk = _rt.Sm120ForwardPolicy.make_kernel
+
+    def make_kernel(**kw):
+        k = orig_mk(**kw)
+        ok = (kw.get("has_bias") and kw.get("has_aux_tensors") and kw.get("score_mod") is None and kw.get("mask_mod") is None
+              and not kw.get("pack_gqa") and kw.get("paged_kv") and not k._uses_split_pv_warps())
+        if ok and kw.get("is_local") and type(k) is FlashAttentionForwardSm120:
+            k.__class__ = FlashAttentionForwardSm120RelProd
+            STATS["built"] += 1
+            logger.warning("n32: FA4 SM120 in-kernel sliding rel-bias kernel built (tile %s x %s, bias rows %s, build %d)",
+                           k.tile_m, k.tile_n, k.bias_block_size, STATS["built"])
+        elif ok and GLOBAL and not kw.get("is_local") and band_cls is not None and type(k).__name__ == "FlashAttentionForwardSm120BandSplit":
+            k.__class__ = band_cls
+            STATS["built"] += 1
+            logger.warning("n32: FA4 SM120 global band-split kernel with in-kernel rel bias built (tile %s x %s, bias rows %s, build %d)",
+                           k.tile_m, k.tile_n, k.bias_block_size, STATS["built"])
+        return k
+
+    _rt.Sm120ForwardPolicy.make_kernel = staticmethod(make_kernel)
+    orig_fwd = _itf._flash_attn_fwd
+
+    def _flash_attn_fwd(q, k, v, *args, **kw):
+        rb = kw.get("rel_bias")
+        if isinstance(rb, N32RelBias):
+            p32 = _p32(rb.mod.proj) if not args and eligible(q, k, v, kw, rb) else None
+            if p32 is not None:
+                tpad = -(-q.shape[0] // 64) * 64
+                e_pad = rb.mod.proj.shape[1] + 256
+                dkey = (str(q.device), e_pad)
+                base = _BASE.get(dkey)
+                if base is None:  # contents never read (the n32 kernel ignores the bias argument): empty is enough
+                    base = _BASE[dkey] = torch.empty(e_pad, dtype=torch.bfloat16, device=q.device)
+                kw = dict(kw)
+                kw["rel_bias"] = base.as_strided((tpad, q.shape[1], e_pad), (0, 0, 1))
+                kw["rel_bias_presheared"] = True
+                kw["rel_bias_prep_cache"] = None
+                kw["aux_tensors"] = [_r32(rb.r), p32]
+                STATS["inline"] += 1
+                if STATS["inline"] <= 2:
+                    logger.warning("n32: in-kernel sliding rel bias, call %d tokens %d", STATS["inline"], q.shape[0])
+                return orig_fwd(q, k, v, *args, **kw)
+            kw = dict(kw)
+            kw["rel_bias"] = rb.materialize()
+            STATS["materialized"] += 1
+            if STATS["materialized"] <= 4:
+                logger.warning("n32: sliding rel bias materialized as served (ineligible call %d, tokens %d)",
+                               STATS["materialized"], q.shape[0] if q is not None else -1)
+        return orig_fwd(q, k, v, *args, **kw)
+
+    # the stock function keeps its compile caches as attributes on itself and reads them through its module global
+    _flash_attn_fwd.__dict__ = orig_fwd.__dict__
+    _itf._flash_attn_fwd = _flash_attn_fwd
+    _INSTALLED = True
+    logger.warning("n32: in-kernel rel-bias hook installed (enabled=%s, global=%s)", ENABLED, GLOBAL)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n32_fwd.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n32_fwd.py
new file mode 100644
index 0000000000000000000000000000000000000000..2d051d7baeb50d046f56e7a7e72a1f35bd695605
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n32_fwd.py
@@ -0,0 +1,1567 @@
+# Generated by work_attnbias/gen/gen_n32.py from the image's sglang/kernels/ops/attention/fa4_sm120/flash_fwd.py (md5 f7161e38).
+"""n126 S4c a4 gate fix (stack seat, 2026-11-24; from n115 a4 7e0b8ca9): a4's consumer-built bias (compute_one_n_block override,
+the producer's bias-fill gate and the kernel-entry n115 setup) now applies to the SLIDING class only (n32_plain_bias False). Every
+class with n32_plain_bias True (n32's global FlashAttentionForwardSm120BandSplitRelProd and S3's n64a BandOnly, its subclass) traces
+S3's 115d2333 code: the compute_one_n_block S3's MRO resolves (BandSplit / base), the ungated bias fill, no n115 setup. Why: S4's
+check boot hung at the first global call (n64a inherited a4's consumer while its own producer filled the bias ring).
+n115 V-a' (verifyship seat, gen_n115.py, from the served n32_fwd.py 115d2333): consumer warps build their own bias rows.
+n32 (inkling2-spark attn-bias seat): FlashAttentionForwardSm120RelProd, the image's SM120 FA4 forward kernel for the
+sliding-layer relative-bias prefill call with the bias producer moved in-kernel (see gen_n32.py). Outputs are meant to be
+bitwise equal to the served einsum + ShearingBias + FA4 path (checked on the GPU)."""
+from sglang.kernels.ops.attention.fa4_sm120 import flash_fwd as _base
+
+globals().update({k: v for k, v in vars(_base).items() if not k.startswith("__")})
+from cutlass import BFloat16, Float32, Int32  # noqa: E402
+from cutlass._mlir.dialects import llvm  # noqa: E402
+from cutlass.cutlass_dsl import dsl_user_op  # noqa: E402
+
+from sglang.kernels.ops.attention.fa4_sm120.flash_fwd import FlashAttentionForwardSm120  # noqa: E402
+
+N32_CONTROL = 0  # 1 = deliberately wrong rounding (truncate to BF16): a failing control for the bitwise checks; never ship
+N32_PRODUCER = 2  # 1 = per-element generic producer, 2 = hoisted producer (same values)
+N115_CONTROL = 0  # 1 = truncate the bias to BF16 (round toward zero): the failing control; never ship
+N115_DMA = 0  # 1 = the DMA warp still fills the bias stages (served n32); 0 = V-a' (consumer warps build their own rows)
+N115_STRIDE2 = 88  # a2: BF16 elements per half-slab row (80 used incl. the odd-row shift)
+N115_STRIDE = 152  # BF16 elements per slab row (>= 16 + 128 - 1 + 1 odd-row shift; 76 words: 8 rows on 8 distinct banks)
+N115_VARIANT = 'a4'
+N32_GLOBAL = 1  # 1 = also define the global-layer class (imports n13_fwd.py, which n21-based recipes mount)
+
+
+@dsl_user_op
+def n32_mma_bf16_k16(a0, a1, a2, a3, b0, b1, *, loc=None, ip=None):
+    """One mma.sync m16n8k16 (row.col, BF16 x BF16 -> fp32) with a zero accumulator; returns (d0, d1, d2, d3)."""
+    f32 = Float32.mlir_type
+    z = Float32(0.0).ir_value(loc=loc, ip=ip)
+    out = llvm.inline_asm(
+        llvm.StructType.get_literal([f32] * 4),
+        [Int32(x).ir_value(loc=loc, ip=ip) for x in (a0, a1, a2, a3, b0, b1)] + [z, z, z, z],
+        "mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 "
+        "{$0, $1, $2, $3}, {$4, $5, $6, $7}, {$8, $9}, {$10, $11, $12, $13};",
+        "=f,=f,=f,=f,r,r,r,r,r,r,f,f,f,f",
+        has_side_effects=False,
+        is_align_stack=False,
+        asm_dialect=llvm.AsmDialect.AD_ATT,
+        loc=loc,
+        ip=ip,
+    )
+    return [Float32(llvm.extractvalue(f32, out, [i], loc=loc, ip=ip)) for i in range(4)]
+
+
+@dsl_user_op
+def n32_trunc_bf16_f32(x, *, loc=None, ip=None):
+    """Control only: x with its low 16 bits cleared (round toward zero to BF16), as fp32."""
+    return Float32(
+        llvm.inline_asm(
+            Float32.mlir_type,
+            [Float32(x).ir_value(loc=loc, ip=ip)],
+            "{ .reg .b32 t; mov.b32 t, $1; and.b32 t, t, 0xffff0000; mov.b32 $0, t; }",
+            "=f,f",
+            has_side_effects=False,
+            is_align_stack=False,
+            asm_dialect=llvm.AsmDialect.AD_ATT,
+            loc=loc,
+            ip=ip,
+        )
+    )
+
+
+@dsl_user_op
+def n115_pack_bf16x2(lo, hi, *, loc=None, ip=None):
+    """{hi, lo} as one 32-bit word: cvt.rn.bf16x2.f32 (round to nearest even per element, as cvt.rn.bf16.f32); lo -> bits 0-15."""
+    return Int32(
+        llvm.inline_asm(
+            Int32.mlir_type,
+            [Float32(hi).ir_value(loc=loc, ip=ip), Float32(lo).ir_value(loc=loc, ip=ip)],
+            "cvt.rn.bf16x2.f32 $0, $1, $2;",
+            "=r,f,f",
+            has_side_effects=False,
+            is_align_stack=False,
+            asm_dialect=llvm.AsmDialect.AD_ATT,
+            loc=loc,
+            ip=ip,
+        )
+    )
+
+
+class FlashAttentionForwardSm120RelProd(FlashAttentionForwardSm120):
+    """SM120 FA4 forward, sliding-layer rel bias produced in-kernel by the DMA warp (n32)."""
+
+    n32_extent = 1024  # rel_extent (rel_extent_padded - 256)
+    n32_plain_bias = False  # stock swizzled bias tile (sliding); True for n13's unswizzled tile (global band-split)
+    n32_chunks = 18  # 8-distance chunks per 16-row group: rows 16 + keys 128 - 1 = 143 distances
+
+    @cute.jit
+    def n32_tile_setup(
+        self,
+        mR32: cute.Tensor,
+        block_info: BlockInfo,
+        seqlen: SeqlenInfoQK,
+        m_block: Int32,
+        head_idx: Int32,
+        tidx: Int32,
+    ):
+        """A fragments (m16n8k16 row layout) of r for this lane: index 4 * grp + hh + 2 * kk = rows 16 grp + 8 hh + g,
+        k pair 2 t + 8 kk; zero for rows past the sequence. Bounds: visible keys of row 16 grp + 8 hh + g are
+        [lo, hi] = [max(n_idx_left, n_idx_right - E), n_idx_right - 1] (the shear's num_bias_vals band); -inf outside."""
+        lane = tidx % cute.arch.WARP_SIZE
+        g = lane // 4
+        t = lane % 4
+        ra = cute.make_rmem_tensor((16,), Int32)
+        lo = cute.make_rmem_tensor((8,), Int32)
+        hi = cute.make_rmem_tensor((8,), Int32)
+        for s in cutlass.range_constexpr(8):
+            grp = s // 2
+            hh = s % 2
+            m_idx = m_block * self.tile_m + 16 * grp + 8 * hh + g
+            n_idx_left, n_idx_right = block_info.get_n_idx_left_right(seqlen, m_idx)
+            lo[s] = cutlass.max(n_idx_left, n_idx_right - self.n32_extent)
+            hi[s] = n_idx_right - 1
+            row = seqlen.offset_q + m_idx
+            for kk in cutlass.range_constexpr(2):
+                v = Int32(0)
+                if m_idx < seqlen.seqlen_q:
+                    v = mR32[row, head_idx, t + 4 * kk]
+                ra[4 * grp + hh + 2 * kk] = v
+        return ra, lo, hi
+
+    @cute.jit
+    def n32_bias_tile(
+        self,
+        sB: cute.Tensor,
+        mP32: cute.Tensor,
+        ra: cute.Tensor,
+        lo: cute.Tensor,
+        hi: cute.Tensor,
+        pmax: Int32,
+        n_block: Int32,
+        seqlen: SeqlenInfoQK,
+        m_block: Int32,
+        tidx: Int32,
+    ):
+        if const_expr(N32_PRODUCER == 2):
+            self.n32_bias_tile_v2(sB, mP32, ra, hi, pmax, n_block, tidx)
+        else:
+            assert self.is_local and not self.n32_plain_bias, "v1 producer: sliding layers only"
+            self.n32_bias_tile_v1(sB, mP32, ra, lo, hi, n_block, tidx)
+
+    @cute.jit
+    def n32_bias_tile_v1(
+        self,
+        sB: cute.Tensor,
+        mP32: cute.Tensor,
+        ra: cute.Tensor,
+        lo: cute.Tensor,
+        hi: cute.Tensor,
+        n_block: Int32,
+        tidx: Int32,
+    ):
+        """Sheared bias tile of key block n_block into sB (bias_block_size, tile_n): sB[i, c] = BF16_RTNE(r_i . proj[:, p])
+        with p = hi_i - k, k = n_block * tile_n + c, if lo_i <= k <= hi_i, else -inf. T[i, j] = r_i . proj[:, D0 + j]
+        with D0 = hi_i - i - k0 - (tile_n - 1) (row independent), and sB[i, c] = T[i, i + tile_n - 1 - c]."""
+        lane = tidx % cute.arch.WARP_SIZE
+        g = lane // 4
+        t = lane % 4
+        k0 = n_block * self.tile_n
+        # hi_i - i is the same for every row: take it from this lane's first row (row g)
+        d0 = hi[0] - g - k0 - (self.tile_n - 1)
+        num_groups = (self.bias_block_size + 15) // 16
+        for grp in cutlass.range_constexpr(num_groups):
+            for ch in cutlass.range(self.n32_chunks, unroll=1):
+                j0 = 16 * grp + 8 * ch
+                d = d0 + j0 + g
+                b0 = Int32(0)
+                b1 = Int32(0)
+                if d >= 0 and d < self.n32_extent:
+                    b0 = mP32[d, t]
+                    b1 = mP32[d, t + 4]
+                acc = n32_mma_bf16_k16(
+                    ra[4 * grp + 0], ra[4 * grp + 1], ra[4 * grp + 2], ra[4 * grp + 3], b0, b1
+                )
+                for hh in cutlass.range_constexpr(2):
+                    if const_expr(16 * grp + 8 * hh < self.bias_block_size):
+                        i = 16 * grp + 8 * hh + g
+                        for e in cutlass.range_constexpr(2):
+                            j = j0 + 2 * t + e
+                            c = i + (self.tile_n - 1) - j
+                            if c >= 0 and c < self.tile_n:
+                                k = k0 + c
+                                x = Float32(-Float32.inf)
+                                if k >= lo[2 * grp + hh] and k <= hi[2 * grp + hh]:
+                                    x = acc[2 * hh + e]
+                                    if const_expr(N32_CONTROL == 1):
+                                        x = n32_trunc_bf16_f32(x)
+                                sB[i, c] = x.to(BFloat16)
+
+    @cute.jit
+    def n32_bias_tile_v2(
+        self,
+        sB: cute.Tensor,
+        mP32: cute.Tensor,
+        ra: cute.Tensor,
+        hi: cute.Tensor,
+        pmax: Int32,
+        n_block: Int32,
+        tidx: Int32,
+    ):
+        """Same tile as v1 (sliding; with n32_plain_bias and causal pads for the global band-split class). Output (i, j) of chunk (grp, ch) has j = 16 grp + 8 ch + 2 t + e, proj index p = d0 + j and
+        column c = i + tile_n - 1 - j = cb - 8 ch + 8 hh - e (cb = tile_n - 1 + g - 2 t: no grp term). Valid iff
+        0 <= p <= pmax (pmax = min(wl + wr, E - 1); k >= 0 always holds), the shear's band. 24 distance chunks
+        u = 2 grp + ch carry the B fragments (d = d0 + 8 u + g). Element offset in the stage (atom 8 x 64, swizzle
+        3/4/3 on bytes) for this lane's rows (i & 7 == g): 512 (i >> 3) + 64 g + bbs (c & 64) + ((c & 63) ^ 8 g)."""
+        lane = tidx % cute.arch.WARP_SIZE
+        g = lane // 4
+        t = lane % 4
+        bbs = self.bias_block_size
+        num_groups = (bbs + 15) // 16
+        nu = 2 * (num_groups - 1) + self.n32_chunks
+        k0 = n_block * self.tile_n
+        d0 = hi[0] - g - k0 - (self.tile_n - 1)
+        raw = cute.make_tensor(cute.recast_ptr(sB.iterator, None), cute.make_layout(bbs * self.tile_n))
+        P = cute.make_tensor(mP32.iterator, cute.make_layout((self.n32_extent, 8), stride=(8, 1)))
+        bf = cute.make_rmem_tensor((2 * nu,), Int32)
+        for u in cutlass.range_constexpr(nu):
+            d = cutlass.min(cutlass.max(d0 + 8 * u + g, 0), self.n32_extent - 1)
+            bf[2 * u] = P[d, t]
+            bf[2 * u + 1] = P[d, t + 4]
+        if d0 >= 0 and d0 + 8 * nu - 1 <= pmax:
+            self.n32_emit(raw, ra, bf, g, t, d0, pmax, False)
+        else:
+            self.n32_emit(raw, ra, bf, g, t, d0, pmax, True)
+
+    @cute.jit
+    def n32_emit(
+        self,
+        raw: cute.Tensor,
+        ra: cute.Tensor,
+        bf: cute.Tensor,
+        g: Int32,
+        t: Int32,
+        d0: Int32,
+        pmax: Int32,
+        check: cutlass.Constexpr[bool],
+    ):
+        bbs = self.bias_block_size
+        num_groups = (bbs + 15) // 16
+        g8 = 8 * g
+        rowbase = (self.tile_n if const_expr(self.n32_plain_bias) else 64) * g
+        # shear pads: right (p < 0) -inf; left (p > pmax) -inf with a left window (sliding), 0.0 without (global, causal)
+        left_pad = Float32(-Float32.inf) if const_expr(self.is_local) else Float32(0.0)
+        cb = (self.tile_n - 1) + g - 2 * t
+        pl = d0 + 2 * t
+        for ch in cutlass.range_constexpr(self.n32_chunks):
+            acc = []
+            for grp in cutlass.range_constexpr(num_groups):
+                u = 2 * grp + ch
+                acc.append(
+                    n32_mma_bf16_k16(
+                        ra[4 * grp + 0], ra[4 * grp + 1], ra[4 * grp + 2], ra[4 * grp + 3],
+                        bf[2 * u], bf[2 * u + 1],
+                    )
+                )
+            for hh in cutlass.range_constexpr(2):
+                for e in cutlass.range_constexpr(2):
+                    c = cb + (8 * hh - 8 * ch - e)
+                    if const_expr(self.n32_plain_bias):
+                        col = rowbase + c  # n13's unswizzled row-major tile: offset 128 i + c
+                    else:
+                        col = rowbase + ((c ^ g8) & 63) + (c & 64) * bbs
+                    edge = const_expr(ch < 2 or ch > self.n32_chunks - 3)
+                    in_tile = True
+                    if const_expr(edge):
+                        in_tile = c >= 0 and c < self.tile_n
+                    for grp in cutlass.range_constexpr(num_groups):
+                        if const_expr(16 * grp + 8 * hh < bbs):
+                            x = acc[grp][2 * hh + e]
+                            if const_expr(N32_CONTROL == 1):
+                                x = n32_trunc_bf16_f32(x)
+                            if const_expr(check):
+                                p = pl + (16 * grp + 8 * ch + e)
+                                if p < 0:
+                                    x = Float32(-Float32.inf)
+                                if p > pmax:
+                                    x = left_pad
+                            roff = (self.tile_n * 8 if const_expr(self.n32_plain_bias) else 512) * (2 * grp + hh)
+                            if const_expr(edge):
+                                if in_tile:
+                                    raw[col + roff] = x.to(BFloat16)
+                            else:
+                                raw[col + roff] = x.to(BFloat16)
+
+    # ---- copied from the image file and patched (gen_n32.py) ----
+    # ---- n115 V-a' (gen_n115.py) ----
+    @cute.jit
+    def n115_bias(
+        self,
+        acc_S: cute.Tensor,
+        thr_mma_qk: cute.TiledMma,
+        sBias: cute.Tensor,
+        base_softmax_scale: Float32,
+        apply_bias: bool,
+        n_block: Int32,
+        m_block: Int32,
+        head_idx: Int32,
+        seqlen: SeqlenInfoQK,
+    ):
+        """n115 V-a' (a4): this warp's 16 rows of the sheared bias, built here per 64-key half with n32 v2's values, merged as served."""
+        cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+        tScS = thr_mma_qk.partition_C(cS)
+        if apply_bias:
+            bbs = self.bias_block_size
+            S2 = N115_STRIDE2
+            HALF = self.tile_n // 2
+            nch = (HALF + 16) // 8
+            nst = cute.size(sBias.shape[2])
+            assert ((bbs + 15) // 16) * 16 * S2 <= bbs * self.tile_n * nst, f"n115 a2 slab does not fit: bbs {bbs} nst {nst}"
+            assert cute.size(acc_S.shape) == 64 and str(acc_S.shape).replace(" ", "") == "((2,2),1,16)", f"n115 a2: acc_S shape {acc_S.shape}"
+            raw = cute.make_tensor(cute.recast_ptr(sBias.iterator, None), cute.make_layout(bbs * self.tile_n * nst))
+            lane = cute.arch.thread_idx()[0] % cute.arch.WARP_SIZE
+            g = lane // 4
+            t = lane % 4
+            gw = tScS[0][0] // 16
+            base = gw * (16 * S2)
+            mR32 = self._n115_r32
+            P = cute.make_tensor(self._n115_p32.iterator, cute.make_layout((self.n32_extent, 8), stride=(8, 1)))
+            m0 = m_block * self.tile_m
+            ra = cute.make_rmem_tensor((4,), Int32)
+            for hh in cutlass.range_constexpr(2):
+                m_idx = m0 + 16 * gw + 8 * hh + g
+                for kk in cutlass.range_constexpr(2):
+                    v = Int32(0)
+                    if m_idx < seqlen.seqlen_q:
+                        v = mR32[seqlen.offset_q + m_idx, head_idx, t + 4 * kk]
+                    ra[hh + 2 * kk] = v
+            n_idx_left, n_idx_right = self._n115_bi.get_n_idx_left_right(seqlen, m0 + g)
+            d0 = (n_idx_right - 1) - g - n_block * self.tile_n - (self.tile_n - 1)
+            pmax = self._n115_pmax
+            raw32 = cute.make_tensor(cute.recast_ptr(sBias.iterator, None, Int32), cute.make_layout((bbs * self.tile_n * nst) // 2))
+            for hf in cutlass.range_constexpr(2):
+                dh = d0 + 16 * gw + HALF * (1 - hf)
+                if 16 * gw < bbs:
+                    cute.arch.sync_warp()  # every lane finished reading the slab's previous contents
+                    if dh >= 0 and dh + 8 * nch - 1 <= pmax:
+                        self.n115_emit_half(raw32, ra, P, dh, pmax, base, g, t, nch, False)
+                    else:
+                        self.n115_emit_half(raw32, ra, P, dh, pmax, base, g, t, nch, True)
+                    cute.arch.sync_warp()  # the half slab is complete before any lane reads it
+                for i in cutlass.range_constexpr(32 * hf, 32 * hf + 32):
+                    row = tScS[i][0]
+                    col = tScS[i][1]
+                    acc_S[i] = acc_S[i] * base_softmax_scale
+                    if const_expr(self.bias_block_size == self.tile_m) or row < self.bias_block_size:
+                        il = row - 16 * gw
+                        acc_S[i] = acc_S[i] + raw[
+                            base + il * S2 + (il + (HALF - 1) - (col - HALF * hf))
+                        ].to(self.qk_acc_dtype)
+        else:
+            for i in cutlass.range(cute.size(acc_S.shape), unroll_full=True):
+                acc_S[i] = acc_S[i] * base_softmax_scale
+
+    @cute.jit
+    def n115_emit_half(
+        self,
+        raw32: cute.Tensor,
+        ra: cute.Tensor,
+        P: cute.Tensor,
+        dh: Int32,
+        pmax: Int32,
+        base: Int32,
+        g: Int32,
+        t: Int32,
+        nch: cutlass.Constexpr[int],
+        check: cutlass.Constexpr[bool],
+    ):
+        S2 = N115_STRIDE2
+        bf = cute.make_rmem_tensor((2 * nch,), Int32)
+        for ch in cutlass.range_constexpr(nch):
+            if const_expr(check):
+                d = cutlass.min(cutlass.max(dh + 8 * ch + g, 0), self.n32_extent - 1)
+            else:
+                d = dh + 8 * ch + g
+            bf[2 * ch] = P[d, t]
+            bf[2 * ch + 1] = P[d, t + 4]
+        for ch in cutlass.range_constexpr(nch):
+            acc = n32_mma_bf16_k16(ra[0], ra[1], ra[2], ra[3], bf[2 * ch], bf[2 * ch + 1])
+            for hh in cutlass.range_constexpr(2):
+                x0 = acc[2 * hh]
+                x1 = acc[2 * hh + 1]
+                if const_expr(N115_CONTROL == 1):
+                    x0 = n32_trunc_bf16_f32(x0)
+                    x1 = n32_trunc_bf16_f32(x1)
+                if const_expr(check):
+                    p = dh + 8 * ch + 2 * t
+                    if p < 0 or p > pmax:
+                        x0 = Float32(-Float32.inf)
+                    if p + 1 < 0 or p + 1 > pmax:
+                        x1 = Float32(-Float32.inf)
+                raw32[(base + (g + 8 * hh) * S2 + 8 * ch + 2 * t) // 2] = n115_pack_bf16x2(x0, x1)
+
+    @cute.jit
+    def compute_one_n_block(
+        self,
+        n_block: Int32,
+        consumer_state: PipelineState,
+        mma_params: SimpleNamespace,
+        smem_copy_params: SimpleNamespace,
+        softmax: Softmax,
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        score_mod: Callable | None,
+        sBias: Optional[cute.Tensor],
+        pipeline_bias: Optional[PipelineAsync],
+        base_softmax_scale: Optional[Float32],
+        apply_bias: bool,
+        batch_idx: Int32,
+        head_idx: Int32,
+        m_block: Int32,
+        seqlen: SeqlenInfoQK,
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+        mask_fn: Optional[Callable] = None,
+        is_first_n_block: cutlass.Constexpr = False,
+        check_inf: cutlass.Constexpr = True,
+    ):
+        acc_shape_S = mma_params.thr_mma_qk.partition_shape_C(
+            (self.tile_m, self.tile_n)
+        )
+        acc_S = cute.make_rmem_tensor(acc_shape_S, Float32)
+        acc_S.fill(0.0)
+        k_wait_token = pipeline_k.consumer_try_wait(consumer_state)
+        pipeline_k.consumer_wait(consumer_state, k_wait_token)
+        self._gemm_qk_phase_local(
+            mma_params.thr_mma_qk,
+            acc_S,
+            smem_copy_params.sQ,
+            smem_copy_params.sK[None, None, consumer_state.index],
+            smem_copy_params.smem_thr_copy_Q,
+            smem_copy_params.smem_thr_copy_K,
+        )
+        pipeline_k.consumer_release(consumer_state)
+
+        if const_expr(self.has_bias):
+            if const_expr(self.bias_block_size == self.tile_m):
+                self.n115_bias(
+                    acc_S,
+                    mma_params.thr_mma_qk,
+                    sBias,
+                    base_softmax_scale,
+                    apply_bias,
+                    n_block,
+                    m_block,
+                    head_idx,
+                    seqlen,
+                )
+            else:
+                self.apply_sheared_bias(
+                    acc_S,
+                    mma_params.thr_mma_qk,
+                    sBias,
+                    pipeline_bias,
+                    consumer_state,
+                    base_softmax_scale,
+                    apply_bias,
+                )
+        if const_expr(score_mod is not None):
+            self.apply_score_mod(
+                mma_params.thr_mma_qk,
+                batch_idx,
+                head_idx,
+                m_block,
+                acc_S,
+                n_block,
+                softmax_scale=(
+                    1.0 if const_expr(self.has_bias) else softmax.softmax_scale
+                ),
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+            )
+        if const_expr(mask_fn is not None):
+            mask_fn(acc_S, n_block=n_block)
+        row_scale = softmax.online_softmax(
+            acc_S, is_first=is_first_n_block, check_inf=check_inf
+        )
+        softmax.rescale_O(mma_params.acc_O, row_scale)
+        rP = cute.make_fragment_like(acc_S, self.dtype)
+        rP.store(acc_S.load().to(self.dtype))
+        tOrP = layout_utils.reshape_acc_to_frgA(rP)
+
+        v_wait_token = pipeline_v.consumer_try_wait(consumer_state)
+        pipeline_v.consumer_wait(consumer_state, v_wait_token)
+        self._gemm_pv_phase_local(
+            mma_params.thr_mma_pv,
+            mma_params.acc_O,
+            tOrP,
+            smem_copy_params.sV[None, None, consumer_state.index],
+            smem_copy_params.smem_thr_copy_V,
+        )
+        pipeline_v.consumer_release(consumer_state)
+        consumer_state.advance()
+        return consumer_state
+
+    @cute.jit
+    def __call__(
+        self,
+        mQ: cute.Tensor,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        softmax_scale: Float32,
+        mCuSeqlensQ: Optional[cute.Tensor] = None,
+        mCuSeqlensK: Optional[cute.Tensor] = None,
+        mSeqUsedQ: Optional[cute.Tensor] = None,
+        mSeqUsedK: Optional[cute.Tensor] = None,
+        mPageTable: Optional[cute.Tensor] = None,
+        window_size_left: Int32 | int | None = None,
+        window_size_right: Int32 | int | None = None,
+        learnable_sink: Optional[cute.Tensor] = None,
+        blocksparse_tensors: Optional[BlockSparseTensors] = None,
+        aux_data: AuxData = AuxData(),
+        mBias: Optional[cute.Tensor] = None,
+        launch_split_combine_early: Int32 = Int32(0),
+        stream: cuda.CUstream = None,
+    ):
+        assert blocksparse_tensors is None, "Block sparsity is not supported on SM120"
+        assert (mBias is not None) == self.has_bias
+        # n32: mBias is a zero-stride stand-in (the presheared-shape argument the interface requires); the kernel reads
+        # r (int32 pairs [T, H, 8]) and proj^T (int32 pairs [E, 8]) from aux_data and builds the sheared tile itself.
+        assert self.has_bias and self.paged_kv and not self.pack_gqa
+        assert not self._uses_split_pv_warps()
+        # n32: row-independent hi - row needs n_idx_right = m_idx + 1 + delta (+ wr): local with a right window, or causal
+        assert (self.is_local and window_size_right is not None) or (self.is_causal and not self.is_local)
+        assert aux_data.tensors is not None and len(aux_data.tensors) == 2
+        n32_r32, n32_p32 = aux_data.tensors[0], aux_data.tensors[1]
+        aux_data = AuxData()
+        mBias = None
+        assert mPageTable is None or self.paged_kv, (
+            "SM120 paged KV requires the dedicated DMA-warp specialization"
+        )
+        self._check_type(
+            *(
+                t.element_type if t is not None else None
+                for t in (
+                    mQ,
+                    mK,
+                    mV,
+                    mO,
+                    mLSE,
+                    mCuSeqlensQ,
+                    mCuSeqlensK,
+                    mSeqUsedQ,
+                    mSeqUsedK,
+                )
+            )
+        )
+        tiled_mma_qk, tiled_mma_pv = self._get_tiled_mma()
+        self.num_qk_threads = tiled_mma_qk.size
+        self.num_mma_threads = tiled_mma_pv.size
+        self.num_producer_threads = self.num_threads
+        self.num_Q_load_threads = (
+            self.num_qk_threads if self._uses_split_pv_warps() else self.num_threads
+        )
+        self.num_epilogue_threads = (
+            self.num_mma_threads if self._uses_split_pv_warps() else self.num_threads
+        )
+        self.use_tma_O = False
+        self._setup_attributes()
+        SharedStorage = self._get_shared_storage_cls()
+
+        mQ, mK, mV, mO = [assume_tensor_aligned(t) for t in (mQ, mK, mV, mO)]
+        if const_expr(mBias is not None):
+            assert mBias.element_type == self.dtype
+            mBias = assume_tensor_aligned(mBias)
+        Q_layout_transpose = (
+            [1, 3, 2, 0] if const_expr(mCuSeqlensQ is None) else [0, 2, 1]
+        )
+        KV_layout_transpose = (
+            [1, 3, 2, 0] if const_expr(mCuSeqlensK is None) else [0, 2, 1]
+        )
+        mQ = cute.make_tensor(
+            mQ.iterator, cute.select(mQ.layout, mode=Q_layout_transpose)
+        )
+        if const_expr(mBias is not None):
+            mBias = cute.make_tensor(
+                mBias.iterator,
+                cute.select(mBias.layout, mode=Q_layout_transpose),
+            )
+        mK, mV = [
+            cute.make_tensor(
+                t.iterator, cute.select(t.layout, mode=KV_layout_transpose)
+            )
+            for t in (mK, mV)
+        ]
+        if const_expr(mPageTable is None):
+            V_layout_transpose = (
+                [1, 0, 2, 3] if const_expr(mCuSeqlensK is None) else [1, 0, 2]
+            )
+            mV = cute.make_tensor(
+                mV.iterator, cute.select(mV.layout, mode=V_layout_transpose)
+            )
+        if const_expr(self.is_split_kv):
+            num_splits = mO.shape[0]
+            O_layout_transpose = (
+                [2, 4, 3, 1, 0] if const_expr(mCuSeqlensQ is None) else [1, 3, 2, 0]
+            )
+            LSE_layout_transpose = (
+                [3, 2, 1, 0] if const_expr(mCuSeqlensQ is None) else [2, 1, 0]
+            )
+        else:
+            num_splits = Int32(1)
+            O_layout_transpose = (
+                [1, 3, 2, 0] if const_expr(mCuSeqlensQ is None) else [0, 2, 1]
+            )
+            LSE_layout_transpose = (
+                [2, 1, 0] if const_expr(mCuSeqlensQ is None) else [1, 0]
+            )
+        mO = cute.make_tensor(
+            mO.iterator, cute.select(mO.layout, mode=O_layout_transpose)
+        )
+        if const_expr(mLSE is not None):
+            mLSE = cute.make_tensor(
+                mLSE.iterator, cute.select(mLSE.layout, mode=LSE_layout_transpose)
+            )
+        if const_expr(self.pack_gqa):
+            nheads_kv = mK.shape[2]
+            mQ = pack_gqa_layout(mQ, self.qhead_per_kvhead, nheads_kv, head_idx=2)
+            mO = pack_gqa_layout(mO, self.qhead_per_kvhead, nheads_kv, head_idx=2)
+            if const_expr(mLSE is not None):
+                mLSE = pack_gqa_layout(
+                    mLSE, self.qhead_per_kvhead, nheads_kv, head_idx=1
+                )
+            if const_expr(mBias is not None):
+                mBias = pack_gqa_layout(
+                    mBias, self.qhead_per_kvhead, nheads_kv, head_idx=2
+                )
+
+        if const_expr(mPageTable is None or self.paged_tma):
+            tma_copy_op = cpasync.CopyBulkTensorTileG2SOp()
+            mV_tma = (
+                mV
+                if const_expr(mPageTable is None)
+                else cute.make_tensor(
+                    mV.iterator,
+                    cute.select(mV.layout, mode=[1, 0, 2, 3]),
+                )
+            )
+            tma_atom_K, tma_tensor_K = cpasync.make_tiled_tma_atom(
+                tma_copy_op,
+                mK,
+                cute.select(self.sK_layout, mode=[0, 1]),
+                (self.tile_n, self.tile_hdim),
+                1,
+            )
+            tma_atom_V, tma_tensor_V = cpasync.make_tiled_tma_atom(
+                tma_copy_op,
+                mV_tma,
+                cute.select(self.sV_layout, mode=[0, 1]),
+                (self.tile_hdimv, self.tile_n),
+                1,
+            )
+            self.tma_copy_bytes_K = cute.size_in_bytes(
+                mK.element_type, cute.select(self.sK_layout, mode=[0, 1])
+            )
+            self.tma_copy_bytes_V = cute.size_in_bytes(
+                mV_tma.element_type,
+                cute.select(self.sV_layout, mode=[0, 1]),
+            )
+        else:
+            tma_atom_K = None
+            tma_atom_V = None
+            tma_tensor_K = mK
+            tma_tensor_V = mV
+        # n32: no bias TMA; the kernel's mBias / tma_atom_Bias slots carry r32 / p32.
+        tma_tensor_Bias = n32_r32
+        tma_atom_Bias = n32_p32
+
+        is_varlen = const_expr(mCuSeqlensQ is not None or mSeqUsedQ is not None)
+        num_batch = (
+            mCuSeqlensQ.shape[0] - 1
+            if const_expr(mCuSeqlensQ is not None)
+            else cute.size(mQ.shape[3])
+        )
+        TileScheduler = (
+            Sm120UniformBatchScheduler
+            if is_varlen and self.direct_uniform_batch
+            else SingleTileVarlenScheduler
+            if is_varlen
+            else SingleTileScheduler
+        )
+        tile_sched_args = TileSchedulerArguments(
+            num_block=cute.ceil_div(cute.size(mQ.shape[0]), self.tile_m),
+            num_head=cute.size(mQ.shape[2]),
+            num_batch=num_batch,
+            num_splits=num_splits,
+            seqlen_k=0,
+            headdim=mQ.shape[1],
+            headdim_v=mO.shape[1],
+            total_q=(
+                cute.size(mQ.shape[0])
+                if const_expr(mCuSeqlensQ is not None)
+                else cute.size(mQ.shape[0]) * cute.size(mQ.shape[3])
+            ),
+            tile_shape_mn=(self.tile_m, self.tile_n),
+            lpt=(self.is_causal or self.is_local) and not self.direct_uniform_batch,
+            qhead_per_kvhead_packgqa=(
+                self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+            ),
+            mCuSeqlensQ=mCuSeqlensQ,
+            mSeqUsedQ=mSeqUsedQ,
+            is_persistent=False,
+            is_split_kv=self.is_split_kv,
+        )
+        tile_sched_params = TileScheduler.to_underlying_arguments(
+            tile_sched_args,
+            scheduling_mode=SchedulingMode.STATIC,
+        )
+        grid_dim = TileScheduler.get_grid_shape(tile_sched_params)
+        if const_expr(self.has_bias):
+            base_softmax_scale = softmax_scale
+            softmax_scale_log2, softmax_scale = utils.LOG2_E, None
+        else:
+            base_softmax_scale = None
+            softmax_scale_log2, softmax_scale = utils.compute_softmax_scale_log2(
+                softmax_scale, self.score_mod
+            )
+        window_size_left = (
+            Int32(window_size_left) if window_size_left is not None else None
+        )
+        window_size_right = (
+            Int32(window_size_right) if window_size_right is not None else None
+        )
+        fastdiv_mods = utils.compute_fastdiv_mods(
+            mQ,
+            mK,
+            self.qhead_per_kvhead,
+            self.pack_gqa,
+            aux_data.tensors,
+            mPageTable,
+        )
+
+        self.kernel(
+            mQ,
+            tma_tensor_K,
+            tma_tensor_V,
+            mO,
+            mLSE,
+            mCuSeqlensQ,
+            mCuSeqlensK,
+            mSeqUsedQ,
+            mSeqUsedK,
+            mPageTable,
+            tma_tensor_Bias,
+            tma_atom_K,
+            tma_atom_V,
+            tma_atom_Bias,
+            softmax_scale_log2,
+            softmax_scale,
+            base_softmax_scale,
+            window_size_left,
+            window_size_right,
+            learnable_sink,
+            self.sQ_layout,
+            self.sK_layout,
+            self.sV_layout,
+            self.sO_layout,
+            self.sP_layout,
+            self.sBias_layout,
+            self.gmem_tiled_copy_Q,
+            self.gmem_tiled_copy_O,
+            tiled_mma_qk,
+            tiled_mma_pv,
+            SharedStorage,
+            tile_sched_params,
+            TileScheduler,
+            launch_split_combine_early,
+            aux_data,
+            fastdiv_mods,
+        ).launch(
+            grid=grid_dim,
+            block=[self.num_threads + self._num_dma_threads(), 1, 1],
+            smem=SharedStorage.size_in_bytes(),
+            stream=stream,
+            min_blocks_per_mp=1,
+            # The immediately preceding ShearingBias grid releases this
+            # dependent launch before all of its CTAs have retired. Bias
+            # readers synchronize before their first TMA issue below; the
+            # remaining kernel prologue can overlap the tail of the shear.
+            use_pdl=False,  # n32: no shear grid precedes this kernel
+        )
+
+    @cute.kernel
+    def kernel(
+        self,
+        mQ: cute.Tensor,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        mCuSeqlensQ: Optional[cute.Tensor],
+        mCuSeqlensK: Optional[cute.Tensor],
+        mSeqUsedQ: Optional[cute.Tensor],
+        mSeqUsedK: Optional[cute.Tensor],
+        mPageTable: Optional[cute.Tensor],
+        mBias: Optional[cute.Tensor],
+        tma_atom_K: Optional[cute.CopyAtom],
+        tma_atom_V: Optional[cute.CopyAtom],
+        tma_atom_Bias: Optional[cute.Tensor],  # n32: proj^T int32 pairs [E, 8]
+        softmax_scale_log2: Float32,
+        softmax_scale: Optional[Float32],
+        base_softmax_scale: Optional[Float32],
+        window_size_left: Optional[Int32],
+        window_size_right: Optional[Int32],
+        learnable_sink: Optional[cute.Tensor],
+        sQ_layout: cute.ComposedLayout,
+        sK_layout: cute.ComposedLayout,
+        sV_layout: cute.ComposedLayout,
+        sO_layout: cute.ComposedLayout,
+        sP_layout: cute.ComposedLayout | None,
+        sBias_layout: cute.ComposedLayout | None,
+        gmem_tiled_copy_Q: cute.TiledCopy,
+        gmem_tiled_copy_O: cute.TiledCopy,
+        tiled_mma_qk: cute.TiledMma,
+        tiled_mma_pv: cute.TiledMma,
+        SharedStorage: cutlass.Constexpr,
+        tile_sched_params,
+        TileScheduler: cutlass.Constexpr[Callable],
+        launch_split_combine_early: Int32,
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+    ):
+        tidx, _, _ = cute.arch.thread_idx()
+        warp_idx = cute.arch.make_warp_uniform(cute.arch.warp_idx())
+        # n115: consumer-side bias inputs, taken at kernel entry so they dominate every consumer use
+        if const_expr(not self.n32_plain_bias):  # n126 S4c: the global classes trace S3's kernel entry
+            self._n115_r32 = mBias
+            self._n115_p32 = tma_atom_Bias
+            self._n115_bi = BlockInfo(
+                self.tile_m,
+                self.tile_n,
+                self.is_causal,
+                self.is_local,
+                self.is_split_kv,
+                window_size_left,
+                window_size_right,
+                qhead_per_kvhead_packgqa=(
+                    self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+                ),
+            )
+            if const_expr(self.is_local):
+                self._n115_pmax = cutlass.min(
+                    window_size_left + window_size_right, self.n32_extent - 1
+                )
+            else:
+                self._n115_pmax = Int32(self.n32_extent - 1)
+
+        if const_expr(self.is_split_kv):
+            if launch_split_combine_early != 0 and warp_idx == 0:
+                cute.arch.griddepcontrol_launch_dependents()
+
+        if const_expr(mPageTable is None or self.paged_tma):
+            if warp_idx == 0:
+                cpasync.prefetch_descriptor(tma_atom_K)
+                cpasync.prefetch_descriptor(tma_atom_V)
+
+        smem = cutlass.utils.SmemAllocator()
+        storage = smem.allocate(SharedStorage)
+        sQ = storage.sQ.get_tensor(sQ_layout.outer, swizzle=sQ_layout.inner)
+        sK = storage.sK.get_tensor(sK_layout.outer, swizzle=sK_layout.inner)
+        sV = storage.sV.get_tensor(sV_layout.outer, swizzle=sV_layout.inner)
+        sO = storage.sQ.get_tensor(sO_layout.outer, swizzle=sO_layout.inner)
+        sBias = (
+            storage.sBias.get_tensor(sBias_layout.outer, swizzle=sBias_layout.inner)
+            if const_expr(self.has_bias)
+            else None
+        )
+        sP = None
+        sRowScale = None
+        sFinalScale = None
+        sLSE = None
+        if const_expr(sP_layout is not None):
+            if const_expr(self._q_in_regs_pipeline()):
+                sP = storage.sQ.get_tensor(sP_layout.outer, swizzle=sP_layout.inner)
+            else:
+                sP = storage.sP.get_tensor(sP_layout.outer, swizzle=sP_layout.inner)
+            sSoftmaxStats = storage.softmax_stats.get_tensor(
+                cute.make_layout(
+                    (self._num_softmax_stat_rows(), self.tile_m),
+                    stride=(self.tile_m, 1),
+                )
+            )
+            sRowScale = sSoftmaxStats
+            if const_expr(self._uses_n_distributed_qk()):
+                num_qk_warps = self.num_qk_threads // cute.arch.WARP_SIZE
+                sFinalScale = sSoftmaxStats[2 * num_qk_warps + 2, None]
+                sLSE = sSoftmaxStats[3 * num_qk_warps + 3, None]
+            else:
+                sFinalScale = sSoftmaxStats[2, None]
+                sLSE = sSoftmaxStats[3, None]
+
+        tma_group = CooperativeGroup(Agent.Thread)
+        qk_group = CooperativeGroup(
+            Agent.Thread, self.num_qk_threads // cute.arch.WARP_SIZE
+        )
+        pv_group = CooperativeGroup(
+            Agent.Thread, self.num_mma_threads // cute.arch.WARP_SIZE
+        )
+        if const_expr(mPageTable is None or self.paged_tma):
+            pipeline_k = PipelineTmaAsync.create(
+                num_stages=self._num_k_stages(),
+                producer_group=tma_group,
+                consumer_group=qk_group,
+                tx_count=self.tma_copy_bytes_K,
+                barrier_storage=storage.mbar_K.data_ptr(),
+                defer_sync=True,
+            )
+            pipeline_v = PipelineTmaAsync.create(
+                num_stages=self._num_v_stages(),
+                producer_group=tma_group,
+                consumer_group=pv_group,
+                tx_count=self.tma_copy_bytes_V,
+                barrier_storage=storage.mbar_V.data_ptr(),
+                defer_sync=True,
+            )
+        else:
+            dma_group = CooperativeGroup(Agent.Thread, self.num_dma_threads)
+            k_consumer_group = CooperativeGroup(
+                Agent.Thread,
+                (
+                    self.num_qk_threads
+                    if self._uses_split_pv_warps()
+                    else self.num_threads
+                ),
+            )
+            v_consumer_group = CooperativeGroup(
+                Agent.Thread,
+                (
+                    self.num_mma_threads
+                    if self._uses_split_pv_warps()
+                    else self.num_threads
+                ),
+            )
+            pipeline_k = pipeline_custom.PipelineCpAsync.create(
+                num_stages=self._num_k_stages(),
+                producer_group=dma_group,
+                consumer_group=k_consumer_group,
+                barrier_storage=storage.mbar_K.data_ptr(),
+                defer_sync=True,
+            )
+            pipeline_v = pipeline_custom.PipelineCpAsync.create(
+                num_stages=self._num_v_stages(),
+                producer_group=dma_group,
+                consumer_group=v_consumer_group,
+                barrier_storage=storage.mbar_V.data_ptr(),
+                defer_sync=True,
+            )
+        # n32: the DMA warp's 32 threads write the bias stage and each arrives; every QK thread waits and arrives on
+        # release (apply_sheared_bias calls consumer_release from all of them).
+        pipeline_bias = PipelineAsync.create(
+            num_stages=self.num_stages,
+            producer_group=CooperativeGroup(Agent.Thread, self.num_dma_threads),
+            consumer_group=CooperativeGroup(Agent.Thread, self.num_qk_threads),
+            barrier_storage=storage.mbar_Bias.data_ptr(),
+            defer_sync=True,
+        )
+        pipeline_p = None
+        pipeline_final = None
+        if const_expr(sP_layout is not None):
+            pipeline_p = PipelineAsync.create(
+                num_stages=self._num_p_stages(),
+                producer_group=CooperativeGroup(Agent.Thread, self.num_qk_threads),
+                consumer_group=CooperativeGroup(Agent.Thread, self.num_mma_threads),
+                barrier_storage=storage.mbar_P.data_ptr(),
+                defer_sync=True,
+                name="sm120_p",
+            )
+            pipeline_final = PipelineAsync.create(
+                num_stages=1,
+                producer_group=CooperativeGroup(Agent.Thread, self.num_qk_threads),
+                consumer_group=CooperativeGroup(Agent.Thread, self.num_mma_threads),
+                barrier_storage=storage.mbar_final.data_ptr(),
+                defer_sync=True,
+                name="sm120_final",
+            )
+        tile_scheduler = TileScheduler.create(tile_sched_params)
+        work_tile = tile_scheduler.initial_work_tile_info()
+        if work_tile.is_valid_tile:
+            m_block, head_idx, batch_idx, split_idx = work_tile.tile_idx
+            seqlen = SeqlenInfoQK.create(
+                batch_idx=batch_idx,
+                seqlen_q_static=(
+                    mQ.shape[0] if const_expr(not self.pack_gqa) else mQ.shape[0][1]
+                ),
+                seqlen_k_static=(
+                    mK.shape[0]
+                    if const_expr(mPageTable is None)
+                    else mK.shape[0] * mPageTable.shape[1]
+                ),
+                mCuSeqlensQ=mCuSeqlensQ,
+                mCuSeqlensK=mCuSeqlensK,
+                mSeqUsedQ=mSeqUsedQ,
+                mSeqUsedK=mSeqUsedK,
+                tile_m=self.tile_m,
+                tile_n=self.tile_n,
+            )
+            run_mainloop = True
+            if const_expr(self.is_split_kv):
+                block_info = BlockInfo(
+                    self.tile_m,
+                    self.tile_n,
+                    self.is_causal,
+                    self.is_local,
+                    self.is_split_kv,
+                    window_size_left,
+                    window_size_right,
+                    qhead_per_kvhead_packgqa=(
+                        self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+                    ),
+                )
+                n_block_min, n_block_max = self._get_n_block_min_max(
+                    block_info,
+                    seqlen,
+                    m_block,
+                    split_idx,
+                    tile_scheduler.params.num_splits,
+                )
+                is_empty_split = n_block_min >= n_block_max
+                if is_empty_split:
+                    if const_expr(self._uses_split_pv_warps()):
+                        if warp_idx >= self.num_qk_threads // cute.arch.WARP_SIZE:
+                            self.epilogue_empty_split(
+                                mO,
+                                mLSE,
+                                learnable_sink,
+                                seqlen,
+                                tiled_mma_pv,
+                                tidx - self.num_qk_threads,
+                                m_block,
+                                head_idx,
+                                batch_idx,
+                                split_idx,
+                            )
+                    else:
+                        if 0 < warp_idx <= self.num_threads // cute.arch.WARP_SIZE:
+                            self.epilogue_empty_split(
+                                mO,
+                                mLSE,
+                                learnable_sink,
+                                seqlen,
+                                tiled_mma_pv,
+                                tidx - self.num_dma_threads,
+                                m_block,
+                                head_idx,
+                                batch_idx,
+                                split_idx,
+                            )
+                run_mainloop = not is_empty_split
+
+            if run_mainloop:
+                pipeline_init_arrive(cluster_shape_mn=(1, 1), is_relaxed=True)
+                pipeline_init_wait(cluster_shape_mn=(1, 1))
+
+                if const_expr(mPageTable is not None and self._uses_split_pv_warps()):
+                    if warp_idx == 0:
+                        self.load_paged_persistent(
+                            mK,
+                            mV,
+                            mPageTable,
+                            tma_atom_K,
+                            tma_atom_V,
+                            sK,
+                            sV,
+                            pipeline_k,
+                            pipeline_v,
+                            tile_scheduler,
+                            mQ,
+                            mCuSeqlensQ,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                            tidx,
+                        )
+                    elif const_expr(self._uses_n_distributed_qk()):
+                        if warp_idx <= self.num_mma_threads // cute.arch.WARP_SIZE:
+                            self.mma_persistent(
+                                mQ,
+                                mK,
+                                mO,
+                                mLSE,
+                                sQ,
+                                sK,
+                                sV,
+                                sO,
+                                sP,
+                                sRowScale,
+                                sLSE,
+                                learnable_sink,
+                                pipeline_k,
+                                pipeline_v,
+                                gmem_tiled_copy_Q,
+                                gmem_tiled_copy_O,
+                                tiled_mma_qk,
+                                tiled_mma_pv,
+                                tidx - self.num_dma_threads,
+                                softmax_scale_log2,
+                                softmax_scale,
+                                base_softmax_scale,
+                                tile_scheduler,
+                                mCuSeqlensQ,
+                                mCuSeqlensK,
+                                mSeqUsedQ,
+                                mSeqUsedK,
+                                mPageTable,
+                                window_size_left,
+                                window_size_right,
+                                True,
+                                aux_data,
+                                fastdiv_mods,
+                            )
+                    elif warp_idx == 1:
+                        self.mma_persistent(
+                            mQ,
+                            mK,
+                            mO,
+                            mLSE,
+                            sQ,
+                            sK,
+                            sV,
+                            sO,
+                            sP,
+                            sRowScale,
+                            sLSE,
+                            learnable_sink,
+                            pipeline_k,
+                            pipeline_v,
+                            gmem_tiled_copy_Q,
+                            gmem_tiled_copy_O,
+                            tiled_mma_qk,
+                            tiled_mma_pv,
+                            tidx - self.num_dma_threads,
+                            softmax_scale_log2,
+                            softmax_scale,
+                            base_softmax_scale,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            mPageTable,
+                            window_size_left,
+                            window_size_right,
+                            True,
+                            aux_data,
+                            fastdiv_mods,
+                        )
+                    elif warp_idx <= self.num_mma_threads // cute.arch.WARP_SIZE:
+                        self.mma_persistent(
+                            mQ,
+                            mK,
+                            mO,
+                            mLSE,
+                            sQ,
+                            sK,
+                            sV,
+                            sO,
+                            sP,
+                            sRowScale,
+                            sLSE,
+                            learnable_sink,
+                            pipeline_k,
+                            pipeline_v,
+                            gmem_tiled_copy_Q,
+                            gmem_tiled_copy_O,
+                            tiled_mma_qk,
+                            tiled_mma_pv,
+                            tidx - self.num_dma_threads,
+                            softmax_scale_log2,
+                            softmax_scale,
+                            base_softmax_scale,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            mPageTable,
+                            window_size_left,
+                            window_size_right,
+                            False,
+                            aux_data,
+                            fastdiv_mods,
+                        )
+                elif const_expr(self._uses_split_pv_warps()):
+                    if warp_idx < self.num_qk_threads // cute.arch.WARP_SIZE:
+                        self.mma_qk_pipeline_persistent(
+                            mQ,
+                            mK,
+                            mV,
+                            sQ,
+                            sK,
+                            sV,
+                            tma_atom_K,
+                            tma_atom_V,
+                            sP,
+                            sRowScale,
+                            sFinalScale,
+                            sLSE,
+                            learnable_sink,
+                            pipeline_k,
+                            pipeline_v,
+                            pipeline_p,
+                            pipeline_final,
+                            gmem_tiled_copy_Q,
+                            tiled_mma_qk,
+                            tidx,
+                            softmax_scale_log2,
+                            softmax_scale,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                            aux_data,
+                            fastdiv_mods,
+                        )
+                    else:
+                        self.mma_pv_pipeline_persistent(
+                            mQ,
+                            mK,
+                            mO,
+                            mLSE,
+                            sV,
+                            sO,
+                            sP,
+                            sRowScale,
+                            sFinalScale,
+                            sLSE,
+                            pipeline_v,
+                            pipeline_p,
+                            pipeline_final,
+                            gmem_tiled_copy_O,
+                            tiled_mma_pv,
+                            tidx - self.num_qk_threads,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                        )
+                elif warp_idx == 0:
+                    if const_expr(mPageTable is None):
+                        self.load_tma_persistent(
+                            mK,
+                            mV,
+                            sK,
+                            sV,
+                            tma_atom_K,
+                            tma_atom_V,
+                            pipeline_k,
+                            pipeline_v,
+                            tile_scheduler,
+                            mQ,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                            mBias=mBias,
+                            sBias=sBias,
+                            tma_atom_Bias=tma_atom_Bias,
+                            pipeline_bias=pipeline_bias,
+                        )
+                    else:
+                        self.load_paged_persistent(
+                            mK,
+                            mV,
+                            mPageTable,
+                            tma_atom_K,
+                            tma_atom_V,
+                            sK,
+                            sV,
+                            pipeline_k,
+                            pipeline_v,
+                            tile_scheduler,
+                            mQ,
+                            mCuSeqlensQ,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                            tidx,
+                            mBias=mBias,
+                            sBias=sBias,
+                            tma_atom_Bias=tma_atom_Bias,
+                            pipeline_bias=pipeline_bias,
+                        )
+                elif warp_idx <= self.num_threads // cute.arch.WARP_SIZE:
+                    self.mma_persistent(
+                        mQ,
+                        mK,
+                        mO,
+                        mLSE,
+                        sQ,
+                        sK,
+                        sV,
+                        sO,
+                        sP,
+                        sRowScale,
+                        sLSE,
+                        learnable_sink,
+                        pipeline_k,
+                        pipeline_v,
+                        gmem_tiled_copy_Q,
+                        gmem_tiled_copy_O,
+                        tiled_mma_qk,
+                        tiled_mma_pv,
+                        tidx - self.num_dma_threads,
+                        softmax_scale_log2,
+                        softmax_scale,
+                        base_softmax_scale,
+                        tile_scheduler,
+                        mCuSeqlensQ,
+                        mCuSeqlensK,
+                        mSeqUsedQ,
+                        mSeqUsedK,
+                        mPageTable,
+                        window_size_left,
+                        window_size_right,
+                        True,
+                        aux_data,
+                        fastdiv_mods,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                    )
+
+    @cute.jit
+    def load_paged_persistent(
+        self,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mPageTable: cute.Tensor,
+        tma_atom_K: Optional[cute.CopyAtom],
+        tma_atom_V: Optional[cute.CopyAtom],
+        sK: cute.Tensor,
+        sV: cute.Tensor,
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        tile_scheduler: TileSchedulerProtocol,
+        mQ: cute.Tensor,
+        mCuSeqlensQ: Optional[cute.Tensor],
+        mSeqUsedQ: Optional[cute.Tensor],
+        mSeqUsedK: Optional[cute.Tensor],
+        window_size_left: Optional[Int32],
+        window_size_right: Optional[Int32],
+        tidx: Int32,
+        mBias: Optional[cute.Tensor] = None,
+        sBias: Optional[cute.Tensor] = None,
+        tma_atom_Bias: Optional[cute.Tensor] = None,  # n32: proj^T int32 pairs; mBias = r int32 pairs
+        pipeline_bias: Optional[PipelineAsync] = None,
+    ):
+        producer_state_k = PipelineState(
+            self._num_k_stages(), Int32(0), Int32(0), Int32(1)
+        )
+        producer_state_v = PipelineState(
+            self._num_v_stages(), Int32(0), Int32(0), Int32(1)
+        )
+        block_info = BlockInfo(
+            self.tile_m,
+            self.tile_n,
+            self.is_causal,
+            self.is_local,
+            self.is_split_kv,
+            window_size_left,
+            window_size_right,
+            qhead_per_kvhead_packgqa=(
+                self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+            ),
+        )
+        work_tile = tile_scheduler.initial_work_tile_info()
+        m_block, head_idx, batch_idx, split_idx = work_tile.tile_idx
+        seqlen = SeqlenInfoQK.create(
+            batch_idx=batch_idx,
+            seqlen_q_static=(
+                mQ.shape[0] if const_expr(not self.pack_gqa) else mQ.shape[0][1]
+            ),
+            seqlen_k_static=mK.shape[0] * mPageTable.shape[1],
+            mCuSeqlensQ=mCuSeqlensQ,
+            mCuSeqlensK=None,
+            mSeqUsedQ=mSeqUsedQ,
+            mSeqUsedK=mSeqUsedK,
+            tile_m=self.tile_m,
+            tile_n=self.tile_n,
+        )
+        n_block_min, n_block_max = self._get_n_block_min_max(
+            block_info,
+            seqlen,
+            m_block,
+            split_idx,
+            tile_scheduler.params.num_splits,
+        )
+        head_idx_kv = (
+            head_idx if const_expr(self.pack_gqa) else head_idx // self.qhead_per_kvhead
+        )
+        bias_max_idx, num_bias_loads = Int32(0), Int32(0)
+        if const_expr(self.has_bias):
+            bias_max_idx, num_bias_loads = self._get_bias_load_info(
+                block_info,
+                seqlen,
+                m_block,
+                n_block_min,
+                n_block_max,
+            )
+            # n32: per-lane A fragments of r for the tile's rows and the rows' visible key bounds.
+            n32_ra, n32_lo, n32_hi = self.n32_tile_setup(
+                mBias, block_info, seqlen, m_block, head_idx, tidx
+            )
+            if const_expr(self.is_local):
+                n32_pmax = cutlass.min(
+                    window_size_left + window_size_right, self.n32_extent - 1
+                )
+            else:
+                n32_pmax = Int32(self.n32_extent - 1)
+        assert not self.paged_tma  # n32: page-TMA path not built
+        if const_expr(self.paged_tma):
+            mK_cur = mK[None, None, head_idx_kv, None]
+            mV_cur = mV[None, None, head_idx_kv, None]
+            gK = cute.local_tile(
+                mK_cur,
+                (self.tile_n, self.tile_hdim),
+                (0, 0, None),
+            )
+            gV = cute.local_tile(
+                mV_cur,
+                (self.tile_hdimv, self.tile_n),
+                (0, 0, None),
+            )
+            copy_K, _, _ = copy_utils.tma_get_copy_fn(
+                tma_atom_K,
+                0,
+                cute.make_layout(1),
+                gK,
+                sK,
+            )
+            copy_V, _, _ = copy_utils.tma_get_copy_fn(
+                tma_atom_V,
+                0,
+                cute.make_layout(1),
+                gV,
+                sV,
+            )
+            num_n_blocks = cutlass.max(n_block_max - n_block_min, 1)
+            for n_tile in cutlass.range(num_n_blocks, unroll=1):
+                n_block = cutlass.max(n_block_max - 1 - n_tile, n_block_min)
+                page_idx = mPageTable[batch_idx, n_block]
+
+                if const_expr(self.has_bias):
+                    if n_tile < num_bias_loads:
+                        pipeline_bias.producer_acquire(producer_state_k)
+                        cute.copy(
+                            tma_atom_Bias,
+                            tBgBias[None, m_block, bias_max_idx - n_tile],
+                            tBsBias[None, producer_state_k.index],
+                            tma_bar_ptr=pipeline_bias.producer_get_barrier(
+                                producer_state_k
+                            ),
+                        )
+                        pipeline_bias.producer_commit(producer_state_k)
+                pipeline_k.producer_acquire(producer_state_k)
+                copy_K(
+                    src_idx=page_idx,
+                    dst_idx=producer_state_k.index,
+                    tma_bar_ptr=pipeline_k.producer_get_barrier(producer_state_k),
+                )
+                pipeline_k.producer_commit(producer_state_k)
+                producer_state_k.advance()
+
+                pipeline_v.producer_acquire(producer_state_v)
+                copy_V(
+                    src_idx=page_idx,
+                    dst_idx=producer_state_v.index,
+                    tma_bar_ptr=pipeline_v.producer_get_barrier(producer_state_v),
+                )
+                pipeline_v.producer_commit(producer_state_v)
+                producer_state_v.advance()
+
+            pipeline_k.producer_tail(producer_state_k)
+            pipeline_v.producer_tail(producer_state_v)
+            return
+
+        paged_kv_manager = Sm120PagedKVManager.create(
+            mPageTable,
+            mK,
+            mV,
+            FastDivmodDivisor(mK.shape[0]),
+            batch_idx,
+            head_idx_kv,
+            tidx,
+            seqlen.seqlen_k,
+            0,
+            self.tile_n,
+            self.tile_hdim,
+            self.tile_hdimv,
+            self.num_dma_threads,
+            mK.element_type,
+        )
+        num_n_blocks = cutlass.max(n_block_max - n_block_min, 1)
+        for n_tile in cutlass.range(num_n_blocks, unroll=1):
+            n_block = cutlass.max(n_block_max - 1 - n_tile, n_block_min)
+            paged_kv_manager.load_page_table(n_block)
+
+            pipeline_k.producer_acquire(producer_state_k)
+            paged_kv_manager.load_KV(
+                n_block,
+                sK[None, None, producer_state_k.index],
+                "K",
+            )
+            cute.arch.cp_async_commit_group()
+            pipeline_k.producer_commit(producer_state_k)
+            if const_expr(self.has_bias and (N115_DMA == 1 or self.bias_block_size != self.tile_m or self.n32_plain_bias)):  # n126 S4c: global classes fill as S3
+                # n32: the sheared bias tile of key block n_block (the served TMA source block bias_max_idx - n_tile
+                # holds keys n_block * tile_n + col), computed while K is in flight; same pipeline state as the TMA.
+                if n_tile < num_bias_loads:
+                    pipeline_bias.producer_acquire(producer_state_k)
+                    self.n32_bias_tile(
+                        sBias[None, None, producer_state_k.index],
+                        tma_atom_Bias,
+                        n32_ra,
+                        n32_lo,
+                        n32_hi,
+                        n32_pmax,
+                        n_block,
+                        seqlen,
+                        m_block,
+                        tidx,
+                    )
+                    pipeline_bias.producer_commit(producer_state_k)
+            producer_state_k.advance()
+
+            pipeline_v.producer_acquire(producer_state_v)
+            sV_stage = layout_utils.transpose_view(
+                sV[None, None, producer_state_v.index]
+            )
+            paged_kv_manager.load_KV(n_block, sV_stage, "V")
+            cute.arch.cp_async_commit_group()
+            pipeline_v.producer_commit(producer_state_v)
+            producer_state_v.advance()
+
+        pipeline_k.producer_tail(producer_state_k)
+        pipeline_v.producer_tail(producer_state_v)
+
+
+if N32_GLOBAL:
+    from sglang.kernels.ops.attention.fa4_sm120.n13_fwd import FlashAttentionForwardSm120BandSplit  # noqa: E402
+
+    class FlashAttentionForwardSm120BandSplitRelProd(FlashAttentionForwardSm120RelProd, FlashAttentionForwardSm120BandSplit):
+        """n13's global-layer band-split kernel (consumer mma and its unswizzled bias tile, n13_fwd.py) fed by the n32
+        in-kernel producer (causal pads: -inf right of the diagonal, 0.0 past the 1024-key band)."""
+
+        n32_plain_bias = True
+        # n126 S4c: S3's consumer. a4 overrides compute_one_n_block on RelProd; S3's MRO (no override on RelProd) resolves it from
+        # BandSplit / the base kernel. Take the raw class-dict object that S3's lookup would find, skipping RelProd, so this class and
+        # every subclass (n64a BandOnly) trace S3's consumer.
+        compute_one_n_block = next(k.__dict__["compute_one_n_block"] for k in FlashAttentionForwardSm120BandSplit.__mro__
+                                   if "compute_one_n_block" in k.__dict__)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n35_w8.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n35_w8.py
new file mode 100644
index 0000000000000000000000000000000000000000..f9b9d92a2cae4fc02b69899fd76f9f7f143f656a
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n35_w8.py
@@ -0,0 +1,128 @@
+"""n35 / n36 (inkling2-spark decode seat, 2026-11-21): MXFP8 W8A16 weights on decode / target-verify forwards only.
+N35_W8 (env, comma list): attn = qkvr + wo_ud of every Inkling2Attention; lm = the verify LM head. Unset or empty: off.
+At the first forward (eager, before any graph capture) each selected BF16 weight gets an e4m3 copy with one power-of-2 scale
+per 32 K-elements (n35_w8gemv.quantize_mx8, the n33_fq 'mx8' rounding: dequantized values are bit-equal to that probe's
+rounded BF16 weights). During decode / verify forwards Inkling2Attention swaps its qkvr / wo_ud child modules for a W8 wrapper
+(n35_w8gemv.w8_gemv: the served _gemv_kernel's tile shape with dequantized tiles, so 1-source visits and wo_ud at <= 16 rows
+reproduce the probe's numerics; the 3-source stacked 24-row projection was nvjet and now is this kernel); the captured verify
+graphs bind the W8 kernels, while prefill (eager or graph) keeps the BF16 path, so KLD is unchanged by construction. The LM
+head is swapped inside Inkling2LogitsProcessor._compute_lm_head while a decode / verify logits call is active. Rows > 128 fall
+back to BF16. Extra memory: FP8 copies (~0.85 GB attn, ~0.21 GB + 6 MB lm) beside the BF16 weights."""
+import logging, os
+
+import torch
+from torch import nn
+
+logger = logging.getLogger(__name__)
+SEL = {s.strip() for s in os.environ.get("N35_W8", "").split(",") if s.strip()}
+S = {"mods": [], "done": False, "lm": {}, "active": False}
+_INSTALLED = False
+
+
+class _W8Lin(nn.Module):
+    def __init__(self, orig, w8, e):
+        super().__init__()
+        self.orig = orig
+        self.register_buffer("w8", w8, persistent=False)
+        self.register_buffer("e", e, persistent=False)
+
+    def forward(self, x, *a, **kw):
+        from sglang.srt.models.inkling_common.n35_w8gemv import w8_gemv
+        rows = x.numel() // x.shape[-1]
+        if a or kw or rows > 128 or x.dtype != torch.bfloat16:
+            return self.orig(x, *a, **kw)
+        return w8_gemv(x, self.w8, self.e), None
+
+
+def _decode_mode(fb):
+    m = fb.forward_mode
+    return m.is_decode() or m.is_target_verify()
+
+
+def _prepare():
+    from sglang.srt.models.inkling_common.n35_w8gemv import quantize_mx8
+    if torch.cuda.is_current_stream_capturing():
+        raise RuntimeError("n35_w8: first forward inside graph capture")
+    tot = 0
+    if "attn" in SEL:
+        for m in S["mods"]:
+            for name in ("qkvr", "wo_ud"):
+                orig = m._modules[name]
+                if getattr(orig, "bias", None) is not None and bool(orig.bias.abs().max() > 0):
+                    raise RuntimeError(f"n35_w8: {name} has a nonzero bias")
+                w8, e = quantize_mx8(orig.weight.data)
+                m.__dict__[f"_n35_{name}"] = (orig, _W8Lin(orig, w8, e))
+                tot += w8.numel() + e.numel()
+    if "lm" in SEL:
+        _patch_lm()
+    S["done"] = True
+    logger.warning("n35_w8 %s: %d attention modules, FP8 copies %.3f GB", sorted(SEL), len(S["mods"]), tot / 1e9)
+
+
+def _patch_lm():
+    """Patched at the first forward: inkling2.py is still importing when inkling2_attn.py runs install()."""
+    from sglang.srt.models import inkling2 as I
+    from sglang.srt.models.inkling_common.n35_w8gemv import quantize_mx8, w8_gemv
+    lp = I.Inkling2LogitsProcessor
+    orig_fwd, orig_head = lp.forward, lp._compute_lm_head
+
+    def forward(self, input_ids, hidden_states, lm_head, logits_metadata, *a, **kw):
+        if hasattr(logits_metadata, "forward_mode") and _decode_mode(logits_metadata):
+            key = id(lm_head)
+            if key not in S["lm"]:
+                if torch.cuda.is_current_stream_capturing():
+                    raise RuntimeError("n35_w8: LM head first seen inside graph capture")
+                S["lm"][key] = quantize_mx8(lm_head.weight.data)
+                logger.warning("n35_w8: LM head FP8 copy %s", tuple(lm_head.weight.shape))
+            S["active"] = key
+            try:
+                return orig_fwd(self, input_ids, hidden_states, lm_head, logits_metadata, *a, **kw)
+            finally:
+                S["active"] = False
+        return orig_fwd(self, input_ids, hidden_states, lm_head, logits_metadata, *a, **kw)
+
+    def compute_lm_head(self, hidden_states, lm_head, embedding_bias=None, *, out=None):
+        key = S["active"]
+        rows = hidden_states.numel() // hidden_states.shape[-1]
+        if key is False or key != id(lm_head) or embedding_bias is not None or rows > 128 or hidden_states.dtype != torch.bfloat16:
+            return orig_head(self, hidden_states, lm_head, embedding_bias, out=out)
+        w8, e = S["lm"][key]
+        dt = torch.float32 if (self.use_fp32_lm_head or getattr(self, "use_fp32_lm_head_output", False)) else hidden_states.dtype
+        if out is None or out.dtype != dt or tuple(out.shape) != (rows, w8.shape[0]):
+            out = torch.empty((rows, w8.shape[0]), device=hidden_states.device, dtype=dt)
+        logits = w8_gemv(hidden_states.reshape(rows, -1), w8, e, out=out)
+        if self.shard_softcap:  # as Inkling2LogitsProcessor._compute_lm_head
+            I.fused_softcap(logits, self.shard_softcap)
+        return logits
+
+    lp.forward, lp._compute_lm_head = forward, compute_lm_head
+    logger.warning("n35_w8: LM head patch installed")
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED or not SEL:
+        return
+    from sglang.srt.models.inkling_common import inkling2_attn as A
+    cls = A.Inkling2Attention
+    orig_init, orig_fwd = cls.__init__, cls._forward
+
+    def init(self, *a, **kw):
+        orig_init(self, *a, **kw)
+        S["mods"].append(self)
+
+    def fwd(self, hidden_states, positions, forward_batch, *, attn, attn_padded):
+        if not S["done"]:
+            _prepare()
+        if "attn" not in SEL or not _decode_mode(forward_batch):
+            return orig_fwd(self, hidden_states, positions, forward_batch, attn=attn, attn_padded=attn_padded)
+        (q0, q1), (w0, w1) = self._n35_qkvr, self._n35_wo_ud
+        self._modules["qkvr"], self._modules["wo_ud"] = q1, w1
+        try:
+            return orig_fwd(self, hidden_states, positions, forward_batch, attn=attn, attn_padded=attn_padded)
+        finally:
+            self._modules["qkvr"], self._modules["wo_ud"] = q0, w0
+
+    cls.__init__, cls._forward = init, fwd
+    _INSTALLED = True
+    logger.warning("n35_w8 installed: %s", sorted(SEL))
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n35_w8gemv.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n35_w8gemv.py
new file mode 100644
index 0000000000000000000000000000000000000000..1dd8cc5dfa2baed1eda175e47a1ed95a4096f7f9
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n35_w8gemv.py
@@ -0,0 +1,64 @@
+"""n33 W8A16 GEMV (inkling2-spark decode seat, 2026-11-21): y[M, N] = x[M, K] @ dequant(w8[N, K])^T, BF16 activations, MXFP8-style
+weights: e4m3 values with one power-of-2 scale per 32 consecutive K elements of a row (stored as int8 exponents e, scale 2^e).
+q * 2^e is exact in BF16, so each dequantized tile equals the fake-quant probe's rounded BF16 weight bit for bit; the dot runs
+in BF16 on tensor cores with FP32 accumulation, in the served _gemv_kernel's shape (BN 32 columns per program, BK 256,
+MP rows padded to 16 / 32 / 64 / 128; BK 128 above 32 rows), so only the weight bytes change: 1.03 B per weight instead of 2.
+quantize_mx8(w) -> (w8, e) builds the operands from a BF16 [N, K] weight (K % 32 == 0) with the n33_fq rounding."""
+import torch
+import triton
+import triton.language as tl
+
+BN, BK, BLK = 32, 256, 32
+
+
+@triton.jit
+def _w8_gemv_kernel(X, W, E, Y, M, N, K, SX, SW, SE, SY, BN: tl.constexpr, BK: tl.constexpr, MP: tl.constexpr,
+                    BLK: tl.constexpr, F32: tl.constexpr = False):
+    pid = tl.program_id(0)
+    cols = pid * BN + tl.arange(0, BN)
+    rows = tl.arange(0, MP)
+    acc = tl.zeros((MP, BN), tl.float32)
+    for k0 in range(0, K, BK):
+        ks = k0 + tl.arange(0, BK)
+        w = tl.load(W + cols[None, :].to(tl.int64) * SW + ks[:, None], (cols[None, :] < N) & (ks[:, None] < K), other=0.0)
+        kb = k0 // BLK + tl.arange(0, BK // BLK)
+        e = tl.load(E + cols[None, :].to(tl.int64) * SE + kb[:, None], (cols[None, :] < N) & (kb[:, None] < K // BLK), other=0)
+        s = tl.exp2(e.to(tl.float32))  # (BK/BLK, BN), exact powers of two
+        wf = tl.reshape(w.to(tl.float32), (BK // BLK, BLK, BN)) * tl.reshape(s, (BK // BLK, 1, BN))
+        wb = tl.reshape(wf, (BK, BN))
+        if not F32:  # F32: CPU-interpreter test path only (its bf16 tl.dot is broken)
+            wb = wb.to(tl.bfloat16)
+        x = tl.load(X + rows[:, None] * SX + ks[None, :], (rows[:, None] < M) & (ks[None, :] < K), other=0.0)
+        acc += tl.dot(x, wb)
+    tl.store(Y + rows[:, None] * SY + cols[None, :], acc.to(Y.dtype.element_ty), (rows[:, None] < M) & (cols[None, :] < N))
+
+
+def quantize_mx8(w: torch.Tensor):
+    n, k = w.shape
+    assert k % BLK == 0
+    x = w.float().view(n, k // BLK, BLK)
+    amax = x.abs().amax(-1, keepdim=True).clamp_min(2.0 ** -120)
+    e = torch.floor(torch.log2(amax)) - 8
+    q = (x / torch.exp2(e)).clamp(-448.0, 448.0).to(torch.float8_e4m3fn)
+    return q.view(n, k).contiguous(), e.view(n, k // BLK).to(torch.int8).contiguous()
+
+
+def dequant_mx8(w8, e):
+    n, k = w8.shape
+    return (w8.float().view(n, k // BLK, BLK) * torch.exp2(e.float()).view(n, k // BLK, 1)).view(n, k).to(torch.bfloat16)
+
+
+def w8_gemv(x: torch.Tensor, w8: torch.Tensor, e: torch.Tensor, out: torch.Tensor | None = None, _f32: bool = False) -> torch.Tensor:
+    lead = x.shape[:-1]
+    x2 = x.reshape(-1, x.shape[-1])
+    m, k = x2.shape
+    n = w8.shape[0]
+    assert m <= 128 and k == w8.shape[1] and k % BK == 0, (m, k, w8.shape)
+    mp = 16 if m <= 16 else 32 if m <= 32 else 64 if m <= 64 else 128
+    bk = BK if mp <= 32 else 128  # bound the x tile for 64 / 128 rows (only the K chunking of the FP32 sum changes)
+    if out is None:
+        out = torch.empty((m, n), device=x.device, dtype=x.dtype)
+    if m:
+        _w8_gemv_kernel[(triton.cdiv(n, BN),)](x2, w8, e, out, m, n, k, x2.stride(0), w8.stride(0), e.stride(0), out.stride(0),
+                                               BN=BN, BK=bk, MP=mp, BLK=BLK, F32=_f32, num_warps=4)
+    return out.view(*lead, n)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n37_tiles.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n37_tiles.py
new file mode 100644
index 0000000000000000000000000000000000000000..6afb39049524dc814e103c57a7bb498060edb7cd
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n37_tiles.py
@@ -0,0 +1,28 @@
+"""n37 (inkling2-spark decode seat, 2026-11-21): NVFP4 grouped-GEMM tile config for decode / verify sizes on GB10.
+sglang.kernels.ops.gemm.inkling2_grouped_sm120._tiles serves <= 128 tokens with (swap_ab, tile_n 32, tile_k 128), measured on
+RTX 5090. On GB10 (n33 microbench, 300 real bs-1 verify routings, cold L2) tile_k 256 is 6.0 pct faster on w13 and 2.5 pct
+on w2 and BITWISE EQUAL to the served config on every routing (the tile shape does not change the per-element K order).
+This hook replaces _tiles for tokens <= 128 only; larger calls keep the image's table. N37_TILE_K (env, default 256; 128 =
+the image config, for a control)."""
+import logging, os
+
+logger = logging.getLogger(__name__)
+TILE_K = int(os.environ.get("N37_TILE_K", "256"))
+_INSTALLED = False
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED:
+        return
+    from sglang.kernels.ops.gemm import inkling2_grouped_sm120 as G
+    orig = G._tiles
+
+    def _tiles(tokens, width):
+        if tokens <= 128:
+            return True, 32, TILE_K
+        return orig(tokens, width)
+
+    G._tiles = _tiles
+    _INSTALLED = True
+    logger.warning("n37: NVFP4 grouped GEMM decode tiles (swap_ab, 32, %d) for <= 128 tokens", TILE_K)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n50b_fused.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n50b_fused.py
new file mode 100644
index 0000000000000000000000000000000000000000..a238d09d44fb9ad0656c5599e52c033e5d975d63
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n50b_fused.py
@@ -0,0 +1,314 @@
+"""n50 form b (stack seat, 2026-11-22; build 6 = build 5 939f1f3f with the bank-stat tile sized to the served thread count: 128
+lanes for 96 threads (3 queries), 64 for 64 (1 query: build 5 masked half of 128). Build 5 = n15_fused.py build 4 380adeee + the
+message-bank AttnRes fused in): one Triton
+kernel for LoopMessageBank.mix on a 2-source bank = attn_res(blocks, None, queries, normalize_values=True) + message_controllers.
+The messages are never written: each program recomputes its controller's message rows from the two BF16 bank sources, copying
+the image AttnResFwdKernel order (kernels/ops/attention/inkling2_attn_res.py, PTX + SASS read from the image compile):
+  - per source: thread t of NT (96 for 3 queries, 64 for 1) holds x[4 NT c + 4 t + v], c < NC (6 / 9), v < 4, and runs one fma.rn
+    chain over (c, v) for sum(x * x) and one for sum(x * q); warp butterfly xor 16, 8, 4, 2, 1; warps added in order from 0.0;
+  - rstd = rsqrt.approx(fma.rn(sumsq, f32(1/2304), eps)); max over sources of round(dot * rstd) from -inf; e = expf(fma(dot, rstd,
+    -max)) (ptxas contracts the served mul + sub); sum = (0 + e0) + e1; inv = rcp.rn(sum); p = e * rstd (mul.rn);
+  - message = mul.rn(fma.rn(p1, x1, fma.rn(p0, x0, 0)), inv).
+Then the build 4 controller, with every Message read replaced by that recompute. Build 4 docstring:
+n15 fused loop controller (stack seat, 2026-11-22): one Triton kernel for message_controllers' norm + down + mix
+(sglang kernels/ops/elementwise/inkling2_loop.py), meant to be BITWISE equal to the served three kernels by copying each
+order:
+  - row RMS: per row a 1-D tensor load + tl.sum under num_warps 8, as _controller_norm
+    (served ttgir: #blocked sizePerThread [8], warpsPerCTA [8]); rsqrt(div_rn(sum, W) + eps) with libdevice;
+  - normed = (x * rstd).to(bf16), concatenated [dest | message] along K = 2W, never written to memory;
+  - down: K walked in 1024-wide groups of BLOCK_K tiles, each group's tl.dot accumulation from zero, groups summed in
+    group order (served non-split path; the split path sums the same partials in the same order); tiles past K masked
+    to zero exactly as the served loads;
+  - mix: hidden.to(bf16) @ gain / forget tiles (K = rank 64 from zero), out = (1 - tanh(f)) * dest + tanh(g) * message,
+    libdevice tanh, enable_fp_fusion False.
+Grid (NUM, row blocks): the controllers of one row block are adjacent programs, so a stride-0 dest (local layers) is
+read from DRAM once and from L2 by the other two. Passes 2 and 3 re-read the row block's dest / message from L2."""
+import os
+
+import triton
+import triton.language as tl
+from triton.language.extra import libdevice
+
+
+@triton.jit
+def _tree_sumsq(v):
+    """the served _controller_norm order on a (256, 16) tile laid out as in _served_sumsq (see build 4)."""
+    q = tl.reshape(v * v, (256, 2, 2, 2, 2))
+    q = tl.sum(q, axis=3)
+    q = tl.sum(q, axis=2)
+    q = tl.sum(q, axis=1)
+    a = tl.sum(q, axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 16)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 8)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 4)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 2)), axis=1)
+    a = tl.sum(tl.reshape(a, (8, 2, 1)), axis=1)
+    a = tl.reshape(a, (8,))
+    a = tl.sum(tl.reshape(a, (2, 4)), axis=0)
+    a = tl.sum(tl.reshape(a, (2, 2)), axis=0)
+    return tl.sum(a, axis=0)
+
+
+@triton.jit
+def _served_off(W: tl.constexpr):
+    t = tl.arange(0, 256)
+    i = tl.arange(0, 16)
+    return (i[None, :] // 8) * 2048 + t[:, None] * 8 + (i[None, :] % 8)
+
+
+@triton.jit
+def _msg(X0, X1, off, ok, p0, p1, inv, INTERP: tl.constexpr):
+    """message values at element offsets off of one row (or tile): mul.rn(fma.rn(p1, x1, fma.rn(p0, x0, 0)), inv)."""
+    x0 = tl.load(X0 + off, ok, other=0).to(tl.float32)
+    x1 = tl.load(X1 + off, ok, other=0).to(tl.float32)
+    if INTERP:
+        return (p1 * x1 + (p0 * x0 + 0.0)) * inv
+    return tl.fma(p1, x1, tl.fma(p0, x0, 0.0)) * inv
+
+
+@triton.jit
+def _warp_tree(a, BLOCK_M: tl.constexpr, NW4: tl.constexpr):
+    """(BLOCK_M, 32 NW4) per-thread partials -> (BLOCK_M, NW4) warp sums by the butterfly xor 16, 8, 4, 2, 1 (lane 0's value)."""
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 16)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 8)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 4)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 2)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 1)), axis=2)
+    return tl.reshape(a, (BLOCK_M, NW4))
+
+
+@triton.jit
+def _warps_in_order(a, BLOCK_M: tl.constexpr, NW: tl.constexpr, NW4: tl.constexpr, WARP_REV: tl.constexpr = False):
+    """(BLOCK_M, NW4) warp sums -> ((0 + w0) + w1) [+ w2], extracted by splits (no arithmetic). WARP_REV (failing control
+    only): the warps added in reverse order."""
+    if NW4 == 4:
+        lo, hi = tl.split(tl.reshape(a, (BLOCK_M, 2, 2)))   # lo = (w0, w2), hi = (w1, w3)
+        w0, w2 = tl.split(lo)
+        w1, w3 = tl.split(hi)
+        if WARP_REV:
+            if NW == 3:
+                s = ((0.0 + w2) + w1) + w0
+            else:
+                s = (0.0 + w1) + w0
+        else:
+            s = (0.0 + w0) + w1
+            if NW == 3:
+                s = s + w2
+    else:
+        w0, w1 = tl.split(a)
+        if WARP_REV:
+            s = (0.0 + w1) + w0
+        else:
+            s = (0.0 + w0) + w1
+    return s
+
+
+@triton.jit
+def _bank_stats(X0, X1, Q, rows, row_ok, d_rcp, eps, W: tl.constexpr, BLOCK_M: tl.constexpr, NT: tl.constexpr,
+                NC: tl.constexpr, NW: tl.constexpr, NTP: tl.constexpr, INTERP: tl.constexpr, SERVED_ORDER: tl.constexpr,
+                WARP_REV: tl.constexpr = False, CHAIN_REV: tl.constexpr = False):
+    """AttnResFwdKernel's per-row statistics for one query: returns (p0, p1, inv) per row, as (BLOCK_M,) fp32."""
+    t = tl.arange(0, NTP)
+    t_ok = t < NT
+    s0 = tl.zeros((BLOCK_M, NTP), tl.float32)
+    s1 = tl.zeros((BLOCK_M, NTP), tl.float32)
+    d0 = tl.zeros((BLOCK_M, NTP), tl.float32)
+    d1 = tl.zeros((BLOCK_M, NTP), tl.float32)
+    base = rows[:, None].to(tl.int64) * W
+    mask = row_ok & t_ok[None, :]
+    for cc in tl.static_range(NC):
+        for vv in tl.static_range(4):
+            if CHAIN_REV:   # failing control only: the per-thread fma chain walked backwards
+                c = NC - 1 - cc
+                v = 3 - vv
+            else:
+                c = cc
+                v = vv
+            e = 4 * NT * c + 4 * t + v
+            q = tl.load(Q + e, t_ok, other=0)
+            x0 = tl.load(X0 + base + e[None, :], mask, other=0).to(tl.float32)
+            x1 = tl.load(X1 + base + e[None, :], mask, other=0).to(tl.float32)
+            if INTERP:
+                s0 = x0 * x0 + s0
+                d0 = x0 * q[None, :] + d0
+                s1 = x1 * x1 + s1
+                d1 = x1 * q[None, :] + d1
+            else:
+                s0 = tl.fma(x0, x0, s0)
+                d0 = tl.fma(x0, q[None, :], d0)
+                s1 = tl.fma(x1, x1, s1)
+                d1 = tl.fma(x1, q[None, :], d1)
+    if SERVED_ORDER:
+        ss0 = _warps_in_order(_warp_tree(s0, BLOCK_M, NTP // 32), BLOCK_M, NW, NTP // 32, WARP_REV)
+        ss1 = _warps_in_order(_warp_tree(s1, BLOCK_M, NTP // 32), BLOCK_M, NW, NTP // 32, WARP_REV)
+        dd0 = _warps_in_order(_warp_tree(d0, BLOCK_M, NTP // 32), BLOCK_M, NW, NTP // 32, WARP_REV)
+        dd1 = _warps_in_order(_warp_tree(d1, BLOCK_M, NTP // 32), BLOCK_M, NW, NTP // 32, WARP_REV)
+    else:  # failing control: one plain tl.sum per row
+        ss0 = tl.sum(s0, axis=1)
+        ss1 = tl.sum(s1, axis=1)
+        dd0 = tl.sum(d0, axis=1)
+        dd1 = tl.sum(d1, axis=1)
+    if INTERP:
+        r0 = tl.rsqrt(ss0 * d_rcp + eps)
+        r1 = tl.rsqrt(ss1 * d_rcp + eps)
+        l0 = dd0 * r0
+        l1 = dd1 * r1
+        mx = tl.maximum(tl.maximum(tl.full((BLOCK_M,), float("-inf"), tl.float32), l0), l1)
+        e0 = tl.exp(dd0 * r0 - mx)
+        e1 = tl.exp(dd1 * r1 - mx)
+        inv = 1.0 / ((0.0 + e0) + e1)
+    else:
+        r0 = libdevice.rsqrt(tl.fma(ss0, d_rcp, eps))
+        r1 = libdevice.rsqrt(tl.fma(ss1, d_rcp, eps))
+        l0 = dd0 * r0
+        l1 = dd1 * r1
+        mx = tl.maximum(tl.maximum(tl.full((BLOCK_M,), float("-inf"), tl.float32), l0), l1)
+        e0 = libdevice.exp(tl.fma(dd0, r0, -mx))
+        e1 = libdevice.exp(tl.fma(dd1, r1, -mx))
+        inv = tl.div_rn(tl.full((BLOCK_M,), 1.0, tl.float32), (0.0 + e0) + e1)
+    return e0 * r0, e1 * r1, inv
+
+
+@triton.jit
+def _row(v, ridx, r):
+    """row r's value of a (BLOCK_M,) vector (one nonzero term: exact)."""
+    return tl.sum(tl.where(ridx == r, v, 0.0), axis=0)
+
+
+@triton.jit
+def _fused_bank_controller(
+    Dest, X0, X1, Query, Down, Gain, Forget, Out, T, DEST_STRIDE, eps, bank_eps, d_rcp,
+    W: tl.constexpr, BLOCK: tl.constexpr, R: tl.constexpr, BLOCK_R: tl.constexpr,
+    BLOCK_M: tl.constexpr, BLOCK_K: tl.constexpr, BLOCK_N: tl.constexpr, NT: tl.constexpr, NC: tl.constexpr, NW: tl.constexpr,
+    NTP: tl.constexpr, INTERP: tl.constexpr = False, SERVED_ORDER: tl.constexpr = True, NUM_STAGES: tl.constexpr = 3,
+):
+    m = tl.program_id(0).to(tl.int64)
+    row0 = tl.program_id(1) * BLOCK_M
+    K: tl.constexpr = 2 * W
+    GROUPS: tl.constexpr = (K + 1023) // 1024
+    cols = tl.arange(0, BLOCK)
+    valid = cols < W
+    ridx = tl.arange(0, BLOCK_M)
+    rows = row0 + ridx
+    row_ok = rows[:, None] < T
+    # pass 0: the bank AttnRes statistics of this controller's query (m) on the row block
+    p0, p1, inv = _bank_stats(X0, X1, Query + m * W, rows, row_ok, d_rcp, bank_eps, W, BLOCK_M, NT, NC, NW, NTP, INTERP, SERVED_ORDER)
+    rstd_d = tl.zeros((BLOCK_M,), tl.float32)
+    rstd_m = tl.zeros((BLOCK_M,), tl.float32)
+    off = _served_off(W)
+    # pass 1: row statistics of dest and of the (recomputed) message, one 1-D row at a time (the served reduction shape)
+    for r in tl.static_range(BLOCK_M):
+        t = (row0 + r).to(tl.int64)
+        ok = (t < T) & (off < W)
+        if SERVED_ORDER:
+            sd = _tree_sumsq(tl.load(Dest + m * DEST_STRIDE + t * W + off, ok, other=0))
+            sm = _tree_sumsq(_msg(X0 + t * W, X1 + t * W, off, ok, _row(p0, ridx, r), _row(p1, ridx, r), _row(inv, ridx, r), INTERP))
+        else:
+            dest = tl.load(Dest + m * DEST_STRIDE + t * W + cols, valid & (t < T), other=0)
+            message = _msg(X0 + t * W, X1 + t * W, cols, valid & (t < T), _row(p0, ridx, r), _row(p1, ridx, r), _row(inv, ridx, r), INTERP)
+            sd = tl.sum(dest * dest)
+            sm = tl.sum(message * message)
+        if INTERP:
+            dr = tl.rsqrt(sd / W + eps)
+            mr = tl.rsqrt(sm / W + eps)
+        else:
+            dr = libdevice.rsqrt(tl.div_rn(sd, W) + eps)
+            mr = libdevice.rsqrt(tl.div_rn(sm, W) + eps)
+        rstd_d = tl.where(ridx == r, dr, rstd_d)
+        rstd_m = tl.where(ridx == r, mr, rstd_m)
+    rank = tl.arange(0, BLOCK_R)
+    ks = tl.arange(0, BLOCK_K)
+    Wd = Down + m * R * K
+    rbase = rows[:, None].to(tl.int64) * W
+    # pass 2: down projection of the normalized [dest | message] rows
+    total = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+    for group in tl.static_range(GROUPS):
+        partial = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+        for tile in tl.range(0, 1024 // BLOCK_K, num_stages=NUM_STAGES):
+            k = group * 1024 + tile * BLOCK_K + ks
+            in_d = k[None, :] < W
+            x = tl.load(Dest + m * DEST_STRIDE + rbase + k[None, :], row_ok & in_d, other=0)
+            y = _msg(X0 + rbase, X1 + rbase, k[None, :] - W, row_ok & (k[None, :] >= W) & (k[None, :] < K),
+                     p0[:, None], p1[:, None], inv[:, None], INTERP)
+            xn = tl.where(in_d, x * rstd_d[:, None], y * rstd_m[:, None])
+            if not INTERP:
+                xn = xn.to(tl.bfloat16)
+            w = tl.load(Wd + rank[None, :] * K + k[:, None], (rank[None, :] < R) & (k[:, None] < K), other=0)
+            partial = tl.dot(xn, w, partial)
+        if group == 0:
+            total = partial
+        else:
+            total = total + partial
+    hidden = total
+    if not INTERP:
+        hidden = total.to(tl.bfloat16)
+    # pass 3: gain / forget and the tanh mix
+    for start in tl.range(0, W, BLOCK_N, num_stages=NUM_STAGES):
+        cn = start + tl.arange(0, BLOCK_N)
+        col_ok = cn[None, :] < W
+        weight_ok = col_ok & (rank[:, None] < R)
+        weights = m * W * R + cn[None, :] * R + rank[:, None]
+        offsets = rbase + cn[None, :]
+        mask = row_ok & col_ok
+        dest_t = tl.load(Dest + m * DEST_STRIDE + offsets, mask, other=0)
+        message_t = _msg(X0 + rbase, X1 + rbase, cn[None, :], mask, p0[:, None], p1[:, None], inv[:, None], INTERP)
+        gain = tl.dot(hidden, tl.load(Gain + weights, weight_ok, other=0))
+        forget = tl.dot(hidden, tl.load(Forget + weights, weight_ok, other=0))
+        if INTERP:
+            tf = 1.0 - 2.0 / (tl.exp(2.0 * forget) + 1.0)
+            tg = 1.0 - 2.0 / (tl.exp(2.0 * gain) + 1.0)
+        else:
+            tf = libdevice.tanh(forget)
+            tg = libdevice.tanh(gain)
+        output = (1.0 - tf) * dest_t + tg * message_t
+        tl.store(Out + m * T * W + offsets, output, mask)
+
+
+_BANK_CFG = {3: (96, 6, 3, 128), 1: (64, 9, 2, 64)}   # N_Q -> (AttnRes compute threads, vec chunks, warps, stat tile lanes) at D 2304
+
+
+def fused_bank_controllers(dest, dest_stride, x0, x1, queries, down, gain, forget, out, eps=1e-6, bank_eps=1e-6,
+                           block_m=16, block_k=128, block_n=64, num_warps=8, fp_fusion=False, num_stages=2,
+                           served_order=True, loop_stages=3):
+    """dest: base tensor with element stride between controllers (0 = one shared stream), as inkling2_loop._stacked returns;
+    x0 / x1: the two BF16 bank sources (T, W) contiguous; queries: (num, W) fp32 scaled queries; out: (num, T, W) fp32."""
+    num, rank, k = down.shape
+    tokens, width = out.shape[1], out.shape[2]
+    assert width == 2304 and num in _BANK_CFG and queries.shape == (num, width)
+    nt, nc, nw, ntp = _BANK_CFG[num]
+    assert 4 * nt * nc == width
+    grid = (num, triton.cdiv(tokens, block_m))
+    _fused_bank_controller[grid](
+        dest, x0, x1, queries, down, gain, forget, out, tokens, dest_stride, eps, bank_eps, 1.0 / width,
+        width, triton.next_power_of_2(width), rank, max(16, triton.next_power_of_2(rank)), block_m, block_k, block_n,
+        nt, nc, nw, ntp, os.environ.get("TRITON_INTERPRET") == "1", served_order, loop_stages,
+        num_warps=num_warps, num_stages=num_stages, enable_fp_fusion=fp_fusion,
+    )
+    return out
+
+
+@triton.jit
+def _bank_messages(X0, X1, Query, Out, T, bank_eps, d_rcp, W: tl.constexpr, BLOCK_M: tl.constexpr, BLOCK_N: tl.constexpr,
+                   NT: tl.constexpr, NC: tl.constexpr, NW: tl.constexpr, NTP: tl.constexpr, INTERP: tl.constexpr = False,
+                   SERVED_ORDER: tl.constexpr = True, WARP_REV: tl.constexpr = False, CHAIN_REV: tl.constexpr = False):
+    """debug / check kernel: the recomputed messages (num, T, W) fp32, to compare with attn_res bitwise."""
+    m = tl.program_id(0).to(tl.int64)
+    rows = tl.program_id(1) * BLOCK_M + tl.arange(0, BLOCK_M)
+    row_ok = rows[:, None] < T
+    p0, p1, inv = _bank_stats(X0, X1, Query + m * W, rows, row_ok, d_rcp, bank_eps, W, BLOCK_M, NT, NC, NW, NTP, INTERP, SERVED_ORDER,
+                              WARP_REV, CHAIN_REV)
+    rbase = rows[:, None].to(tl.int64) * W
+    for start in tl.range(0, W, BLOCK_N):
+        cn = start + tl.arange(0, BLOCK_N)
+        mask = row_ok & (cn[None, :] < W)
+        tl.store(Out + m * T * W + rbase + cn[None, :], _msg(X0 + rbase, X1 + rbase, cn[None, :], mask, p0[:, None], p1[:, None], inv[:, None], INTERP), mask)
+
+
+def bank_messages(x0, x1, queries, out, bank_eps=1e-6, block_m=16, block_n=128, num_warps=8, fp_fusion=False, served_order=True,
+                  warp_rev=False, chain_rev=False):
+    num, tokens, width = out.shape
+    nt, nc, nw, ntp = _BANK_CFG[num]
+    _bank_messages[(num, triton.cdiv(tokens, block_m))](x0, x1, queries, out, tokens, bank_eps, 1.0 / width, width, block_m, block_n,
+                                                          nt, nc, nw, ntp, os.environ.get("TRITON_INTERPRET") == "1", served_order, warp_rev, chain_rev,
+                                                          num_warps=num_warps, enable_fp_fusion=fp_fusion)
+    return out
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n52_band.cuh b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n52_band.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..06283c043b1df2921fc35d1aa96b5fe7d9e232eb
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n52_band.cuh
@@ -0,0 +1,1886 @@
+// SPDX-License-Identifier: Apache-2.0
+// n52 F1 (inkling2-spark moe seat, 2026-11-23): the SM120 MoE prefill visit's NVFP4 gate_up grouped GEMM with the swiglu +
+// NVFP4 quantization done per 128-row band from L2 by the CTA that finishes the band's last tile ("band pass").
+// GENERATED by work_moe/n52/gen_n52.py from n52_head.cuh + CUTLASS's ptr-array cooperative kernel + n52_tail.cuh.
+//
+// - GEMM: FlashInfer 0.7.4's CutlassNVFP4GroupwiseScaledGroupGEMMSM120<128, 128, 256, SwapAB false> types (the served config
+//   above 3,072 tokens at K 2,304) with the stock BF16 TMA epilogue, so D = the served gate_up output bit for bit.
+// - After each tile's epilogue store, the TMA-issuing warp waits for its bulk stores, fences the async proxy and the GPU, and
+//   thread 0 adds 1 to the band's counter (band = one 128-row M-tile of one expert, numbered like the SFA layout). The CTA
+//   whose add makes N / 128 (= 18) runs the band pass.
+// - Band pass = the image's nvfp4_swiglu_quantize_routed arithmetic (its own device helpers from routed_quant.cuh, E = 4 lanes
+//   per 16-value block as the image's split for width 1,152) over the band's rows: D read with ld.global.cg (L2), per row
+//   scale and gamma loaded once, v = bf16(capped_swiglu(bf16(D * scale) pairs)), row amax, quantize_part, store_part, the
+//   expert's scale tail zeroed on its last band; then discard.global.L2 on the row's D lines (never written back).
+// - mode (runtime): -1 stock (no hook), 0 signal only, 1 discard only, 2 pass + discard (the form), 3 pass without discard.
+#include 
+
+#include 
+
+#include 
+
+#include "routed_quant_sm120.cuh"
+
+#include "cute/tensor.hpp"
+#include "cutlass/cutlass.h"
+#include "cutlass/detail/sm100_blockscaled_layout.hpp"
+#include "cutlass/epilogue/collective/collective_builder.hpp"
+#include "cutlass/gemm/collective/collective_builder.hpp"
+#include "cutlass/gemm/device/gemm_universal_adapter.h"
+#include "cutlass/gemm/group_array_problem_shape.hpp"
+#include "cutlass/gemm/kernel/gemm_universal.hpp"
+#include "cutlass/util/packed_stride.hpp"
+
+#include 
+
+namespace sglang::n52_band {
+
+struct BandParams {
+  int mode = -1;                          // -1 stock, 0 signal, 1 discard, 2 pass + discard, 3 pass
+  int* counters = nullptr;                // [bands], zero on entry; the last arriver resets its band to 0
+  __nv_bfloat16 const* d = nullptr;       // [rows, n] gate_up D (BF16), the GEMM's output
+  int n = 0;                              // gate_up width (2 x the swiglu width)
+  int const* offsets = nullptr;           // [experts + 1] expert row offsets (m_indptr)
+  float const* acc_amax = nullptr;        // [rows] amax of the quantized A rows
+  float const* w_amax = nullptr;          // [experts]
+  float const* w_den = nullptr;           // [1]
+  float const* gammas = nullptr;          // [rows]
+  uint8_t* values = nullptr;              // [rows, n / 4] NVFP4 of v
+  uint8_t* x_scales = nullptr;            // SFA layout, 128-row padding per expert
+  float* amax_out = nullptr;              // [rows]
+  float gate_cap = 0.f;
+  float up_cap = 0.f;
+};
+
+constexpr int kBandBarrier = 14;  // named barrier id (CUTLASS reserves the low ids)
+constexpr int kTileN = 128;
+
+// bar.red.or over the 256 consumer threads: returns 1 in every thread if any thread passed a nonzero pred.
+__device__ __forceinline__ int bar_red_or(int pred) {
+  int r;
+  asm volatile(
+      "{ .reg .pred p, q; setp.ne.s32 p, %1, 0; bar.red.or.pred q, %2, %3, p; selp.s32 %0, 1, 0, q; }"
+      : "=r"(r)
+      : "r"(pred), "n"(kBandBarrier), "n"(256)
+      : "memory");
+  return r;
+}
+
+__device__ __forceinline__ void discard_l2(void const* p) {
+  asm volatile("discard.global.L2 [%0], 128;" ::"l"(p) : "memory");
+}
+
+#if defined(N52_LEAN) && N52_LEAN
+// Build 2 ("lean"), for the checkpoint's caps (gate 4, up 25) only: n52_moe.py refuses lean for other caps. The image's
+// capped_swiglu with its two IEEE divides replaced where provably equal on BF16 inputs (work_moe/n52/cpu/div25_proof.py,
+// exact rationals over all 65,280 finite BF16 values: PASS): gate / 4 -> gate * 0.25; up / 25 -> q0 = up * RN(1/25),
+// rem = fma(-q0, 25, up), fma(rem, RN(1/25), q0); a non-finite up takes the IEEE divide. gate and up are BF16-rounded before
+// this call, as in the image kernel; sigmoid, tanh and the multiplies are the image's instructions in the image's order.
+__device__ __forceinline__ float capped_swiglu_lean(float gate, float up, float gamma, float, float) {
+  float sigmoid;
+  asm("{ .reg .f32 t; mul.rn.f32 t, %1, 0fBFB8AA3B; "
+      "ex2.approx.ftz.f32 t, t; add.rn.f32 t, t, 0f3F800000; "
+      "rcp.approx.ftz.f32 %0, t; }"
+      : "=f"(sigmoid)
+      : "f"(gate));
+  float t;
+  asm("tanh.approx.f32 %0, %1;" : "=f"(t) : "f"(__fmul_rn(gate, 0.25f)));
+  gate = __fmul_rn(4.0f, t);
+  float q = __fmul_rn(up, 0.04f);
+  q = __fmaf_rn(__fmaf_rn(-q, 25.0f, up), 0.04f, q);
+  if (!isfinite(up)) q = __fdiv_rn(up, 25.0f);
+  asm("tanh.approx.f32 %0, %1;" : "=f"(t) : "f"(q));
+  up = __fmul_rn(25.0f, t);
+  return __fmul_rn(__fmul_rn(__fmul_rn(gate, sigmoid), up), gamma);
+}
+#define N52_SWIGLU capped_swiglu_lean
+#else
+#define N52_SWIGLU capped_swiglu
+#endif
+
+// One row of expert e by one warp: lane = (block within the 8-block group) * 4 + part, as the image's E = 4 split, 9 groups of
+// 8 blocks per 1,152-wide row. Used by the band pass (F1, one warp per row of the band) and the chunk pass (F2).
+template 
+__device__ __forceinline__ void band_row(BandParams const& p, int e, int row, int lane, bool pass, bool discard) {
+  using namespace sglang::inkling2_routed_quant;
+  constexpr int NH = N2 / 2, BLOCKS = NH / 16, ITERS = BLOCKS / 8, LINES = N2 * 2 / 128;
+  static_assert(NH % 128 == 0 && N2 * 2 % 128 == 0, "whole 8-block groups and whole 128-byte lines per row");
+  static_assert(split(NH) == 4, "the image quantizes width NH with E = 4 (4 lanes per block)");
+  int const bl = lane / 4, part = lane % 4;
+  float const rcp = __frcp_rn(__fmul_rn(1536.0f, *p.w_den));
+  float const wa = p.w_amax[e];
+  {
+    __nv_bfloat16 const* drow = p.d + int64_t(row) * N2;
+    if (pass) {
+      uint4 raw[ITERS];
+      uint4 const* src = reinterpret_cast(drow);
+#pragma unroll
+      for (int i = 0; i < ITERS; ++i)
+        raw[i] = __ldcg(src + (i * 8 + bl) * 4 + part);  // block b = 8i + bl: D columns 32b + 8 part .. + 8
+      float const scale = __fmul_rn(__fmul_rn(p.acc_amax[row], wa), rcp);
+      float const gamma = p.gammas[row];
+      float v[ITERS][4];
+      float bmax[ITERS];
+      float m = 0.0f;
+#pragma unroll
+      for (int i = 0; i < ITERS; ++i) {
+        __nv_bfloat16 const* a = reinterpret_cast<__nv_bfloat16 const*>(&raw[i]);
+#pragma unroll
+        for (int j = 0; j < 4; ++j) {
+          float gate = __bfloat162float(__float2bfloat16_rn(__fmul_rn(__bfloat162float(a[2 * j]), scale)));
+          float up = __bfloat162float(__float2bfloat16_rn(__fmul_rn(__bfloat162float(a[2 * j + 1]), scale)));
+          v[i][j] = __bfloat162float(__float2bfloat16_rn(N52_SWIGLU(gate, up, gamma, p.gate_cap, p.up_cap)));
+        }
+        bmax[i] = part_max<4>(v[i]);  // max over the block's 16 values (xor 1, 2 within the lane quad)
+        m = fmaxf(m, bmax[i]);
+      }
+#pragma unroll
+      for (int s = 4; s < 32; s *= 2)  // the other 7 blocks of each group: all 72 block maxima of the row
+        m = fmaxf(m, __shfl_xor_sync(0xFFFFFFFF, m, s));
+      float const amax = m;
+#pragma unroll
+      for (int i = 0; i < ITERS; ++i) {
+        uint32_t packed;
+        uint8_t sbits;
+        quantize_part<4>(v[i], amax, bmax[i], packed, sbits);
+        store_part<4>(p.values, p.x_scales, p.offsets, e, row, i * 8 + bl, part, NH, packed, sbits);
+      }
+      if (lane == 0) p.amax_out[row] = amax;
+    }
+    if (discard) {
+      __syncwarp();  // every lane's loads of this row have returned (their values were consumed above)
+      for (int l = lane; l < LINES; l += 32)
+        discard_l2(drow + l * 64);
+    }
+  }
+}
+
+// One band's rows, one warp per row (rows w, w + 8, ...).
+template 
+__device__ __forceinline__ void band_rows(BandParams const& p, int e, int r0, int r1, int tid, bool pass, bool discard) {
+  int const warp = tid / 32, lane = tid % 32;
+  for (int row = r0 + warp; row < r1; row += 8)
+    band_row(p, e, row, lane, pass, discard);
+}
+
+// zero_expert_tail for the expert's last 128-row tile (the image's bytes), by threads tid = 0 .. nthreads - 1.
+template 
+__device__ __forceinline__ void band_tail(BandParams const& p, int e, int tid, int nthreads = 256) {
+  using namespace sglang::inkling2_routed_quant;
+  constexpr int NH = N2 / 2, SCALE_K = (NH + 63) / 64 * 4, ATOMS = SCALE_K / 4;
+  int const count = p.offsets[e + 1] - p.offsets[e];
+  int const used = count % 128;
+  if (used == 0) return;
+  uint8_t* tile = p.x_scales + scale_base(p.offsets, e, SCALE_K) + int64_t(count / 128) * ATOMS * 512;
+  for (int item = tid; item < ATOMS * 32; item += nthreads) {
+    int const lane = item % 32;
+    uint32_t* atom = reinterpret_cast(tile + (item / 32) * 512 + lane * 16);
+#pragma unroll
+    for (int i = 0; i < 4; ++i)
+      if (lane + 32 * i >= used) atom[i] = 0;
+  }
+}
+
+// Called by all 256 consumer threads after each tile's epilogue store (tid = mma_thread_idx; warp 0 issued the TMA stores).
+template 
+__device__ __forceinline__ void n52_band_hook(BandParams const& p, int e, int mt, int n, int tid) {
+  if (tid < 32) {
+    asm volatile("cp.async.bulk.wait_group 0;" ::: "memory");  // this tile's D stores are complete (not just read)
+    asm volatile("fence.proxy.async.global;" ::: "memory");    // async-proxy writes ordered before generic accesses
+    __syncwarp();
+  }
+  int const base = p.offsets[0];
+  int const band = (p.offsets[e] - base + e * 127) / 128 + mt;
+  int last = 0;
+  if (tid == 0) {
+    __threadfence();
+    int const old = atomicAdd(p.counters + band, 1);
+    __threadfence();
+    last = old == (n + kTileN - 1) / kTileN - 1;
+  }
+  if (!bar_red_or(last)) return;
+  __threadfence();
+  if (p.mode >= 1) {
+    int const r0 = p.offsets[e] + mt * 128;
+    int const r1 = min(r0 + 128, p.offsets[e + 1]);
+    bool const pass = p.mode >= 2, discard = p.mode <= 2;
+    if (n == N2) {
+      band_rows(p, e, r0, r1, tid, pass, discard);
+      if (pass && r1 == p.offsets[e + 1]) band_tail(p, e, tid);
+    }
+  }
+  if (tid == 0) p.counters[band] = 0;
+}
+
+}  // namespace sglang::n52_band
+
+namespace cutlass::gemm::kernel {
+
+// ---- N52Kernel: cutlass/gemm/kernel/sm90_gemm_array_tma_warpspecialized_cooperative.hpp (md5 3b39c38d712b5f27af49baea07e8c8b4) with the n52 edits ----
+using sglang::n52_band::BandParams;
+using sglang::n52_band::n52_band_hook;
+
+template <
+  class ProblemShape_,
+  class CollectiveMainloop_,
+  class CollectiveEpilogue_,
+  class TileScheduler_
+>
+class N52Kernel
+{
+  // Get the type of the scheduler response.
+  template
+  struct TileSchedulerResponseGetter {
+    using Type = typename TileScheduler::CLCResponse;
+  };
+
+  template
+  struct TileSchedulerResponseGetter> {
+    using Type = typename TileScheduler::SchedulerResponse;
+  };
+
+public:
+  //
+  // Type Aliases
+  //
+  using ProblemShape = ProblemShape_;
+  static_assert(rank(typename ProblemShape::UnderlyingProblemShape{}) == 3 or rank(typename ProblemShape::UnderlyingProblemShape{}) == 4,
+    "ProblemShape{} should be  or ");
+
+  static_assert(cute::is_base_of_v);
+
+  static constexpr bool IsGdcEnabled = false;
+
+  // Mainloop derived types
+  using CollectiveMainloop = CollectiveMainloop_;
+  using TileShape = typename CollectiveMainloop::TileShape;
+  using TiledMma  = typename CollectiveMainloop::TiledMma;
+  using ArchTag   = typename CollectiveMainloop::ArchTag;
+  using ElementA  = typename CollectiveMainloop::ElementA;
+  using StrideA   = typename CollectiveMainloop::StrideA;
+  using InternalStrideA = typename CollectiveMainloop::InternalStrideA;
+  using ElementB  = typename CollectiveMainloop::ElementB;
+  using InternalStrideB = typename CollectiveMainloop::InternalStrideB;
+  using StrideB   = typename CollectiveMainloop::StrideB;
+  using DispatchPolicy = typename CollectiveMainloop::DispatchPolicy;
+  using Schedule = typename DispatchPolicy::Schedule;
+  using ElementAccumulator = typename CollectiveMainloop::ElementAccumulator;
+  using ClusterShape = typename DispatchPolicy::ClusterShape;
+  using MainloopArguments = typename CollectiveMainloop::Arguments;
+  using MainloopParams = typename CollectiveMainloop::Params;
+
+  // Epilogue derived types
+  using CollectiveEpilogue = CollectiveEpilogue_;
+  using ElementC = typename CollectiveEpilogue::ElementC;
+  using StrideC  = typename CollectiveEpilogue::StrideC;
+  using InternalStrideC = typename CollectiveEpilogue::InternalStrideC;
+  using ElementD = typename CollectiveEpilogue::ElementD;
+  using StrideD  = typename CollectiveEpilogue::StrideD;
+  using InternalStrideD = typename CollectiveEpilogue::InternalStrideD;
+  using EpilogueArguments = typename CollectiveEpilogue::Arguments;
+  using EpilogueParams = typename CollectiveEpilogue::Params;
+
+  static_assert(ArchTag::kMinComputeCapability >= 90);
+
+  static constexpr bool IsGroupedGemmKernel = !cute::is_same_v;
+  static constexpr uint32_t MinTensorMapWorkspaceAlignment = 64;
+
+  static_assert(
+    cute::is_void_v
+    or (
+      IsGroupedGemmKernel
+      and cute::is_any_of_v
+    ),
+    "Ptr-Array Cooperative and Grouped Gemm Cooperative kernel only supports the default scheduler.");
+
+  using SchedulerTag = cute::conditional_t<
+    cute::is_void_v,
+    cute::conditional_t<
+      IsGroupedGemmKernel,
+      GroupScheduler,     // Special grouped gemm scheduler
+      void                // Default scheduler for non-grouped kernels
+    >,
+    TileScheduler_
+  >;
+
+  using TileScheduler = typename detail::TileSchedulerSelector<
+    SchedulerTag,
+    ArchTag,
+    TileShape,
+    ClusterShape,
+    8, // SchedulerPipelineStageCount -- Grouped GEMM scheduler will benefit from a larger number of stages.
+    cute::conditional_t, void, ProblemShape> // Use void for default scheduler.
+  >::Scheduler;
+
+  using TileSchedulerArguments = typename TileScheduler::Arguments;
+  using TileSchedulerParams = typename TileScheduler::Params;
+  using TileSchedulerResponse = typename TileSchedulerResponseGetter::Type;
+
+  static constexpr auto TileSchedulerStages = 8;
+
+  static constexpr uint32_t NumLoadWarpGroups = 1;
+  static constexpr uint32_t NumMmaThreads = size(TiledMma{});
+  static constexpr uint32_t NumMmaWarpGroups = NumMmaThreads / NumThreadsPerWarpGroup;
+  static constexpr uint32_t MaxThreadsPerBlock = NumMmaThreads + (NumLoadWarpGroups * NumThreadsPerWarpGroup);
+  static constexpr uint32_t MinBlocksPerMultiprocessor = 1;
+  static constexpr uint32_t NumProducerThreads = CollectiveMainloop::NumProducerThreadEvents;
+  static constexpr bool     IsMainloopAuxiliaryLoadNeeded = detail::HasAuxiliaryLoad_v;
+
+  /// Register requirement for Load and Math WGs
+  static constexpr int RegsPerThread =
+    2 * size<0>(TileShape{}) * size<1>(TileShape{}) / NumMmaThreads *
+    sizeof(ElementAccumulator) / sizeof(uint32_t);
+
+  // Detect if this is SM120 blockscaled kernel which hits low register pressure
+  // on smaller tiles
+  template 
+  struct IsSm120BlockScaled : cute::false_type {};
+
+  template 
+  struct IsSm120BlockScaled>
+    : cute::true_type {};
+
+  static constexpr bool IsLowRegisterPressure = IsSm120BlockScaled::value && (RegsPerThread <= 64);
+
+  /// Register requirement for Load and Math WGs
+  static constexpr uint32_t LoadRegisterRequirement = 40;
+  static constexpr uint32_t MmaRegisterRequirement = 232;
+
+  static constexpr bool IsSm120Family = cute::is_same_v;
+
+  // 1 stage ordered sequence between mainloop and epilogue producer load threads
+  using LoadWarpOrderBarrier = cutlass::OrderedSequenceBarrier<1,2>;
+
+  // Kernel level shared memory storage
+  struct SharedStorage {
+    struct TensorStorage : cute::aligned_struct<128, _1> {
+      using MainloopTensorStorage = typename CollectiveMainloop::TensorStorage;
+      using EpilogueTensorStorage = typename CollectiveEpilogue::TensorStorage;
+
+      MainloopTensorStorage mainloop;
+      EpilogueTensorStorage epilogue;
+    } tensors;
+
+    struct PipelineStorage : cute::aligned_struct<16, _1> {
+      using TileSchedulerPipelineStorage = typename TileScheduler::PipelineStorage;
+      using MainloopPipelineStorage = typename CollectiveMainloop::PipelineStorage;
+      using EpiLoadPipelineStorage = typename CollectiveEpilogue::PipelineStorage;
+
+      alignas(16) TileSchedulerPipelineStorage scheduler;
+      alignas(16) MainloopPipelineStorage mainloop;
+      alignas(16) EpiLoadPipelineStorage epi_load;
+      alignas(16) typename LoadWarpOrderBarrier::SharedStorage load_order;
+    } pipelines;
+
+    alignas(16) TileSchedulerResponse scheduler_response[TileSchedulerStages];
+
+    struct TensorMapStorage : cute::aligned_struct<128, _1> {
+      using MainloopTensorMapStorage = typename CollectiveMainloop::TensorMapStorage;
+      using EpilogueTensorMapStorage = typename CollectiveEpilogue::TensorMapStorage;
+
+      alignas(128) MainloopTensorMapStorage mainloop;
+      alignas(128) EpilogueTensorMapStorage epilogue;
+    } tensormaps;
+  };
+
+  static constexpr int SharedStorageSize = sizeof(SharedStorage);
+
+  // Device side arguments
+  struct Arguments {
+    GemmUniversalMode mode{};
+    ProblemShape problem_shape{};
+    MainloopArguments mainloop{};
+    EpilogueArguments epilogue{};
+    KernelHardwareInfo hw_info{};
+    TileSchedulerArguments scheduler{};
+    BandParams band{};  // n52
+  };
+
+  // Kernel entry point API
+  struct Params {
+    GemmUniversalMode mode{};
+    ProblemShape problem_shape{};
+    MainloopParams mainloop{};
+    EpilogueParams epilogue{};
+    KernelHardwareInfo hw_info{};
+    TileSchedulerParams scheduler{};
+    void* workspace{nullptr};
+    BandParams band{};  // n52
+  };
+
+  //
+  // Methods
+  //
+
+  // Convert to underlying arguments. In this case, a simple copy for the aliased type.
+  static
+  Params
+  to_underlying_arguments(Arguments const& args, void* workspace) {
+    CUTLASS_TRACE_HOST("to_underlying_arguments():");
+
+    ProblemShape problem_shapes = args.problem_shape;
+
+    // Get SM count if needed, otherwise use user supplied SM count
+    int sm_count = args.hw_info.sm_count;
+    if (sm_count <= 0) {
+      CUTLASS_TRACE_HOST("  WARNING: Arguments do not include a valid SM count.\n"
+          "  For optimal performance, populate the arguments KernelHardwareInfo struct with the SM count.");
+      sm_count = KernelHardwareInfo::query_device_multiprocessor_count(args.hw_info.device_id);
+    }
+    CUTLASS_TRACE_HOST("to_underlying_arguments(): Setting persistent grid SM count to " << sm_count);
+
+    // Get maximum number of clusters that could co-exist on the target device
+    int max_active_clusters = args.hw_info.max_active_clusters;
+    if (max_active_clusters <= 0) {
+      max_active_clusters = 0;
+      CUTLASS_TRACE_HOST("  WARNING: Arguments do not include a valid max cluster count.\n"
+          "  For optimal performance, populate the arguments KernelHardwareInfo struct with the max_active_clusters.");
+    }
+    else {
+      CUTLASS_TRACE_HOST("to_underlying_arguments(): Setting persistent grid cluster count to " << max_active_clusters);
+    }
+
+    KernelHardwareInfo hw_info{args.hw_info.device_id, sm_count, max_active_clusters};
+
+    // Calculate workspace pointers
+    uint8_t* workspace_ptr = reinterpret_cast(workspace);
+    size_t workspace_offset = 0;
+
+    void* epilogue_workspace = workspace_ptr + workspace_offset;
+    workspace_offset += CollectiveEpilogue::get_workspace_size(problem_shapes, args.epilogue, sm_count);
+    workspace_offset = round_nearest(workspace_offset, MinTensorMapWorkspaceAlignment);
+
+    void* mainloop_workspace = workspace_ptr + workspace_offset;
+    workspace_offset += CollectiveMainloop::get_workspace_size(problem_shapes, args.mainloop, sm_count);
+    workspace_offset = round_nearest(workspace_offset, MinTensorMapWorkspaceAlignment);
+
+    void* scheduler_workspace = workspace_ptr + workspace_offset;
+    workspace_offset += TileScheduler::template get_workspace_size(
+      args.scheduler, typename ProblemShape::UnderlyingProblemShape{}, args.hw_info, NumMmaWarpGroups);
+    workspace_offset = round_nearest(workspace_offset, MinTensorMapWorkspaceAlignment);
+
+    TileSchedulerParams scheduler;
+    if constexpr (IsGroupedGemmKernel) {
+      scheduler = TileScheduler::to_underlying_arguments(
+      problem_shapes, TileShape{}, ClusterShape{}, hw_info, args.scheduler, scheduler_workspace);
+    }
+    else {
+      scheduler = TileScheduler::to_underlying_arguments(
+      problem_shapes.get_host_problem_shape(), TileShape{}, ClusterShape{}, hw_info, args.scheduler, scheduler_workspace);
+    }
+
+    return {
+      args.mode,
+      problem_shapes,
+      CollectiveMainloop::to_underlying_arguments(problem_shapes, args.mainloop, mainloop_workspace),
+      CollectiveEpilogue::to_underlying_arguments(problem_shapes, args.epilogue, epilogue_workspace),
+      hw_info,
+      scheduler,
+      workspace,
+      args.band  // n52
+    };
+  }
+
+  static bool
+  can_implement(Arguments const& args) {
+    bool implementable = true;
+    if constexpr (IsGroupedGemmKernel) {
+      // Group GEMM currently only supports rank-3 problem shapes
+      implementable &= (args.mode == GemmUniversalMode::kGrouped && rank(typename ProblemShape::UnderlyingProblemShape{}) == 3);
+    }
+    else {
+      implementable &= (args.mode == GemmUniversalMode::kArray && rank(typename ProblemShape::UnderlyingProblemShape{}) == 4);
+    }
+    if (!implementable) {
+      CUTLASS_TRACE_HOST("  CAN IMPLEMENT: Arguments or Problem Shape don't meet the requirements for Ptr Array Gemm or Grouped Gemm.\n");
+      return implementable;
+    }
+    implementable &= CollectiveMainloop::can_implement(args.problem_shape, args.mainloop);
+    implementable &= CollectiveEpilogue::can_implement(args.problem_shape, args.epilogue);
+    implementable &= TileScheduler::can_implement(args.scheduler);
+    return implementable;
+  }
+
+  static size_t
+  get_workspace_size(Arguments const& args) {
+    size_t workspace_size = 0;
+    constexpr uint32_t NumEpilogueSubTiles = CollectiveEpilogue::get_store_pipe_increment(TileShape{});
+
+    // Get SM count if needed, otherwise use user supplied SM count
+    int sm_count = args.hw_info.sm_count;
+    if (sm_count <= 0) {
+      CUTLASS_TRACE_HOST("  WARNING: Arguments do not include a valid SM count.\n"
+          "  For optimal performance, populate the arguments KernelHardwareInfo struct with the SM count.");
+      sm_count = KernelHardwareInfo::query_device_multiprocessor_count(args.hw_info.device_id);
+    }
+
+    workspace_size += CollectiveEpilogue::get_workspace_size(args.problem_shape, args.epilogue, sm_count);
+    workspace_size = round_nearest(workspace_size, MinTensorMapWorkspaceAlignment);
+
+    workspace_size += CollectiveMainloop::get_workspace_size(args.problem_shape, args.mainloop, sm_count);
+    workspace_size = round_nearest(workspace_size, MinTensorMapWorkspaceAlignment);
+
+    workspace_size += TileScheduler::template get_workspace_size(
+      args.scheduler, typename ProblemShape::UnderlyingProblemShape{}, args.hw_info, NumMmaWarpGroups, NumEpilogueSubTiles);
+    workspace_size = round_nearest(workspace_size, MinTensorMapWorkspaceAlignment);
+
+    return workspace_size;
+  }
+
+  static cutlass::Status
+  initialize_workspace(Arguments const& args, void* workspace = nullptr, cudaStream_t stream = nullptr,
+    CudaHostAdapter* cuda_adapter = nullptr) {
+    Status status = Status::kSuccess;
+    uint8_t* workspace_ptr = reinterpret_cast(workspace);
+    size_t workspace_offset = 0;
+    constexpr uint32_t NumEpilogueSubTiles = CollectiveEpilogue::get_store_pipe_increment(TileShape{});
+    static constexpr uint32_t NumAccumulatorMtxs = 1;
+
+    status = CollectiveEpilogue::initialize_workspace(args.problem_shape, args.epilogue, workspace_ptr + workspace_offset, stream, cuda_adapter);
+    workspace_offset += CollectiveEpilogue::get_workspace_size(args.problem_shape, args.epilogue, args.hw_info.sm_count);
+    workspace_offset = round_nearest(workspace_offset, MinTensorMapWorkspaceAlignment);
+    if (status != Status::kSuccess) {
+      return status;
+    }
+
+    status = CollectiveMainloop::initialize_workspace(args.problem_shape, args.mainloop, workspace_ptr + workspace_offset, stream, cuda_adapter);
+    workspace_offset += CollectiveMainloop::get_workspace_size(args.problem_shape, args.mainloop, args.hw_info.sm_count);
+    workspace_offset = round_nearest(workspace_offset, MinTensorMapWorkspaceAlignment);
+    if (status != Status::kSuccess) {
+      return status;
+    }
+
+    status = TileScheduler::template initialize_workspace(
+      args.scheduler, workspace_ptr + workspace_offset, stream, typename ProblemShape::UnderlyingProblemShape{}, args.hw_info, NumMmaWarpGroups, NumEpilogueSubTiles, NumAccumulatorMtxs, cuda_adapter);
+    workspace_offset += TileScheduler::template get_workspace_size(
+      args.scheduler, typename ProblemShape::UnderlyingProblemShape{}, args.hw_info, NumMmaWarpGroups, NumEpilogueSubTiles);
+    workspace_offset = round_nearest(workspace_offset, MinTensorMapWorkspaceAlignment);
+    if (status != Status::kSuccess) {
+      return status;
+    }
+    return status;
+  }
+
+  // Computes the kernel launch grid shape based on runtime parameters
+  static dim3
+  get_grid_shape(Params const& params) {
+    // Given device SM count, set grid size s.t. we do not launch more thread blocks than we can run concurrently
+    TileSchedulerArguments args{};
+    args.raster_order = params.scheduler.raster_order_ == TileScheduler::RasterOrder::AlongN ? TileScheduler::RasterOrderOptions::AlongN : TileScheduler::RasterOrderOptions::AlongM;
+    dim3 grid_shape;
+    if constexpr (IsGroupedGemmKernel) {
+      grid_shape = TileScheduler::get_grid_shape(params.scheduler, params.problem_shape, TileShape{}, ClusterShape{}, params.hw_info, args);
+    }
+    else {
+      grid_shape = TileScheduler::get_grid_shape(params.scheduler, params.problem_shape.get_host_problem_shape(), TileShape{}, ClusterShape{}, params.hw_info, args);
+    }
+    return grid_shape;
+  }
+
+  static dim3
+  get_block_shape() {
+    return dim3(MaxThreadsPerBlock, 1, 1);
+  }
+
+  CUTLASS_DEVICE
+  void
+  operator()(Params const& params, char* smem_buf) {
+    using namespace cute;
+    using X = Underscore;
+
+#  if (defined(__CUDA_ARCH_FEAT_SM90_ALL) || defined(__CUDA_ARCH_FEAT_SM120_ALL) || defined(__CUDA_ARCH_FEAT_SM121_ALL) ||\
+      CUDA_ARCH_CONDITIONAL_OR_FAMILY(1200) || CUDA_ARCH_CONDITIONAL_OR_FAMILY(1210))
+#    define ENABLE_SM90_KERNEL_LEVEL 1
+#  endif
+
+// Any Tensor Op MMA Atom in the ISA is arch conditional.
+#if ! defined(ENABLE_SM90_KERNEL_LEVEL)
+    CUTE_INVALID_CONTROL_PATH("ERROR : Arch conditional MMA instruction used without targeting appropriate compute capability. Aborting.\n");
+#else
+
+    // Preconditions
+    static_assert(size(TiledMma{}) == 256, "Cooperative kernel must have TiledMMA operating using 256 threads.");
+    static_assert(size<0>(TileShape{}) >= 128,
+        "Cooperative kernel requires Tile Size to be greater than or equal to 128 along the M-dimension.");
+    static_assert(NumMmaWarpGroups == 2, "Cooperative kernels currently only support NumMmaWarpGroups == 2");
+
+    if constexpr (cutlass::epilogue::collective::detail::sm90_is_ptr_array_tma_dispatch_policy_v) {
+      static_assert(NumMmaWarpGroups == CollectiveEpilogue::NumEpilogueWarpGroups,
+                    "Tiled MmA does not match expected warp groups performing the epilogue");
+    }
+
+    static_assert(cute::rank(InternalStrideA{}) == 3, "StrideA must be rank-3: [M, K, L]. If batch mode is not needed, set L stride to Int<0>.");
+    static_assert(cute::rank(InternalStrideB{}) == 3, "StrideB must be rank-3: [N, K, L]. If batch mode is not needed, set L stride to Int<0>.");
+    static_assert(cute::rank(InternalStrideC{}) == 3, "StrideC must be rank-3: [M, N, L]. If batch mode is not needed, set L stride to Int<0>.");
+    static_assert(cute::rank(InternalStrideD{}) == 3, "StrideD must be rank-3: [M, N, L]. If batch mode is not needed, set L stride to Int<0>.");
+
+    /* In the Cooperative kernel, Consumer0 and Consumer1 collaborate on the same tile */
+    enum class WarpGroupRole {
+      Producer = 0,
+      Consumer0 = 1,
+      Consumer1 = 2
+    };
+    enum class ProducerWarpRole {
+      Mainloop = 0,
+      MainloopAux = 1,
+      Epilogue = 2,
+      Scheduler = 3
+    };
+
+    // Kernel level shared memory storage
+    SharedStorage& shared_storage = *reinterpret_cast(smem_buf);
+
+    // In a warp specialized kernel, collectives expose data movement and compute operations separately
+    CollectiveMainloop collective_mainloop;
+    CollectiveEpilogue collective_epilogue(params.epilogue, shared_storage.tensors.epilogue);
+
+    int thread_idx = int(threadIdx.x);
+    int lane_idx = canonical_lane_idx();
+    int warp_idx = canonical_warp_idx_sync();
+    int warp_idx_in_warp_group = warp_idx % NumWarpsPerWarpGroup;
+    int warp_group_thread_idx = thread_idx % NumThreadsPerWarpGroup;
+    int mma_thread_idx = thread_idx % size(TiledMma{});
+    auto warp_group_idx = canonical_warp_group_idx();
+    auto warp_group_role = WarpGroupRole(warp_group_idx);
+    auto producer_warp_role = ProducerWarpRole(warp_idx_in_warp_group);
+    int lane_predicate = cute::elect_one_sync();
+    uint32_t block_rank_in_cluster = cute::block_rank_in_cluster();
+
+    // Note: Tma Descriptor Prefetch (from either const or param) is not applicable here
+
+    // TileScheduler pipeline
+    using TileSchedulerPipeline = typename TileScheduler::Pipeline;
+    typename TileSchedulerPipeline::Params tile_scheduler_pipeline_params;
+    if constexpr (cute::is_same_v) {
+      if (warp_group_role == WarpGroupRole::Producer
+        && producer_warp_role == ProducerWarpRole::Scheduler) {
+        tile_scheduler_pipeline_params.role = TileSchedulerPipeline::ThreadCategory::Producer;
+      }
+      else {
+        tile_scheduler_pipeline_params.role = TileSchedulerPipeline::ThreadCategory::Consumer;
+      }
+      tile_scheduler_pipeline_params.consumer_arv_count = NumMmaThreads
+                                                        + NumThreadsPerWarp * (
+                                                          1                                                           // Main DMA warp
+                                                          + (collective_epilogue.is_producer_load_needed() ? 1 : 0)   // Epilog DMA warp
+                                                          + (IsMainloopAuxiliaryLoadNeeded ? 1 : 0)                   // Aux DMA warp
+                                                        );
+      tile_scheduler_pipeline_params.producer_arv_count = 1;
+    }
+    TileSchedulerPipeline tile_scheduler_pipeline(shared_storage.pipelines.scheduler, tile_scheduler_pipeline_params);
+    // Mainloop Load pipeline
+    using MainloopPipeline = typename CollectiveMainloop::MainloopPipeline;
+    typename MainloopPipeline::Params mainloop_pipeline_params;
+    if (warp_group_role == WarpGroupRole::Producer
+      && (producer_warp_role == ProducerWarpRole::Mainloop
+       || producer_warp_role == ProducerWarpRole::MainloopAux)) {
+      mainloop_pipeline_params.role = MainloopPipeline::ThreadCategory::Producer;
+    }
+    if (warp_group_role == WarpGroupRole::Consumer0 || warp_group_role == WarpGroupRole::Consumer1) {
+      mainloop_pipeline_params.role = MainloopPipeline::ThreadCategory::Consumer;
+    }
+    mainloop_pipeline_params.is_leader = warp_group_thread_idx == 0;
+    mainloop_pipeline_params.num_consumers = NumMmaThreads;
+    mainloop_pipeline_params.num_producers = NumProducerThreads;
+    mainloop_pipeline_params.transaction_bytes = params.mainloop.tma_transaction_bytes;
+    MainloopPipeline mainloop_pipeline(shared_storage.pipelines.mainloop, mainloop_pipeline_params, ClusterShape{});
+
+    // Epilogue Load pipeline
+    using EpiLoadPipeline = typename CollectiveEpilogue::LoadPipeline;
+    typename EpiLoadPipeline::Params epi_load_pipeline_params;
+    if (warp_group_role == WarpGroupRole::Producer && producer_warp_role == ProducerWarpRole::Epilogue) {
+      epi_load_pipeline_params.role = EpiLoadPipeline::ThreadCategory::Producer;
+    }
+    if (warp_group_role == WarpGroupRole::Consumer0 || warp_group_role == WarpGroupRole::Consumer1) {
+      epi_load_pipeline_params.role = EpiLoadPipeline::ThreadCategory::Consumer;
+    }
+    epi_load_pipeline_params.dst_blockid = cute::block_rank_in_cluster();
+    epi_load_pipeline_params.producer_arv_count = NumThreadsPerWarp;
+    epi_load_pipeline_params.consumer_arv_count = size(TiledMma{});
+    if constexpr (CollectiveEpilogue::RequiresTransactionBytes) {
+      epi_load_pipeline_params.transaction_bytes = params.epilogue.tma_transaction_bytes;
+    }
+    EpiLoadPipeline epi_load_pipeline(shared_storage.pipelines.epi_load, epi_load_pipeline_params);
+
+    // Epilogue Store pipeline
+    using EpiStorePipeline = typename CollectiveEpilogue::StorePipeline;
+    typename EpiStorePipeline::Params epi_store_pipeline_params;
+    epi_store_pipeline_params.always_wait = true;
+    EpiStorePipeline epi_store_pipeline(epi_store_pipeline_params);
+
+    typename LoadWarpOrderBarrier::Params params_load_order_barrier;
+    params_load_order_barrier.group_id = producer_warp_role == ProducerWarpRole::Mainloop ? 0 : 1;
+    params_load_order_barrier.group_size = NumThreadsPerWarp;
+    LoadWarpOrderBarrier load_order_barrier(shared_storage.pipelines.load_order, params_load_order_barrier);
+
+    // Initialize starting pipeline states for the collectives
+    // Epilogue store pipe is producer-only (consumer is TMA unit, waits via scoreboarding)
+    typename TileSchedulerPipeline::PipelineState tile_scheduler_pipe_consumer_state;
+    typename CollectiveMainloop::PipelineState mainloop_pipe_consumer_state;
+    typename CollectiveEpilogue::LoadPipelineState epi_load_pipe_consumer_state;
+
+    // For the DMA Load (producer) we start with an opposite phase
+    // i.e., we skip all waits since we know that the buffer is indeed empty
+    PipelineState tile_scheduler_pipe_producer_state = cutlass::make_producer_start_state();
+    PipelineState mainloop_pipe_producer_state = cutlass::make_producer_start_state();
+    PipelineState epi_load_pipe_producer_state = cutlass::make_producer_start_state();
+    PipelineState epi_store_pipe_producer_state = cutlass::make_producer_start_state();
+
+    auto cluster_wait_fn = [] () {
+      // We need this to guarantee that the Pipeline init is visible
+      // To all producers and consumer thread blocks in the Cluster
+      if constexpr (size(ClusterShape{}) > 1) {
+        cute::cluster_arrive_relaxed();
+        return [] () { cute::cluster_wait(); };
+      }
+      else {
+        __syncthreads();
+        return [] () {}; // do nothing
+      }
+    } ();
+
+    // Get the appropriate blocks for this thread block -- potential for thread block locality
+    TiledMma tiled_mma;
+    const auto blk_shape = TileShape{};                                                                // (BLK_M,BLK_N,BLK_K)
+    const auto c_tile_count = CollectiveEpilogue::get_load_pipe_increment(blk_shape);
+    const auto d_tile_count = CollectiveEpilogue::get_store_pipe_increment(blk_shape);
+
+    // Wait for all thread blocks in the Cluster
+    cluster_wait_fn();
+
+    // Ensure memory ops in this kernel are not done prior to completion of dependent grids.
+    cutlass::arch::wait_on_dependent_grids();
+
+    auto scheduler = [&] () {
+      // Group scheduler requires a different constructor that takes a response ptr
+      if constexpr (cute::is_same_v) {
+        return TileScheduler{params.scheduler, shared_storage.scheduler_response};
+      }
+      else {
+        return TileScheduler{params.scheduler};
+      }
+    } ();
+
+    auto work_tile_info = scheduler.initial_work_tile_info(ClusterShape{});
+
+    if (not work_tile_info.is_valid()) {
+      // When problem shapes are only on device, the grid launched may be larger than the total number of blocks across groups
+      return;
+    }
+
+    // Optionally append 1s until problem shape is rank-4 in case it is only rank-3 (MNK)
+    auto problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(work_tile_info.L_idx), 1);
+
+    // Prepare and partition the input tensors. Expects a tuple of tensors where:
+    // get<0>(load_inputs) is the tma tensor A after local tiling so that it has shape (BLK_M,BLK_K,m,k,l)
+    // get<1>(load_inputs) is the tma tensor B after local tiling so that it has shape (BLK_N,BLK_K,n,k,l)
+    auto load_inputs = collective_mainloop.load_init(problem_shape_MNKL, params.mainloop);
+    static_assert(cute::tuple_size_v >= 2, "Output of load_init must have at least two elements (A, B)");
+
+    // Extract out partitioned A and B.
+    Tensor gA_mkl = get<0>(load_inputs);
+    Tensor gB_nkl = get<1>(load_inputs);
+
+    // Get pipeline stage increments from tensor shapes
+    auto k_tile_count = size<3>(gA_mkl);
+
+    if (warp_group_role == WarpGroupRole::Producer) {
+      if constexpr (!IsLowRegisterPressure) {
+        cutlass::arch::warpgroup_reg_dealloc();
+      }
+
+      if (producer_warp_role == ProducerWarpRole::Scheduler) {
+        // GroupScheduler requires a producer warp to iterate over the group infos and push
+        // the work tile infos to the downstream pipelines.
+        if constexpr (cute::is_same_v) {
+          do {
+            auto [next_work_tile_info, increment_pipe] = scheduler.advance_to_next_work(tile_scheduler_pipeline, tile_scheduler_pipe_producer_state);
+            work_tile_info = next_work_tile_info;
+            if (increment_pipe) {
+              ++tile_scheduler_pipe_producer_state;
+            }
+          } while (work_tile_info.is_valid());
+          tile_scheduler_pipeline.producer_tail(tile_scheduler_pipe_producer_state);
+        }
+      }
+      // Mainloop Producer Warp
+      else if (producer_warp_role == ProducerWarpRole::Mainloop) {
+        int32_t curr_batch = idx2crd(work_tile_info.L_idx, shape<4>(gB_nkl)); // Usually just returns work_tile_info.L_idx;
+        int32_t const mock_l_coord = 0;
+        int32_t const sm_idx = blockIdx.x + (blockIdx.y * gridDim.x);
+        int32_t const sm_count = params.hw_info.sm_count;
+
+        // Fetch a copy of tensormaps for the CTA
+        auto input_tensormaps = collective_mainloop.tensormaps_init(params.mainloop, shared_storage.tensormaps.mainloop, sm_count, sm_idx);
+
+        // Update tensormap for the initial batch for the CTA
+        collective_mainloop.tensormaps_perform_update(
+          shared_storage.tensormaps.mainloop,
+          params.mainloop,
+          input_tensormaps,
+          problem_shape_MNKL,
+          curr_batch
+        );
+        // Ensure warp is converged before issuing tensormap fence release
+        __syncwarp();
+        // Entire warp must do this (i.e. it's aligned)
+        collective_mainloop.tensormaps_cp_fence_release(shared_storage.tensormaps.mainloop, input_tensormaps);
+
+        bool do_load_order_arrive = true;
+        bool did_batch_change = true;
+        do {
+          if (!TileScheduler::valid_warpgroup_in_work_tile(work_tile_info)) {
+            auto [next_work_tile_info, increment_pipe] = scheduler.fetch_next_work(
+                work_tile_info, tile_scheduler_pipeline, tile_scheduler_pipe_consumer_state);
+            work_tile_info = next_work_tile_info;
+            if (increment_pipe) {
+              ++tile_scheduler_pipe_consumer_state;
+            }
+            continue;
+          }
+
+          // Compute m_coord, n_coord, l_coord with the post-tiled m-shape and n-shape
+          auto m_coord = idx2crd(work_tile_info.M_idx, shape<2>(gA_mkl));
+          auto n_coord = idx2crd(work_tile_info.N_idx, shape<2>(gB_nkl));
+          auto blk_coord = make_coord(m_coord, n_coord, _, mock_l_coord);
+
+          // Get the number of K tiles to compute for this work as well as the starting K tile offset of the work.
+          auto work_k_tile_count = TileScheduler::get_work_k_tile_count(work_tile_info, problem_shape_MNKL, blk_shape);
+          auto work_k_tile_start = TileScheduler::get_work_k_tile_start(work_tile_info);
+          auto k_tile_iter = cute::make_coord_iterator(idx2crd(work_k_tile_start, shape<3>(gA_mkl)), shape<3>(gA_mkl));
+
+          if (did_batch_change) {
+            load_inputs = collective_mainloop.tensors_perform_update(load_inputs, params.mainloop, problem_shape_MNKL, curr_batch);
+            collective_mainloop.tensormaps_fence_acquire(input_tensormaps);
+          }
+
+          collective_mainloop.load(
+            params.mainloop,
+            mainloop_pipeline,
+            mainloop_pipe_producer_state,
+            load_inputs,
+            input_tensormaps,
+            blk_coord,
+            k_tile_iter, work_k_tile_count,
+            lane_idx,
+            block_rank_in_cluster,
+            shared_storage.tensors.mainloop
+          );
+          // Pipeline state is only advanced if there are K tiles to compute
+          mainloop_pipe_producer_state.advance(work_k_tile_count);
+
+          // Signal for the epilogue load warp to begin
+          if (do_load_order_arrive) {
+            load_order_barrier.arrive();
+            do_load_order_arrive = false;
+          }
+
+          // Get next work tile
+          auto [next_work_tile_info, increment_pipe] = scheduler.fetch_next_work(work_tile_info, tile_scheduler_pipeline, tile_scheduler_pipe_consumer_state);
+          work_tile_info = next_work_tile_info;
+          if (increment_pipe) {
+            ++tile_scheduler_pipe_consumer_state;
+          }
+          auto next_batch = idx2crd(work_tile_info.L_idx, shape<4>(gB_nkl)); // Usually just returns work_tile_info.L_idx
+          did_batch_change = next_batch != curr_batch;
+          if (work_tile_info.is_valid() && did_batch_change) {
+            curr_batch = next_batch;
+            if constexpr (IsGroupedGemmKernel) {
+              problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(curr_batch), 1);
+            }
+            collective_mainloop.tensormaps_perform_update(
+              shared_storage.tensormaps.mainloop,
+              params.mainloop,
+              input_tensormaps,
+              problem_shape_MNKL,
+              curr_batch
+            );
+            // Ensure warp is converged before issuing tensor replace
+            __syncwarp();
+            // Entire warp must do this (i.e. it's aligned)
+            collective_mainloop.tensormaps_cp_fence_release(shared_storage.tensormaps.mainloop, input_tensormaps);
+          }
+        } while (work_tile_info.is_valid()); // Scheduler work fetch loop
+
+        // Make sure all Consumer Warp Groups have been waited upon
+        collective_mainloop.load_tail(mainloop_pipeline, mainloop_pipe_producer_state);
+      } // Mainloop Producer Warp End
+      else if (producer_warp_role == ProducerWarpRole::MainloopAux) {
+        if constexpr (IsMainloopAuxiliaryLoadNeeded) {
+          int32_t curr_batch = idx2crd(work_tile_info.L_idx, shape<4>(gB_nkl)); // Usually just returns work_tile_info.L_idx;
+          int32_t const mock_l_coord = 0;
+
+          bool did_batch_change = true;
+          do {
+            if (!TileScheduler::valid_warpgroup_in_work_tile(work_tile_info)) {
+              auto [next_work_tile_info, increment_pipe] = scheduler.fetch_next_work(work_tile_info, tile_scheduler_pipeline, tile_scheduler_pipe_consumer_state);
+              work_tile_info = next_work_tile_info;
+              if (increment_pipe) {
+                ++tile_scheduler_pipe_consumer_state;
+              }
+              continue;
+            }
+
+            // Compute m_coord, n_coord, l_coord with the post-tiled m-shape and n-shape
+            auto m_coord = idx2crd(work_tile_info.M_idx, shape<2>(gA_mkl));
+            auto n_coord = idx2crd(work_tile_info.N_idx, shape<2>(gB_nkl));
+            auto blk_coord = make_coord(m_coord, n_coord, _, mock_l_coord);
+
+            // Get the number of K tiles to compute for this work as well as the starting K tile offset of the work.
+            auto work_k_tile_count = TileScheduler::get_work_k_tile_count(work_tile_info, problem_shape_MNKL, blk_shape);
+            auto work_k_tile_start = TileScheduler::get_work_k_tile_start(work_tile_info);
+            auto k_tile_iter = cute::make_coord_iterator(idx2crd(work_k_tile_start, shape<3>(gA_mkl)), shape<3>(gA_mkl));
+
+            if (did_batch_change) {
+              load_inputs = collective_mainloop.tensors_perform_update(load_inputs, params.mainloop, problem_shape_MNKL, curr_batch);
+            }
+
+            collective_mainloop.load_auxiliary(
+              params.mainloop,
+              mainloop_pipeline,
+              mainloop_pipe_producer_state,
+              load_inputs,
+              blk_coord,
+              k_tile_iter, work_k_tile_count,
+              lane_idx,
+              block_rank_in_cluster,
+              shared_storage.tensors.mainloop
+            );
+
+            // Update starting pipeline state for the next tile
+            mainloop_pipe_producer_state.advance(work_k_tile_count);
+
+            // Get next work tile
+            auto [next_work_tile_info, increment_pipe] = scheduler.fetch_next_work(work_tile_info, tile_scheduler_pipeline, tile_scheduler_pipe_consumer_state);
+            work_tile_info = next_work_tile_info;
+            if (increment_pipe) {
+              ++tile_scheduler_pipe_consumer_state;
+            }
+            auto next_batch = idx2crd(work_tile_info.L_idx, shape<4>(gB_nkl)); // Usually just returns work_tile_info.L_idx
+            did_batch_change = next_batch != curr_batch;
+            if (work_tile_info.is_valid() && did_batch_change) {
+              curr_batch = next_batch;
+              if constexpr (IsGroupedGemmKernel) {
+                problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(curr_batch), 1);
+              }
+            }
+          } while (work_tile_info.is_valid()); // Scheduler work fetch loop
+        } // End of auxiliary load needed check
+      } // Mainloop Auxiliary Load Producer Warp End
+      // Epilogue Producer Warp
+      else if (producer_warp_role == ProducerWarpRole::Epilogue && collective_epilogue.is_producer_load_needed()) {
+        int32_t const sm_idx = blockIdx.x + (blockIdx.y * gridDim.x);
+        int32_t const sm_count = params.hw_info.sm_count;
+
+        auto epi_load_tensormap = get<0>(collective_epilogue.load_init(params.epilogue, shared_storage.tensormaps.epilogue, sm_count, sm_idx));
+
+        bool did_batch_change = true;
+        constexpr bool IsEpiLoad = true;
+
+        collective_epilogue.template tensormaps_perform_update(
+          shared_storage.tensormaps.epilogue,
+          params.epilogue,
+          epi_load_tensormap,
+          problem_shape_MNKL,
+          work_tile_info.L_idx,
+          0
+        );
+
+        // Converge before issuing tensormap fence release since fence is aligned
+        __syncwarp();
+        collective_epilogue.template tensormaps_cp_fence_release(shared_storage.tensormaps.epilogue, epi_load_tensormap, 0);
+
+        load_order_barrier.wait();
+
+        do {
+          int32_t curr_batch = work_tile_info.L_idx;
+
+          // Get next work tile
+          auto [next_work_tile_info, increment_pipe] = scheduler.fetch_next_work(work_tile_info, tile_scheduler_pipeline, tile_scheduler_pipe_consumer_state);
+
+          if (TileScheduler::compute_epilogue(work_tile_info, params.scheduler)) {
+            if constexpr (IsGroupedGemmKernel) {
+              problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(work_tile_info.L_idx), 1);
+            }
+
+            // Compute m_coord, n_coord, l_coord with the post-tiled m-shape and n-shape
+            auto m_coord = idx2crd(work_tile_info.M_idx, shape<2>(gA_mkl));
+            auto n_coord = idx2crd(work_tile_info.N_idx, shape<2>(gB_nkl));
+            auto l_coord = idx2crd(work_tile_info.L_idx, shape<4>(gB_nkl));
+            auto blk_coord = make_coord(m_coord, n_coord, _, l_coord);
+
+            if (did_batch_change) {
+              collective_epilogue.template tensormaps_fence_acquire(epi_load_tensormap);
+            }
+
+            epi_load_pipe_producer_state = collective_epilogue.load(
+              epi_load_pipeline,
+              epi_load_pipe_producer_state,
+              problem_shape_MNKL,
+              blk_shape,
+              blk_coord,
+              tiled_mma,
+              lane_idx,
+              shared_storage.tensors.epilogue,
+              epi_load_tensormap,
+              work_tile_info.reduction_subtile_idx()
+            );
+          }
+
+          work_tile_info = next_work_tile_info;
+          if (increment_pipe) {
+            ++tile_scheduler_pipe_consumer_state;
+          }
+          did_batch_change = curr_batch != work_tile_info.L_idx;
+
+          if (work_tile_info.is_valid() && did_batch_change) {
+            if constexpr (IsGroupedGemmKernel) {
+              problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(work_tile_info.L_idx), 1);
+            }
+
+            // tensormap update
+            {
+              collective_epilogue.template tensormaps_perform_update(
+                shared_storage.tensormaps.epilogue,
+                params.epilogue,
+                epi_load_tensormap,
+                problem_shape_MNKL,
+                work_tile_info.L_idx,
+                0
+              );
+
+              // Converge before issuing tensormap fence release since fence is aligned
+              __syncwarp();
+              collective_epilogue.template tensormaps_cp_fence_release(shared_storage.tensormaps.epilogue, epi_load_tensormap, 0);
+            }
+          }
+
+        } while (work_tile_info.is_valid()); // Scheduler work fetch loop
+
+        // Make sure all Consumer Warp Groups have been waited upon
+        collective_epilogue.load_tail(epi_load_pipeline, epi_load_pipe_producer_state);
+      } // Epilogue Producer Warp End
+    } // Producer Warp Group End
+
+    else if (warp_group_role == WarpGroupRole::Consumer0 || warp_group_role == WarpGroupRole::Consumer1) {
+      if constexpr (!IsLowRegisterPressure) {
+        cutlass::arch::warpgroup_reg_alloc();
+      }
+
+      // Index of warp group within consumer warp groups
+      int consumer_warp_group_idx = warp_group_role == WarpGroupRole::Consumer0 ? 0 : 1;
+
+      int32_t const sm_idx = blockIdx.x + (blockIdx.y * gridDim.x);
+      int32_t const sm_count = params.hw_info.sm_count;
+      // Do we potentially issue tail arrives for TMA stores, if epilogue load is waiting for it
+      bool do_store_tail = false;
+      // Get a copy of tensormaps
+      auto epi_store_tensormap = get<0>(collective_epilogue.store_init(params.epilogue, shared_storage.tensormaps.epilogue, sm_count, sm_idx, consumer_warp_group_idx));
+
+      bool did_batch_change = true;
+      constexpr bool IsEpiLoad = false;
+
+      if (warp_idx_in_warp_group == 0) {
+        collective_epilogue.template tensormaps_perform_update(
+          shared_storage.tensormaps.epilogue,
+          params.epilogue,
+          epi_store_tensormap,
+          problem_shape_MNKL,
+          work_tile_info.L_idx,
+          consumer_warp_group_idx
+        );
+
+        // Converge before issuing tensormap fence release since fence is aligned
+        __syncwarp();
+        collective_epilogue.template tensormaps_cp_fence_release(shared_storage.tensormaps.epilogue,
+                                                                    epi_store_tensormap,
+                                                                    consumer_warp_group_idx);
+      }
+
+      do {
+        if constexpr (IsGroupedGemmKernel) {
+          problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(work_tile_info.L_idx), 1);
+        }
+
+        int32_t curr_batch = work_tile_info.L_idx;
+
+        // Compute m_coord, n_coord, l_coord with the post-tiled m-shape and n-shape
+        auto m_coord = idx2crd(work_tile_info.M_idx, shape<2>(gA_mkl));
+        auto n_coord = idx2crd(work_tile_info.N_idx, shape<2>(gB_nkl));
+        auto l_coord = idx2crd(work_tile_info.L_idx, shape<4>(gB_nkl));
+        auto blk_coord = make_coord(m_coord, n_coord, _, l_coord);
+        auto work_k_tile_count = TileScheduler::get_work_k_tile_count(work_tile_info, problem_shape_MNKL, blk_shape);
+
+        // Allocate the accumulators for the (M,N) blk_shape
+        //
+        // MSVC CTAD breaks if we say "Tensor" here, so we use "auto" instead.
+        auto accumulators = partition_fragment_C(tiled_mma, take<0,2>(blk_shape));               // (MMA,MMA_M,MMA_N)
+
+        if (TileScheduler::valid_warpgroup_in_work_tile(work_tile_info)) {
+
+          if constexpr (IsSm120Family) {
+            collective_mainloop.mma(
+              mainloop_pipeline,
+              mainloop_pipe_consumer_state,
+              accumulators,
+              work_k_tile_count,
+              mma_thread_idx,
+              shared_storage.tensors.mainloop,
+              params.mainloop,
+              blk_coord
+            );
+          }
+          else {
+            collective_mainloop.mma(
+              mainloop_pipeline,
+              mainloop_pipe_consumer_state,
+              accumulators,
+              work_k_tile_count,
+              mma_thread_idx,
+              shared_storage.tensors.mainloop,
+              params.mainloop
+            );
+          }
+
+          // Make sure the math instructions are done and free buffers before entering the epilogue
+          collective_mainloop.mma_tail(
+            mainloop_pipeline,
+            mainloop_pipe_consumer_state,
+            work_k_tile_count
+          );
+
+          // Update starting mainloop pipeline state for the next tile
+          mainloop_pipe_consumer_state.advance(work_k_tile_count);
+        }
+
+        // Perform reduction across splits, if needed
+        TileScheduler::fixup(
+          params.scheduler, work_tile_info, accumulators, NumMmaWarpGroups, consumer_warp_group_idx);
+
+        if (did_batch_change) {
+          collective_epilogue.template tensormaps_fence_acquire(epi_store_tensormap);
+        }
+
+        if (TileScheduler::compute_epilogue(work_tile_info, params.scheduler)) {
+
+          // Epilogue and write to gD
+          auto [epi_load_pipe_consumer_state_next, epi_store_pipe_producer_state_next] =
+          collective_epilogue.store(
+            epi_load_pipeline,
+            epi_load_pipe_consumer_state,
+            epi_store_pipeline,
+            epi_store_pipe_producer_state,
+            problem_shape_MNKL,
+            blk_shape,
+            blk_coord,
+            accumulators,
+            tiled_mma,
+            mma_thread_idx,
+            shared_storage.tensors.epilogue,
+            epi_store_tensormap,
+            work_tile_info.reduction_subtile_idx()
+          );
+
+          epi_load_pipe_consumer_state = epi_load_pipe_consumer_state_next;
+          epi_store_pipe_producer_state = epi_store_pipe_producer_state_next;
+          do_store_tail = true;
+          // n52: this tile's D is stored; signal its band, the last arriver runs the band pass.
+#ifndef N52_NO_HOOK
+          if (params.band.mode >= 0) {
+            n52_band_hook(params.band, int(work_tile_info.L_idx), int(work_tile_info.M_idx),
+                          int(get<1>(problem_shape_MNKL)), mma_thread_idx);
+          }
+#endif
+        }
+
+        // Get next work tile
+        auto [next_work_tile_info, increment_pipe] = scheduler.fetch_next_work(work_tile_info, tile_scheduler_pipeline, tile_scheduler_pipe_consumer_state);
+
+        if (!next_work_tile_info.is_valid()) {
+          cutlass::arch::launch_dependent_grids();
+        }
+
+        work_tile_info = next_work_tile_info;
+        if (increment_pipe) {
+          ++tile_scheduler_pipe_consumer_state;
+        }
+
+        did_batch_change = curr_batch != work_tile_info.L_idx;
+        if (work_tile_info.is_valid() && did_batch_change) {
+          if constexpr (IsGroupedGemmKernel) {
+            problem_shape_MNKL = append<4>(params.problem_shape.get_problem_shape(work_tile_info.L_idx), 1);
+          }
+          if (warp_idx_in_warp_group == 0) {
+            collective_epilogue.template tensormaps_perform_update(
+              shared_storage.tensormaps.epilogue,
+              params.epilogue,
+              epi_store_tensormap,
+              problem_shape_MNKL,
+              work_tile_info.L_idx,
+              consumer_warp_group_idx
+            );
+
+            // Converge before issuing tensormap fence release since fence is aligned
+            __syncwarp();
+            collective_epilogue.template tensormaps_cp_fence_release(shared_storage.tensormaps.epilogue,
+                                                                       epi_store_tensormap,
+                                                                       consumer_warp_group_idx);
+          }
+        }
+
+      } while (work_tile_info.is_valid()); // Scheduler work fetch loop
+
+      // Cooperative only needs TMA to complete at the very end of the kernel
+      if (do_store_tail) {
+        collective_epilogue.store_tail(
+          epi_load_pipeline,
+          epi_load_pipe_consumer_state,
+          epi_store_pipeline,
+          epi_store_pipe_producer_state
+        );
+      }
+    } // Consumer Warp Groups End
+#endif
+  }
+};
+
+
+} // namespace cutlass::gemm::kernel
+
+namespace sglang::n52_band {
+
+using namespace cute;
+
+// ---- GEMM types: FlashInfer's builder arguments for <128, 128, 256, SwapAB false>, ElementD bf16, ElementC void. ----
+using ElementA = cutlass::float_e2m1_t;
+using ElementB = cutlass::float_e2m1_t;
+using ElementSF = cutlass::float_ue4m3_t;
+using ElementD = cutlass::bfloat16_t;
+constexpr int AlignmentA = 128 / cutlass::sizeof_bits::value;
+constexpr int AlignmentB = 128 / cutlass::sizeof_bits::value;
+constexpr int AlignmentD = 128 / cutlass::sizeof_bits::value;
+using ElementAccumulator = float;
+using ElementCompute = float;
+using ElementAMainloop = cutlass::nv_float4_t;
+using ElementBMainloop = cutlass::nv_float4_t;
+using ProblemShape = cutlass::gemm::GroupProblemShape>;
+using LayoutA = cutlass::layout::RowMajor;
+using LayoutB = cutlass::layout::ColumnMajor;
+using LayoutD = cutlass::layout::RowMajor;
+using ClusterShape = Shape<_1, _1, _1>;
+using ThreadBlockShape = Shape<_128, _128, _256>;
+using CollectiveEpilogue = typename cutlass::epilogue::collective::CollectiveBuilder<
+    cutlass::arch::Sm120,
+    cutlass::arch::OpClassBlockScaledTensorOp,
+    ThreadBlockShape,
+    ClusterShape,
+    cutlass::epilogue::collective::EpilogueTileAuto,
+    ElementAccumulator,
+    ElementCompute,
+    void,
+    LayoutD*,
+    AlignmentD,
+    ElementD,
+    LayoutD*,
+    AlignmentD,
+    cutlass::epilogue::collective::EpilogueScheduleAuto>::CollectiveOp;
+using CollectiveMainloop = typename cutlass::gemm::collective::CollectiveBuilder<
+    cutlass::arch::Sm120,
+    cutlass::arch::OpClassBlockScaledTensorOp,
+    ElementAMainloop,
+    LayoutA*,
+    AlignmentA,
+    ElementBMainloop,
+    LayoutB*,
+    AlignmentB,
+    ElementAccumulator,
+    ThreadBlockShape,
+    ClusterShape,
+    cutlass::gemm::collective::StageCountAutoCarveout(sizeof(typename CollectiveEpilogue::SharedStorage))>,
+    cutlass::gemm::collective::KernelScheduleAuto>::CollectiveOp;
+static_assert(
+    cute::is_base_of_v<
+        cutlass::gemm::KernelPtrArrayTmaWarpSpecializedCooperative,
+        typename CollectiveMainloop::DispatchPolicy::Schedule>,
+    "the served config builds the ptr-array cooperative kernel; N52Kernel is a copy of that kernel");
+using GemmKernel = cutlass::gemm::kernel::N52Kernel;
+using Gemm = cutlass::gemm::device::GemmUniversalAdapter;
+static_assert(GemmKernel::SharedStorageSize <= 101376, "dynamic smem must fit sm_120's 99 KB per block");
+using StrideA = typename Gemm::GemmKernel::InternalStrideA;
+using StrideB = typename Gemm::GemmKernel::InternalStrideB;
+using StrideD = typename Gemm::GemmKernel::InternalStrideD;
+using ScaleConfig = typename Gemm::GemmKernel::CollectiveMainloop::Sm1xxBlkScaledConfig;
+using LayoutSFA = typename Gemm::GemmKernel::CollectiveMainloop::InternalLayoutSFA;
+using LayoutSFB = typename Gemm::GemmKernel::CollectiveMainloop::InternalLayoutSFB;
+constexpr int ScaleGranularity = Gemm::GemmKernel::CollectiveMainloop::TiledMma::SFVecSize;
+static_assert(ScaleGranularity == 16);
+using UnderlyingProblemShape = typename ProblemShape::UnderlyingProblemShape;
+
+template 
+__host__ __device__ __forceinline__ T* inc_ptr(T* ptr, size_t offset) {
+  constexpr int adjustment = (cutlass::sizeof_bits::value < 8) ? (8 / cutlass::sizeof_bits::value) : 1;
+  return ptr + offset / adjustment;
+}
+
+// FlashInfer's compute_sm120_cutlass_nvfp4_group_gemm_args (SwapAB false), line for line.
+__global__ void group_args(
+    ElementA* A,
+    ElementB* B,
+    ElementSF* SFA,
+    ElementSF* SFB,
+    ElementD* D,
+    int const* m_indptr,
+    int n,
+    int k,
+    int num_groups,
+    UnderlyingProblemShape* problem_sizes,
+    ElementA const** A_ptr,
+    ElementB const** B_ptr,
+    ElementSF const** SFA_ptr,
+    ElementSF const** SFB_ptr,
+    ElementD** D_ptr,
+    StrideA* stride_A,
+    StrideB* stride_B,
+    StrideD* stride_D,
+    LayoutSFA* layout_SFA,
+    LayoutSFB* layout_SFB) {
+  int i = blockIdx.x * blockDim.x + threadIdx.x;
+  if (i >= num_groups) return;
+  constexpr size_t alignment_swizzled_mn = 128;
+  constexpr size_t alignment_swizzled_k = static_cast(ScaleGranularity) * 4;
+  size_t sf_n = (static_cast(n) + alignment_swizzled_mn - 1) / alignment_swizzled_mn * alignment_swizzled_mn;
+  size_t swizzled_k = (static_cast(k) + alignment_swizzled_k - 1) / alignment_swizzled_k * alignment_swizzled_k;
+  size_t sf_k = swizzled_k / static_cast(ScaleGranularity);
+  asm volatile("griddepcontrol.wait;");
+  asm volatile("griddepcontrol.launch_dependents;");
+  int m_offset = m_indptr[i];
+  int m_offset_next = m_indptr[i + 1];
+  size_t m = static_cast(m_offset_next) - static_cast(m_offset);
+  size_t sf_m_offset = (static_cast(m_offset) + static_cast(i) * (alignment_swizzled_mn - 1)) /
+                       alignment_swizzled_mn * alignment_swizzled_mn;
+  problem_sizes[i] = UnderlyingProblemShape(int(m), n, k);
+  stride_A[i] = cutlass::make_cute_packed_stride(StrideA{}, {int(m), k, 1});
+  stride_B[i] = cutlass::make_cute_packed_stride(StrideB{}, {n, k, 1});
+  stride_D[i] = cutlass::make_cute_packed_stride(StrideD{}, {int(m), n, 1});
+  A_ptr[i] = inc_ptr(A, static_cast(m_offset) * static_cast(k));
+  B_ptr[i] = inc_ptr(B, static_cast(i) * static_cast(n) * static_cast(k));
+  D_ptr[i] = D + static_cast(m_offset) * static_cast(n);
+  layout_SFA[i] = ScaleConfig::tile_atom_to_shape_SFA(
+      make_shape(static_cast(m), static_cast(sf_n), static_cast(swizzled_k), 1));
+  SFA_ptr[i] = inc_ptr(SFA, sf_m_offset * sf_k);
+  layout_SFB[i] = ScaleConfig::tile_atom_to_shape_SFB(
+      make_shape(static_cast(m), static_cast(sf_n), static_cast(swizzled_k), 1));
+  SFB_ptr[i] = inc_ptr(SFB, static_cast(i) * sf_n * sf_k);
+}
+
+inline size_t align16(size_t x) {
+  return (x + 15) / 16 * 16;
+}
+
+// values [rows, k/2] u8, weight [E, n, k/2] u8, scales (SFA, u8), weight_scales [E, n, k/16] u8 view, m_indptr [E+1],
+// acc_amax / gammas [rows] f32, w_amax [E] f32, w_den [1] f32, d [rows, n] bf16 scratch (the GEMM's D),
+// out_values [rows, n/4] u8, out_scales (SFA of width n/2, u8), out_amax [rows] f32, counters [>= bands] i32 (zero),
+// int_ws / float_ws u8 workspaces. mode: -1 stock, 0 signal, 1 discard, 2 pass + discard, 3 pass. raster: 0 AlongM, 1 AlongN.
+void gate_up_band(
+    tvm::ffi::TensorView values,
+    tvm::ffi::TensorView weight,
+    tvm::ffi::TensorView scales,
+    tvm::ffi::TensorView weight_scales,
+    tvm::ffi::TensorView m_indptr,
+    tvm::ffi::TensorView acc_amax,
+    tvm::ffi::TensorView w_amax,
+    tvm::ffi::TensorView w_den,
+    tvm::ffi::TensorView gammas,
+    tvm::ffi::TensorView d,
+    tvm::ffi::TensorView out_values,
+    tvm::ffi::TensorView out_scales,
+    tvm::ffi::TensorView out_amax,
+    tvm::ffi::TensorView counters,
+    tvm::ffi::TensorView int_ws,
+    tvm::ffi::TensorView float_ws,
+    double gate_cap,
+    double up_cap,
+    int64_t mode,
+    int64_t raster,
+    int64_t sm_count) {
+  auto device = host::SymbolicDevice{};
+  device.set_options();
+  auto rows = host::SymbolicSize{"rows"};
+  auto experts = host::SymbolicSize{"experts"};
+  auto n = host::SymbolicSize{"n"};
+  auto kp = host::SymbolicSize{"k/2"};
+  host::TensorMatcher({rows, kp}).with_dtype().with_device(device).verify(values);
+  host::TensorMatcher({experts, n, kp}).with_dtype().with_device(device).verify(weight);
+  host::TensorMatcher({rows}).with_dtype().with_device(device).verify(acc_amax).verify(gammas).verify(out_amax);
+  host::TensorMatcher({experts}).with_dtype().with_device(device).verify(w_amax);
+  host::TensorMatcher({1}).with_dtype().with_device(device).verify(w_den);
+  host::TensorMatcher({rows, n}).with_dtype().with_device(device).verify(d);
+  int const num_groups = static_cast(experts.unwrap());
+  int const N = static_cast(n.unwrap()), K = static_cast(kp.unwrap()) * 2;
+  int64_t const R = rows.unwrap();
+  CHECK_HOST(N == 2304) << "n52 band pass is compiled for gate_up width 2304, got " << N;
+  CHECK_HOST(m_indptr.size(0) == num_groups + 1) << "m_indptr must hold experts + 1 offsets";
+  CHECK_HOST(out_values.size(0) == R && out_values.size(1) == N / 4) << "out_values must be [rows, n / 4]";
+  int64_t const bands = (R + 127 * int64_t(num_groups)) / 128 + 1;
+  CHECK_HOST(counters.numel() >= bands) << "counters need " << bands << " entries";
+  CHECK_HOST(out_scales.numel() >= (R + 127 * int64_t(num_groups) + 127) / 128 * 128 * (N / 2 / 16))
+      << "out_scales too small for the SFA layout";
+  CHECK_HOST(mode >= -1 && mode <= 3) << "mode must be -1..3";
+  cudaStream_t stream = host::LaunchKernel::resolve_device(device.unwrap());
+
+  uint8_t* ib = static_cast(int_ws.data_ptr());
+  size_t off = 0;
+  auto take = [&](size_t bytes) {
+    void* p = ib + off;
+    off += align16(bytes);
+    return p;
+  };
+  auto problem_sizes = static_cast(take(num_groups * sizeof(UnderlyingProblemShape)));
+  auto A_ptr = static_cast(take(num_groups * sizeof(void*)));
+  auto B_ptr = static_cast(take(num_groups * sizeof(void*)));
+  auto D_ptr = static_cast(take(num_groups * sizeof(void*)));
+  auto SFA_ptr = static_cast(take(num_groups * sizeof(void*)));
+  auto SFB_ptr = static_cast(take(num_groups * sizeof(void*)));
+  auto stride_A = static_cast(take(num_groups * sizeof(StrideA)));
+  auto stride_B = static_cast(take(num_groups * sizeof(StrideB)));
+  auto stride_D = static_cast(take(num_groups * sizeof(StrideD)));
+  auto layout_SFA = static_cast(take(num_groups * sizeof(LayoutSFA)));
+  auto layout_SFB = static_cast(take(num_groups * sizeof(LayoutSFB)));
+  CHECK_HOST(off <= size_t(int_ws.numel())) << "int workspace too small: need " << off;
+
+  cudaLaunchConfig_t config{};
+  config.gridDim = (num_groups + 1023) / 1024;
+  config.blockDim = std::min(num_groups, 1024);
+  config.dynamicSmemBytes = 0;
+  config.stream = stream;
+  cudaLaunchAttribute attrs[1];
+  attrs[0].id = cudaLaunchAttributeProgrammaticStreamSerialization;
+  attrs[0].val.programmaticStreamSerializationAllowed = true;
+  config.numAttrs = 1;
+  config.attrs = attrs;
+  cudaError_t const st = cudaLaunchKernelEx(
+      &config,
+      group_args,
+      static_cast(values.data_ptr()),
+      static_cast(weight.data_ptr()),
+      static_cast(scales.data_ptr()),
+      static_cast(weight_scales.data_ptr()),
+      static_cast(d.data_ptr()),
+      static_cast(m_indptr.data_ptr()),
+      N,
+      K,
+      num_groups,
+      problem_sizes,
+      A_ptr,
+      B_ptr,
+      SFA_ptr,
+      SFB_ptr,
+      D_ptr,
+      stride_A,
+      stride_B,
+      stride_D,
+      layout_SFA,
+      layout_SFB);
+  CHECK_HOST(st == cudaSuccess) << "n52 group args launch: " << cudaGetErrorString(st);
+
+  cutlass::KernelHardwareInfo hw_info;
+  hw_info.device_id = device.unwrap().device_id;
+  hw_info.sm_count = static_cast(sm_count);
+  typename Gemm::Arguments arguments{
+      cutlass::gemm::GemmUniversalMode::kGrouped,
+      {num_groups, problem_sizes, /*problem_sizes_host=*/nullptr},
+      {A_ptr, stride_A, B_ptr, stride_B, SFA_ptr, layout_SFA, SFB_ptr, layout_SFB},
+      {{}, nullptr, nullptr, D_ptr, stride_D},
+      hw_info};
+  auto& fusion_args = arguments.epilogue.thread;
+  fusion_args.alpha = 1.0f;  // FlashInfer with alpha == nullptr (the served call passes none)
+  fusion_args.beta = 0;
+  fusion_args.alpha_ptr = nullptr;
+  fusion_args.dAlpha = {cute::_0{}, cute::_0{}, 0};
+  using RasterOptions = decltype(arguments.scheduler.raster_order);
+  arguments.scheduler.raster_order = raster ? RasterOptions::AlongN : RasterOptions::AlongM;
+  BandParams& b = arguments.band;
+  b.mode = static_cast(mode);
+  b.counters = static_cast(counters.data_ptr());
+  b.d = static_cast<__nv_bfloat16 const*>(d.data_ptr());
+  b.n = N;
+  b.offsets = static_cast(m_indptr.data_ptr());
+  b.acc_amax = static_cast(acc_amax.data_ptr());
+  b.w_amax = static_cast(w_amax.data_ptr());
+  b.w_den = static_cast(w_den.data_ptr());
+  b.gammas = static_cast(gammas.data_ptr());
+  b.values = static_cast(out_values.data_ptr());
+  b.x_scales = static_cast(out_scales.data_ptr());
+  b.amax_out = static_cast(out_amax.data_ptr());
+  b.gate_cap = static_cast(gate_cap);
+  b.up_cap = static_cast(up_cap);
+
+  Gemm gemm;
+  size_t const ws = Gemm::get_workspace_size(arguments);
+  CHECK_HOST(ws <= size_t(float_ws.numel())) << "float workspace too small: need " << ws;
+  CHECK_HOST(gemm.can_implement(arguments) == cutlass::Status::kSuccess) << "n52 gemm cannot implement";
+  CHECK_HOST(gemm.initialize(arguments, float_ws.data_ptr()) == cutlass::Status::kSuccess) << "n52 gemm initialize";
+  CHECK_HOST(gemm.run(stream, /*cuda_adapter=*/nullptr, /*launch_with_pdl=*/true) == cutlass::Status::kSuccess)
+      << "n52 gemm run";
+}
+
+// ---------------------------------------------------------------------------------------------------------------------------
+// F2 (chunked L2 pass): the same GEMM type, hook off (band mode -1), launched once per chunk of TB padded 128-row bands (the
+// band numbering of F1 = the SFA layout's), each launch covering every expert's M-tiles that fall in the chunk; after each GEMM
+// launch a pass kernel runs the band arithmetic (band_row) over the chunk's rows reading D from L2 and discarding it. Kernel
+// boundaries order D's writes before the pass (no counters, no fences). Exact for the same reason as F1: each tile is the
+// served tile (same rows, same K order); a sub-problem starts on a 128-row tile of its expert, so its A / D / SFA pointers are
+// the expert's plus whole tiles (the SFA layout is row-block outermost: 128 x sf_k bytes per block).
+
+__device__ __forceinline__ int band0_of(int const* offsets, int e) {
+  return (offsets[e] - offsets[0] + e * 127) / 128;
+}
+
+// Expert of padded band b: the largest e with band0_of(e) <= b (bands between experts' last tile and the next start are unused).
+__device__ __forceinline__ int expert_of_band(int const* offsets, int experts, int b) {
+  int lo = 0, hi = experts;
+  while (hi - lo > 1) {
+    int const mid = (lo + hi) / 2;
+    if (band0_of(offsets, mid) <= b)
+      lo = mid;
+    else
+      hi = mid;
+  }
+  return lo;
+}
+
+// One thread per (chunk, group): the arrays of chunk c start at c * num_groups.
+__global__ void chunk_args(
+    ElementA* A,
+    ElementB* B,
+    ElementSF* SFA,
+    ElementSF* SFB,
+    ElementD* D,
+    int const* m_indptr,
+    int n,
+    int k,
+    int num_groups,
+    int nchunks,
+    int tb,
+    UnderlyingProblemShape* problem_sizes,
+    ElementA const** A_ptr,
+    ElementB const** B_ptr,
+    ElementSF const** SFA_ptr,
+    ElementSF const** SFB_ptr,
+    ElementD** D_ptr,
+    StrideA* stride_A,
+    StrideB* stride_B,
+    StrideD* stride_D,
+    LayoutSFA* layout_SFA,
+    LayoutSFB* layout_SFB) {
+  int const t = blockIdx.x * blockDim.x + threadIdx.x;
+  asm volatile("griddepcontrol.wait;");
+  asm volatile("griddepcontrol.launch_dependents;");
+  if (t >= num_groups * nchunks) return;
+  int const c = t / num_groups, i = t % num_groups;
+  constexpr size_t alignment_swizzled_mn = 128;
+  constexpr size_t alignment_swizzled_k = static_cast(ScaleGranularity) * 4;
+  size_t sf_n = (static_cast(n) + alignment_swizzled_mn - 1) / alignment_swizzled_mn * alignment_swizzled_mn;
+  size_t swizzled_k = (static_cast(k) + alignment_swizzled_k - 1) / alignment_swizzled_k * alignment_swizzled_k;
+  size_t sf_k = swizzled_k / static_cast(ScaleGranularity);
+  int const m_offset = m_indptr[i], cnt = m_indptr[i + 1] - m_indptr[i];
+  int const b0 = band0_of(m_indptr, i), nt = (cnt + 127) / 128;
+  int const lo = max(b0, c * tb), hi = min(b0 + nt, (c + 1) * tb);  // this expert's bands inside chunk c
+  int const mt0 = hi > lo ? lo - b0 : 0;
+  int const m = hi > lo ? min(cnt, (hi - b0) * 128) - mt0 * 128 : 0;
+  int const row0 = m_offset + mt0 * 128;
+  size_t sf_m_offset = (static_cast(m_offset) + static_cast(i) * (alignment_swizzled_mn - 1)) /
+                       alignment_swizzled_mn * alignment_swizzled_mn + static_cast(mt0) * 128;
+  problem_sizes[t] = UnderlyingProblemShape(m, n, k);
+  stride_A[t] = cutlass::make_cute_packed_stride(StrideA{}, {m, k, 1});
+  stride_B[t] = cutlass::make_cute_packed_stride(StrideB{}, {n, k, 1});
+  stride_D[t] = cutlass::make_cute_packed_stride(StrideD{}, {m, n, 1});
+  A_ptr[t] = inc_ptr(A, static_cast(row0) * static_cast(k));
+  B_ptr[t] = inc_ptr(B, static_cast(i) * static_cast(n) * static_cast(k));
+  D_ptr[t] = D + static_cast(row0) * static_cast(n);
+  layout_SFA[t] = ScaleConfig::tile_atom_to_shape_SFA(
+      make_shape(static_cast(m), static_cast(sf_n), static_cast(swizzled_k), 1));
+  SFA_ptr[t] = inc_ptr(SFA, sf_m_offset * sf_k);
+  layout_SFB[t] = ScaleConfig::tile_atom_to_shape_SFB(
+      make_shape(static_cast(m), static_cast(sf_n), static_cast(swizzled_k), 1));
+  SFB_ptr[t] = inc_ptr(SFB, static_cast(i) * sf_n * sf_k);
+}
+
+// Chunk pass: CTA j of chunk c covers padded rows [(c * tb) * 128 + 16 j, + 16), two per warp. Grid tb * 8, 256 threads.
+template 
+__global__ void __launch_bounds__(256) chunk_pass(BandParams p, int experts, int c, int tb) {
+  asm volatile("griddepcontrol.wait;" ::: "memory");  // the chunk's GEMM has completed (its D is in memory)
+  asm volatile("griddepcontrol.launch_dependents;");
+  int const warp = threadIdx.x / 32, lane = threadIdx.x % 32;
+  bool const pass = p.mode >= 2, discard = p.mode <= 2;
+#pragma unroll 1
+  for (int h = 0; h < 2; ++h) {
+    int const pr = (c * tb) * 128 + blockIdx.x * 16 + h * 8 + warp;
+    int const band = pr / 128;
+    int const e = expert_of_band(p.offsets, experts, band);
+    int const cnt = p.offsets[e + 1] - p.offsets[e];
+    int const local = (band - band0_of(p.offsets, e)) * 128 + pr % 128;
+    if (local < cnt) {
+      int const row = p.offsets[e] + local;
+      band_row(p, e, row, lane, pass, discard);
+      if (pass && local == cnt - 1) band_tail(p, e, lane, 32);
+    }
+  }
+}
+
+// F2 host entry: as gate_up_band (mode 2 pass + discard, 3 pass), with tb bands per chunk. int_ws must hold the args of every
+// chunk (~300 B x experts x chunks).
+void gate_up_chunks(
+    tvm::ffi::TensorView values,
+    tvm::ffi::TensorView weight,
+    tvm::ffi::TensorView scales,
+    tvm::ffi::TensorView weight_scales,
+    tvm::ffi::TensorView m_indptr,
+    tvm::ffi::TensorView acc_amax,
+    tvm::ffi::TensorView w_amax,
+    tvm::ffi::TensorView w_den,
+    tvm::ffi::TensorView gammas,
+    tvm::ffi::TensorView d,
+    tvm::ffi::TensorView out_values,
+    tvm::ffi::TensorView out_scales,
+    tvm::ffi::TensorView out_amax,
+    tvm::ffi::TensorView int_ws,
+    tvm::ffi::TensorView float_ws,
+    double gate_cap,
+    double up_cap,
+    int64_t mode,
+    int64_t raster,
+    int64_t tb,
+    int64_t sm_count) {
+  auto device = host::SymbolicDevice{};
+  device.set_options();
+  auto rows = host::SymbolicSize{"rows"};
+  auto experts = host::SymbolicSize{"experts"};
+  auto n = host::SymbolicSize{"n"};
+  auto kp = host::SymbolicSize{"k/2"};
+  host::TensorMatcher({rows, kp}).with_dtype().with_device(device).verify(values);
+  host::TensorMatcher({experts, n, kp}).with_dtype().with_device(device).verify(weight);
+  host::TensorMatcher({rows}).with_dtype().with_device(device).verify(acc_amax).verify(gammas).verify(out_amax);
+  host::TensorMatcher({experts}).with_dtype().with_device(device).verify(w_amax);
+  host::TensorMatcher({1}).with_dtype().with_device(device).verify(w_den);
+  host::TensorMatcher({rows, n}).with_dtype().with_device(device).verify(d);
+  int const G = static_cast(experts.unwrap());
+  int const N = static_cast(n.unwrap()), K = static_cast(kp.unwrap()) * 2;
+  int64_t const R = rows.unwrap();
+  CHECK_HOST(N == 2304) << "n52 chunk pass is compiled for gate_up width 2304, got " << N;
+  CHECK_HOST(m_indptr.size(0) == G + 1) << "m_indptr must hold experts + 1 offsets";
+  CHECK_HOST(out_values.size(0) == R && out_values.size(1) == N / 4) << "out_values must be [rows, n / 4]";
+  CHECK_HOST(out_scales.numel() >= (R + 127 * int64_t(G) + 127) / 128 * 128 * (N / 2 / 16)) << "out_scales too small";
+  CHECK_HOST(mode == 2 || mode == 3) << "chunk mode must be 2 (pass + discard) or 3 (pass)";
+  CHECK_HOST(tb >= 1 && tb <= 4096) << "tb (bands per chunk) out of range";
+  int const bands = static_cast((R + 127 * int64_t(G)) / 128 + 1);
+  int const nchunks = static_cast((bands + tb - 1) / tb);
+  cudaStream_t stream = host::LaunchKernel::resolve_device(device.unwrap());
+
+  uint8_t* ib = static_cast(int_ws.data_ptr());
+  size_t off = 0;
+  size_t const NC = size_t(nchunks) * G;
+  auto take = [&](size_t bytes) {
+    void* q = ib + off;
+    off += align16(bytes);
+    return q;
+  };
+  auto problem_sizes = static_cast(take(NC * sizeof(UnderlyingProblemShape)));
+  auto A_ptr = static_cast(take(NC * sizeof(void*)));
+  auto B_ptr = static_cast(take(NC * sizeof(void*)));
+  auto D_ptr = static_cast(take(NC * sizeof(void*)));
+  auto SFA_ptr = static_cast(take(NC * sizeof(void*)));
+  auto SFB_ptr = static_cast(take(NC * sizeof(void*)));
+  auto stride_A = static_cast(take(NC * sizeof(StrideA)));
+  auto stride_B = static_cast(take(NC * sizeof(StrideB)));
+  auto stride_D = static_cast(take(NC * sizeof(StrideD)));
+  auto layout_SFA = static_cast(take(NC * sizeof(LayoutSFA)));
+  auto layout_SFB = static_cast(take(NC * sizeof(LayoutSFB)));
+  CHECK_HOST(off <= size_t(int_ws.numel())) << "int workspace too small: need " << off;
+
+  cudaLaunchAttribute attrs[1];
+  attrs[0].id = cudaLaunchAttributeProgrammaticStreamSerialization;
+  attrs[0].val.programmaticStreamSerializationAllowed = true;
+  cudaLaunchConfig_t config{};
+  config.gridDim = static_cast((NC + 255) / 256);
+  config.blockDim = 256;
+  config.stream = stream;
+  config.numAttrs = 1;
+  config.attrs = attrs;
+  cudaError_t st = cudaLaunchKernelEx(
+      &config, chunk_args, static_cast(values.data_ptr()), static_cast(weight.data_ptr()),
+      static_cast(scales.data_ptr()), static_cast(weight_scales.data_ptr()),
+      static_cast(d.data_ptr()), static_cast(m_indptr.data_ptr()), N, K, G, nchunks, static_cast(tb),
+      problem_sizes, A_ptr, B_ptr, SFA_ptr, SFB_ptr, D_ptr, stride_A, stride_B, stride_D, layout_SFA, layout_SFB);
+  CHECK_HOST(st == cudaSuccess) << "n52 chunk args launch: " << cudaGetErrorString(st);
+
+  BandParams b;
+  b.mode = static_cast(mode);
+  b.counters = nullptr;
+  b.d = static_cast<__nv_bfloat16 const*>(d.data_ptr());
+  b.n = N;
+  b.offsets = static_cast(m_indptr.data_ptr());
+  b.acc_amax = static_cast(acc_amax.data_ptr());
+  b.w_amax = static_cast(w_amax.data_ptr());
+  b.w_den = static_cast(w_den.data_ptr());
+  b.gammas = static_cast(gammas.data_ptr());
+  b.values = static_cast(out_values.data_ptr());
+  b.x_scales = static_cast(out_scales.data_ptr());
+  b.amax_out = static_cast(out_amax.data_ptr());
+  b.gate_cap = static_cast(gate_cap);
+  b.up_cap = static_cast(up_cap);
+
+  cutlass::KernelHardwareInfo hw_info;
+  hw_info.device_id = device.unwrap().device_id;
+  hw_info.sm_count = static_cast(sm_count);
+  for (int c = 0; c < nchunks; ++c) {
+    size_t const o = size_t(c) * G;
+    typename Gemm::Arguments arguments{
+        cutlass::gemm::GemmUniversalMode::kGrouped,
+        {G, problem_sizes + o, /*problem_sizes_host=*/nullptr},
+        {A_ptr + o, stride_A + o, B_ptr + o, stride_B + o, SFA_ptr + o, layout_SFA + o, SFB_ptr + o, layout_SFB + o},
+        {{}, nullptr, nullptr, D_ptr + o, stride_D + o},
+        hw_info};
+    auto& fusion_args = arguments.epilogue.thread;
+    fusion_args.alpha = 1.0f;
+    fusion_args.beta = 0;
+    fusion_args.alpha_ptr = nullptr;
+    fusion_args.dAlpha = {cute::_0{}, cute::_0{}, 0};
+    using RasterOptions = decltype(arguments.scheduler.raster_order);
+    arguments.scheduler.raster_order = raster ? RasterOptions::AlongN : RasterOptions::AlongM;
+    arguments.band.mode = -1;  // F2: no in-kernel hook
+    Gemm gemm;
+    size_t const ws = Gemm::get_workspace_size(arguments);
+    CHECK_HOST(ws <= size_t(float_ws.numel())) << "float workspace too small: need " << ws;
+    CHECK_HOST(gemm.can_implement(arguments) == cutlass::Status::kSuccess) << "n52 chunk gemm cannot implement";
+    CHECK_HOST(gemm.initialize(arguments, float_ws.data_ptr()) == cutlass::Status::kSuccess) << "n52 chunk gemm initialize";
+    CHECK_HOST(gemm.run(stream, /*cuda_adapter=*/nullptr, /*launch_with_pdl=*/true) == cutlass::Status::kSuccess)
+        << "n52 chunk gemm run";
+    cudaLaunchConfig_t pc{};
+    pc.gridDim = static_cast(tb * 8);
+    pc.blockDim = 256;
+    pc.stream = stream;
+    pc.numAttrs = 1;
+    pc.attrs = attrs;
+    st = cudaLaunchKernelEx(&pc, chunk_pass<2304>, b, G, c, static_cast(tb));
+    CHECK_HOST(st == cudaSuccess) << "n52 chunk pass launch: " << cudaGetErrorString(st);
+  }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------------
+// L5 (lean standalone swiglu-quant) and C5 (its null twin): the image's nvfp4_swiglu_quantize_routed (routed_quant_sm120.cuh)
+// line for line, except capped_swiglu -> N52_SWIGLU: the lean unit (N52_LEAN 1) runs the proven divide rewrite (L5), the plain
+// unit runs the image's capped_swiglu (C5 = a copy of the image kernel: its timing is the copy null). Same launch (grid_size,
+// split_threads, PDL wait + trigger), same device helpers, so outputs are the image kernel's bit for bit.
+using sglang::inkling2_routed_quant_sm120::zero_expert_tail;
+
+template 
+__global__ void __launch_bounds__(sglang::inkling2_routed_quant::split_threads(N)) swiglu_quantize_l5(
+    __nv_bfloat16 const* __restrict__ acc,
+    float const* __restrict__ acc_amax,
+    float const* __restrict__ w_amax,
+    float const* __restrict__ w_denominator,
+    float const* __restrict__ gammas,
+    uint8_t* values,
+    uint8_t* x_scales,
+    float* amax_out,
+    int32_t const* __restrict__ offsets,
+    int32_t experts,
+    float gate_cap,
+    float up_cap) {
+  using namespace sglang::inkling2_routed_quant;
+  constexpr int kThreads = split_threads(N), kSplit = split(N), E = 16 / kSplit;
+  static_assert(N % 64 == 0 && kSplit > 1 && E % 4 == 0);
+  __shared__ int32_t s_offsets[kMaxExperts + 1];
+  __shared__ float red[2][kThreads / 32];
+  device::PDLWaitPrimary();
+  device::PDLTriggerSecondary();
+  load_offsets(offsets, experts, s_offsets);
+  int32_t const block = threadIdx.x / kSplit, part = threadIdx.x % kSplit;
+  bool const active = block < N / 16;
+  float const rcp = __frcp_rn(__fmul_rn(1536.0f, *w_denominator));
+  int32_t parity = 0;
+  for (int32_t row = s_offsets[0] + blockIdx.x; row < s_offsets[experts]; row += gridDim.x, parity ^= 1) {
+    int32_t const expert = row_expert(s_offsets, experts, row);
+    float v[E];
+#pragma unroll
+    for (int i = 0; i < E; ++i)
+      v[i] = 0.0f;
+    if (active) {
+      uint4 raw[E / 4];
+      uint4 const* src = reinterpret_cast(acc + int64_t(row) * 2 * N + block * 32 + part * 2 * E);
+#pragma unroll
+      for (int i = 0; i < E / 4; ++i)
+        raw[i] = src[i];
+      __nv_bfloat16 const* a = reinterpret_cast<__nv_bfloat16 const*>(raw);
+      float scale = __fmul_rn(__fmul_rn(acc_amax[row], w_amax[expert]), rcp);
+      float gamma = gammas[row];
+#pragma unroll
+      for (int i = 0; i < E; ++i) {
+        float gate = __bfloat162float(__float2bfloat16_rn(__fmul_rn(__bfloat162float(a[2 * i]), scale)));
+        float up = __bfloat162float(__float2bfloat16_rn(__fmul_rn(__bfloat162float(a[2 * i + 1]), scale)));
+        v[i] = __bfloat162float(__float2bfloat16_rn(N52_SWIGLU(gate, up, gamma, gate_cap, up_cap)));
+      }
+    }
+    float block_max = part_max(v);
+    float amax = block_max_reduce(block_max, red[parity]);
+    uint32_t packed;
+    uint8_t scale_bits;
+    quantize_part(v, amax, block_max, packed, scale_bits);
+    if (active) {
+      if (threadIdx.x == 0) amax_out[row] = amax;
+      store_part(values, x_scales, s_offsets, expert, row, block, part, N, packed, scale_bits);
+    }
+    if (row == s_offsets[expert + 1] - 1) zero_expert_tail(s_offsets, expert, x_scales, (N + 63) / 64 * 4);
+  }
+}
+
+// = the image's nvfp4_swiglu_quantize host wrapper for N = 1152 (same checks, grid and PDL launch), kernel swiglu_quantize_l5.
+void swiglu_quant_l5(
+    tvm::ffi::TensorView acc,
+    tvm::ffi::TensorView acc_amax,
+    tvm::ffi::TensorView w_amax,
+    tvm::ffi::TensorView w_denominator,
+    tvm::ffi::TensorView gammas,
+    tvm::ffi::TensorView values,
+    tvm::ffi::TensorView x_scales,
+    tvm::ffi::TensorView amax,
+    tvm::ffi::TensorView offsets,
+    double gate_cap,
+    double up_cap,
+    int64_t sm_count) {
+  using namespace sglang::inkling2_routed_quant;
+  constexpr int N = 1152;
+  constexpr int64_t kPart = 16 / split(N);
+  auto rows = host::SymbolicSize{"routed rows"};
+  auto scale_rows = host::SymbolicSize{"scale rows"};
+  auto device = host::SymbolicDevice{};
+  device.set_options();
+  int32_t const experts = sglang::inkling2_routed_quant_sm120::verify_offsets(offsets, device);
+  host::TensorMatcher({rows, 2 * N}).with_dtype().with_device(device).ensure_alignment(16).verify(acc);
+  host::TensorMatcher({rows}).with_dtype().with_device(device).verify(acc_amax).verify(gammas).verify(amax);
+  host::TensorMatcher({int64_t{experts}}).with_dtype().with_device(device).verify(w_amax);
+  host::TensorMatcher({1}).with_dtype().with_device(device).verify(w_denominator);
+  host::TensorMatcher({rows, N / 2}).with_dtype().with_device(device).ensure_alignment(kPart / 2).verify(values);
+  host::TensorMatcher({scale_rows, N / 16}).with_dtype().with_device(device).verify(x_scales);
+  int32_t const num_rows = sglang::inkling2_routed_quant_sm120::verify_rows(rows);
+  CHECK_HOST(scale_rows.unwrap() >= host::div_ceil(num_rows + 127 * int64_t{experts}, 128) * 128)
+      << "NVFP4 scales need 128-row blocks per expert, got " << scale_rows.unwrap() << " rows";
+  host::LaunchKernel(grid_size(num_rows, static_cast(sm_count)), split_threads(N), device.unwrap())
+      .enable_pdl(true)(
+          swiglu_quantize_l5,
+          static_cast<__nv_bfloat16 const*>(acc.data_ptr()),
+          static_cast(acc_amax.data_ptr()),
+          static_cast(w_amax.data_ptr()),
+          static_cast(w_denominator.data_ptr()),
+          static_cast(gammas.data_ptr()),
+          static_cast(values.data_ptr()),
+          static_cast(x_scales.data_ptr()),
+          static_cast(amax.data_ptr()),
+          static_cast(offsets.data_ptr()),
+          experts,
+          static_cast(gate_cap),
+          static_cast(up_cap));
+}
+
+}  // namespace sglang::n52_band
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n52_moe.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n52_moe.py
new file mode 100644
index 0000000000000000000000000000000000000000..3064b9244c23d108ffc28a451b2df238af1c2c6e
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n52_moe.py
@@ -0,0 +1,202 @@
+"""n52 F1 (inkling2-spark moe seat, 2026-11-23): SM120 MoE prefill NVFP4 visits with the swiglu + NVFP4 quantization done
+inside the gate_up grouped GEMM, per 128-row band, from L2 (n52_band.cuh), EXACT (same outputs bit for bit as S3's visit).
+
+S3's visit (n14 qc, n14_moe.py f9435cd7) is: token-major quantize-once -> FlashInfer gate_up GEMM (BF16 D, 302 MB at 8K)
+-> the image's nvfp4_swiglu_quantize_routed (reads D back) -> down GEMM -> BF16-direct combine. n52 replaces the middle two
+on calls whose gate_up runs the served (swap_ab False, 128, 256) config (> 3,072 tokens at width 2,304): the same GEMM
+(same CUTLASS types, mainloop and TMA epilogue, so D is the served D) in a kernel copy whose CTAs, after each tile's
+epilogue, count the tiles of the tile's 128-row band; the CTA that completes a band runs the image's swiglu + NVFP4
+arithmetic over the band's rows reading D from L2 and discards the band's D lines from L2 (no DRAM write-back).
+Everything else (routing, quantize-once, down GEMM, combine, the MXFP8 layers, calls of < 3,073 tokens) is S3's code.
+
+Knobs (env): N52_BAND 2 (pass + discard, the form) | 3 (pass, no discard) | 0 / empty = S3's path. N52_RASTER 1 (tile
+raster AlongN: a band's 18 tiles run back to back) | 0 (AlongM, the served default). N52_MIN_TOKENS (default 3073).
+N52_LEAN 1 = build 2: the band pass's two IEEE divides replaced by gate * 0.25 and a mul + 2 fma for up / 25, proven equal
+on every finite BF16 input (cpu/div25_proof.py); non-finite inputs keep the divide. Separate JIT unit (-DN52_LEAN=1).
+Graph capture: allocations are torch.empty / torch.zeros per call (graph pool; the counters' memset is a graph node), the
+launch shape depends on the token count only, PDL as served.
+mb1 (11-24): F1 KILLED on its measured cost (the in-GEMM pass is latency-starved: +15-23 ms per visit). mb2 adds:
+  F2 = gate_up_chunks: the same GEMM (hook off) launched per chunk of TB 128-row bands, each followed by a standalone pass
+       kernel at full occupancy reading D from L2 and discarding it (N52_FORM f2, N52_TB, N52_LEAN, N52_RASTER);
+  L5 = the served GEMM + swiglu_quant_l5, the image's swiglu-quant kernel line for line with the proven divide rewrite
+       (N52_FORM l5, N52_LEAN 1); with N52_LEAN 0 the same entry is C5, a verbatim copy of the image kernel (the copy null).
+N52_FORM (env, default f1 = the mb1 path when N52_BAND is 2 / 3)."""
+import logging
+import os
+
+import torch
+
+from sglang.kernels.jit.utils import cache_once, load_jit
+
+logger = logging.getLogger(__name__)
+_B = os.environ.get("N52_BAND", "2").strip()
+BAND = int(_B) if _B not in ("", "0") else 0
+RASTER = int(os.environ.get("N52_RASTER", "1"))
+MIN_TOKENS = int(os.environ.get("N52_MIN_TOKENS", "3073"))
+LEAN = int(os.environ.get("N52_LEAN", "0"))
+FORM = os.environ.get("N52_FORM", "f1").strip()
+TB = int(os.environ.get("N52_TB", "16"))
+_INSTALLED = False
+_SM = {}
+
+
+@cache_once
+def _module(lean: int = 0):
+    import flashinfer
+
+    data = os.path.join(os.path.dirname(flashinfer.__file__), "data")
+    return load_jit(
+        "n52_band",
+        str(int(lean)),
+        cuda_files=["inkling2/n52_band.cuh"],
+        cuda_wrappers=[("gate_up_band", "n52_band::gate_up_band"), ("gate_up_chunks", "n52_band::gate_up_chunks"),
+                       ("swiglu_quant_l5", "n52_band::swiglu_quant_l5")],
+        extra_include_paths=[f"{data}/cutlass/include", f"{data}/cutlass/tools/util/include"],
+        extra_cuda_cflags=["-DCUTLASS_ENABLE_GDC_FOR_SM100=1", "-DCUTE_SM90_EXTENDED_MMA_SHAPES_ENABLED",
+                           f"-DN52_LEAN={int(lean)}"],
+    )
+
+
+def _sm_count(device):
+    k = device.index if device.index is not None else torch.cuda.current_device()
+    if k not in _SM:
+        _SM[k] = torch.cuda.get_device_properties(k).multi_processor_count
+    return _SM[k]
+
+
+def gate_up_band(layer, values, scales, amax, gammas, offsets, mode=None, raster=None, d=None, lean=None):
+    """= image nvfp4_routed_swiglu_quantize(nvfp4_expert_matmul(values, scales, w13, ...), amax, ...) in one GEMM launch.
+    mode: 2 pass + discard, 3 pass only; timing twins: -1 no hook, 0 signal only, 1 discard only (outputs not written)."""
+    from sglang.kernels.ops.moe import inkling2_experts_sm120 as ex
+
+    w = layer.w13_weight
+    experts, n, kp = w.shape
+    rows = values.shape[0]
+    lean = LEAN if lean is None else int(lean)
+    if lean and (float(layer.gate_cap), float(layer.up_cap)) != (4.0, 25.0):
+        raise ValueError("n52 lean build is compiled for MLP softcaps (4, 25)")
+    qv, qs, qa = ex._nvfp4_outputs(rows=rows, width=n // 2, experts=experts, device=values.device)
+    if rows:
+        dev = values.device
+        if d is None:
+            d = torch.empty((rows, n), dtype=torch.bfloat16, device=dev)
+        counters = torch.zeros((rows + 127 * experts) // 128 + 1, dtype=torch.int32, device=dev)
+        iw = torch.empty(1 << 20, dtype=torch.uint8, device=dev)
+        fw = torch.empty(4 << 20, dtype=torch.uint8, device=dev)
+        _module(lean).gate_up_band(
+            values, w, scales, layer.w13_scale.view(torch.uint8).view(experts, n, kp // 8), offsets, amax,
+            layer.w13_amax, layer.w13_outer_scale_denominator, gammas, d, qv, qs, qa, counters, iw, fw,
+            float(layer.gate_cap), float(layer.up_cap), BAND if mode is None else mode,
+            RASTER if raster is None else raster, _sm_count(dev),
+        )
+    return qv, qs, qa
+
+
+def _lean_ok(layer, lean):
+    if lean and (float(layer.gate_cap), float(layer.up_cap)) != (4.0, 25.0):
+        raise ValueError("n52 lean build is compiled for MLP softcaps (4, 25)")
+
+
+def gate_up_chunks(layer, values, scales, amax, gammas, offsets, mode=2, raster=0, tb=None, lean=None):
+    """F2: = image nvfp4_routed_swiglu_quantize(nvfp4_expert_matmul(...)) by chunked GEMM launches + an L2 pass per chunk."""
+    from sglang.kernels.ops.moe import inkling2_experts_sm120 as ex
+
+    w = layer.w13_weight
+    experts, n, kp = w.shape
+    rows = values.shape[0]
+    lean = LEAN if lean is None else int(lean)
+    _lean_ok(layer, lean)
+    qv, qs, qa = ex._nvfp4_outputs(rows=rows, width=n // 2, experts=experts, device=values.device)
+    if rows:
+        dev = values.device
+        d = torch.empty((rows, n), dtype=torch.bfloat16, device=dev)
+        iw = torch.empty(8 << 20, dtype=torch.uint8, device=dev)
+        fw = torch.empty(4 << 20, dtype=torch.uint8, device=dev)
+        _module(lean).gate_up_chunks(
+            values, w, scales, layer.w13_scale.view(torch.uint8).view(experts, n, kp // 8), offsets, amax,
+            layer.w13_amax, layer.w13_outer_scale_denominator, gammas, d, qv, qs, qa, iw, fw,
+            float(layer.gate_cap), float(layer.up_cap), int(mode), int(raster), int(TB if tb is None else tb), _sm_count(dev),
+        )
+    return qv, qs, qa
+
+
+def swiglu_l5(layer, gate_up, amax, gammas, offsets, lean=None):
+    """L5 (lean 1) / C5 (lean 0): = image nvfp4_routed_swiglu_quantize(gate_up, amax, ...) by the n52 copy of its kernel."""
+    from sglang.kernels.ops.moe import inkling2_experts_sm120 as ex
+
+    lean = LEAN if lean is None else int(lean)
+    _lean_ok(layer, lean)
+    rows, width = gate_up.shape[0], gate_up.shape[1] // 2
+    qv, qs, qa = ex._nvfp4_outputs(rows=rows, width=width, experts=offsets.numel() - 1, device=gate_up.device)
+    if rows:
+        _module(lean).swiglu_quant_l5(
+            gate_up, amax, layer.w13_amax, layer.w13_outer_scale_denominator, gammas, qv, qs, qa, offsets,
+            float(layer.gate_cap), float(layer.up_cap), _sm_count(gate_up.device),
+        )
+    return qv, qs, qa
+
+
+def uses_band(layer, tokens):
+    from sglang.kernels.ops.gemm import inkling2_grouped_sm120 as grouped_sm120
+
+    return (
+        BAND in (2, 3)
+        and tokens >= MIN_TOKENS
+        and layer._routed_kernels == torch.uint8
+        and layer.w13_weight.shape[1] == 2304
+        and grouped_sm120._tiles(tokens=tokens, width=layer.w13_weight.shape[2] * 2) == (False, 128, 256)
+    )
+
+
+def forward_sm120(self, x, weights, ids, combine, mode=None, raster=None, lean=None, form=None, tb=None):
+    """S3's n14 forward_sm120(mode 'qc') on an NVFP4 layer with the gate_up GEMM + swiglu-quant replaced by the n52 form
+    (f1 gate_up_band, f2 gate_up_chunks, l5 the served GEMM + swiglu_l5)."""
+    from sglang.kernels.ops.gemm import inkling2_grouped_sm120 as grouped_sm120
+    from sglang.srt.models.inkling_common import n14_moe as N14
+    from sglang.srt.models.inkling_common.inkling2_moe import RoutedOutput
+
+    tokens, top_k = ids.shape
+    src2dst, dst2src, gammas, offsets = self._sm120_route(ids, weights)
+    x = x.contiguous()
+    values, scales, amax = N14.nvfp4_token_quantize(x, src2dst, top_k, offsets)
+    form = FORM if form is None else form
+    if form == "f2":
+        values, scales, amax = gate_up_chunks(self, values, scales, amax, gammas, offsets, mode=2 if mode is None else mode,
+                                              raster=0 if raster is None else raster, tb=tb, lean=lean)
+    elif form == "l5":
+        gate_up = grouped_sm120.nvfp4_expert_matmul(values=values, scales=scales, weight=self.w13_weight,
+                                                    weight_scales=self.w13_scale, offsets=offsets, tokens=tokens)
+        values, scales, amax = swiglu_l5(self, gate_up, amax, gammas, offsets, lean=lean)
+    else:
+        values, scales, amax = gate_up_band(self, values, scales, amax, gammas, offsets, mode=mode, raster=raster, lean=lean)
+    down = grouped_sm120.nvfp4_expert_matmul(
+        values=values, scales=scales, weight=self.w2_weight, weight_scales=self.w2_scale, offsets=offsets, tokens=tokens
+    )
+    out = N14.routed_partial_bf16(
+        down, offsets, src2dst, top_k, nvfp4_scales=(amax, self.w2_amax, self.w2_outer_scale_denominator)
+    )
+    return out if combine else RoutedOutput(out, None, 0)
+
+
+def install():
+    """Chain after n14's install (S3's inkling2_attn.py calls n14_moe.install() first): NVFP4 calls the band form takes go
+    to forward_sm120 above (n14 qc + the band GEMM); every other call goes to the method n14 installed."""
+    global _INSTALLED
+    if _INSTALLED:
+        return
+    _INSTALLED = True
+    if BAND not in (2, 3):
+        logger.warning("n52: N52_BAND %r, S3 MoE path", _B)
+        return
+    from sglang.srt.models.inkling_common import inkling2_moe as M
+
+    prev = M.Inkling2Experts._forward_sm120
+
+    def _forward_sm120(self, x, weights, ids, combine):
+        if x.dtype == torch.bfloat16 and uses_band(self, ids.shape[0]):
+            return forward_sm120(self, x, weights, ids, combine)
+        return prev(self, x, weights, ids, combine)
+
+    M.Inkling2Experts._forward_sm120 = _forward_sm120
+    logger.warning("n52: band gate_up on NVFP4 calls >= %d tokens (band %d, raster %s, lean %d)", MIN_TOKENS, BAND,
+                   "N" if RASTER else "M", LEAN)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64_attn_global.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64_attn_global.py
new file mode 100644
index 0000000000000000000000000000000000000000..1313f645818ea35cffc4c4d8cffa05ea7ea12fcf
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64_attn_global.py
@@ -0,0 +1,233 @@
+"""n64 (inkling2-spark attn seat): global-layer prefill attention as two kernels, bitwise equal to n54's served kernel.
+  kernel A = FlashAttentionForwardSm120BandOnly (fa4_sm120/n64a_fwd.py): n54's band-split kernel (n32 producer + n13 consumer)
+             on the first / causal-mask / bias-band key blocks, storing each thread's raw state (fragment order);
+  kernel B = FlashAttentionForwardSm120W8Far (fa4_sm120/n64b_fwd.py): 8 consumer warps (2 per SM sub-partition, setmaxnreg)
+             continuing that state over the far blocks with n54's far-loop arithmetic, then the served finalize + epilogue.
+Installed AFTER n32_attn_local (its wrapper stays the entry point for every other call). A global-layer call that n32 would
+run in-kernel (N32RelBias, window (-1, -1), n32.eligible) goes through A then B when SGLANG_INKLING_N64=1 and the KV span
+bound (page_table width x page size) is >= SGLANG_INKLING_N64_MIN_K; anything else is passed on unchanged.
+Workspace: stO fp32 (H, Tpad * 128) + stS fp32 (H, Tpad * 16), Tpad = tokens + 128 x sequences, allocated eagerly and
+reused; a call that needs more, or arrives inside a CUDA-graph capture without a big enough buffer, takes n54's path."""
+import logging
+import os
+
+import torch
+
+logger = logging.getLogger(__name__)
+MODE = os.environ.get("SGLANG_INKLING_N64", "0")  # "0" n54's path, "1" the pair, "check" = check boot (below)
+ENABLED = MODE in ("1", "check")
+# check (n64-p1 check boot, the n50 pattern): every eligible global call runs n54's served path into scratch, the pair into the
+# caller's out (RETURNED, so the boot's logprobs / KLD / smoke read the pair's numerics) and a failing control (kernel B with
+# the unbiased folded scale, its own compile key via a third dummy aux tensor) into scratch, and adds into a device counter:
+# [0] pair out words != served (both-NaN excluded), [1] calls, [2] out words compared, [3] control out words != served,
+# [4] pair LSE words != served, [5] real tokens, [6] control LSE words != served, [7] PADDED-row out words that differ
+# (reported only; real-row counters [0] [2] [3] [4] [6] mask rows >= cu_seqlens_q[-1]). Graph replays count too
+# (the counting ops are captured); the counter is copied to pinned host memory by a one-program Triton kernel each call and a
+# daemon thread prints "N64CHECK ..." to stderr every 10 s when it changed.
+MIN_K = int(os.environ.get("SGLANG_INKLING_N64_MIN_K", "0"))
+MAX_ROWS = int(os.environ.get("SGLANG_INKLING_N64_MAX_ROWS", "16384"))  # Tpad cap of the preallocated workspace
+PREALLOC_HEADS = int(os.environ.get("SGLANG_INKLING_N64_PREALLOC_HEADS", "0"))  # served: 24 (q heads per rank)
+PHASE = [None]  # None | "A" | "B": set around the two interface calls, read by the make_kernel / thread-count hooks
+STATS = {"pair": 0, "passed": 0, "built_a": 0, "built_b": 0, "too_big": 0}
+_WS = {}
+_INSTALLED = False
+_CHK = {}
+
+import triton  # noqa: E402
+import triton.language as tl  # noqa: E402
+
+
+@triton.jit
+def _n64_publish(Src, Dst, N: tl.constexpr):
+    # check mode: copy the device counter into pinned host memory (graph replays included), as n50's _n50_publish
+    i = tl.arange(0, N)
+    tl.store(Dst + i, tl.load(Src + i))
+
+
+def _check_init(device):
+    import sys
+    import threading
+    import time
+
+    _CHK["pub"] = _n64_publish
+    _CHK["count"] = torch.zeros(8, dtype=torch.int64, device=device)
+    _CHK["host"] = torch.zeros(8, dtype=torch.int64, pin_memory=True)
+    _CHK["dummy"] = torch.zeros(4, dtype=torch.int32, device=device)
+    _CHK["dummy"].__assumed_align__ = 16
+    _CHK["dummy"].__leading_dim__ = 0
+    print(f"N64CHECK init capturing={torch.cuda.is_current_stream_capturing()} pid={os.getpid()}", file=sys.stderr, flush=True)
+
+    def line(c):
+        return (f"N64CHECK words={c[0]} calls={c[1]} compared={c[2]} ctl_words={c[3]} lse_words={c[4]} tokens={c[5]}"
+                f" ctl_lse_words={c[6]} pad_words={c[7]} t={time.strftime('%H:%M:%S', time.gmtime())}")
+
+    _CHK["line"] = line
+
+    def report():
+        last = None
+        while True:
+            time.sleep(10)
+            c = _CHK["host"].tolist()
+            if c != last:
+                print(line(c), file=sys.stderr, flush=True)
+                last = c
+
+    threading.Thread(target=report, daemon=True, name="n64check").start()
+
+
+def _words_ne(a, b):
+    return (a.contiguous().view(torch.int32) != b.contiguous().view(torch.int32)).sum()
+
+
+def _workspace(h, rows, device):
+    key = (str(device), h)
+    ws = _WS.get(key)
+    if ws is None or ws[0] < rows:
+        if torch.cuda.is_current_stream_capturing() or rows > MAX_ROWS:
+            return None
+        cap = max(rows, MAX_ROWS)
+        st_o = torch.empty(h, cap * 128, dtype=torch.float32, device=device)
+        st_s = torch.empty(h, cap * 16, dtype=torch.float32, device=device)
+        ws = _WS[key] = (cap, st_o, st_s)
+    st_o, st_s = ws[1], ws[2]
+    for t in (st_o, st_s):
+        t.__assumed_align__ = 16
+        t.__leading_dim__ = 1
+    return st_o, st_s
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED:
+        return
+    from sglang.kernels.ops.attention.fa4_sm120 import runtime as _rt
+    from sglang.kernels.ops.attention.fa4_sm120 import flash_fwd as _ff
+    from sglang.kernels.ops.attention.fa4_sm120.n64a_fwd import FlashAttentionForwardSm120BandOnly
+    from sglang.kernels.ops.attention.fa4_sm120.n64b_fwd import FlashAttentionForwardSm120W8Far
+    from sglang.kernels.ops.attention.flash_attn.cute import interface as _itf
+    from sglang.srt.models.inkling_common import n32_attn_local as _h32
+
+    prev_mk = _rt.Sm120ForwardPolicy.make_kernel
+
+    def make_kernel(**kw):
+        k = prev_mk(**kw)
+        if PHASE[0] == "A" and type(k).__name__ == "FlashAttentionForwardSm120BandSplitRelProd":
+            k.__class__ = FlashAttentionForwardSm120BandOnly
+            STATS["built_a"] += 1
+            logger.warning("n64: kernel A (band part + state store) built, tile %s x %s", k.tile_m, k.tile_n)
+        elif (PHASE[0] in ("B", "Bctl") and type(k) is _ff.FlashAttentionForwardSm120 and not k.has_bias
+              and (k.tile_m, k.tile_n, k.num_threads) == (128, 128, 256)):
+            k.__class__ = FlashAttentionForwardSm120W8Far
+            STATS["built_b"] += 1
+            logger.warning("n64: kernel B (W8 far part, 8 consumer warps) built")
+        return k
+
+    _rt.Sm120ForwardPolicy.make_kernel = staticmethod(make_kernel)
+    prev_nt = _ff.FlashAttentionForwardSm120.get_fwd_num_threads
+
+    def get_fwd_num_threads(head_dim, head_dim_v, tile_m, tile_n, paged_kv=False):
+        if PHASE[0] in ("B", "Bctl") and (head_dim, head_dim_v, tile_m, tile_n) == (128, 128, 128, 128):
+            return 256
+        return prev_nt(head_dim, head_dim_v, tile_m, tile_n, paged_kv=paged_kv)
+
+    _ff.FlashAttentionForwardSm120.get_fwd_num_threads = staticmethod(get_fwd_num_threads)
+    prev_fwd = _itf._flash_attn_fwd
+
+    def _flash_attn_fwd(q, k, v, *args, **kw):
+        rb = kw.get("rel_bias")
+        if (ENABLED and not args and isinstance(rb, _h32.N32RelBias) and _h32.GLOBAL
+                and kw.get("window_size_left") in (None, -1) and kw.get("window_size_right") in (None, -1)
+                and _h32.eligible(q, k, v, kw, rb)
+                and k.shape[1] * kw["page_table"].shape[1] >= MIN_K):
+            p32 = _h32._p32(rb.mod.proj)
+            nseq = kw["cu_seqlens_q"].shape[0] - 1
+            ws = _workspace(q.shape[1], q.shape[0] + 128 * nseq, q.device) if p32 is not None else None
+            if ws is not None:
+                st_o, st_s = ws
+                tpad = -(-q.shape[0] // 64) * 64
+                e_pad = rb.mod.proj.shape[1] + 256
+                dkey = (str(q.device), e_pad)
+                base = _h32._BASE.get(dkey)
+                if base is None:
+                    base = _h32._BASE[dkey] = torch.empty(e_pad, dtype=torch.bfloat16, device=q.device)
+                kw_a = dict(kw)
+                kw_a["rel_bias"] = base.as_strided((tpad, q.shape[1], e_pad), (0, 0, 1))
+                kw_a["rel_bias_presheared"] = True
+                kw_a["rel_bias_prep_cache"] = None
+                kw_a["aux_tensors"] = [_h32._r32(rb.r), p32, st_o, st_s]
+                kw_b = {x: y for x, y in kw.items() if x not in ("rel_bias", "rel_bias_presheared", "rel_bias_prep_cache")}
+                kw_b["tile_mn"] = (128, 128)
+                kw_b["aux_tensors"] = [st_o, st_s]
+                STATS["pair"] += 1
+                if STATS["pair"] <= 2:
+                    logger.warning("n64: global call %d through kernels A + B, tokens %d", STATS["pair"], q.shape[0])
+                if MODE == "check":
+                    if not _CHK:
+                        _check_init(q.device)
+                    kw_ref = dict(kw)
+                    kw_ref["out"] = torch.empty_like(kw["out"]) if kw.get("out") is not None else None
+                    if kw.get("lse") is not None:  # never share a caller lse buffer with the reference or the control
+                        kw_ref["lse"] = torch.empty_like(kw["lse"])
+                    ref = prev_fwd(q, k, v, **kw_ref)  # n54's served path (n32 wrapper), scratch out
+                PHASE[0] = "A"
+                try:
+                    prev_fwd(q, k, v, **kw_a)
+                finally:
+                    PHASE[0] = None
+                PHASE[0] = "B"
+                try:
+                    res = prev_fwd(q, k, v, **kw_b)
+                finally:
+                    PHASE[0] = None
+                if MODE == "check":
+                    from sglang.kernels.ops.attention.fa4_sm120 import n64b_fwd as _nb
+
+                    kw_c = dict(kw_b)
+                    kw_c["out"] = torch.empty_like(kw["out"]) if kw.get("out") is not None else None
+                    if kw.get("lse") is not None:
+                        kw_c["lse"] = torch.empty_like(kw["lse"])
+                    kw_c["aux_tensors"] = [st_o, st_s, _CHK["dummy"]]
+                    PHASE[0] = "Bctl"
+                    _nb.N64_FAR = False  # read at trace time only: the control compiles under its own key (3 aux tensors)
+                    try:
+                        ctl = prev_fwd(q, k, v, **kw_c)
+                    finally:
+                        PHASE[0] = None
+                        _nb.N64_FAR = True
+                    c = _CHK["count"]
+                    o, ro, co = res[0], ref[0], ctl[0]
+                    # real rows only: graph-bucket padding rows (>= cu_seqlens_q[-1]) are written by neither kernel, so the
+                    # caller's buffer and a fresh scratch differ there (check boot 1: every mismatch was such a row)
+                    real = torch.arange(o.shape[0], device=o.device) < kw["cu_seqlens_q"][-1]
+                    rmask = real.view(-1, *([1] * (o.dim() - 1)))
+                    both = torch.isnan(o) & torch.isnan(ro)
+                    ne = (o.view(torch.int32) != ro.view(torch.int32)) & ~both
+                    c[0] += (ne & rmask).sum()
+                    c[1] += 1
+                    c[2] += (rmask.expand_as(o)).sum()
+                    c[3] += ((co.view(torch.int32) != ro.view(torch.int32)) & rmask).sum()
+                    if res[1] is not None and ref[1] is not None:
+                        lmask = real.view(1, -1) if res[1].shape[-1] == o.shape[0] else real.view(-1, 1)
+                        c[4] += ((res[1].view(torch.int32) != ref[1].view(torch.int32)) & lmask).sum()
+                        c[6] += ((ctl[1].view(torch.int32) != ref[1].view(torch.int32)) & lmask).sum()
+                    c[5] += real.sum()
+                    c[7] += (ne & ~rmask).sum()  # padded-row out words that differ (reported, not a bar)
+                    _CHK["pub"][(1,)](c, _CHK["host"], 8)
+                return res
+            STATS["too_big"] += 1
+            if STATS["too_big"] <= 4:
+                logger.warning("n64: global call kept n54's path (workspace %s, capturing %s, tokens %d)", "none" if ws is None else "ok",
+                               torch.cuda.is_current_stream_capturing(), q.shape[0])
+        STATS["passed"] += 1
+        return prev_fwd(q, k, v, *args, **kw)
+
+    _flash_attn_fwd.__dict__ = prev_fwd.__dict__
+    _itf._flash_attn_fwd = _flash_attn_fwd
+    _INSTALLED = True
+    if ENABLED and PREALLOC_HEADS > 0 and torch.cuda.is_available():
+        # served: allocate before any CUDA-graph capture (prefill chunks <= 8K tokens replay captured graphs, and a capture
+        # never allocates the workspace), so captured chunks run the pair
+        ws = _workspace(PREALLOC_HEADS, MAX_ROWS, torch.device("cuda", torch.cuda.current_device()))
+        logger.warning("n64: workspace preallocated (%d heads x %d rows: %.0f MB)", PREALLOC_HEADS, MAX_ROWS,
+                       0 if ws is None else (ws[0].numel() + ws[1].numel()) * 4 / 2**20)
+    logger.warning("n64: two-kernel global attention hook installed (mode=%s, min_k=%d)", MODE, MIN_K)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64a_fwd.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64a_fwd.py
new file mode 100644
index 0000000000000000000000000000000000000000..77ad21202f0b9bc227d2c84ca4eefe734f0baf29
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64a_fwd.py
@@ -0,0 +1,1138 @@
+# Generated by work_attn/gen/gen_n64a.py from n54's fa4_sm120/n32_fwd.py (md5 115d2333) and n13_fwd.py (md5 18257a9c).
+"""Generate n64a_fwd.py (fa4_sm120/n64a_fwd.py) = n64 exact far form, KERNEL A, from n54's served global-layer kernel files:
+n32_fwd.py (md5 115d2333, FlashAttentionForwardSm120BandSplitRelProd: n32 in-kernel bias producer) and n13_fwd.py (md5
+18257a9c, n13's band-split consumer mma).
+
+FlashAttentionForwardSm120BandOnly: n54's global-layer prefill kernel (64-row CTAs, 4 consumer warps + the n32 producer
+warp) running the first, causal-mask and bias-band key blocks exactly as served, then, instead of n13's far loop and the
+finalize / epilogue, storing each consumer thread's raw state for kernel B (n64b_fwd.py) in fragment order:
+stO (H, Tpad * 128): lane l of the 16-row group starting at padded row grow = offset_q + 128 x batch + 64 m_block + 16 w
+holds its 64 acc_O values at grow * 128 + 64 l; stS (H, Tpad * 16): (row_max[0..1], lane-partial row_sum[0..1]) at
+grow * 16 + 4 l and n_far_top at grow * 16 + 128. The out / LSE tensors are written by kernel B only.
+Patches (asserted string replacements): __call__ (n32's: 4 aux tensors, keeps [stO, stS] in aux_data), load_paged_persistent
+(n32's: loads only blocks n_block_max - 1 .. n_far_top, the consumer's count), mma (n13's: no far loop, state store
+instead of finalize + epilogue)."""
+from sglang.kernels.ops.attention.fa4_sm120 import n13_fwd as _n13
+from sglang.kernels.ops.attention.fa4_sm120 import n32_fwd as _n32
+globals().update({k: v for k, v in vars(_n13).items() if not k.startswith("__")})
+globals().update({k: v for k, v in vars(_n32).items() if not k.startswith("__")})
+from sglang.kernels.ops.attention.fa4_sm120.n32_fwd import FlashAttentionForwardSm120BandSplitRelProd  # noqa: E402
+import operator  # noqa: E402
+
+N64A_CTL = 0  # 1 = failing control for the bitwise checks (quad-reduced row sums stored); never ship
+
+
+class FlashAttentionForwardSm120BandOnly(FlashAttentionForwardSm120BandSplitRelProd):
+    """n64 kernel A: n54's global-layer kernel without the far blocks; stores the raw state for kernel B."""
+
+    @cute.jit
+    def n64_far_top(self, block_info, seqlen, m_block, n_block_min, n_block_max, num_bias_loads):
+        """n13's n_far_top (first block n_block_max - 1, then the causal-mask loop, then the band loop down to n_far_top)."""
+        n_block_upper = cutlass.max(n_block_max - 1, 0)
+        if const_expr(self.is_causal or self.is_local):
+            n_block_upper = cutlass.min(
+                n_block_upper, block_info.get_n_block_min_causal_local_mask(seqlen, m_block, n_block_min)
+            )
+        return cutlass.max(
+            cutlass.min(n_block_upper, n_block_max - num_bias_loads),
+            block_info.get_n_block_min_before_local_mask(seqlen, m_block, n_block_min),
+        )
+
+    # ---- copied from n54's n32_fwd.py / n13_fwd.py and patched (gen_n64a.py) ----
+    @cute.jit
+    def __call__(
+        self,
+        mQ: cute.Tensor,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        softmax_scale: Float32,
+        mCuSeqlensQ: Optional[cute.Tensor] = None,
+        mCuSeqlensK: Optional[cute.Tensor] = None,
+        mSeqUsedQ: Optional[cute.Tensor] = None,
+        mSeqUsedK: Optional[cute.Tensor] = None,
+        mPageTable: Optional[cute.Tensor] = None,
+        window_size_left: Int32 | int | None = None,
+        window_size_right: Int32 | int | None = None,
+        learnable_sink: Optional[cute.Tensor] = None,
+        blocksparse_tensors: Optional[BlockSparseTensors] = None,
+        aux_data: AuxData = AuxData(),
+        mBias: Optional[cute.Tensor] = None,
+        launch_split_combine_early: Int32 = Int32(0),
+        stream: cuda.CUstream = None,
+    ):
+        assert blocksparse_tensors is None, "Block sparsity is not supported on SM120"
+        assert (mBias is not None) == self.has_bias
+        # n32: mBias is a zero-stride stand-in (the presheared-shape argument the interface requires); the kernel reads
+        # r (int32 pairs [T, H, 8]) and proj^T (int32 pairs [E, 8]) from aux_data and builds the sheared tile itself.
+        assert self.has_bias and self.paged_kv and not self.pack_gqa
+        assert not self._uses_split_pv_warps()
+        # n32: row-independent hi - row needs n_idx_right = m_idx + 1 + delta (+ wr): local with a right window, or causal
+        assert (self.is_local and window_size_right is not None) or (self.is_causal and not self.is_local)
+        # n64 kernel A: aux tensors = [r32, proj^T, stO, stS]; the state tensors stay in aux_data for mma
+        assert aux_data.tensors is not None and len(aux_data.tensors) == 4
+        n32_r32, n32_p32 = aux_data.tensors[0], aux_data.tensors[1]
+        aux_data = AuxData(tuple(aux_data.tensors[2:]))
+        mBias = None
+        assert mPageTable is None or self.paged_kv, (
+            "SM120 paged KV requires the dedicated DMA-warp specialization"
+        )
+        self._check_type(
+            *(
+                t.element_type if t is not None else None
+                for t in (
+                    mQ,
+                    mK,
+                    mV,
+                    mO,
+                    mLSE,
+                    mCuSeqlensQ,
+                    mCuSeqlensK,
+                    mSeqUsedQ,
+                    mSeqUsedK,
+                )
+            )
+        )
+        tiled_mma_qk, tiled_mma_pv = self._get_tiled_mma()
+        self.num_qk_threads = tiled_mma_qk.size
+        self.num_mma_threads = tiled_mma_pv.size
+        self.num_producer_threads = self.num_threads
+        self.num_Q_load_threads = (
+            self.num_qk_threads if self._uses_split_pv_warps() else self.num_threads
+        )
+        self.num_epilogue_threads = (
+            self.num_mma_threads if self._uses_split_pv_warps() else self.num_threads
+        )
+        self.use_tma_O = False
+        self._setup_attributes()
+        SharedStorage = self._get_shared_storage_cls()
+
+        mQ, mK, mV, mO = [assume_tensor_aligned(t) for t in (mQ, mK, mV, mO)]
+        if const_expr(mBias is not None):
+            assert mBias.element_type == self.dtype
+            mBias = assume_tensor_aligned(mBias)
+        Q_layout_transpose = (
+            [1, 3, 2, 0] if const_expr(mCuSeqlensQ is None) else [0, 2, 1]
+        )
+        KV_layout_transpose = (
+            [1, 3, 2, 0] if const_expr(mCuSeqlensK is None) else [0, 2, 1]
+        )
+        mQ = cute.make_tensor(
+            mQ.iterator, cute.select(mQ.layout, mode=Q_layout_transpose)
+        )
+        if const_expr(mBias is not None):
+            mBias = cute.make_tensor(
+                mBias.iterator,
+                cute.select(mBias.layout, mode=Q_layout_transpose),
+            )
+        mK, mV = [
+            cute.make_tensor(
+                t.iterator, cute.select(t.layout, mode=KV_layout_transpose)
+            )
+            for t in (mK, mV)
+        ]
+        if const_expr(mPageTable is None):
+            V_layout_transpose = (
+                [1, 0, 2, 3] if const_expr(mCuSeqlensK is None) else [1, 0, 2]
+            )
+            mV = cute.make_tensor(
+                mV.iterator, cute.select(mV.layout, mode=V_layout_transpose)
+            )
+        if const_expr(self.is_split_kv):
+            num_splits = mO.shape[0]
+            O_layout_transpose = (
+                [2, 4, 3, 1, 0] if const_expr(mCuSeqlensQ is None) else [1, 3, 2, 0]
+            )
+            LSE_layout_transpose = (
+                [3, 2, 1, 0] if const_expr(mCuSeqlensQ is None) else [2, 1, 0]
+            )
+        else:
+            num_splits = Int32(1)
+            O_layout_transpose = (
+                [1, 3, 2, 0] if const_expr(mCuSeqlensQ is None) else [0, 2, 1]
+            )
+            LSE_layout_transpose = (
+                [2, 1, 0] if const_expr(mCuSeqlensQ is None) else [1, 0]
+            )
+        mO = cute.make_tensor(
+            mO.iterator, cute.select(mO.layout, mode=O_layout_transpose)
+        )
+        if const_expr(mLSE is not None):
+            mLSE = cute.make_tensor(
+                mLSE.iterator, cute.select(mLSE.layout, mode=LSE_layout_transpose)
+            )
+        if const_expr(self.pack_gqa):
+            nheads_kv = mK.shape[2]
+            mQ = pack_gqa_layout(mQ, self.qhead_per_kvhead, nheads_kv, head_idx=2)
+            mO = pack_gqa_layout(mO, self.qhead_per_kvhead, nheads_kv, head_idx=2)
+            if const_expr(mLSE is not None):
+                mLSE = pack_gqa_layout(
+                    mLSE, self.qhead_per_kvhead, nheads_kv, head_idx=1
+                )
+            if const_expr(mBias is not None):
+                mBias = pack_gqa_layout(
+                    mBias, self.qhead_per_kvhead, nheads_kv, head_idx=2
+                )
+
+        if const_expr(mPageTable is None or self.paged_tma):
+            tma_copy_op = cpasync.CopyBulkTensorTileG2SOp()
+            mV_tma = (
+                mV
+                if const_expr(mPageTable is None)
+                else cute.make_tensor(
+                    mV.iterator,
+                    cute.select(mV.layout, mode=[1, 0, 2, 3]),
+                )
+            )
+            tma_atom_K, tma_tensor_K = cpasync.make_tiled_tma_atom(
+                tma_copy_op,
+                mK,
+                cute.select(self.sK_layout, mode=[0, 1]),
+                (self.tile_n, self.tile_hdim),
+                1,
+            )
+            tma_atom_V, tma_tensor_V = cpasync.make_tiled_tma_atom(
+                tma_copy_op,
+                mV_tma,
+                cute.select(self.sV_layout, mode=[0, 1]),
+                (self.tile_hdimv, self.tile_n),
+                1,
+            )
+            self.tma_copy_bytes_K = cute.size_in_bytes(
+                mK.element_type, cute.select(self.sK_layout, mode=[0, 1])
+            )
+            self.tma_copy_bytes_V = cute.size_in_bytes(
+                mV_tma.element_type,
+                cute.select(self.sV_layout, mode=[0, 1]),
+            )
+        else:
+            tma_atom_K = None
+            tma_atom_V = None
+            tma_tensor_K = mK
+            tma_tensor_V = mV
+        # n32: no bias TMA; the kernel's mBias / tma_atom_Bias slots carry r32 / p32.
+        tma_tensor_Bias = n32_r32
+        tma_atom_Bias = n32_p32
+
+        is_varlen = const_expr(mCuSeqlensQ is not None or mSeqUsedQ is not None)
+        num_batch = (
+            mCuSeqlensQ.shape[0] - 1
+            if const_expr(mCuSeqlensQ is not None)
+            else cute.size(mQ.shape[3])
+        )
+        TileScheduler = (
+            Sm120UniformBatchScheduler
+            if is_varlen and self.direct_uniform_batch
+            else SingleTileVarlenScheduler
+            if is_varlen
+            else SingleTileScheduler
+        )
+        tile_sched_args = TileSchedulerArguments(
+            num_block=cute.ceil_div(cute.size(mQ.shape[0]), self.tile_m),
+            num_head=cute.size(mQ.shape[2]),
+            num_batch=num_batch,
+            num_splits=num_splits,
+            seqlen_k=0,
+            headdim=mQ.shape[1],
+            headdim_v=mO.shape[1],
+            total_q=(
+                cute.size(mQ.shape[0])
+                if const_expr(mCuSeqlensQ is not None)
+                else cute.size(mQ.shape[0]) * cute.size(mQ.shape[3])
+            ),
+            tile_shape_mn=(self.tile_m, self.tile_n),
+            lpt=(self.is_causal or self.is_local) and not self.direct_uniform_batch,
+            qhead_per_kvhead_packgqa=(
+                self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+            ),
+            mCuSeqlensQ=mCuSeqlensQ,
+            mSeqUsedQ=mSeqUsedQ,
+            is_persistent=False,
+            is_split_kv=self.is_split_kv,
+        )
+        tile_sched_params = TileScheduler.to_underlying_arguments(
+            tile_sched_args,
+            scheduling_mode=SchedulingMode.STATIC,
+        )
+        grid_dim = TileScheduler.get_grid_shape(tile_sched_params)
+        if const_expr(self.has_bias):
+            base_softmax_scale = softmax_scale
+            softmax_scale_log2, softmax_scale = utils.LOG2_E, None
+        else:
+            base_softmax_scale = None
+            softmax_scale_log2, softmax_scale = utils.compute_softmax_scale_log2(
+                softmax_scale, self.score_mod
+            )
+        window_size_left = (
+            Int32(window_size_left) if window_size_left is not None else None
+        )
+        window_size_right = (
+            Int32(window_size_right) if window_size_right is not None else None
+        )
+        fastdiv_mods = utils.compute_fastdiv_mods(
+            mQ,
+            mK,
+            self.qhead_per_kvhead,
+            self.pack_gqa,
+            aux_data.tensors,
+            mPageTable,
+        )
+
+        self.kernel(
+            mQ,
+            tma_tensor_K,
+            tma_tensor_V,
+            mO,
+            mLSE,
+            mCuSeqlensQ,
+            mCuSeqlensK,
+            mSeqUsedQ,
+            mSeqUsedK,
+            mPageTable,
+            tma_tensor_Bias,
+            tma_atom_K,
+            tma_atom_V,
+            tma_atom_Bias,
+            softmax_scale_log2,
+            softmax_scale,
+            base_softmax_scale,
+            window_size_left,
+            window_size_right,
+            learnable_sink,
+            self.sQ_layout,
+            self.sK_layout,
+            self.sV_layout,
+            self.sO_layout,
+            self.sP_layout,
+            self.sBias_layout,
+            self.gmem_tiled_copy_Q,
+            self.gmem_tiled_copy_O,
+            tiled_mma_qk,
+            tiled_mma_pv,
+            SharedStorage,
+            tile_sched_params,
+            TileScheduler,
+            launch_split_combine_early,
+            aux_data,
+            fastdiv_mods,
+        ).launch(
+            grid=grid_dim,
+            block=[self.num_threads + self._num_dma_threads(), 1, 1],
+            smem=SharedStorage.size_in_bytes(),
+            stream=stream,
+            min_blocks_per_mp=1,
+            # The immediately preceding ShearingBias grid releases this
+            # dependent launch before all of its CTAs have retired. Bias
+            # readers synchronize before their first TMA issue below; the
+            # remaining kernel prologue can overlap the tail of the shear.
+            use_pdl=False,  # n32: no shear grid precedes this kernel
+        )
+
+    @cute.jit
+    def load_paged_persistent(
+        self,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mPageTable: cute.Tensor,
+        tma_atom_K: Optional[cute.CopyAtom],
+        tma_atom_V: Optional[cute.CopyAtom],
+        sK: cute.Tensor,
+        sV: cute.Tensor,
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        tile_scheduler: TileSchedulerProtocol,
+        mQ: cute.Tensor,
+        mCuSeqlensQ: Optional[cute.Tensor],
+        mSeqUsedQ: Optional[cute.Tensor],
+        mSeqUsedK: Optional[cute.Tensor],
+        window_size_left: Optional[Int32],
+        window_size_right: Optional[Int32],
+        tidx: Int32,
+        mBias: Optional[cute.Tensor] = None,
+        sBias: Optional[cute.Tensor] = None,
+        tma_atom_Bias: Optional[cute.Tensor] = None,  # n32: proj^T int32 pairs; mBias = r int32 pairs
+        pipeline_bias: Optional[PipelineAsync] = None,
+    ):
+        producer_state_k = PipelineState(
+            self._num_k_stages(), Int32(0), Int32(0), Int32(1)
+        )
+        producer_state_v = PipelineState(
+            self._num_v_stages(), Int32(0), Int32(0), Int32(1)
+        )
+        block_info = BlockInfo(
+            self.tile_m,
+            self.tile_n,
+            self.is_causal,
+            self.is_local,
+            self.is_split_kv,
+            window_size_left,
+            window_size_right,
+            qhead_per_kvhead_packgqa=(
+                self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+            ),
+        )
+        work_tile = tile_scheduler.initial_work_tile_info()
+        m_block, head_idx, batch_idx, split_idx = work_tile.tile_idx
+        seqlen = SeqlenInfoQK.create(
+            batch_idx=batch_idx,
+            seqlen_q_static=(
+                mQ.shape[0] if const_expr(not self.pack_gqa) else mQ.shape[0][1]
+            ),
+            seqlen_k_static=mK.shape[0] * mPageTable.shape[1],
+            mCuSeqlensQ=mCuSeqlensQ,
+            mCuSeqlensK=None,
+            mSeqUsedQ=mSeqUsedQ,
+            mSeqUsedK=mSeqUsedK,
+            tile_m=self.tile_m,
+            tile_n=self.tile_n,
+        )
+        n_block_min, n_block_max = self._get_n_block_min_max(
+            block_info,
+            seqlen,
+            m_block,
+            split_idx,
+            tile_scheduler.params.num_splits,
+        )
+        head_idx_kv = (
+            head_idx if const_expr(self.pack_gqa) else head_idx // self.qhead_per_kvhead
+        )
+        bias_max_idx, num_bias_loads = Int32(0), Int32(0)
+        if const_expr(self.has_bias):
+            bias_max_idx, num_bias_loads = self._get_bias_load_info(
+                block_info,
+                seqlen,
+                m_block,
+                n_block_min,
+                n_block_max,
+            )
+            # n32: per-lane A fragments of r for the tile's rows and the rows' visible key bounds.
+            n32_ra, n32_lo, n32_hi = self.n32_tile_setup(
+                mBias, block_info, seqlen, m_block, head_idx, tidx
+            )
+            if const_expr(self.is_local):
+                n32_pmax = cutlass.min(
+                    window_size_left + window_size_right, self.n32_extent - 1
+                )
+            else:
+                n32_pmax = Int32(self.n32_extent - 1)
+        assert not self.paged_tma  # n32: page-TMA path not built
+        if const_expr(self.paged_tma):
+            mK_cur = mK[None, None, head_idx_kv, None]
+            mV_cur = mV[None, None, head_idx_kv, None]
+            gK = cute.local_tile(
+                mK_cur,
+                (self.tile_n, self.tile_hdim),
+                (0, 0, None),
+            )
+            gV = cute.local_tile(
+                mV_cur,
+                (self.tile_hdimv, self.tile_n),
+                (0, 0, None),
+            )
+            copy_K, _, _ = copy_utils.tma_get_copy_fn(
+                tma_atom_K,
+                0,
+                cute.make_layout(1),
+                gK,
+                sK,
+            )
+            copy_V, _, _ = copy_utils.tma_get_copy_fn(
+                tma_atom_V,
+                0,
+                cute.make_layout(1),
+                gV,
+                sV,
+            )
+            num_n_blocks = cutlass.max(n_block_max - n_block_min, 1)
+            for n_tile in cutlass.range(num_n_blocks, unroll=1):
+                n_block = cutlass.max(n_block_max - 1 - n_tile, n_block_min)
+                page_idx = mPageTable[batch_idx, n_block]
+
+                if const_expr(self.has_bias):
+                    if n_tile < num_bias_loads:
+                        pipeline_bias.producer_acquire(producer_state_k)
+                        cute.copy(
+                            tma_atom_Bias,
+                            tBgBias[None, m_block, bias_max_idx - n_tile],
+                            tBsBias[None, producer_state_k.index],
+                            tma_bar_ptr=pipeline_bias.producer_get_barrier(
+                                producer_state_k
+                            ),
+                        )
+                        pipeline_bias.producer_commit(producer_state_k)
+                pipeline_k.producer_acquire(producer_state_k)
+                copy_K(
+                    src_idx=page_idx,
+                    dst_idx=producer_state_k.index,
+                    tma_bar_ptr=pipeline_k.producer_get_barrier(producer_state_k),
+                )
+                pipeline_k.producer_commit(producer_state_k)
+                producer_state_k.advance()
+
+                pipeline_v.producer_acquire(producer_state_v)
+                copy_V(
+                    src_idx=page_idx,
+                    dst_idx=producer_state_v.index,
+                    tma_bar_ptr=pipeline_v.producer_get_barrier(producer_state_v),
+                )
+                pipeline_v.producer_commit(producer_state_v)
+                producer_state_v.advance()
+
+            pipeline_k.producer_tail(producer_state_k)
+            pipeline_v.producer_tail(producer_state_v)
+            return
+
+        paged_kv_manager = Sm120PagedKVManager.create(
+            mPageTable,
+            mK,
+            mV,
+            FastDivmodDivisor(mK.shape[0]),
+            batch_idx,
+            head_idx_kv,
+            tidx,
+            seqlen.seqlen_k,
+            0,
+            self.tile_n,
+            self.tile_hdim,
+            self.tile_hdimv,
+            self.num_dma_threads,
+            mK.element_type,
+        )
+        # n64 kernel A: only the first / causal-mask / bias-band blocks (the consumer's count); far blocks are kernel B's
+        num_n_blocks = cutlass.max(
+            n_block_max - self.n64_far_top(block_info, seqlen, m_block, n_block_min, n_block_max, num_bias_loads), 1
+        )
+        for n_tile in cutlass.range(num_n_blocks, unroll=1):
+            n_block = cutlass.max(n_block_max - 1 - n_tile, n_block_min)
+            paged_kv_manager.load_page_table(n_block)
+
+            pipeline_k.producer_acquire(producer_state_k)
+            paged_kv_manager.load_KV(
+                n_block,
+                sK[None, None, producer_state_k.index],
+                "K",
+            )
+            cute.arch.cp_async_commit_group()
+            pipeline_k.producer_commit(producer_state_k)
+            if const_expr(self.has_bias):
+                # n32: the sheared bias tile of key block n_block (the served TMA source block bias_max_idx - n_tile
+                # holds keys n_block * tile_n + col), computed while K is in flight; same pipeline state as the TMA.
+                if n_tile < num_bias_loads:
+                    pipeline_bias.producer_acquire(producer_state_k)
+                    self.n32_bias_tile(
+                        sBias[None, None, producer_state_k.index],
+                        tma_atom_Bias,
+                        n32_ra,
+                        n32_lo,
+                        n32_hi,
+                        n32_pmax,
+                        n_block,
+                        seqlen,
+                        m_block,
+                        tidx,
+                    )
+                    pipeline_bias.producer_commit(producer_state_k)
+            producer_state_k.advance()
+
+            pipeline_v.producer_acquire(producer_state_v)
+            sV_stage = layout_utils.transpose_view(
+                sV[None, None, producer_state_v.index]
+            )
+            paged_kv_manager.load_KV(n_block, sV_stage, "V")
+            cute.arch.cp_async_commit_group()
+            pipeline_v.producer_commit(producer_state_v)
+            producer_state_v.advance()
+
+        pipeline_k.producer_tail(producer_state_k)
+        pipeline_v.producer_tail(producer_state_v)
+
+    @cute.jit
+    def mma(
+        self,
+        mQ: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        sQ: cute.Tensor,
+        sK: cute.Tensor,
+        sV: cute.Tensor,
+        sO: cute.Tensor,
+        sP: Optional[cute.Tensor],
+        sRowScale: Optional[cute.Tensor],
+        sLSE: Optional[cute.Tensor],
+        learnable_sink: Optional[cute.Tensor],
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        gmem_tiled_copy_Q: cute.TiledCopy,
+        gmem_tiled_copy_O: cute.TiledCopy,
+        tiled_mma_qk: cute.TiledMma,
+        tiled_mma_pv: cute.TiledMma,
+        tidx: Int32,
+        softmax_scale_log2: Float32,
+        softmax_scale: Optional[Float32],
+        consumer_state: PipelineState,
+        block_info: BlockInfo,
+        seqlen: SeqlenInfoQK,
+        n_block_min: Int32,
+        n_block_max: Int32,
+        m_block: Int32,
+        head_idx: Int32,
+        batch_idx: Int32,
+        split_idx: Int32,
+        is_qk_owner: cutlass.Constexpr[bool],
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+        sBias: Optional[cute.Tensor] = None,
+        pipeline_bias: Optional[PipelineAsync] = None,
+        base_softmax_scale: Optional[Float32] = None,
+    ):
+        mQ_cur = seqlen.offset_batch_Q(mQ, batch_idx, dim=3)[None, None, head_idx]
+        if const_expr(not self.pack_gqa):
+            gQ = cute.local_tile(mQ_cur, (self.tile_m, self.tile_hdim), (m_block, 0))
+        num_bias_loads = Int32(0)
+        if const_expr(self.has_bias):
+            _, num_bias_loads = self._get_bias_load_info(
+                block_info,
+                seqlen,
+                m_block,
+                n_block_min,
+                n_block_max,
+            )
+
+        split_pv_warps = self._uses_split_pv_warps()
+        thr_mma_pv = tiled_mma_pv.get_slice(tidx)
+        acc_shape_O = thr_mma_pv.partition_shape_C((self.tile_m, self.tile_hdimv))
+        acc_O = cute.make_rmem_tensor(acc_shape_O, Float32)
+        acc_O.fill(0.0)
+
+        smem_copy_atom_QK = cute.make_copy_atom(
+            warp.LdMatrix8x8x16bOp(transpose=False, num_matrices=4), self.dtype
+        )
+        smem_copy_atom_V = cute.make_copy_atom(
+            warp.LdMatrix8x8x16bOp(transpose=True, num_matrices=4), self.dtype
+        )
+        smem_thr_copy_V = utils.make_tiled_copy_B(
+            smem_copy_atom_V, tiled_mma_pv
+        ).get_slice(tidx)
+        if const_expr(split_pv_warps):
+            tOrV = thr_mma_pv.make_fragment_B(thr_mma_pv.partition_B(sV[None, None, 0]))
+            tOsV = smem_thr_copy_V.partition_S(sV)
+            smem_thr_copy_P = utils.make_tiled_copy_A(
+                smem_copy_atom_QK, tiled_mma_pv
+            ).get_slice(tidx)
+            tPsP = smem_thr_copy_P.partition_S(sP)
+            tOrP = thr_mma_pv.make_fragment_A(thr_mma_pv.partition_A(sP[None, None, 0]))
+        if const_expr(not split_pv_warps or is_qk_owner):
+            thr_mma_qk = tiled_mma_qk.get_slice(tidx)
+            smem_thr_copy_Q = utils.make_tiled_copy_A(
+                smem_copy_atom_QK, tiled_mma_qk
+            ).get_slice(tidx)
+            smem_thr_copy_K = utils.make_tiled_copy_B(
+                smem_copy_atom_QK, tiled_mma_qk
+            ).get_slice(tidx)
+            if const_expr(split_pv_warps):
+                tSrQ = thr_mma_qk.make_fragment_A(thr_mma_qk.partition_A(sQ))
+                tSrK = thr_mma_qk.make_fragment_B(
+                    thr_mma_qk.partition_B(sK[None, None, 0])
+                )
+                tSsQ = smem_thr_copy_Q.partition_S(sQ)
+                tSsK = smem_thr_copy_K.partition_S(sK)
+                smem_store_atom_P = utils.get_smem_store_atom(
+                    120,
+                    self.dtype,
+                )
+                smem_thr_store_P = cute.make_tiled_copy_C(
+                    smem_store_atom_P, tiled_mma_qk
+                ).get_slice(tidx)
+                tPsP_store = smem_thr_store_P.partition_D(sP)
+
+        if const_expr(not split_pv_warps or is_qk_owner):
+            gmem_thr_copy_Q = gmem_tiled_copy_Q.get_slice(tidx)
+            if const_expr(not self.pack_gqa):
+                self.load_Q(
+                    gmem_thr_copy_Q,
+                    gQ,
+                    sQ,
+                    m_block,
+                    seqlen=seqlen.seqlen_q,
+                    headdim=mQ.shape[1],
+                )
+            else:
+                PackGQA(
+                    self.tile_m,
+                    self.tile_hdim,
+                    self.check_hdim_oob,
+                    self.qhead_per_kvhead,
+                ).load_Q(
+                    mQ_cur,
+                    sQ,
+                    gmem_tiled_copy_Q,
+                    tidx,
+                    m_block,
+                    seqlen.seqlen_q,
+                )
+            cute.arch.cp_async_commit_group()
+            cute.arch.cp_async_wait_group(0)
+            cute.arch.barrier(
+                barrier_id=1,
+                number_of_threads=self.num_Q_load_threads,
+            )
+
+        if const_expr(not split_pv_warps or is_qk_owner):
+            if const_expr(self._uses_n_distributed_qk()):
+                softmax = None
+                mma_params = SimpleNamespace(
+                    thr_mma_qk=thr_mma_qk,
+                    thr_mma_pv=thr_mma_pv,
+                    tSrQ=tSrQ,
+                    tSrK=tSrK,
+                    tOrV=tOrV,
+                    acc_O=acc_O,
+                    tOrP=tOrP,
+                    tidx=tidx,
+                )
+                smem_copy_params = SimpleNamespace(
+                    smem_thr_copy_Q=smem_thr_copy_Q,
+                    smem_thr_copy_K=smem_thr_copy_K,
+                    smem_thr_copy_V=smem_thr_copy_V,
+                    tOsV=tOsV,
+                    smem_thr_copy_P=smem_thr_copy_P,
+                    tPsP=tPsP,
+                    smem_thr_store_P=(
+                        smem_thr_store_P if const_expr(self.split_qk_n) else None
+                    ),
+                    tPsP_store=(tPsP_store if const_expr(self.split_qk_n) else None),
+                    sQ=sQ,
+                    sK=sK,
+                    sP=sP,
+                    sRowScale=sRowScale,
+                    sLSE=sLSE,
+                    softmax_scale_log2=softmax_scale_log2,
+                    softmax_scale=softmax_scale,
+                )
+                if const_expr(self.split_qk_n):
+                    mask = AttentionMask(
+                        self.tile_m,
+                        self.tile_n,
+                        seqlen,
+                        block_info.window_size_left,
+                        block_info.window_size_right,
+                        (self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1),
+                        enable_r2p_optimization=False,
+                    )
+                    mask_fn = partial(
+                        mask.apply_mask,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        thr_mma=thr_mma_qk,
+                        mask_causal=self.is_causal,
+                        mask_local=self.is_local,
+                        aux_data=aux_data,
+                        fastdiv_mods=(
+                            fastdiv_mods
+                            if const_expr(self.mask_mod is not None)
+                            else None
+                        ),
+                    )
+                else:
+                    mask_fn = None
+            else:
+                softmax = Softmax.create(
+                    softmax_scale_log2,
+                    num_rows=acc_O.shape[0][0] * acc_O.shape[1],
+                    softmax_scale=softmax_scale,
+                )
+                softmax.reset()
+                if const_expr(split_pv_warps):
+                    mma_params = SimpleNamespace(
+                        thr_mma_qk=thr_mma_qk,
+                        thr_mma_pv=thr_mma_pv,
+                        tSrQ=tSrQ,
+                        tSrK=tSrK,
+                        tOrV=tOrV,
+                        acc_O=acc_O,
+                        tOrP=tOrP,
+                    )
+                    smem_copy_params = SimpleNamespace(
+                        smem_thr_copy_Q=smem_thr_copy_Q,
+                        smem_thr_copy_K=smem_thr_copy_K,
+                        smem_thr_copy_V=smem_thr_copy_V,
+                        tSsQ=tSsQ,
+                        tSsK=tSsK,
+                        tOsV=tOsV,
+                        smem_thr_store_P=smem_thr_store_P,
+                        tPsP_store=tPsP_store,
+                        smem_thr_copy_P=smem_thr_copy_P,
+                        tPsP=tPsP,
+                        sRowScale=sRowScale,
+                        sLSE=sLSE,
+                    )
+                else:
+                    mma_params = SimpleNamespace(
+                        thr_mma_qk=thr_mma_qk,
+                        thr_mma_pv=thr_mma_pv,
+                        acc_O=acc_O,
+                    )
+                    smem_copy_params = SimpleNamespace(
+                        smem_thr_copy_Q=smem_thr_copy_Q,
+                        smem_thr_copy_K=smem_thr_copy_K,
+                        smem_thr_copy_V=smem_thr_copy_V,
+                        sQ=sQ,
+                        sK=sK,
+                        sV=sV,
+                    )
+                mask = AttentionMask(
+                    self.tile_m,
+                    self.tile_n,
+                    seqlen,
+                    block_info.window_size_left,
+                    block_info.window_size_right,
+                    self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1,
+                )
+                mask_fn = partial(
+                    mask.apply_mask,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    thr_mma=thr_mma_qk,
+                    mask_causal=self.is_causal,
+                    mask_local=self.is_local,
+                    aux_data=aux_data,
+                    fastdiv_mods=(
+                        fastdiv_mods if const_expr(self.mask_mod is not None) else None
+                    ),
+                )
+        else:
+            softmax = None
+            mma_params = SimpleNamespace(
+                thr_mma_pv=thr_mma_pv,
+                tOrV=tOrV,
+                acc_O=acc_O,
+                tOrP=tOrP,
+            )
+            smem_copy_params = SimpleNamespace(
+                smem_thr_copy_V=smem_thr_copy_V,
+                tOsV=tOsV,
+                smem_thr_copy_P=smem_thr_copy_P,
+                tPsP=tPsP,
+                sRowScale=sRowScale,
+                sLSE=sLSE,
+            )
+            mask_fn = None
+        if const_expr(split_pv_warps and not self._uses_n_distributed_qk()):
+            compute_one_n_block = (
+                self.compute_one_n_block_split_pv_owner
+                if const_expr(is_qk_owner)
+                else self.compute_one_n_block_split_pv_helper
+            )
+        elif const_expr(not self._uses_n_distributed_qk()):
+            compute_one_n_block = self.compute_one_n_block
+        if const_expr(not split_pv_warps or is_qk_owner):
+            mask_fn_seqlen = partial(mask_fn, mask_mod=self.mask_mod, mask_seqlen=True)
+            mask_fn_no_seqlen = partial(
+                mask_fn, mask_mod=self.mask_mod, mask_seqlen=False
+            )
+        else:
+            mask_fn_seqlen = None
+            mask_fn_no_seqlen = None
+        n_block = cutlass.max(n_block_max - 1, 0)
+        if const_expr(self._uses_n_distributed_qk()):
+            consumer_state = self.compute_one_n_block_split_pv_distributed_qk(
+                n_block,
+                consumer_state,
+                mma_params,
+                smem_copy_params,
+                None,
+                pipeline_k,
+                pipeline_v,
+                score_mod=self.score_mod,
+                batch_idx=batch_idx,
+                head_idx=head_idx,
+                m_block=m_block,
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+                mask_fn=mask_fn_seqlen,
+                is_first_n_block=True,
+                is_last_n_block=n_block == n_block_min,
+                learnable_sink=learnable_sink,
+                split_idx=split_idx,
+            )
+            for n_tile in cutlass.range(n_block - n_block_min, unroll=1):
+                consumer_state = self.compute_one_n_block_split_pv_distributed_qk(
+                    n_block - n_tile - 1,
+                    consumer_state,
+                    mma_params,
+                    smem_copy_params,
+                    None,
+                    pipeline_k,
+                    pipeline_v,
+                    score_mod=self.score_mod,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    seqlen=seqlen,
+                    aux_data=aux_data,
+                    fastdiv_mods=fastdiv_mods,
+                    mask_fn=mask_fn_no_seqlen,
+                    is_last_n_block=n_block - n_tile - 1 == n_block_min,
+                    learnable_sink=learnable_sink,
+                    split_idx=split_idx,
+                )
+        else:
+            consumer_state = compute_one_n_block(
+                n_block,
+                consumer_state,
+                mma_params,
+                smem_copy_params,
+                softmax,
+                pipeline_k,
+                pipeline_v,
+                score_mod=self.score_mod,
+                sBias=sBias,
+                pipeline_bias=pipeline_bias,
+                base_softmax_scale=base_softmax_scale,
+                apply_bias=n_block >= n_block_max - num_bias_loads,
+                batch_idx=batch_idx,
+                head_idx=head_idx,
+                m_block=m_block,
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+                mask_fn=mask_fn_seqlen,
+                is_first_n_block=True,
+            )
+            n_block_upper = n_block
+            if const_expr(self.is_causal or self.is_local):
+                n_block_min_causal_local_mask = (
+                    block_info.get_n_block_min_causal_local_mask(
+                        seqlen, m_block, n_block_min
+                    )
+                )
+                for n_tile in cutlass.range(
+                    n_block_max - 1 - n_block_min_causal_local_mask, unroll=1
+                ):
+                    n_block = n_block_max - 2 - n_tile
+                    consumer_state = compute_one_n_block(
+                        n_block,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=n_block >= n_block_max - num_bias_loads,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_seqlen,
+                    )
+                n_block_upper = cutlass.min(
+                    n_block_upper, n_block_min_causal_local_mask
+                )
+            n_block_min_before_local_mask = (
+                block_info.get_n_block_min_before_local_mask(
+                    seqlen, m_block, n_block_min
+                )
+            )
+            if const_expr(self.has_bias):
+                # n13: blocks [n_far_top, n_block_upper) are inside the bias band (apply_bias True for every one of
+                # them in the served loop), blocks below n_far_top are outside it (apply_bias False). Same blocks,
+                # same order, same arithmetic; the bias branch is resolved at compile time in each loop.
+                n_far_top = cutlass.max(
+                    cutlass.min(n_block_upper, n_block_max - num_bias_loads),
+                    n_block_min_before_local_mask,
+                )
+                for n_tile in cutlass.range(n_block_upper - n_far_top, unroll=1):
+                    consumer_state = compute_one_n_block(
+                        n_block_upper - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=True,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+                # n64 kernel A: n13's far loop is kernel B's (n64b_fwd.py)
+            else:
+                for n_tile in cutlass.range(
+                    n_block_upper - n_block_min_before_local_mask, unroll=1
+                ):
+                    consumer_state = compute_one_n_block(
+                        n_block_upper - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=(n_block_upper - n_tile - 1 >= n_block_max - num_bias_loads),
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+            if const_expr(self.is_local and block_info.window_size_left is not None):
+                n_block_upper = cutlass.min(
+                    n_block_upper, n_block_min_before_local_mask
+                )
+                for n_tile in cutlass.range(n_block_upper - n_block_min, unroll=1):
+                    consumer_state = compute_one_n_block(
+                        n_block_upper - n_tile - 1,
+                        consumer_state,
+                        mma_params,
+                        smem_copy_params,
+                        softmax,
+                        pipeline_k,
+                        pipeline_v,
+                        score_mod=self.score_mod,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                        base_softmax_scale=base_softmax_scale,
+                        apply_bias=(
+                            n_block_upper - n_tile - 1 >= n_block_max - num_bias_loads
+                        ),
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        seqlen=seqlen,
+                        aux_data=aux_data,
+                        fastdiv_mods=fastdiv_mods,
+                        mask_fn=mask_fn_no_seqlen,
+                    )
+
+        if const_expr(self._uses_n_distributed_qk()):
+            cO = cute.make_identity_tensor((self.tile_m, self.tile_hdimv))
+            tOcO_mn_finalize = layout_utils.reshape_acc_to_mn(
+                thr_mma_pv.partition_C(cO)
+            )
+            num_rows_pv = acc_O.shape[0][0] * acc_O.shape[1]
+            row_scale_pv = cute.make_rmem_tensor(num_rows_pv, Float32)
+            lse = cute.make_rmem_tensor(num_rows_pv, Float32)
+            for r in cutlass.range(cute.size(row_scale_pv), unroll_full=True):
+                row = tOcO_mn_finalize[r, 0][0]
+                row_scale_pv[r] = sRowScale[0, row]
+                lse[r] = sLSE[row]
+            self._rescale_O(acc_O, row_scale_pv)
+        elif const_expr(split_pv_warps):
+            if const_expr(is_qk_owner):
+                sink_val = None
+                if const_expr(learnable_sink is not None):
+                    if const_expr(not self.pack_gqa):
+                        sink_val = Float32(learnable_sink[head_idx])
+                    else:
+                        sink_val = cute.make_rmem_tensor_like(softmax.row_max, Float32)
+                        cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                        tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                            thr_mma_qk.partition_C(cS)
+                        )
+                        for r in cutlass.range(cute.size(sink_val), unroll_full=True):
+                            row = m_block * self.tile_m + tScS_mn_finalize[r][0]
+                            q_head_idx = (
+                                row % self.qhead_per_kvhead
+                                + head_idx * self.qhead_per_kvhead
+                            )
+                            sink_val[r] = Float32(learnable_sink[q_head_idx])
+                if const_expr(self.is_split_kv and learnable_sink is not None):
+                    if const_expr(not self.pack_gqa):
+                        sink_val = sink_val if split_idx == 0 else -Float32.inf
+                    elif split_idx != 0:
+                        sink_val.fill(-Float32.inf)
+                row_scale_qk = softmax.finalize(sink_val=sink_val)
+                cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                    thr_mma_qk.partition_C(cS)
+                )
+                if tScS_mn_finalize[0][1] == 0:
+                    for r in cutlass.range(cute.size(row_scale_qk), unroll_full=True):
+                        row = tScS_mn_finalize[r][0]
+                        sRowScale[2, row] = row_scale_qk[r]
+                        sLSE[row] = softmax.row_sum[r]
+                cute.arch.fence_view_async_shared()
+            cute.arch.barrier(
+                barrier_id=int(NamedBarrierFwd.PFull),
+                number_of_threads=self.num_mma_threads,
+            )
+            cO = cute.make_identity_tensor((self.tile_m, self.tile_hdimv))
+            tOcO_mn_finalize = layout_utils.reshape_acc_to_mn(
+                thr_mma_pv.partition_C(cO)
+            )
+            num_rows_pv = acc_O.shape[0][0] * acc_O.shape[1]
+            row_scale_pv = cute.make_rmem_tensor(num_rows_pv, Float32)
+            lse = cute.make_rmem_tensor(num_rows_pv, Float32)
+            for r in cutlass.range(cute.size(row_scale_pv), unroll_full=True):
+                row = tOcO_mn_finalize[r, 0][0]
+                row_scale_pv[r] = sRowScale[2, row]
+                lse[r] = sLSE[row]
+            self._rescale_O(acc_O, row_scale_pv)
+        else:
+            sink_val = None
+            if const_expr(learnable_sink is not None):
+                if const_expr(not self.pack_gqa):
+                    sink_val = Float32(learnable_sink[head_idx])
+                else:
+                    sink_val = cute.make_rmem_tensor_like(softmax.row_max, Float32)
+                    cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                    tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                        thr_mma_qk.partition_C(cS)
+                    )
+                    for r in cutlass.range(cute.size(sink_val), unroll_full=True):
+                        row = m_block * self.tile_m + tScS_mn_finalize[r][0]
+                        q_head_idx = (
+                            row % self.qhead_per_kvhead
+                            + head_idx * self.qhead_per_kvhead
+                        )
+                        sink_val[r] = Float32(learnable_sink[q_head_idx])
+            if const_expr(self.is_split_kv and learnable_sink is not None):
+                if const_expr(not self.pack_gqa):
+                    sink_val = sink_val if split_idx == 0 else -Float32.inf
+                elif split_idx != 0:
+                    sink_val.fill(-Float32.inf)
+            # n64 kernel A: no finalize / epilogue; store the raw per-thread state for kernel B (fragment order)
+            stO = aux_data.tensors[0]
+            stS = aux_data.tensors[1]
+            lane = tidx % cute.arch.WARP_SIZE
+            wrow = (tidx // cute.arch.WARP_SIZE) * 16
+            grow = seqlen.offset_q + 128 * batch_idx + m_block * self.tile_m + wrow
+            fO = cute.make_tensor(utils.elem_pointer(stO, (head_idx, grow * self.tile_hdimv + lane * cute.size(acc_O))),
+                                  cute.make_layout(cute.size(acc_O)))
+            for i in cutlass.range(cute.size(acc_O), unroll_full=True):
+                fO[i] = acc_O[i]
+            fS = cute.make_tensor(utils.elem_pointer(stS, (head_idx, grow * 16 + lane * 4)), cute.make_layout(4))
+            nrow = cute.size(softmax.row_max)
+            if const_expr(N64A_CTL == 1):
+                # FAILING CONTROL (mb only): store quad-reduced row sums instead of the lane partials (must differ)
+                softmax.row_sum.store(utils.warp_reduce(softmax.row_sum.load(), operator.add, width=4))
+            for r in cutlass.range(nrow, unroll_full=True):
+                fS[r] = softmax.row_max[r]
+                fS[nrow + r] = softmax.row_sum[r]
+            if lane == 0:
+                stS[head_idx, grow * 16 + 128] = Float32(n_far_top)
+        return consumer_state
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64b_fwd.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64b_fwd.py
new file mode 100644
index 0000000000000000000000000000000000000000..33f2f21f38382bc2420008b02e7b1ca29da4cd17
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n64b_fwd.py
@@ -0,0 +1,1597 @@
+# Generated by work_attn/gen/gen_n64b.py from the image's sglang/kernels/ops/attention/fa4_sm120/flash_fwd.py (md5 f7161e38).
+"""Generate n64b_fwd.py (fa4_sm120/n64b_fwd.py) = n64 exact far form, KERNEL B, from the image's flash_fwd.py (md5 f7161e38).
+
+FlashAttentionForwardSm120W8Far: the W8 layout of gen_n64.py (tile (128,128), consumers = warps 4-11 at N64_REG_C under
+setmaxnreg, producer warpgroup 0-3 at N64_REG_P, warp 0 = the image's paged cp.async loader) running only the FAR key blocks
+of a global-layer prefill visit, continuing the per-thread state that kernel A (n64a_fwd.py, n54's band-split kernel with
+the far loop removed) stored, with n54's far-loop arithmetic:
+  * __call__: the has_bias scale pair (base_softmax_scale = softmax_scale, softmax_scale_log2 = LOG2_E) without bias tiles;
+  * compute_one_n_block: acc_S *= base_softmax_scale (apply_sheared_bias with apply_bias False), then the image softmax / PV;
+  * mma: after Softmax.create / reset, acc_O, row_max and the per-lane partial row_sum are loaded from aux tensors
+    [stO fp32 (H, Tpad * 128), stS fp32 (H, Tpad * 16), fragment order per 16-row group: see the mma comment;
+    Tpad = T + 128 x batch]; blocks from the causal top down to the half's n_far_top are consumed without compute (wait + release), the far
+    blocks n_far_top - 1 .. n_block_min run with the served mask call (no-op there); finalize + epilogue are the image's."""
+from sglang.kernels.ops.attention.fa4_sm120 import flash_fwd as _base
+globals().update({k: v for k, v in vars(_base).items() if not k.startswith("__")})
+from sglang.kernels.ops.attention.fa4_sm120.flash_fwd import FlashAttentionForwardSm120  # noqa: E402
+
+N64_REG_P = 40  # producer warpgroup registers per thread after setmaxnreg
+N64_REG_C = 232  # consumer warpgroup registers per thread after setmaxnreg
+N64_CONSUMER_WARP0 = 4  # consumers are warps 4-11 (two whole warpgroups)
+N64_FAR = True  # kernel B: n54's far-loop arithmetic (FMUL by the softmax scale, exp2 with LOG2_E)
+
+
+class FlashAttentionForwardSm120W8Far(FlashAttentionForwardSm120):
+    """n64 kernel B: W8 layout, far blocks only, continuing kernel A's per-thread state with n54's far-loop math."""
+
+    def _num_dma_threads(self) -> int:
+        assert self.num_threads == 256 and not self._uses_split_pv_warps() and not self.has_bias
+        return N64_CONSUMER_WARP0 * 32
+
+    # ---- copied from the image file and patched (gen_n64b.py) ----
+    @cute.jit
+    def __call__(
+        self,
+        mQ: cute.Tensor,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        softmax_scale: Float32,
+        mCuSeqlensQ: Optional[cute.Tensor] = None,
+        mCuSeqlensK: Optional[cute.Tensor] = None,
+        mSeqUsedQ: Optional[cute.Tensor] = None,
+        mSeqUsedK: Optional[cute.Tensor] = None,
+        mPageTable: Optional[cute.Tensor] = None,
+        window_size_left: Int32 | int | None = None,
+        window_size_right: Int32 | int | None = None,
+        learnable_sink: Optional[cute.Tensor] = None,
+        blocksparse_tensors: Optional[BlockSparseTensors] = None,
+        aux_data: AuxData = AuxData(),
+        mBias: Optional[cute.Tensor] = None,
+        launch_split_combine_early: Int32 = Int32(0),
+        stream: cuda.CUstream = None,
+    ):
+        assert blocksparse_tensors is None, "Block sparsity is not supported on SM120"
+        assert (mBias is not None) == self.has_bias
+        assert mPageTable is None or self.paged_kv, (
+            "SM120 paged KV requires the dedicated DMA-warp specialization"
+        )
+        self._check_type(
+            *(
+                t.element_type if t is not None else None
+                for t in (
+                    mQ,
+                    mK,
+                    mV,
+                    mO,
+                    mLSE,
+                    mCuSeqlensQ,
+                    mCuSeqlensK,
+                    mSeqUsedQ,
+                    mSeqUsedK,
+                )
+            )
+        )
+        tiled_mma_qk, tiled_mma_pv = self._get_tiled_mma()
+        self.num_qk_threads = tiled_mma_qk.size
+        self.num_mma_threads = tiled_mma_pv.size
+        self.num_producer_threads = self.num_threads
+        self.num_Q_load_threads = (
+            self.num_qk_threads if self._uses_split_pv_warps() else self.num_threads
+        )
+        self.num_epilogue_threads = (
+            self.num_mma_threads if self._uses_split_pv_warps() else self.num_threads
+        )
+        self.use_tma_O = False
+        self._setup_attributes()
+        SharedStorage = self._get_shared_storage_cls()
+
+        mQ, mK, mV, mO = [assume_tensor_aligned(t) for t in (mQ, mK, mV, mO)]
+        if const_expr(mBias is not None):
+            assert mBias.element_type == self.dtype
+            mBias = assume_tensor_aligned(mBias)
+        Q_layout_transpose = (
+            [1, 3, 2, 0] if const_expr(mCuSeqlensQ is None) else [0, 2, 1]
+        )
+        KV_layout_transpose = (
+            [1, 3, 2, 0] if const_expr(mCuSeqlensK is None) else [0, 2, 1]
+        )
+        mQ = cute.make_tensor(
+            mQ.iterator, cute.select(mQ.layout, mode=Q_layout_transpose)
+        )
+        if const_expr(mBias is not None):
+            mBias = cute.make_tensor(
+                mBias.iterator,
+                cute.select(mBias.layout, mode=Q_layout_transpose),
+            )
+        mK, mV = [
+            cute.make_tensor(
+                t.iterator, cute.select(t.layout, mode=KV_layout_transpose)
+            )
+            for t in (mK, mV)
+        ]
+        if const_expr(mPageTable is None):
+            V_layout_transpose = (
+                [1, 0, 2, 3] if const_expr(mCuSeqlensK is None) else [1, 0, 2]
+            )
+            mV = cute.make_tensor(
+                mV.iterator, cute.select(mV.layout, mode=V_layout_transpose)
+            )
+        if const_expr(self.is_split_kv):
+            num_splits = mO.shape[0]
+            O_layout_transpose = (
+                [2, 4, 3, 1, 0] if const_expr(mCuSeqlensQ is None) else [1, 3, 2, 0]
+            )
+            LSE_layout_transpose = (
+                [3, 2, 1, 0] if const_expr(mCuSeqlensQ is None) else [2, 1, 0]
+            )
+        else:
+            num_splits = Int32(1)
+            O_layout_transpose = (
+                [1, 3, 2, 0] if const_expr(mCuSeqlensQ is None) else [0, 2, 1]
+            )
+            LSE_layout_transpose = (
+                [2, 1, 0] if const_expr(mCuSeqlensQ is None) else [1, 0]
+            )
+        mO = cute.make_tensor(
+            mO.iterator, cute.select(mO.layout, mode=O_layout_transpose)
+        )
+        if const_expr(mLSE is not None):
+            mLSE = cute.make_tensor(
+                mLSE.iterator, cute.select(mLSE.layout, mode=LSE_layout_transpose)
+            )
+        if const_expr(self.pack_gqa):
+            nheads_kv = mK.shape[2]
+            mQ = pack_gqa_layout(mQ, self.qhead_per_kvhead, nheads_kv, head_idx=2)
+            mO = pack_gqa_layout(mO, self.qhead_per_kvhead, nheads_kv, head_idx=2)
+            if const_expr(mLSE is not None):
+                mLSE = pack_gqa_layout(
+                    mLSE, self.qhead_per_kvhead, nheads_kv, head_idx=1
+                )
+            if const_expr(mBias is not None):
+                mBias = pack_gqa_layout(
+                    mBias, self.qhead_per_kvhead, nheads_kv, head_idx=2
+                )
+
+        if const_expr(mPageTable is None or self.paged_tma):
+            tma_copy_op = cpasync.CopyBulkTensorTileG2SOp()
+            mV_tma = (
+                mV
+                if const_expr(mPageTable is None)
+                else cute.make_tensor(
+                    mV.iterator,
+                    cute.select(mV.layout, mode=[1, 0, 2, 3]),
+                )
+            )
+            tma_atom_K, tma_tensor_K = cpasync.make_tiled_tma_atom(
+                tma_copy_op,
+                mK,
+                cute.select(self.sK_layout, mode=[0, 1]),
+                (self.tile_n, self.tile_hdim),
+                1,
+            )
+            tma_atom_V, tma_tensor_V = cpasync.make_tiled_tma_atom(
+                tma_copy_op,
+                mV_tma,
+                cute.select(self.sV_layout, mode=[0, 1]),
+                (self.tile_hdimv, self.tile_n),
+                1,
+            )
+            self.tma_copy_bytes_K = cute.size_in_bytes(
+                mK.element_type, cute.select(self.sK_layout, mode=[0, 1])
+            )
+            self.tma_copy_bytes_V = cute.size_in_bytes(
+                mV_tma.element_type,
+                cute.select(self.sV_layout, mode=[0, 1]),
+            )
+        else:
+            tma_atom_K = None
+            tma_atom_V = None
+            tma_tensor_K = mK
+            tma_tensor_V = mV
+        if const_expr(self.has_bias):
+            tma_atom_Bias, tma_tensor_Bias = cpasync.make_tiled_tma_atom(
+                cpasync.CopyBulkTensorTileG2SOp(),
+                mBias,
+                cute.select(self.sBias_layout, mode=[0, 1]),
+                (self.bias_block_size, self.tile_n),
+                1,
+            )
+            self.tma_copy_bytes_Bias = cute.size_in_bytes(
+                mBias.element_type,
+                cute.select(self.sBias_layout, mode=[0, 1]),
+            )
+        else:
+            tma_atom_Bias = None
+            tma_tensor_Bias = mBias
+
+        is_varlen = const_expr(mCuSeqlensQ is not None or mSeqUsedQ is not None)
+        num_batch = (
+            mCuSeqlensQ.shape[0] - 1
+            if const_expr(mCuSeqlensQ is not None)
+            else cute.size(mQ.shape[3])
+        )
+        TileScheduler = (
+            Sm120UniformBatchScheduler
+            if is_varlen and self.direct_uniform_batch
+            else SingleTileVarlenScheduler
+            if is_varlen
+            else SingleTileScheduler
+        )
+        tile_sched_args = TileSchedulerArguments(
+            num_block=cute.ceil_div(cute.size(mQ.shape[0]), self.tile_m),
+            num_head=cute.size(mQ.shape[2]),
+            num_batch=num_batch,
+            num_splits=num_splits,
+            seqlen_k=0,
+            headdim=mQ.shape[1],
+            headdim_v=mO.shape[1],
+            total_q=(
+                cute.size(mQ.shape[0])
+                if const_expr(mCuSeqlensQ is not None)
+                else cute.size(mQ.shape[0]) * cute.size(mQ.shape[3])
+            ),
+            tile_shape_mn=(self.tile_m, self.tile_n),
+            lpt=(self.is_causal or self.is_local) and not self.direct_uniform_batch,
+            qhead_per_kvhead_packgqa=(
+                self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+            ),
+            mCuSeqlensQ=mCuSeqlensQ,
+            mSeqUsedQ=mSeqUsedQ,
+            is_persistent=False,
+            is_split_kv=self.is_split_kv,
+        )
+        tile_sched_params = TileScheduler.to_underlying_arguments(
+            tile_sched_args,
+            scheduling_mode=SchedulingMode.STATIC,
+        )
+        grid_dim = TileScheduler.get_grid_shape(tile_sched_params)
+        if const_expr(self.has_bias or N64_FAR):  # n64 kernel B: n54's far-loop scale pair (FMUL by scale, exp2 with LOG2_E)
+            base_softmax_scale = softmax_scale
+            softmax_scale_log2, softmax_scale = utils.LOG2_E, None
+        else:
+            base_softmax_scale = None
+            softmax_scale_log2, softmax_scale = utils.compute_softmax_scale_log2(
+                softmax_scale, self.score_mod
+            )
+        window_size_left = (
+            Int32(window_size_left) if window_size_left is not None else None
+        )
+        window_size_right = (
+            Int32(window_size_right) if window_size_right is not None else None
+        )
+        fastdiv_mods = utils.compute_fastdiv_mods(
+            mQ,
+            mK,
+            self.qhead_per_kvhead,
+            self.pack_gqa,
+            aux_data.tensors,
+            mPageTable,
+        )
+
+        self.kernel(
+            mQ,
+            tma_tensor_K,
+            tma_tensor_V,
+            mO,
+            mLSE,
+            mCuSeqlensQ,
+            mCuSeqlensK,
+            mSeqUsedQ,
+            mSeqUsedK,
+            mPageTable,
+            tma_tensor_Bias,
+            tma_atom_K,
+            tma_atom_V,
+            tma_atom_Bias,
+            softmax_scale_log2,
+            softmax_scale,
+            base_softmax_scale,
+            window_size_left,
+            window_size_right,
+            learnable_sink,
+            self.sQ_layout,
+            self.sK_layout,
+            self.sV_layout,
+            self.sO_layout,
+            self.sP_layout,
+            self.sBias_layout,
+            self.gmem_tiled_copy_Q,
+            self.gmem_tiled_copy_O,
+            tiled_mma_qk,
+            tiled_mma_pv,
+            SharedStorage,
+            tile_sched_params,
+            TileScheduler,
+            launch_split_combine_early,
+            aux_data,
+            fastdiv_mods,
+        ).launch(
+            grid=grid_dim,
+            block=[self.num_threads + self._num_dma_threads(), 1, 1],
+            smem=SharedStorage.size_in_bytes(),
+            stream=stream,
+            min_blocks_per_mp=1,
+            # The immediately preceding ShearingBias grid releases this
+            # dependent launch before all of its CTAs have retired. Bias
+            # readers synchronize before their first TMA issue below; the
+            # remaining kernel prologue can overlap the tail of the shear.
+            use_pdl=self.has_bias,
+        )
+
+    @cute.kernel
+    def kernel(
+        self,
+        mQ: cute.Tensor,
+        mK: cute.Tensor,
+        mV: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        mCuSeqlensQ: Optional[cute.Tensor],
+        mCuSeqlensK: Optional[cute.Tensor],
+        mSeqUsedQ: Optional[cute.Tensor],
+        mSeqUsedK: Optional[cute.Tensor],
+        mPageTable: Optional[cute.Tensor],
+        mBias: Optional[cute.Tensor],
+        tma_atom_K: Optional[cute.CopyAtom],
+        tma_atom_V: Optional[cute.CopyAtom],
+        tma_atom_Bias: Optional[cute.CopyAtom],
+        softmax_scale_log2: Float32,
+        softmax_scale: Optional[Float32],
+        base_softmax_scale: Optional[Float32],
+        window_size_left: Optional[Int32],
+        window_size_right: Optional[Int32],
+        learnable_sink: Optional[cute.Tensor],
+        sQ_layout: cute.ComposedLayout,
+        sK_layout: cute.ComposedLayout,
+        sV_layout: cute.ComposedLayout,
+        sO_layout: cute.ComposedLayout,
+        sP_layout: cute.ComposedLayout | None,
+        sBias_layout: cute.ComposedLayout | None,
+        gmem_tiled_copy_Q: cute.TiledCopy,
+        gmem_tiled_copy_O: cute.TiledCopy,
+        tiled_mma_qk: cute.TiledMma,
+        tiled_mma_pv: cute.TiledMma,
+        SharedStorage: cutlass.Constexpr,
+        tile_sched_params,
+        TileScheduler: cutlass.Constexpr[Callable],
+        launch_split_combine_early: Int32,
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+    ):
+        tidx, _, _ = cute.arch.thread_idx()
+        warp_idx = cute.arch.make_warp_uniform(cute.arch.warp_idx())
+
+        if const_expr(self.is_split_kv):
+            if launch_split_combine_early != 0 and warp_idx == 0:
+                cute.arch.griddepcontrol_launch_dependents()
+
+        if const_expr(mPageTable is None or self.paged_tma):
+            if warp_idx == 0:
+                cpasync.prefetch_descriptor(tma_atom_K)
+                cpasync.prefetch_descriptor(tma_atom_V)
+        if const_expr(self.has_bias):
+            if warp_idx == 0:
+                cpasync.prefetch_descriptor(tma_atom_Bias)
+
+        smem = cutlass.utils.SmemAllocator()
+        storage = smem.allocate(SharedStorage)
+        sQ = storage.sQ.get_tensor(sQ_layout.outer, swizzle=sQ_layout.inner)
+        sK = storage.sK.get_tensor(sK_layout.outer, swizzle=sK_layout.inner)
+        sV = storage.sV.get_tensor(sV_layout.outer, swizzle=sV_layout.inner)
+        sO = storage.sQ.get_tensor(sO_layout.outer, swizzle=sO_layout.inner)
+        sBias = (
+            storage.sBias.get_tensor(sBias_layout.outer, swizzle=sBias_layout.inner)
+            if const_expr(self.has_bias)
+            else None
+        )
+        sP = None
+        sRowScale = None
+        sFinalScale = None
+        sLSE = None
+        if const_expr(sP_layout is not None):
+            if const_expr(self._q_in_regs_pipeline()):
+                sP = storage.sQ.get_tensor(sP_layout.outer, swizzle=sP_layout.inner)
+            else:
+                sP = storage.sP.get_tensor(sP_layout.outer, swizzle=sP_layout.inner)
+            sSoftmaxStats = storage.softmax_stats.get_tensor(
+                cute.make_layout(
+                    (self._num_softmax_stat_rows(), self.tile_m),
+                    stride=(self.tile_m, 1),
+                )
+            )
+            sRowScale = sSoftmaxStats
+            if const_expr(self._uses_n_distributed_qk()):
+                num_qk_warps = self.num_qk_threads // cute.arch.WARP_SIZE
+                sFinalScale = sSoftmaxStats[2 * num_qk_warps + 2, None]
+                sLSE = sSoftmaxStats[3 * num_qk_warps + 3, None]
+            else:
+                sFinalScale = sSoftmaxStats[2, None]
+                sLSE = sSoftmaxStats[3, None]
+
+        tma_group = CooperativeGroup(Agent.Thread)
+        qk_group = CooperativeGroup(
+            Agent.Thread, self.num_qk_threads // cute.arch.WARP_SIZE
+        )
+        pv_group = CooperativeGroup(
+            Agent.Thread, self.num_mma_threads // cute.arch.WARP_SIZE
+        )
+        if const_expr(mPageTable is None or self.paged_tma):
+            pipeline_k = PipelineTmaAsync.create(
+                num_stages=self._num_k_stages(),
+                producer_group=tma_group,
+                consumer_group=qk_group,
+                tx_count=self.tma_copy_bytes_K,
+                barrier_storage=storage.mbar_K.data_ptr(),
+                defer_sync=True,
+            )
+            pipeline_v = PipelineTmaAsync.create(
+                num_stages=self._num_v_stages(),
+                producer_group=tma_group,
+                consumer_group=pv_group,
+                tx_count=self.tma_copy_bytes_V,
+                barrier_storage=storage.mbar_V.data_ptr(),
+                defer_sync=True,
+            )
+        else:
+            dma_group = CooperativeGroup(Agent.Thread, self.num_dma_threads)
+            k_consumer_group = CooperativeGroup(
+                Agent.Thread,
+                (
+                    self.num_qk_threads
+                    if self._uses_split_pv_warps()
+                    else self.num_threads
+                ),
+            )
+            v_consumer_group = CooperativeGroup(
+                Agent.Thread,
+                (
+                    self.num_mma_threads
+                    if self._uses_split_pv_warps()
+                    else self.num_threads
+                ),
+            )
+            pipeline_k = pipeline_custom.PipelineCpAsync.create(
+                num_stages=self._num_k_stages(),
+                producer_group=dma_group,
+                consumer_group=k_consumer_group,
+                barrier_storage=storage.mbar_K.data_ptr(),
+                defer_sync=True,
+            )
+            pipeline_v = pipeline_custom.PipelineCpAsync.create(
+                num_stages=self._num_v_stages(),
+                producer_group=dma_group,
+                consumer_group=v_consumer_group,
+                barrier_storage=storage.mbar_V.data_ptr(),
+                defer_sync=True,
+            )
+        pipeline_bias = (
+            PipelineTmaAsync.create(
+                num_stages=self.num_stages,
+                producer_group=tma_group,
+                consumer_group=qk_group,
+                tx_count=self.tma_copy_bytes_Bias,
+                barrier_storage=storage.mbar_Bias.data_ptr(),
+                defer_sync=True,
+            )
+            if const_expr(self.has_bias)
+            else None
+        )
+        pipeline_p = None
+        pipeline_final = None
+        if const_expr(sP_layout is not None):
+            pipeline_p = PipelineAsync.create(
+                num_stages=self._num_p_stages(),
+                producer_group=CooperativeGroup(Agent.Thread, self.num_qk_threads),
+                consumer_group=CooperativeGroup(Agent.Thread, self.num_mma_threads),
+                barrier_storage=storage.mbar_P.data_ptr(),
+                defer_sync=True,
+                name="sm120_p",
+            )
+            pipeline_final = PipelineAsync.create(
+                num_stages=1,
+                producer_group=CooperativeGroup(Agent.Thread, self.num_qk_threads),
+                consumer_group=CooperativeGroup(Agent.Thread, self.num_mma_threads),
+                barrier_storage=storage.mbar_final.data_ptr(),
+                defer_sync=True,
+                name="sm120_final",
+            )
+        tile_scheduler = TileScheduler.create(tile_sched_params)
+        work_tile = tile_scheduler.initial_work_tile_info()
+        if work_tile.is_valid_tile:
+            m_block, head_idx, batch_idx, split_idx = work_tile.tile_idx
+            seqlen = SeqlenInfoQK.create(
+                batch_idx=batch_idx,
+                seqlen_q_static=(
+                    mQ.shape[0] if const_expr(not self.pack_gqa) else mQ.shape[0][1]
+                ),
+                seqlen_k_static=(
+                    mK.shape[0]
+                    if const_expr(mPageTable is None)
+                    else mK.shape[0] * mPageTable.shape[1]
+                ),
+                mCuSeqlensQ=mCuSeqlensQ,
+                mCuSeqlensK=mCuSeqlensK,
+                mSeqUsedQ=mSeqUsedQ,
+                mSeqUsedK=mSeqUsedK,
+                tile_m=self.tile_m,
+                tile_n=self.tile_n,
+            )
+            run_mainloop = True
+            if const_expr(self.is_split_kv):
+                block_info = BlockInfo(
+                    self.tile_m,
+                    self.tile_n,
+                    self.is_causal,
+                    self.is_local,
+                    self.is_split_kv,
+                    window_size_left,
+                    window_size_right,
+                    qhead_per_kvhead_packgqa=(
+                        self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+                    ),
+                )
+                n_block_min, n_block_max = self._get_n_block_min_max(
+                    block_info,
+                    seqlen,
+                    m_block,
+                    split_idx,
+                    tile_scheduler.params.num_splits,
+                )
+                is_empty_split = n_block_min >= n_block_max
+                if is_empty_split:
+                    if const_expr(self._uses_split_pv_warps()):
+                        if warp_idx >= self.num_qk_threads // cute.arch.WARP_SIZE:
+                            self.epilogue_empty_split(
+                                mO,
+                                mLSE,
+                                learnable_sink,
+                                seqlen,
+                                tiled_mma_pv,
+                                tidx - self.num_qk_threads,
+                                m_block,
+                                head_idx,
+                                batch_idx,
+                                split_idx,
+                            )
+                    else:
+                        if warp_idx >= N64_CONSUMER_WARP0:
+                            self.epilogue_empty_split(
+                                mO,
+                                mLSE,
+                                learnable_sink,
+                                seqlen,
+                                tiled_mma_pv,
+                                tidx - N64_CONSUMER_WARP0 * cute.arch.WARP_SIZE,
+                                m_block,
+                                head_idx,
+                                batch_idx,
+                                split_idx,
+                            )
+                run_mainloop = not is_empty_split
+
+            if run_mainloop:
+                pipeline_init_arrive(cluster_shape_mn=(1, 1), is_relaxed=True)
+                pipeline_init_wait(cluster_shape_mn=(1, 1))
+
+                if const_expr(mPageTable is not None and self._uses_split_pv_warps()):
+                    if warp_idx == 0:
+                        self.load_paged_persistent(
+                            mK,
+                            mV,
+                            mPageTable,
+                            tma_atom_K,
+                            tma_atom_V,
+                            sK,
+                            sV,
+                            pipeline_k,
+                            pipeline_v,
+                            tile_scheduler,
+                            mQ,
+                            mCuSeqlensQ,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                            tidx,
+                        )
+                    elif const_expr(self._uses_n_distributed_qk()):
+                        if warp_idx <= self.num_mma_threads // cute.arch.WARP_SIZE:
+                            self.mma_persistent(
+                                mQ,
+                                mK,
+                                mO,
+                                mLSE,
+                                sQ,
+                                sK,
+                                sV,
+                                sO,
+                                sP,
+                                sRowScale,
+                                sLSE,
+                                learnable_sink,
+                                pipeline_k,
+                                pipeline_v,
+                                gmem_tiled_copy_Q,
+                                gmem_tiled_copy_O,
+                                tiled_mma_qk,
+                                tiled_mma_pv,
+                                tidx - self.num_dma_threads,
+                                softmax_scale_log2,
+                                softmax_scale,
+                                base_softmax_scale,
+                                tile_scheduler,
+                                mCuSeqlensQ,
+                                mCuSeqlensK,
+                                mSeqUsedQ,
+                                mSeqUsedK,
+                                mPageTable,
+                                window_size_left,
+                                window_size_right,
+                                True,
+                                aux_data,
+                                fastdiv_mods,
+                            )
+                    elif warp_idx == 1:
+                        self.mma_persistent(
+                            mQ,
+                            mK,
+                            mO,
+                            mLSE,
+                            sQ,
+                            sK,
+                            sV,
+                            sO,
+                            sP,
+                            sRowScale,
+                            sLSE,
+                            learnable_sink,
+                            pipeline_k,
+                            pipeline_v,
+                            gmem_tiled_copy_Q,
+                            gmem_tiled_copy_O,
+                            tiled_mma_qk,
+                            tiled_mma_pv,
+                            tidx - self.num_dma_threads,
+                            softmax_scale_log2,
+                            softmax_scale,
+                            base_softmax_scale,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            mPageTable,
+                            window_size_left,
+                            window_size_right,
+                            True,
+                            aux_data,
+                            fastdiv_mods,
+                        )
+                    elif warp_idx <= self.num_mma_threads // cute.arch.WARP_SIZE:
+                        self.mma_persistent(
+                            mQ,
+                            mK,
+                            mO,
+                            mLSE,
+                            sQ,
+                            sK,
+                            sV,
+                            sO,
+                            sP,
+                            sRowScale,
+                            sLSE,
+                            learnable_sink,
+                            pipeline_k,
+                            pipeline_v,
+                            gmem_tiled_copy_Q,
+                            gmem_tiled_copy_O,
+                            tiled_mma_qk,
+                            tiled_mma_pv,
+                            tidx - self.num_dma_threads,
+                            softmax_scale_log2,
+                            softmax_scale,
+                            base_softmax_scale,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            mPageTable,
+                            window_size_left,
+                            window_size_right,
+                            False,
+                            aux_data,
+                            fastdiv_mods,
+                        )
+                elif const_expr(self._uses_split_pv_warps()):
+                    if warp_idx < self.num_qk_threads // cute.arch.WARP_SIZE:
+                        self.mma_qk_pipeline_persistent(
+                            mQ,
+                            mK,
+                            mV,
+                            sQ,
+                            sK,
+                            sV,
+                            tma_atom_K,
+                            tma_atom_V,
+                            sP,
+                            sRowScale,
+                            sFinalScale,
+                            sLSE,
+                            learnable_sink,
+                            pipeline_k,
+                            pipeline_v,
+                            pipeline_p,
+                            pipeline_final,
+                            gmem_tiled_copy_Q,
+                            tiled_mma_qk,
+                            tidx,
+                            softmax_scale_log2,
+                            softmax_scale,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                            aux_data,
+                            fastdiv_mods,
+                        )
+                    else:
+                        self.mma_pv_pipeline_persistent(
+                            mQ,
+                            mK,
+                            mO,
+                            mLSE,
+                            sV,
+                            sO,
+                            sP,
+                            sRowScale,
+                            sFinalScale,
+                            sLSE,
+                            pipeline_v,
+                            pipeline_p,
+                            pipeline_final,
+                            gmem_tiled_copy_O,
+                            tiled_mma_pv,
+                            tidx - self.num_qk_threads,
+                            tile_scheduler,
+                            mCuSeqlensQ,
+                            mCuSeqlensK,
+                            mSeqUsedQ,
+                            mSeqUsedK,
+                            window_size_left,
+                            window_size_right,
+                        )
+                elif warp_idx < N64_CONSUMER_WARP0:
+                    cute.arch.setmaxregister_decrease(N64_REG_P)  # n64: producer warpgroup
+                    if warp_idx == 0:
+                        if const_expr(mPageTable is None):
+                            self.load_tma_persistent(
+                                mK,
+                                mV,
+                                sK,
+                                sV,
+                                tma_atom_K,
+                                tma_atom_V,
+                                pipeline_k,
+                                pipeline_v,
+                                tile_scheduler,
+                                mQ,
+                                mCuSeqlensQ,
+                                mCuSeqlensK,
+                                mSeqUsedQ,
+                                mSeqUsedK,
+                                window_size_left,
+                                window_size_right,
+                                mBias=mBias,
+                                sBias=sBias,
+                                tma_atom_Bias=tma_atom_Bias,
+                                pipeline_bias=pipeline_bias,
+                            )
+                        else:
+                            self.load_paged_persistent(
+                                mK,
+                                mV,
+                                mPageTable,
+                                tma_atom_K,
+                                tma_atom_V,
+                                sK,
+                                sV,
+                                pipeline_k,
+                                pipeline_v,
+                                tile_scheduler,
+                                mQ,
+                                mCuSeqlensQ,
+                                mSeqUsedQ,
+                                mSeqUsedK,
+                                window_size_left,
+                                window_size_right,
+                                tidx,
+                                mBias=mBias,
+                                sBias=sBias,
+                                tma_atom_Bias=tma_atom_Bias,
+                                pipeline_bias=pipeline_bias,
+                            )
+                else:
+                    cute.arch.setmaxregister_increase(N64_REG_C)  # n64: consumer warpgroups
+                    self.mma_persistent(
+                        mQ,
+                        mK,
+                        mO,
+                        mLSE,
+                        sQ,
+                        sK,
+                        sV,
+                        sO,
+                        sP,
+                        sRowScale,
+                        sLSE,
+                        learnable_sink,
+                        pipeline_k,
+                        pipeline_v,
+                        gmem_tiled_copy_Q,
+                        gmem_tiled_copy_O,
+                        tiled_mma_qk,
+                        tiled_mma_pv,
+                        tidx - N64_CONSUMER_WARP0 * cute.arch.WARP_SIZE,
+                        softmax_scale_log2,
+                        softmax_scale,
+                        base_softmax_scale,
+                        tile_scheduler,
+                        mCuSeqlensQ,
+                        mCuSeqlensK,
+                        mSeqUsedQ,
+                        mSeqUsedK,
+                        mPageTable,
+                        window_size_left,
+                        window_size_right,
+                        True,
+                        aux_data,
+                        fastdiv_mods,
+                        sBias=sBias,
+                        pipeline_bias=pipeline_bias,
+                    )
+
+    @cute.jit
+    def mma_persistent(
+        self,
+        mQ: cute.Tensor,
+        mK: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        sQ: cute.Tensor,
+        sK: cute.Tensor,
+        sV: cute.Tensor,
+        sO: cute.Tensor,
+        sP: Optional[cute.Tensor],
+        sRowScale: Optional[cute.Tensor],
+        sLSE: Optional[cute.Tensor],
+        learnable_sink: Optional[cute.Tensor],
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        gmem_tiled_copy_Q: cute.TiledCopy,
+        gmem_tiled_copy_O: cute.TiledCopy,
+        tiled_mma_qk: cute.TiledMma,
+        tiled_mma_pv: cute.TiledMma,
+        tidx: Int32,
+        softmax_scale_log2: Float32,
+        softmax_scale: Optional[Float32],
+        base_softmax_scale: Optional[Float32],
+        tile_scheduler: TileSchedulerProtocol,
+        mCuSeqlensQ: Optional[cute.Tensor],
+        mCuSeqlensK: Optional[cute.Tensor],
+        mSeqUsedQ: Optional[cute.Tensor],
+        mSeqUsedK: Optional[cute.Tensor],
+        mPageTable: Optional[cute.Tensor],
+        window_size_left: Optional[Int32],
+        window_size_right: Optional[Int32],
+        is_qk_owner: cutlass.Constexpr[bool],
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+        sBias: Optional[cute.Tensor] = None,
+        pipeline_bias: Optional[PipelineAsync] = None,
+    ):
+        consumer_state = PipelineState(self.num_stages, Int32(0), Int32(0), Int32(0))
+        block_info = BlockInfo(
+            self.tile_m,
+            self.tile_n,
+            self.is_causal,
+            self.is_local,
+            self.is_split_kv,
+            window_size_left,
+            window_size_right,
+            qhead_per_kvhead_packgqa=(
+                self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1
+            ),
+        )
+        work_tile = tile_scheduler.initial_work_tile_info()
+        m_block, head_idx, batch_idx, split_idx = work_tile.tile_idx
+        seqlen = SeqlenInfoQK.create(
+            batch_idx=batch_idx,
+            seqlen_q_static=(
+                mQ.shape[0] if const_expr(not self.pack_gqa) else mQ.shape[0][1]
+            ),
+            seqlen_k_static=(
+                mK.shape[0]
+                if const_expr(mPageTable is None)
+                else mK.shape[0] * mPageTable.shape[1]
+            ),
+            mCuSeqlensQ=mCuSeqlensQ,
+            mCuSeqlensK=mCuSeqlensK,
+            mSeqUsedQ=mSeqUsedQ,
+            mSeqUsedK=mSeqUsedK,
+            tile_m=self.tile_m,
+            tile_n=self.tile_n,
+        )
+        n_block_min, n_block_max = self._get_n_block_min_max(
+            block_info,
+            seqlen,
+            m_block,
+            split_idx,
+            tile_scheduler.params.num_splits,
+        )
+        mma_fn = partial(
+            self.mma,
+            mQ,
+            mO,
+            mLSE,
+            sQ,
+            sK,
+            sV,
+            sO,
+            sP,
+            sRowScale,
+            sLSE,
+            learnable_sink,
+            pipeline_k,
+            pipeline_v,
+            gmem_tiled_copy_Q,
+            gmem_tiled_copy_O,
+            tiled_mma_qk,
+            tiled_mma_pv,
+            tidx,
+            softmax_scale_log2,
+            softmax_scale,
+            consumer_state,
+            block_info,
+            seqlen,
+            n_block_min,
+            n_block_max,
+            m_block,
+            head_idx,
+            batch_idx,
+            split_idx,
+            is_qk_owner,
+            aux_data,
+            fastdiv_mods,
+        )
+        if const_expr(self.has_bias):
+            mma_fn(
+                base_softmax_scale=base_softmax_scale,
+                sBias=sBias,
+                pipeline_bias=pipeline_bias,
+            )
+        elif const_expr(N64_FAR):
+            mma_fn(base_softmax_scale=base_softmax_scale)  # n64 kernel B: the far-loop FMUL scale
+        else:
+            mma_fn()
+
+    @cute.jit
+    def mma(
+        self,
+        mQ: cute.Tensor,
+        mO: cute.Tensor,
+        mLSE: Optional[cute.Tensor],
+        sQ: cute.Tensor,
+        sK: cute.Tensor,
+        sV: cute.Tensor,
+        sO: cute.Tensor,
+        sP: Optional[cute.Tensor],
+        sRowScale: Optional[cute.Tensor],
+        sLSE: Optional[cute.Tensor],
+        learnable_sink: Optional[cute.Tensor],
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        gmem_tiled_copy_Q: cute.TiledCopy,
+        gmem_tiled_copy_O: cute.TiledCopy,
+        tiled_mma_qk: cute.TiledMma,
+        tiled_mma_pv: cute.TiledMma,
+        tidx: Int32,
+        softmax_scale_log2: Float32,
+        softmax_scale: Optional[Float32],
+        consumer_state: PipelineState,
+        block_info: BlockInfo,
+        seqlen: SeqlenInfoQK,
+        n_block_min: Int32,
+        n_block_max: Int32,
+        m_block: Int32,
+        head_idx: Int32,
+        batch_idx: Int32,
+        split_idx: Int32,
+        is_qk_owner: cutlass.Constexpr[bool],
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+        sBias: Optional[cute.Tensor] = None,
+        pipeline_bias: Optional[PipelineAsync] = None,
+        base_softmax_scale: Optional[Float32] = None,
+    ):
+        mQ_cur = seqlen.offset_batch_Q(mQ, batch_idx, dim=3)[None, None, head_idx]
+        if const_expr(not self.pack_gqa):
+            gQ = cute.local_tile(mQ_cur, (self.tile_m, self.tile_hdim), (m_block, 0))
+        num_bias_loads = Int32(0)
+        if const_expr(self.has_bias):
+            _, num_bias_loads = self._get_bias_load_info(
+                block_info,
+                seqlen,
+                m_block,
+                n_block_min,
+                n_block_max,
+            )
+
+        split_pv_warps = self._uses_split_pv_warps()
+        thr_mma_pv = tiled_mma_pv.get_slice(tidx)
+        acc_shape_O = thr_mma_pv.partition_shape_C((self.tile_m, self.tile_hdimv))
+        acc_O = cute.make_rmem_tensor(acc_shape_O, Float32)
+        acc_O.fill(0.0)
+
+        smem_copy_atom_QK = cute.make_copy_atom(
+            warp.LdMatrix8x8x16bOp(transpose=False, num_matrices=4), self.dtype
+        )
+        smem_copy_atom_V = cute.make_copy_atom(
+            warp.LdMatrix8x8x16bOp(transpose=True, num_matrices=4), self.dtype
+        )
+        smem_thr_copy_V = utils.make_tiled_copy_B(
+            smem_copy_atom_V, tiled_mma_pv
+        ).get_slice(tidx)
+        if const_expr(split_pv_warps):
+            tOrV = thr_mma_pv.make_fragment_B(thr_mma_pv.partition_B(sV[None, None, 0]))
+            tOsV = smem_thr_copy_V.partition_S(sV)
+            smem_thr_copy_P = utils.make_tiled_copy_A(
+                smem_copy_atom_QK, tiled_mma_pv
+            ).get_slice(tidx)
+            tPsP = smem_thr_copy_P.partition_S(sP)
+            tOrP = thr_mma_pv.make_fragment_A(thr_mma_pv.partition_A(sP[None, None, 0]))
+        if const_expr(not split_pv_warps or is_qk_owner):
+            thr_mma_qk = tiled_mma_qk.get_slice(tidx)
+            smem_thr_copy_Q = utils.make_tiled_copy_A(
+                smem_copy_atom_QK, tiled_mma_qk
+            ).get_slice(tidx)
+            smem_thr_copy_K = utils.make_tiled_copy_B(
+                smem_copy_atom_QK, tiled_mma_qk
+            ).get_slice(tidx)
+            if const_expr(split_pv_warps):
+                tSrQ = thr_mma_qk.make_fragment_A(thr_mma_qk.partition_A(sQ))
+                tSrK = thr_mma_qk.make_fragment_B(
+                    thr_mma_qk.partition_B(sK[None, None, 0])
+                )
+                tSsQ = smem_thr_copy_Q.partition_S(sQ)
+                tSsK = smem_thr_copy_K.partition_S(sK)
+                smem_store_atom_P = utils.get_smem_store_atom(
+                    120,
+                    self.dtype,
+                )
+                smem_thr_store_P = cute.make_tiled_copy_C(
+                    smem_store_atom_P, tiled_mma_qk
+                ).get_slice(tidx)
+                tPsP_store = smem_thr_store_P.partition_D(sP)
+
+        if const_expr(not split_pv_warps or is_qk_owner):
+            gmem_thr_copy_Q = gmem_tiled_copy_Q.get_slice(tidx)
+            if const_expr(not self.pack_gqa):
+                self.load_Q(
+                    gmem_thr_copy_Q,
+                    gQ,
+                    sQ,
+                    m_block,
+                    seqlen=seqlen.seqlen_q,
+                    headdim=mQ.shape[1],
+                )
+            else:
+                PackGQA(
+                    self.tile_m,
+                    self.tile_hdim,
+                    self.check_hdim_oob,
+                    self.qhead_per_kvhead,
+                ).load_Q(
+                    mQ_cur,
+                    sQ,
+                    gmem_tiled_copy_Q,
+                    tidx,
+                    m_block,
+                    seqlen.seqlen_q,
+                )
+            cute.arch.cp_async_commit_group()
+            cute.arch.cp_async_wait_group(0)
+            cute.arch.barrier(
+                barrier_id=1,
+                number_of_threads=self.num_Q_load_threads,
+            )
+
+        if const_expr(not split_pv_warps or is_qk_owner):
+            if const_expr(self._uses_n_distributed_qk()):
+                softmax = None
+                mma_params = SimpleNamespace(
+                    thr_mma_qk=thr_mma_qk,
+                    thr_mma_pv=thr_mma_pv,
+                    tSrQ=tSrQ,
+                    tSrK=tSrK,
+                    tOrV=tOrV,
+                    acc_O=acc_O,
+                    tOrP=tOrP,
+                    tidx=tidx,
+                )
+                smem_copy_params = SimpleNamespace(
+                    smem_thr_copy_Q=smem_thr_copy_Q,
+                    smem_thr_copy_K=smem_thr_copy_K,
+                    smem_thr_copy_V=smem_thr_copy_V,
+                    tOsV=tOsV,
+                    smem_thr_copy_P=smem_thr_copy_P,
+                    tPsP=tPsP,
+                    smem_thr_store_P=(
+                        smem_thr_store_P if const_expr(self.split_qk_n) else None
+                    ),
+                    tPsP_store=(tPsP_store if const_expr(self.split_qk_n) else None),
+                    sQ=sQ,
+                    sK=sK,
+                    sP=sP,
+                    sRowScale=sRowScale,
+                    sLSE=sLSE,
+                    softmax_scale_log2=softmax_scale_log2,
+                    softmax_scale=softmax_scale,
+                )
+                if const_expr(self.split_qk_n):
+                    mask = AttentionMask(
+                        self.tile_m,
+                        self.tile_n,
+                        seqlen,
+                        block_info.window_size_left,
+                        block_info.window_size_right,
+                        (self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1),
+                        enable_r2p_optimization=False,
+                    )
+                    mask_fn = partial(
+                        mask.apply_mask,
+                        batch_idx=batch_idx,
+                        head_idx=head_idx,
+                        m_block=m_block,
+                        thr_mma=thr_mma_qk,
+                        mask_causal=self.is_causal,
+                        mask_local=self.is_local,
+                        aux_data=aux_data,
+                        fastdiv_mods=(
+                            fastdiv_mods
+                            if const_expr(self.mask_mod is not None)
+                            else None
+                        ),
+                    )
+                else:
+                    mask_fn = None
+            else:
+                softmax = Softmax.create(
+                    softmax_scale_log2,
+                    num_rows=acc_O.shape[0][0] * acc_O.shape[1],
+                    softmax_scale=softmax_scale,
+                )
+                softmax.reset()
+                if const_expr(split_pv_warps):
+                    mma_params = SimpleNamespace(
+                        thr_mma_qk=thr_mma_qk,
+                        thr_mma_pv=thr_mma_pv,
+                        tSrQ=tSrQ,
+                        tSrK=tSrK,
+                        tOrV=tOrV,
+                        acc_O=acc_O,
+                        tOrP=tOrP,
+                    )
+                    smem_copy_params = SimpleNamespace(
+                        smem_thr_copy_Q=smem_thr_copy_Q,
+                        smem_thr_copy_K=smem_thr_copy_K,
+                        smem_thr_copy_V=smem_thr_copy_V,
+                        tSsQ=tSsQ,
+                        tSsK=tSsK,
+                        tOsV=tOsV,
+                        smem_thr_store_P=smem_thr_store_P,
+                        tPsP_store=tPsP_store,
+                        smem_thr_copy_P=smem_thr_copy_P,
+                        tPsP=tPsP,
+                        sRowScale=sRowScale,
+                        sLSE=sLSE,
+                    )
+                else:
+                    mma_params = SimpleNamespace(
+                        thr_mma_qk=thr_mma_qk,
+                        thr_mma_pv=thr_mma_pv,
+                        acc_O=acc_O,
+                    )
+                    smem_copy_params = SimpleNamespace(
+                        smem_thr_copy_Q=smem_thr_copy_Q,
+                        smem_thr_copy_K=smem_thr_copy_K,
+                        smem_thr_copy_V=smem_thr_copy_V,
+                        sQ=sQ,
+                        sK=sK,
+                        sV=sV,
+                    )
+                mask = AttentionMask(
+                    self.tile_m,
+                    self.tile_n,
+                    seqlen,
+                    block_info.window_size_left,
+                    block_info.window_size_right,
+                    self.qhead_per_kvhead if const_expr(self.pack_gqa) else 1,
+                )
+                mask_fn = partial(
+                    mask.apply_mask,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    thr_mma=thr_mma_qk,
+                    mask_causal=self.is_causal,
+                    mask_local=self.is_local,
+                    aux_data=aux_data,
+                    fastdiv_mods=(
+                        fastdiv_mods if const_expr(self.mask_mod is not None) else None
+                    ),
+                )
+        else:
+            softmax = None
+            mma_params = SimpleNamespace(
+                thr_mma_pv=thr_mma_pv,
+                tOrV=tOrV,
+                acc_O=acc_O,
+                tOrP=tOrP,
+            )
+            smem_copy_params = SimpleNamespace(
+                smem_thr_copy_V=smem_thr_copy_V,
+                tOsV=tOsV,
+                smem_thr_copy_P=smem_thr_copy_P,
+                tPsP=tPsP,
+                sRowScale=sRowScale,
+                sLSE=sLSE,
+            )
+            mask_fn = None
+        if const_expr(split_pv_warps and not self._uses_n_distributed_qk()):
+            compute_one_n_block = (
+                self.compute_one_n_block_split_pv_owner
+                if const_expr(is_qk_owner)
+                else self.compute_one_n_block_split_pv_helper
+            )
+        elif const_expr(not self._uses_n_distributed_qk()):
+            compute_one_n_block = self.compute_one_n_block
+        if const_expr(not split_pv_warps or is_qk_owner):
+            mask_fn_seqlen = partial(mask_fn, mask_mod=self.mask_mod, mask_seqlen=True)
+            mask_fn_no_seqlen = partial(
+                mask_fn, mask_mod=self.mask_mod, mask_seqlen=False
+            )
+        else:
+            mask_fn_seqlen = None
+            mask_fn_no_seqlen = None
+        n_block = cutlass.max(n_block_max - 1, 0)
+        if const_expr(self._uses_n_distributed_qk()):
+            consumer_state = self.compute_one_n_block_split_pv_distributed_qk(
+                n_block,
+                consumer_state,
+                mma_params,
+                smem_copy_params,
+                None,
+                pipeline_k,
+                pipeline_v,
+                score_mod=self.score_mod,
+                batch_idx=batch_idx,
+                head_idx=head_idx,
+                m_block=m_block,
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+                mask_fn=mask_fn_seqlen,
+                is_first_n_block=True,
+                is_last_n_block=n_block == n_block_min,
+                learnable_sink=learnable_sink,
+                split_idx=split_idx,
+            )
+            for n_tile in cutlass.range(n_block - n_block_min, unroll=1):
+                consumer_state = self.compute_one_n_block_split_pv_distributed_qk(
+                    n_block - n_tile - 1,
+                    consumer_state,
+                    mma_params,
+                    smem_copy_params,
+                    None,
+                    pipeline_k,
+                    pipeline_v,
+                    score_mod=self.score_mod,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    seqlen=seqlen,
+                    aux_data=aux_data,
+                    fastdiv_mods=fastdiv_mods,
+                    mask_fn=mask_fn_no_seqlen,
+                    is_last_n_block=n_block - n_tile - 1 == n_block_min,
+                    learnable_sink=learnable_sink,
+                    split_idx=split_idx,
+                )
+        else:
+            # n64 kernel B: restore kernel A's per-thread state (fp32 bit copies), consume the band blocks without
+            # compute, then the far blocks n_far_top - 1 .. n_block_min exactly as n54's far loop.
+            # state in FRAGMENT order (kernel A writes the same): the 16-row group of consumer warp w starts at padded row
+            # grow = offset_q + 128 * batch + tile row 16 w; stO (H, Tpad * 128): lane l's 64 acc_O values at grow * 128 +
+            # 64 l; stS (H, Tpad * 16): lane l's (row_max[0], row_max[1], row_sum[0], row_sum[1]) at grow * 16 + 4 l and the
+            # 64-row block's n_far_top at grow * 16 + 128. One base address per thread, no per-element coordinates.
+            stO = aux_data.tensors[0]
+            stS = aux_data.tensors[1]
+            lane = tidx % cute.arch.WARP_SIZE
+            wrow = (tidx // cute.arch.WARP_SIZE) * 16
+            grow = seqlen.offset_q + 128 * batch_idx + m_block * self.tile_m + wrow
+            fO = cute.make_tensor(utils.elem_pointer(stO, (head_idx, grow * self.tile_hdimv + lane * cute.size(acc_O))),
+                                  cute.make_layout(cute.size(acc_O)))
+            for i in cutlass.range(cute.size(acc_O), unroll_full=True):
+                acc_O[i] = fO[i]
+            fS = cute.make_tensor(utils.elem_pointer(stS, (head_idx, grow * 16 + lane * 4)), cute.make_layout(4))
+            nrow = cute.size(softmax.row_max)
+            for r in cutlass.range(nrow, unroll_full=True):
+                softmax.row_max[r] = fS[r]
+                softmax.row_sum[r] = fS[nrow + r]
+            # kernel A ran this warp's 64-row half iff the half's first row is in the sequence; else consume every block
+            n_far_top = n_block_max
+            if m_block * self.tile_m + (wrow // 64) * 64 < seqlen.seqlen_q:
+                n_far_top = cutlass.min(cutlass.max(Int32(stS[head_idx, grow * 16 + 128]), n_block_min), n_block_max)
+            for n_tile in cutlass.range(n_block_max - n_far_top, unroll=1):
+                k_wait_token = pipeline_k.consumer_try_wait(consumer_state)
+                pipeline_k.consumer_wait(consumer_state, k_wait_token)
+                pipeline_k.consumer_release(consumer_state)
+                v_wait_token = pipeline_v.consumer_try_wait(consumer_state)
+                pipeline_v.consumer_wait(consumer_state, v_wait_token)
+                pipeline_v.consumer_release(consumer_state)
+                consumer_state.advance()
+            # the first far block is peeled (as the image peels its first block): without it ptxas spills part of acc_O in
+            # the loop at 232 registers (CPU: LDL 46 per block vs 0 peeled)
+            if n_far_top > n_block_min:
+                consumer_state = compute_one_n_block(
+                    n_far_top - 1,
+                    consumer_state,
+                    mma_params,
+                    smem_copy_params,
+                    softmax,
+                    pipeline_k,
+                    pipeline_v,
+                    score_mod=self.score_mod,
+                    sBias=sBias,
+                    pipeline_bias=pipeline_bias,
+                    base_softmax_scale=base_softmax_scale,
+                    apply_bias=False,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    seqlen=seqlen,
+                    aux_data=aux_data,
+                    fastdiv_mods=fastdiv_mods,
+                    mask_fn=mask_fn_no_seqlen,
+                )
+            for n_tile in cutlass.range(n_far_top - 1 - n_block_min, unroll=1):
+                consumer_state = compute_one_n_block(
+                    n_far_top - n_tile - 2,
+                    consumer_state,
+                    mma_params,
+                    smem_copy_params,
+                    softmax,
+                    pipeline_k,
+                    pipeline_v,
+                    score_mod=self.score_mod,
+                    sBias=sBias,
+                    pipeline_bias=pipeline_bias,
+                    base_softmax_scale=base_softmax_scale,
+                    apply_bias=False,
+                    batch_idx=batch_idx,
+                    head_idx=head_idx,
+                    m_block=m_block,
+                    seqlen=seqlen,
+                    aux_data=aux_data,
+                    fastdiv_mods=fastdiv_mods,
+                    mask_fn=mask_fn_no_seqlen,
+                )
+
+        if const_expr(self._uses_n_distributed_qk()):
+            cO = cute.make_identity_tensor((self.tile_m, self.tile_hdimv))
+            tOcO_mn_finalize = layout_utils.reshape_acc_to_mn(
+                thr_mma_pv.partition_C(cO)
+            )
+            num_rows_pv = acc_O.shape[0][0] * acc_O.shape[1]
+            row_scale_pv = cute.make_rmem_tensor(num_rows_pv, Float32)
+            lse = cute.make_rmem_tensor(num_rows_pv, Float32)
+            for r in cutlass.range(cute.size(row_scale_pv), unroll_full=True):
+                row = tOcO_mn_finalize[r, 0][0]
+                row_scale_pv[r] = sRowScale[0, row]
+                lse[r] = sLSE[row]
+            self._rescale_O(acc_O, row_scale_pv)
+        elif const_expr(split_pv_warps):
+            if const_expr(is_qk_owner):
+                sink_val = None
+                if const_expr(learnable_sink is not None):
+                    if const_expr(not self.pack_gqa):
+                        sink_val = Float32(learnable_sink[head_idx])
+                    else:
+                        sink_val = cute.make_rmem_tensor_like(softmax.row_max, Float32)
+                        cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                        tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                            thr_mma_qk.partition_C(cS)
+                        )
+                        for r in cutlass.range(cute.size(sink_val), unroll_full=True):
+                            row = m_block * self.tile_m + tScS_mn_finalize[r][0]
+                            q_head_idx = (
+                                row % self.qhead_per_kvhead
+                                + head_idx * self.qhead_per_kvhead
+                            )
+                            sink_val[r] = Float32(learnable_sink[q_head_idx])
+                if const_expr(self.is_split_kv and learnable_sink is not None):
+                    if const_expr(not self.pack_gqa):
+                        sink_val = sink_val if split_idx == 0 else -Float32.inf
+                    elif split_idx != 0:
+                        sink_val.fill(-Float32.inf)
+                row_scale_qk = softmax.finalize(sink_val=sink_val)
+                cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                    thr_mma_qk.partition_C(cS)
+                )
+                if tScS_mn_finalize[0][1] == 0:
+                    for r in cutlass.range(cute.size(row_scale_qk), unroll_full=True):
+                        row = tScS_mn_finalize[r][0]
+                        sRowScale[2, row] = row_scale_qk[r]
+                        sLSE[row] = softmax.row_sum[r]
+                cute.arch.fence_view_async_shared()
+            cute.arch.barrier(
+                barrier_id=int(NamedBarrierFwd.PFull),
+                number_of_threads=self.num_mma_threads,
+            )
+            cO = cute.make_identity_tensor((self.tile_m, self.tile_hdimv))
+            tOcO_mn_finalize = layout_utils.reshape_acc_to_mn(
+                thr_mma_pv.partition_C(cO)
+            )
+            num_rows_pv = acc_O.shape[0][0] * acc_O.shape[1]
+            row_scale_pv = cute.make_rmem_tensor(num_rows_pv, Float32)
+            lse = cute.make_rmem_tensor(num_rows_pv, Float32)
+            for r in cutlass.range(cute.size(row_scale_pv), unroll_full=True):
+                row = tOcO_mn_finalize[r, 0][0]
+                row_scale_pv[r] = sRowScale[2, row]
+                lse[r] = sLSE[row]
+            self._rescale_O(acc_O, row_scale_pv)
+        else:
+            sink_val = None
+            if const_expr(learnable_sink is not None):
+                if const_expr(not self.pack_gqa):
+                    sink_val = Float32(learnable_sink[head_idx])
+                else:
+                    sink_val = cute.make_rmem_tensor_like(softmax.row_max, Float32)
+                    cS = cute.make_identity_tensor((self.tile_m, self.tile_n))
+                    tScS_mn_finalize = layout_utils.reshape_acc_to_mn(
+                        thr_mma_qk.partition_C(cS)
+                    )
+                    for r in cutlass.range(cute.size(sink_val), unroll_full=True):
+                        row = m_block * self.tile_m + tScS_mn_finalize[r][0]
+                        q_head_idx = (
+                            row % self.qhead_per_kvhead
+                            + head_idx * self.qhead_per_kvhead
+                        )
+                        sink_val[r] = Float32(learnable_sink[q_head_idx])
+            if const_expr(self.is_split_kv and learnable_sink is not None):
+                if const_expr(not self.pack_gqa):
+                    sink_val = sink_val if split_idx == 0 else -Float32.inf
+                elif split_idx != 0:
+                    sink_val.fill(-Float32.inf)
+            row_scale = softmax.finalize(sink_val=sink_val)
+            softmax.rescale_O(acc_O, row_scale)
+            lse = softmax.row_sum
+
+        self.epilogue(
+            acc_O,
+            lse,
+            mO,
+            mLSE,
+            sO,
+            seqlen,
+            gmem_tiled_copy_O,
+            None,
+            tiled_mma_pv,
+            tidx,
+            m_block,
+            head_idx,
+            batch_idx,
+            split_idx,
+        )
+        return consumer_state
+
+    @cute.jit
+    def compute_one_n_block(
+        self,
+        n_block: Int32,
+        consumer_state: PipelineState,
+        mma_params: SimpleNamespace,
+        smem_copy_params: SimpleNamespace,
+        softmax: Softmax,
+        pipeline_k: PipelineAsync,
+        pipeline_v: PipelineAsync,
+        score_mod: Callable | None,
+        sBias: Optional[cute.Tensor],
+        pipeline_bias: Optional[PipelineAsync],
+        base_softmax_scale: Optional[Float32],
+        apply_bias: bool,
+        batch_idx: Int32,
+        head_idx: Int32,
+        m_block: Int32,
+        seqlen: SeqlenInfoQK,
+        aux_data: AuxData = AuxData(),
+        fastdiv_mods=None,
+        mask_fn: Optional[Callable] = None,
+        is_first_n_block: cutlass.Constexpr = False,
+        check_inf: cutlass.Constexpr = True,
+    ):
+        acc_shape_S = mma_params.thr_mma_qk.partition_shape_C(
+            (self.tile_m, self.tile_n)
+        )
+        acc_S = cute.make_rmem_tensor(acc_shape_S, Float32)
+        acc_S.fill(0.0)
+        k_wait_token = pipeline_k.consumer_try_wait(consumer_state)
+        pipeline_k.consumer_wait(consumer_state, k_wait_token)
+        self._gemm_qk_phase_local(
+            mma_params.thr_mma_qk,
+            acc_S,
+            smem_copy_params.sQ,
+            smem_copy_params.sK[None, None, consumer_state.index],
+            smem_copy_params.smem_thr_copy_Q,
+            smem_copy_params.smem_thr_copy_K,
+        )
+        pipeline_k.consumer_release(consumer_state)
+
+        if const_expr(self.has_bias):
+            self.apply_sheared_bias(
+                acc_S,
+                mma_params.thr_mma_qk,
+                sBias,
+                pipeline_bias,
+                consumer_state,
+                base_softmax_scale,
+                apply_bias,
+            )
+        elif const_expr(N64_FAR):
+            # n64 kernel B: apply_sheared_bias(apply_bias=False) of n54's far loop, verbatim
+            for i in cutlass.range(cute.size(acc_S.shape), unroll_full=True):
+                acc_S[i] = acc_S[i] * base_softmax_scale
+        if const_expr(score_mod is not None):
+            self.apply_score_mod(
+                mma_params.thr_mma_qk,
+                batch_idx,
+                head_idx,
+                m_block,
+                acc_S,
+                n_block,
+                softmax_scale=(
+                    1.0 if const_expr(self.has_bias) else softmax.softmax_scale
+                ),
+                seqlen=seqlen,
+                aux_data=aux_data,
+                fastdiv_mods=fastdiv_mods,
+            )
+        if const_expr(mask_fn is not None):
+            mask_fn(acc_S, n_block=n_block)
+        row_scale = softmax.online_softmax(
+            acc_S, is_first=is_first_n_block, check_inf=check_inf
+        )
+        softmax.rescale_O(mma_params.acc_O, row_scale)
+        rP = cute.make_fragment_like(acc_S, self.dtype)
+        rP.store(acc_S.load().to(self.dtype))
+        tOrP = layout_utils.reshape_acc_to_frgA(rP)
+
+        v_wait_token = pipeline_v.consumer_try_wait(consumer_state)
+        pipeline_v.consumer_wait(consumer_state, v_wait_token)
+        self._gemm_pv_phase_local(
+            mma_params.thr_mma_pv,
+            mma_params.acc_O,
+            tOrP,
+            smem_copy_params.sV[None, None, consumer_state.index],
+            smem_copy_params.smem_thr_copy_V,
+        )
+        pipeline_v.consumer_release(consumer_state)
+        consumer_state.advance()
+        return consumer_state
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n66fb.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n66fb.py
new file mode 100644
index 0000000000000000000000000000000000000000..4066ce9ab4d2f5d0dbd20ab316bba2dff276b5d4
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n66fb.py
@@ -0,0 +1,369 @@
+"""n66 build file n66fb.py (ctrl seat, 2026-11-24; = forms/fb.py f7130ab6 + BANK / Message / TREE_REV). BANK True = form FB, BANK False = form C2
+(the same controller with the FP32 messages read from memory, i.e. message_controllers alone). Form FB: LoopMessageBank.mix on a 2-source bank in ONE Triton kernel per visit, one program per
+BLOCK_M-row block for ALL of the visit's controllers (3 on the attention side, 1 on the MLP side). Meant to be BITWISE equal to
+S3's served pair attn_res(bank, None, queries, normalize_values=True) + message_controllers (n50 build 4 = the served 3 kernels),
+by copying each served order (the helpers are form b build 6's, n50b_fused.py 3df3c785, bitwise in mb8-mb11 with powered controls):
+  - bank stats (image AttnResFwdKernel order): per source, thread t of NT (96 for 3 queries, 64 for 1) holds x[4 NT c + 4 t + v], one
+    fma.rn chain over (c, v) for sum(x * x) (shared by the queries, as in the CuTe kernel) and one per query for sum(x * q); lane
+    butterfly xor 16..1; warps added in order from 0.0; rstd = rsqrt(fma(sumsq, 1/2304, eps)); softmax over the 2 sources;
+    message = mul(fma(p1, x1, fma(p0, x0, 0)), inv) recomputed wherever a message value is needed (never written);
+  - dest / message row RMS: the served _controller_norm order (packed f32x2 tree over f, g, h, b; lane butterfly; warp tree
+    xor 4, 2, 1), computed for RB rows at a time (each size-2 sum is one add, so the order does not depend on the layout);
+  - down: 1024-wide K groups from zero, BLOCK_K tiles in k order (dest tiles then message tiles inside a group), groups summed in
+    order; tiles past K masked to zero as served; on local layers the dest half's normalized tile is shared by the 3 controllers;
+  - mix: bf16 hidden @ gain / forget (K 64 from zero), (1 - tanh(f)) * dest + tanh(g) * message, libdevice tanh, no fp fusion.
+What it removes vs S3 (per 8K chunk, trace map): the bank AttnRes kernels (messages FP32 written 7.25 GB and read back 7.25 GB),
+the per-controller recompute that sank n50 form b build 5 (+37 ms: bank stats and dest reads once per controller program), and the
+row-at-a-time stats pass. Controls (failing on purpose): CHAIN_REV (bank per-thread chain walked backwards), FP_FUSION (launch)."""
+import os
+
+import triton
+import triton.language as tl
+from triton.language.extra import libdevice
+
+_BANK_CFG = {3: (96, 6, 3, 128), 1: (64, 9, 2, 64)}   # queries -> (AttnRes compute threads, vec chunks, warps, stat tile lanes) at D 2304
+
+
+@triton.jit
+def _tree3(v, RB: tl.constexpr, TREE_REV: tl.constexpr = False):
+    """served _controller_norm order on an (RB, 256, 16) tile (element 2048 h + 8 t + 4 g + 2 f + b at [., t, 8 h + 4 g + 2 f + b]).
+    TREE_REV (failing control only): the in-thread tree pairs b first (then f, g, h) instead of f, g, h, b."""
+    q = tl.reshape(v * v, (RB, 256, 2, 2, 2, 2))
+    if TREE_REV:
+        q = tl.sum(q, axis=5)
+        q = tl.sum(q, axis=4)
+        q = tl.sum(q, axis=3)
+        a = tl.sum(q, axis=2)
+    else:
+        q = tl.sum(q, axis=4)
+        q = tl.sum(q, axis=3)
+        q = tl.sum(q, axis=2)
+        a = tl.sum(q, axis=2)
+    a = tl.sum(tl.reshape(a, (RB, 8, 2, 16)), axis=2)
+    a = tl.sum(tl.reshape(a, (RB, 8, 2, 8)), axis=2)
+    a = tl.sum(tl.reshape(a, (RB, 8, 2, 4)), axis=2)
+    a = tl.sum(tl.reshape(a, (RB, 8, 2, 2)), axis=2)
+    a = tl.sum(tl.reshape(a, (RB, 8, 2, 1)), axis=2)
+    a = tl.reshape(a, (RB, 8))
+    a = tl.sum(tl.reshape(a, (RB, 2, 4)), axis=1)
+    a = tl.sum(tl.reshape(a, (RB, 2, 2)), axis=1)
+    return tl.sum(a, axis=1)
+
+
+@triton.jit
+def _warp_tree(a, BLOCK_M: tl.constexpr, NW4: tl.constexpr):
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 16)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 8)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 4)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 2)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 1)), axis=2)
+    return tl.reshape(a, (BLOCK_M, NW4))
+
+
+@triton.jit
+def _warps_in_order(a, BLOCK_M: tl.constexpr, NW: tl.constexpr, NW4: tl.constexpr):
+    """(BLOCK_M, NW4) warp sums -> ((0 + w0) + w1) [+ w2]."""
+    if NW4 == 4:
+        lo, hi = tl.split(tl.reshape(a, (BLOCK_M, 2, 2)))
+        w0, w2 = tl.split(lo)
+        w1, w3 = tl.split(hi)
+        s = (0.0 + w0) + w1
+        if NW == 3:
+            s = s + w2
+    else:
+        w0, w1 = tl.split(a)
+        s = (0.0 + w0) + w1
+    return s
+
+
+@triton.jit
+def _red(a, BLOCK_M: tl.constexpr, NW: tl.constexpr, NTP: tl.constexpr):
+    return _warps_in_order(_warp_tree(a, BLOCK_M, NTP // 32), BLOCK_M, NW, NTP // 32)
+
+
+@triton.jit
+def _probs(ss0, ss1, dd0, dd1, d_rcp, eps, BLOCK_M: tl.constexpr):
+    r0 = libdevice.rsqrt(tl.fma(ss0, d_rcp, eps))
+    r1 = libdevice.rsqrt(tl.fma(ss1, d_rcp, eps))
+    l0 = dd0 * r0
+    l1 = dd1 * r1
+    mx = tl.maximum(tl.maximum(tl.full((BLOCK_M,), float("-inf"), tl.float32), l0), l1)
+    e0 = libdevice.exp(tl.fma(dd0, r0, -mx))
+    e1 = libdevice.exp(tl.fma(dd1, r1, -mx))
+    inv = tl.div_rn(tl.full((BLOCK_M,), 1.0, tl.float32), (0.0 + e0) + e1)
+    return e0 * r0, e1 * r1, inv
+
+
+@triton.jit
+def _msg(x0, x1, p0, p1, inv):
+    return tl.fma(p1, x1, tl.fma(p0, x0, 0.0)) * inv
+
+
+@triton.jit
+def _pick(v, s, BLOCK_M: tl.constexpr, RB: tl.constexpr):
+    """rows [s RB, (s + 1) RB) of a (BLOCK_M,) vector (one nonzero term per output: exact for the positive stats used here)."""
+    v2 = tl.reshape(v, (BLOCK_M // RB, RB))
+    sel = (tl.arange(0, BLOCK_M // RB) == s)[:, None]
+    return tl.sum(tl.where(sel, v2, 0.0), axis=0)
+
+
+@triton.jit
+def _put(full, part, s, BLOCK_M: tl.constexpr, RB: tl.constexpr):
+    f2 = tl.reshape(full, (BLOCK_M // RB, RB))
+    sel = (tl.arange(0, BLOCK_M // RB) == s)[:, None]
+    return tl.reshape(tl.where(sel, part[None, :], f2), (BLOCK_M,))
+
+
+@triton.jit
+def _fb_kernel(
+    Dest, X0, X1, Query, Message, Down, Gain, Forget, Out, T, DEST_STRIDE, MESSAGE_STRIDE, eps, bank_eps, d_rcp,
+    W: tl.constexpr, R: tl.constexpr, BLOCK_R: tl.constexpr, NQ: tl.constexpr, SHARED: tl.constexpr,
+    BLOCK_M: tl.constexpr, BLOCK_K: tl.constexpr, BLOCK_N: tl.constexpr, RB: tl.constexpr,
+    NT: tl.constexpr, NC: tl.constexpr, NW: tl.constexpr, NTP: tl.constexpr,
+    CHAIN_REV: tl.constexpr = False, NUM_STAGES: tl.constexpr = 2, BANK: tl.constexpr = True, TREE_REV: tl.constexpr = False,
+):
+    row0 = tl.program_id(0) * BLOCK_M
+    K: tl.constexpr = 2 * W
+    GROUPS: tl.constexpr = (K + 1023) // 1024
+    ridx = tl.arange(0, BLOCK_M)
+    rows = row0 + ridx
+    row_ok = rows[:, None] < T
+    rbase = rows[:, None].to(tl.int64) * W
+    # ---- pass 0: bank AttnRes statistics, all queries at once (sumsq chains shared) ---- (BANK only)
+    pa0 = tl.zeros((BLOCK_M,), tl.float32)
+    pa1 = pa0
+    ia = pa0
+    pb0 = pa0
+    pb1 = pa0
+    ib = pa0
+    pc0 = pa0
+    pc1 = pa0
+    ic = pa0
+    if BANK:
+        t = tl.arange(0, NTP)
+        t_ok = t < NT
+        s0 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        s1 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        a0 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        a1 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        b0 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        b1 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        c0 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        c1 = tl.zeros((BLOCK_M, NTP), tl.float32)
+        smask = row_ok & t_ok[None, :]
+        for cc in range(NC):                        # dynamic loop (compile time); same chain order
+            for vv in tl.static_range(4):
+                if CHAIN_REV:
+                    c = NC - 1 - cc
+                    v = 3 - vv
+                else:
+                    c = cc
+                    v = vv
+                e = 4 * NT * c + 4 * t + v
+                x0 = tl.load(X0 + rbase + e[None, :], smask, other=0).to(tl.float32)
+                x1 = tl.load(X1 + rbase + e[None, :], smask, other=0).to(tl.float32)
+                s0 = tl.fma(x0, x0, s0)
+                s1 = tl.fma(x1, x1, s1)
+                qa = tl.load(Query + e, t_ok, other=0)
+                a0 = tl.fma(x0, qa[None, :], a0)
+                a1 = tl.fma(x1, qa[None, :], a1)
+                if NQ == 3:
+                    qb = tl.load(Query + W + e, t_ok, other=0)
+                    qc = tl.load(Query + 2 * W + e, t_ok, other=0)
+                    b0 = tl.fma(x0, qb[None, :], b0)
+                    b1 = tl.fma(x1, qb[None, :], b1)
+                    c0 = tl.fma(x0, qc[None, :], c0)
+                    c1 = tl.fma(x1, qc[None, :], c1)
+        ss0 = _red(s0, BLOCK_M, NW, NTP)
+        ss1 = _red(s1, BLOCK_M, NW, NTP)
+        pa0, pa1, ia = _probs(ss0, ss1, _red(a0, BLOCK_M, NW, NTP), _red(a1, BLOCK_M, NW, NTP), d_rcp, bank_eps, BLOCK_M)
+        pb0 = pa0
+        pb1 = pa1
+        ib = ia
+        pc0 = pa0
+        pc1 = pa1
+        ic = ia
+        if NQ == 3:
+            pb0, pb1, ib = _probs(ss0, ss1, _red(b0, BLOCK_M, NW, NTP), _red(b1, BLOCK_M, NW, NTP), d_rcp, bank_eps, BLOCK_M)
+            pc0, pc1, ic = _probs(ss0, ss1, _red(c0, BLOCK_M, NW, NTP), _red(c1, BLOCK_M, NW, NTP), d_rcp, bank_eps, BLOCK_M)
+    # ---- pass 1: dest / message row RMS in the served order, RB rows at a time ----
+    tt = tl.arange(0, 256)
+    ii = tl.arange(0, 16)
+    off = (ii[None, :] // 8) * 2048 + tt[:, None] * 8 + (ii[None, :] % 8)          # (256, 16)
+    rj = tl.arange(0, RB)
+    rd_a = tl.zeros((BLOCK_M,), tl.float32)
+    rd_b = tl.zeros((BLOCK_M,), tl.float32)
+    rd_c = tl.zeros((BLOCK_M,), tl.float32)
+    rm_a = tl.zeros((BLOCK_M,), tl.float32)
+    rm_b = tl.zeros((BLOCK_M,), tl.float32)
+    rm_c = tl.zeros((BLOCK_M,), tl.float32)
+    for s in range(BLOCK_M // RB):                   # dynamic loop (compile time); rows are independent
+        r3 = (row0 + s * RB + rj)
+        ok3 = (r3 < T)[:, None, None] & (off < W)[None, :, :]
+        o3 = r3.to(tl.int64)[:, None, None] * W + off[None, :, :]
+        if BANK:
+            z0 = tl.load(X0 + o3, ok3, other=0).to(tl.float32)
+            z1 = tl.load(X1 + o3, ok3, other=0).to(tl.float32)
+        za = tl.load(Dest + o3, ok3, other=0)
+        rd_a = _put(rd_a, libdevice.rsqrt(tl.div_rn(_tree3(za, RB, TREE_REV), W) + eps), s, BLOCK_M, RB)
+        if BANK:
+            na = _msg(z0, z1, _pick(pa0, s, BLOCK_M, RB)[:, None, None], _pick(pa1, s, BLOCK_M, RB)[:, None, None],
+                      _pick(ia, s, BLOCK_M, RB)[:, None, None])
+        else:
+            na = tl.load(Message + o3, ok3, other=0)
+        rm_a = _put(rm_a, libdevice.rsqrt(tl.div_rn(_tree3(na, RB, TREE_REV), W) + eps), s, BLOCK_M, RB)
+        if NQ == 3:
+            if not SHARED:
+                zb = tl.load(Dest + DEST_STRIDE + o3, ok3, other=0)
+                zc = tl.load(Dest + 2 * DEST_STRIDE + o3, ok3, other=0)
+                rd_b = _put(rd_b, libdevice.rsqrt(tl.div_rn(_tree3(zb, RB, TREE_REV), W) + eps), s, BLOCK_M, RB)
+                rd_c = _put(rd_c, libdevice.rsqrt(tl.div_rn(_tree3(zc, RB, TREE_REV), W) + eps), s, BLOCK_M, RB)
+            if BANK:
+                nb = _msg(z0, z1, _pick(pb0, s, BLOCK_M, RB)[:, None, None], _pick(pb1, s, BLOCK_M, RB)[:, None, None],
+                          _pick(ib, s, BLOCK_M, RB)[:, None, None])
+                nc_ = _msg(z0, z1, _pick(pc0, s, BLOCK_M, RB)[:, None, None], _pick(pc1, s, BLOCK_M, RB)[:, None, None],
+                           _pick(ic, s, BLOCK_M, RB)[:, None, None])
+            else:
+                nb = tl.load(Message + MESSAGE_STRIDE + o3, ok3, other=0)
+                nc_ = tl.load(Message + 2 * MESSAGE_STRIDE + o3, ok3, other=0)
+            rm_b = _put(rm_b, libdevice.rsqrt(tl.div_rn(_tree3(nb, RB, TREE_REV), W) + eps), s, BLOCK_M, RB)
+            rm_c = _put(rm_c, libdevice.rsqrt(tl.div_rn(_tree3(nc_, RB, TREE_REV), W) + eps), s, BLOCK_M, RB)
+    if SHARED:
+        rd_b = rd_a
+        rd_c = rd_a
+    # ---- pass 2: down projection, dest tiles then message tiles in k order inside each 1024-wide group ----
+    rank = tl.arange(0, BLOCK_R)
+    ks = tl.arange(0, BLOCK_K)
+    wk = rank[None, :] < R
+    ha = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+    hb = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+    hc = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+    for group in tl.static_range(GROUPS):
+        G0 = group * 1024
+        ND = (1024 if W - G0 >= 1024 else (W - G0 if W > G0 else 0)) // BLOCK_K   # dest tiles of this group (compile time)
+        qa_ = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+        qb_ = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+        qc_ = tl.zeros((BLOCK_M, BLOCK_R), tl.float32)
+        for tile in tl.range(0, ND, num_stages=NUM_STAGES):
+            k = G0 + tile * BLOCK_K + ks
+            xa = tl.load(Dest + rbase + k[None, :], row_ok, other=0)
+            wa = tl.load(Down + rank[None, :] * K + k[:, None], wk, other=0)
+            qa_ = tl.dot((xa * rd_a[:, None]).to(tl.bfloat16), wa, qa_)
+            if NQ == 3:
+                wb = tl.load(Down + R * K + rank[None, :] * K + k[:, None], wk, other=0)
+                wc = tl.load(Down + 2 * R * K + rank[None, :] * K + k[:, None], wk, other=0)
+                if SHARED:
+                    qb_ = tl.dot((xa * rd_b[:, None]).to(tl.bfloat16), wb, qb_)
+                    qc_ = tl.dot((xa * rd_c[:, None]).to(tl.bfloat16), wc, qc_)
+                else:
+                    xb = tl.load(Dest + DEST_STRIDE + rbase + k[None, :], row_ok, other=0)
+                    xc = tl.load(Dest + 2 * DEST_STRIDE + rbase + k[None, :], row_ok, other=0)
+                    qb_ = tl.dot((xb * rd_b[:, None]).to(tl.bfloat16), wb, qb_)
+                    qc_ = tl.dot((xc * rd_c[:, None]).to(tl.bfloat16), wc, qc_)
+        for tile in tl.range(ND, 1024 // BLOCK_K, num_stages=NUM_STAGES):
+            k = G0 + tile * BLOCK_K + ks
+            kin = (k[None, :] >= W) & (k[None, :] < K)
+            mofs = rbase + (k[None, :] - W)
+            if BANK:
+                y0 = tl.load(X0 + mofs, row_ok & kin, other=0).to(tl.float32)
+                y1 = tl.load(X1 + mofs, row_ok & kin, other=0).to(tl.float32)
+                ma = _msg(y0, y1, pa0[:, None], pa1[:, None], ia[:, None])
+            else:
+                ma = tl.load(Message + mofs, row_ok & kin, other=0)
+            kw = wk & (k[:, None] < K)
+            wa = tl.load(Down + rank[None, :] * K + k[:, None], kw, other=0)
+            qa_ = tl.dot((ma * rm_a[:, None]).to(tl.bfloat16), wa, qa_)
+            if NQ == 3:
+                if BANK:
+                    mb = _msg(y0, y1, pb0[:, None], pb1[:, None], ib[:, None])
+                    mc = _msg(y0, y1, pc0[:, None], pc1[:, None], ic[:, None])
+                else:
+                    mb = tl.load(Message + MESSAGE_STRIDE + mofs, row_ok & kin, other=0)
+                    mc = tl.load(Message + 2 * MESSAGE_STRIDE + mofs, row_ok & kin, other=0)
+                wb = tl.load(Down + R * K + rank[None, :] * K + k[:, None], kw, other=0)
+                wc = tl.load(Down + 2 * R * K + rank[None, :] * K + k[:, None], kw, other=0)
+                qb_ = tl.dot((mb * rm_b[:, None]).to(tl.bfloat16), wb, qb_)
+                qc_ = tl.dot((mc * rm_c[:, None]).to(tl.bfloat16), wc, qc_)
+        if group == 0:
+            ha = qa_
+            hb = qb_
+            hc = qc_
+        else:
+            ha = ha + qa_
+            hb = hb + qb_
+            hc = hc + qc_
+    ha = ha.to(tl.bfloat16)
+    hb = hb.to(tl.bfloat16)
+    hc = hc.to(tl.bfloat16)
+    # ---- pass 3: gain / forget and the tanh mix; dest and bank tiles loaded once for all controllers ----
+    for start in tl.range(0, W, BLOCK_N, num_stages=NUM_STAGES):
+        cn = start + tl.arange(0, BLOCK_N)
+        col_ok = cn[None, :] < W
+        mask = row_ok & col_ok
+        wofs = cn[None, :] * R + rank[:, None]
+        wok = col_ok & (rank[:, None] < R)
+        offs = rbase + cn[None, :]
+        if BANK:
+            y0 = tl.load(X0 + offs, mask, other=0).to(tl.float32)
+            y1 = tl.load(X1 + offs, mask, other=0).to(tl.float32)
+            ma = _msg(y0, y1, pa0[:, None], pa1[:, None], ia[:, None])
+        else:
+            ma = tl.load(Message + offs, mask, other=0)
+        da = tl.load(Dest + offs, mask, other=0)
+        g = tl.dot(ha, tl.load(Gain + wofs, wok, other=0))
+        f = tl.dot(ha, tl.load(Forget + wofs, wok, other=0))
+        out = (1.0 - libdevice.tanh(f)) * da + libdevice.tanh(g) * ma
+        tl.store(Out + offs, out, mask)
+        if NQ == 3:
+            if SHARED:
+                db = da
+                dc = da
+            else:
+                db = tl.load(Dest + DEST_STRIDE + offs, mask, other=0)
+                dc = tl.load(Dest + 2 * DEST_STRIDE + offs, mask, other=0)
+            g = tl.dot(hb, tl.load(Gain + W * R + wofs, wok, other=0))
+            f = tl.dot(hb, tl.load(Forget + W * R + wofs, wok, other=0))
+            if BANK:
+                mb = _msg(y0, y1, pb0[:, None], pb1[:, None], ib[:, None])
+            else:
+                mb = tl.load(Message + MESSAGE_STRIDE + offs, mask, other=0)
+            out = (1.0 - libdevice.tanh(f)) * db + libdevice.tanh(g) * mb
+            tl.store(Out + T * W + offs, out, mask)
+            g = tl.dot(hc, tl.load(Gain + 2 * W * R + wofs, wok, other=0))
+            f = tl.dot(hc, tl.load(Forget + 2 * W * R + wofs, wok, other=0))
+            if BANK:
+                mc = _msg(y0, y1, pc0[:, None], pc1[:, None], ic[:, None])
+            else:
+                mc = tl.load(Message + 2 * MESSAGE_STRIDE + offs, mask, other=0)
+            out = (1.0 - libdevice.tanh(f)) * dc + libdevice.tanh(g) * mc
+            tl.store(Out + 2 * T * W + offs, out, mask)
+
+
+def fb_controllers(dest, dest_stride, x0, x1, queries, down, gain, forget, out, eps=1e-6, bank_eps=1e-6,
+                   block_m=16, block_k=64, block_n=64, rb=1, num_warps=8, num_stages=2, fp_fusion=False, chain_rev=False,
+                   message=None, message_stride=0, tree_rev=False, maxnreg=None):
+    """dest: base tensor + element stride between controllers (0 = one shared stream), as inkling2_loop._stacked returns;
+    x0 / x1: the two BF16 bank sources (T, W) (form FB, message None) or message + message_stride: the FP32 messages as
+    _stacked returns them (form C2: the bank AttnRes ran); queries: (num, W) fp32 scaled loop queries (FB only); down (num, R, 2W),
+    gain / forget (num, W, R) bf16; out: (num, T, W) fp32 contiguous. Returns out (the launch handle in fb_controllers.last)."""
+    num, rank, k = down.shape
+    tokens, width = out.shape[1], out.shape[2]
+    bank = message is None
+    assert width == 2304 and num in _BANK_CFG and k == 2 * width and out.is_contiguous()
+    assert down.is_contiguous() and gain.is_contiguous() and forget.is_contiguous()
+    if bank:
+        assert queries.shape == (num, width) and queries.is_contiguous() and x0.is_contiguous() and x1.is_contiguous()
+    else:
+        x0 = x1 = queries = message
+    assert 256 % block_k == 0 and block_m % rb == 0
+    nt, nc, nw, ntp = _BANK_CFG[num]
+    shared = num == 1 or dest_stride == 0
+    grid = (triton.cdiv(tokens, block_m),)
+    fb_controllers.last = _fb_kernel[grid](
+        dest, x0, x1, queries, message if message is not None else dest, down, gain, forget, out, tokens, dest_stride,
+        message_stride, eps, bank_eps, 1.0 / width,
+        width, rank, max(16, triton.next_power_of_2(rank)), num, shared, block_m, block_k, block_n, rb, nt, nc, nw, ntp,
+        chain_rev, num_stages, bank, tree_rev, num_warps=num_warps, num_stages=num_stages, enable_fp_fusion=fp_fusion,
+        **({"maxnreg": maxnreg} if maxnreg else {}),   # ptxas register cap only (allocation, not arithmetic)
+    )
+    return out
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n71_resnorm.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n71_resnorm.py
new file mode 100644
index 0000000000000000000000000000000000000000..8e8a5451acb19e27db40a8a2dca7156ba41831e4
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n71_resnorm.py
@@ -0,0 +1,257 @@
+"""n71 G2 resnorm (stack seat, 2026-11-22; GENERATED by make_g2.py, do not edit by hand): the served
+attn_res(..., normalize_values=True) [kernels/ops/attention/inkling2_attn_res.py AttnResFwdKernel] + the RMSNorm it feeds
+[kernels/ops/layernorm/inkling2_rms_norm.py RMSNormFwd] in one kernel, never writing the FP32 AttnRes output. Orders: the
+AttnRes statistics, softmax and output chain as n50b build 6 read them from the image PTX / SASS (bitwise in mb9-mb11),
+generalized to N sources and the partial addend (add.rn on the last source, as compute_qk / compute_pv); the norm as
+n71_loopnorm.py (G3). Controls: NORM_ORDER 1 (norm groups reversed), PV_REV (output chain over sources reversed)."""
+import os
+
+import torch
+import triton
+import triton.language as tl
+from triton.language.extra import libdevice
+
+
+@triton.jit
+def _warp_tree(a, BLOCK_M: tl.constexpr, NW4: tl.constexpr):
+    """(BLOCK_M, 32 NW4) per-thread partials -> (BLOCK_M, NW4) warp sums by the butterfly xor 16, 8, 4, 2, 1 (lane 0's value)."""
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 16)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 8)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 4)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 2)), axis=2)
+    a = tl.sum(tl.reshape(a, (BLOCK_M, NW4, 2, 1)), axis=2)
+    return tl.reshape(a, (BLOCK_M, NW4))
+
+
+@triton.jit
+def _warps_in_order(a, BLOCK_M: tl.constexpr, NW: tl.constexpr, NW4: tl.constexpr, WARP_REV: tl.constexpr = False):
+    """(BLOCK_M, NW4) warp sums -> ((0 + w0) + w1) [+ w2], extracted by splits (no arithmetic). WARP_REV (failing control
+    only): the warps added in reverse order."""
+    if NW4 == 4:
+        lo, hi = tl.split(tl.reshape(a, (BLOCK_M, 2, 2)))   # lo = (w0, w2), hi = (w1, w3)
+        w0, w2 = tl.split(lo)
+        w1, w3 = tl.split(hi)
+        if WARP_REV:
+            if NW == 3:
+                s = ((0.0 + w2) + w1) + w0
+            else:
+                s = (0.0 + w1) + w0
+        else:
+            s = (0.0 + w0) + w1
+            if NW == 3:
+                s = s + w2
+    else:
+        w0, w1 = tl.split(a)
+        if WARP_REV:
+            s = (0.0 + w1) + w0
+        else:
+            s = (0.0 + w0) + w1
+    return s
+
+
+@triton.jit
+def _lane_chain(acc, x, BLOCK_M: tl.constexpr, NORM_ORDER: tl.constexpr):
+    """Add one 64-column tile (half of a 128-column group j: 16 lanes) of the row's squares into acc[BLOCK_M, 16 lanes] in
+    the served order: column 128 j + 64 h + 4 l + v -> lane 16 h + l, v = 0, 1, 2, 3 in order (fma), as the served
+    thread's in-register chain."""
+    x4 = tl.reshape(x, (BLOCK_M, 16, 2, 2))      # [r, l, i, k], v = 2 i + k
+    a, b = tl.split(x4)                           # a: v in (0, 2), b: v in (1, 3), indexed by i
+    x0, x2 = tl.split(a)
+    x1, x3 = tl.split(b)
+    if NORM_ORDER == 2:                           # control: no contraction
+        acc = acc + x0 * x0
+        acc = acc + x1 * x1
+        acc = acc + x2 * x2
+        acc = acc + x3 * x3
+    else:
+        acc = tl.fma(x0, x0, acc)
+        acc = tl.fma(x1, x1, acc)
+        acc = tl.fma(x2, x2, acc)
+        acc = tl.fma(x3, x3, acc)
+    return acc
+
+
+@triton.jit
+def _lane_tree(acc_lo, acc_hi, BLOCK_M: tl.constexpr):
+    """The served lane butterfly xor 16, 8, 4, 2, 1: xor 16 = lane l + lane l + 16 = acc_lo + acc_hi, then each step is one
+    add over a size-2 axis (commutative, so the order does not depend on the layout this kernel gets)."""
+    s = acc_lo + acc_hi
+    s = tl.sum(tl.reshape(s, (BLOCK_M, 2, 8)), axis=1)
+    s = tl.sum(tl.reshape(s, (BLOCK_M, 2, 4)), axis=1)
+    s = tl.sum(tl.reshape(s, (BLOCK_M, 2, 2)), axis=1)
+    s = tl.sum(tl.reshape(s, (BLOCK_M, 2, 1)), axis=1)
+    return tl.reshape(s, (BLOCK_M,))
+
+@triton.jit
+def _src(X0, X1, X2, X3, X4, n: tl.constexpr):
+    if n == 0:
+        return X0
+    elif n == 1:
+        return X1
+    elif n == 2:
+        return X2
+    elif n == 3:
+        return X3
+    else:
+        return X4
+
+
+@triton.jit
+def _pick3(a, idx, n: tl.constexpr):
+    """slot n of the last axis of a 3-D tensor (one nonzero term plus zeros: the value itself)."""
+    return tl.sum(tl.where(idx == n, a, 0.0), axis=2)
+
+
+@triton.jit
+def _pick2(a, idx, n: tl.constexpr):
+    """slot n of the last axis of a 2-D tensor."""
+    return tl.sum(tl.where(idx == n, a, 0.0), axis=1)
+
+
+@triton.jit
+def _load_src(X0, X1, X2, X3, X4, Addend, base, e, mask, n: tl.constexpr, N: tl.constexpr, HAS_ADDEND: tl.constexpr):
+    """source n at element offsets e (FP32); the last source carries the partial addend: x = add.rn(x, addend)."""
+    x = tl.load(_src(X0, X1, X2, X3, X4, n) + base + e, mask, other=0).to(tl.float32)
+    if HAS_ADDEND:
+        if n == N - 1:
+            x = x + tl.load(Addend + base + e, mask, other=0).to(tl.float32)
+    return x
+
+
+@triton.jit
+def _mix_tile(X0, X1, X2, X3, X4, Addend, P, inv, nidx, base, cols, mask, N: tl.constexpr, HAS_ADDEND: tl.constexpr,
+              BLOCK_M: tl.constexpr, QP: tl.constexpr, BLOCK_N: tl.constexpr, INTERP: tl.constexpr, PV_REV: tl.constexpr):
+    """AttnRes output on a (BLOCK_M, QP, BLOCK_N) tile: mul.rn(fma.rn chain over sources n of (p_n, x_n) from 0, inv), the
+    served compute_pv order (PV_REV: failing control, sources walked backwards)."""
+    acc = tl.zeros((BLOCK_M, QP, BLOCK_N), tl.float32)
+    for nn in tl.static_range(N):
+        n = nn + PV_REV * (N - 1 - 2 * nn)            # PV_REV (control): N - 1 - nn
+        x = _load_src(X0, X1, X2, X3, X4, Addend, base, cols[None, :], mask, n, N, HAS_ADDEND)
+        p = _pick3(P, nidx[None, None, :], n)
+        if INTERP:
+            acc = p[:, :, None] * x[:, None, :] + acc
+        else:
+            acc = tl.fma(p[:, :, None], x[:, None, :], acc)
+    return acc * inv[:, :, None]
+
+
+@triton.jit
+def _resnorm_kernel(
+    X0, X1, X2, X3, X4, Addend, Query, NormW, Y, T, d_rcp, eps, norm_eps, NORMW_STRIDE,
+    W: tl.constexpr, N: tl.constexpr, HAS_ADDEND: tl.constexpr, Q: tl.constexpr, QP: tl.constexpr, NP: tl.constexpr,
+    NT: tl.constexpr, NC: tl.constexpr, NW: tl.constexpr, NTP: tl.constexpr, BLOCK_M: tl.constexpr,
+    INTERP: tl.constexpr = False, NORM_ORDER: tl.constexpr = 0, PV_REV: tl.constexpr = False, STORE_MIX: tl.constexpr = False,
+):
+    tl.static_assert(W % 128 == 0, "W must be a whole number of 128-column groups")
+    tl.static_assert(4 * NT * NC == W, "served AttnRes layout: thread t of NT holds x[4 NT c + 4 t + v]")
+    row0 = tl.program_id(0) * BLOCK_M
+    ridx = tl.arange(0, BLOCK_M)
+    rows = row0 + ridx
+    row_ok = rows[:, None] < T
+    base = rows[:, None].to(tl.int64) * W
+    t = tl.arange(0, NTP)
+    t_ok = t < NT
+    qi = tl.arange(0, QP)
+    q_ok = qi < Q
+    nidx = tl.arange(0, NP)
+    # pass A: the served AttnResFwdKernel statistics per source (n50b's order, generalized to N sources + the addend)
+    DD = tl.zeros((BLOCK_M, QP, NP), tl.float32)
+    RR = tl.zeros((BLOCK_M, NP), tl.float32)
+    for n in tl.static_range(N):
+        s = tl.zeros((BLOCK_M, NTP), tl.float32)
+        d = tl.zeros((BLOCK_M, QP, NTP), tl.float32)
+        for c in tl.static_range(NC):
+            for v in tl.static_range(4):
+                e = 4 * NT * c + 4 * t + v
+                x = _load_src(X0, X1, X2, X3, X4, Addend, base, e[None, :], row_ok & t_ok[None, :], n, N, HAS_ADDEND)
+                qv = tl.load(Query + qi[:, None] * W + e[None, :], q_ok[:, None] & t_ok[None, :], other=0)
+                if INTERP:
+                    s = x * x + s
+                    d = x[:, None, :] * qv[None, :, :] + d
+                else:
+                    s = tl.fma(x, x, s)
+                    d = tl.fma(x[:, None, :], qv[None, :, :], d)
+        ss = _warps_in_order(_warp_tree(s, BLOCK_M, NTP // 32), BLOCK_M, NW, NTP // 32)
+        dd = tl.reshape(_warps_in_order(_warp_tree(tl.reshape(d, (BLOCK_M * QP, NTP)), BLOCK_M * QP, NTP // 32),
+                                        BLOCK_M * QP, NW, NTP // 32), (BLOCK_M, QP))
+        if INTERP:
+            r = tl.rsqrt(ss * d_rcp + eps)
+        else:
+            r = libdevice.rsqrt(tl.fma(ss, d_rcp, eps))
+        RR = tl.where(nidx[None, :] == n, r[:, None], RR)
+        DD = tl.where(nidx[None, None, :] == n, dd[:, :, None], DD)
+    # softmax over the sources in order (one thread per query in the served kernel)
+    mx = tl.full((BLOCK_M, QP), float("-inf"), tl.float32)
+    for n in tl.static_range(N):
+        mx = tl.maximum(mx, _pick3(DD, nidx[None, None, :], n) * _pick2(RR, nidx[None, :], n)[:, None])
+    ssum = tl.zeros((BLOCK_M, QP), tl.float32)
+    P = tl.zeros((BLOCK_M, QP, NP), tl.float32)
+    for n in tl.static_range(N):
+        dn = _pick3(DD, nidx[None, None, :], n)
+        rn = _pick2(RR, nidx[None, :], n)[:, None]
+        if INTERP:
+            ex = tl.exp(dn * rn - mx)
+        else:
+            ex = libdevice.exp(tl.fma(dn, rn, -mx))
+        ssum = ssum + ex
+        P = tl.where(nidx[None, None, :] == n, (ex * rn)[:, :, None], P)
+    if INTERP:
+        inv = 1.0 / ssum
+    else:
+        inv = tl.div_rn(tl.full((BLOCK_M, QP), 1.0, tl.float32), ssum)
+    mask3 = row_ok[:, :, None] & q_ok[None, :, None]
+    # pass B: the output tile by tile, squares into the served RMSNorm order (64-column halves: lanes 16 h .. 16 h + 15)
+    acc_lo = tl.zeros((BLOCK_M * QP, 16), tl.float32)
+    acc_hi = tl.zeros((BLOCK_M * QP, 16), tl.float32)
+    for jj in tl.range(0, W // 128):
+        if NORM_ORDER == 1:   # control: groups j descending
+            j = W // 128 - 1 - jj
+        else:
+            j = jj
+        for h in tl.static_range(2):
+            cols = 128 * j + 64 * h + tl.arange(0, 64)
+            out = _mix_tile(X0, X1, X2, X3, X4, Addend, P, inv, nidx, base, cols, row_ok, N, HAS_ADDEND, BLOCK_M, QP, 64,
+                            INTERP, PV_REV)
+            if h == 0:
+                acc_lo = _lane_chain(acc_lo, tl.reshape(out, (BLOCK_M * QP, 64)), BLOCK_M * QP, NORM_ORDER)
+            else:
+                acc_hi = _lane_chain(acc_hi, tl.reshape(out, (BLOCK_M * QP, 64)), BLOCK_M * QP, NORM_ORDER)
+    sumsq = tl.reshape(_lane_tree(acc_lo, acc_hi, BLOCK_M * QP), (BLOCK_M, QP))
+    if INTERP:
+        rstd = 1.0 / tl.sqrt(sumsq / W + norm_eps)
+    else:
+        rstd = libdevice.rsqrt(tl.div_rn(sumsq, W) + norm_eps)
+    # pass C: the output recomputed, normalized, stored (STORE_MIX debug: the FP32 AttnRes output itself)
+    for j in tl.range(0, W // 64):
+        cols = 64 * j + tl.arange(0, 64)
+        out = _mix_tile(X0, X1, X2, X3, X4, Addend, P, inv, nidx, base, cols, row_ok, N, HAS_ADDEND, BLOCK_M, QP, 64,
+                        INTERP, PV_REV)
+        offs = qi[None, :, None].to(tl.int64) * T * W + base[:, :, None] + cols[None, None, :]
+        if STORE_MIX:
+            tl.store(Y + offs, out, mask3)
+        else:
+            w = tl.load(NormW + qi[:, None] * NORMW_STRIDE + cols[None, :], q_ok[:, None], other=0).to(tl.float32)
+            y = (out * rstd[:, :, None]) * w[None, :, :]
+            tl.store(Y + offs, y.to(Y.dtype.element_ty), mask3)
+
+
+_LAYOUT = {1: (64, 9, 2, 64), 3: (96, 6, 3, 128)}   # served AttnRes config for W 2304: (threads, chunks, warps, padded threads)
+
+
+def resnorm(sources, addend, queries, norm_w, y, eps=1e-6, norm_eps=1e-6, block_m=4, num_warps=4, norm_order=0, pv_rev=False,
+            store_mix=False):
+    """sources: [*blocks, partial] BF16 [T, W] (2..5), addend: BF16 [T, W] or None (added to the last source), queries: the
+    scaled FP32 queries [Q, W], norm_w: [W] (shared) or [Q, W] (q / k / v norms), y: [Q, T, W] (BF16; FP32 for debug)."""
+    T, W = sources[0].shape
+    N, Q = len(sources), queries.shape[0]
+    assert 2 <= N <= 5 and Q in _LAYOUT and W == 2304
+    nt, nc, nw, ntp = _LAYOUT[Q]
+    xs = list(sources) + [sources[0]] * (5 - N)
+    nws = 0 if norm_w.dim() == 1 else norm_w.stride(0)
+    _resnorm_kernel[(triton.cdiv(T, block_m),)](
+        *xs, addend if addend is not None else sources[0], queries, norm_w, y, T, float(torch.tensor(1.0 / W, dtype=torch.float32)),
+        eps, norm_eps, nws, W, N, addend is not None, Q, 4 if Q > 1 else 1, 8, nt, nc, nw, ntp, block_m,
+        os.environ.get("TRITON_INTERPRET") == "1", norm_order, pv_rev, store_mix,
+        num_warps=num_warps, enable_fp_fusion=False,
+    )
+    return y
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n71_sconvres.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n71_sconvres.py
new file mode 100644
index 0000000000000000000000000000000000000000..4e200eefd2b3b6c6ec65a9c095c0f04550c303d7
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n71_sconvres.py
@@ -0,0 +1,135 @@
+"""n71 G1 sconvres (stack seat, 2026-11-22; GENERATED by make_g1.py from the image's inkling2_sconv.py f65e8906, do not edit
+by hand): the MLP short convolution of an extend batch (served tiled kernel, rows >= PREFILL_MIN_ROWS 2048, static weights,
+residual) fused with the layer's residual update (residual_add or the block-boundary add), so the BF16 conv output is never
+written and read back (saves 2 B per element of [rows, 2304] per visit). Bit-identical by construction: the conv code is the
+image kernel's text, its accumulator is rounded to BF16 exactly where the served store rounds it, and the residual sum keeps
+residual_add's FP32 order from zeros. The sconv cache prepare / update calls around it stay the served ones.
+ROUND_CONV False = the failing control (FP32 conv added without its BF16 rounding)."""
+import torch
+import triton
+import triton.language as tl
+
+PREFILL_MIN_ROWS = 2048
+
+
+@triton.jit
+def _sconv_residual_kernel(
+    X,
+    Weight,
+    Dynamic,
+    Cache,
+    Indices,
+    Mask,
+    Cu,
+    Seq,
+    Y,
+    Attn,
+    Partial,
+    n_rows,
+    SX: tl.constexpr,
+    SW0: tl.constexpr,
+    SW1: tl.constexpr,
+    SC0: tl.constexpr,
+    SC1: tl.constexpr,
+    SC2: tl.constexpr,
+    D: tl.constexpr,
+    W: tl.constexpr,
+    HEAD_DIM: tl.constexpr,
+    DYNAMIC: tl.constexpr,
+    RESIDUAL: tl.constexpr,
+    SCALE: tl.constexpr,
+    BM: tl.constexpr,
+    BN: tl.constexpr,
+    USE_PDL: tl.constexpr = False,
+    HAS_PARTIAL: tl.constexpr = True,
+    ROUND_CONV: tl.constexpr = True,
+):
+    """n71 G1: the image _sconv_prefill_kernel (verbatim above the store) + the residual update in the served order."""
+    if USE_PDL:
+        tl.extra.cuda.gdc_wait()
+        tl.extra.cuda.gdc_launch_dependents()
+    rows = tl.program_id(0) * BM + tl.arange(0, BM)
+    col = tl.program_id(1) * BN + tl.arange(0, BN)
+    valid = (rows < n_rows)[:, None] & (col < D)[None, :]
+    rows = tl.minimum(rows, n_rows - 1)
+    seq = tl.load(Seq + rows)
+    bos = tl.load(Cu + seq)
+    slot = tl.load(Indices + seq).to(tl.int64)
+    has_cache = (tl.load(Mask + seq) != 0) & (slot > 0)
+    current = tl.load(X + rows[:, None] * SX + col[None, :], valid, other=0).to(
+        tl.float32
+    )
+    acc = tl.full((BM, BN), 0, tl.float32)
+    for tap in tl.static_range(W):
+        lag = tap if DYNAMIC else W - 1 - tap
+        src = rows - lag
+        from_x = (src >= bos)[:, None]
+        value = tl.load(
+            X + src[:, None] * SX + col[None, :], valid & from_x, other=0
+        ).to(tl.float32)
+        prefix = tl.load(
+            Cache
+            + slot[:, None] * SC0
+            + (src - bos + W - 1)[:, None] * SC1
+            + col[None, :] * SC2,
+            valid & ~from_x & has_cache[:, None],
+            other=0,
+        ).to(tl.float32)
+        value = tl.where(from_x, value, prefix)
+        if DYNAMIC:
+            dyn = tl.load(
+                Dynamic
+                + rows[:, None] * (D // HEAD_DIM) * W
+                + (col // HEAD_DIM)[None, :] * W
+                + lag,
+                valid,
+                other=0,
+            ).to(tl.float32)
+            weight = tl.load(Weight + lag * SW0 + col * SW1, col < D, other=0).to(
+                tl.float32
+            )
+            weight = weight[None, :] + dyn
+        else:
+            weight = (
+                tl.load(Weight + col * SW0 + tap * SW1, col < D, other=0)
+                .to(X.dtype.element_ty)
+                .to(tl.float32)
+            )[None, :]
+        if DYNAMIC and tap == 0:
+            acc = value * weight
+        else:
+            acc = tl.fma(value, weight, acc)
+    if RESIDUAL:
+        acc = acc + current
+    acc = acc * SCALE
+
+    if ROUND_CONV:
+        conv = acc.to(tl.bfloat16).to(tl.float32)    # the served BF16 output of the conv, read back by residual_add / torch add
+    else:
+        conv = acc                                    # control: no BF16 rounding of the conv
+    attn = tl.load(Attn + rows[:, None] * D + col[None, :], valid, other=0).to(tl.float32)
+    if HAS_PARTIAL:                                   # residual_add(partial, attention, conv): FP32 from zeros, argument order
+        total = tl.zeros((BM, BN), tl.float32)
+        total += tl.load(Partial + rows[:, None] * D + col[None, :], valid, other=0).to(tl.float32)
+        total += attn
+        total += conv
+    else:                                             # block boundary: attention + conv (torch BF16 add)
+        total = attn + conv
+    tl.store(Y + rows[:, None] * D + col[None, :], total, valid)
+
+
+def sconv_residual(x, weight, cache, metadata, attention, partial=None, *, round_conv=True, use_pdl=False):
+    """Served-equivalent of short_convolution(x, weight, cache, metadata) (extend, static weights, residual, rows >= 2048)
+    followed by residual_add(partial, attention, conv) (or attention + conv when partial is None). Returns the new partial."""
+    assert x.shape[0] >= PREFILL_MIN_ROWS and x.stride(-1) == 1 and attention.shape == x.shape
+    width = weight.shape[1]
+    scale = (width + 1) ** -0.5
+    out = torch.empty_like(attention if partial is None else partial)
+    _sconv_residual_kernel[(triton.cdiv(x.shape[0], 16), triton.cdiv(x.shape[1], 128))](
+        x, weight, None, cache, metadata["safe_idx"], metadata["cache_mask"], metadata["cu"], metadata["si"],
+        out, attention.contiguous(), partial.contiguous() if partial is not None else None, x.shape[0],
+        x.stride(0), *weight.stride(), *cache.stride(), x.shape[1], width, x.shape[1], False, True, scale, 16, 128,
+        HAS_PARTIAL=partial is not None, ROUND_CONV=round_conv, enable_fp_fusion=False,
+        **({"USE_PDL": True, "launch_pdl": True} if use_pdl else {}),
+    )
+    return out
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_c12.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_c12.py
new file mode 100644
index 0000000000000000000000000000000000000000..f91d0016d42e2d5f704f39d7d9a116b012794d25
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_c12.py
@@ -0,0 +1,188 @@
+"""n75 c12 (inkling2-spark packed seat, 2026-11-22): exact 12-bit packed BF16 weights for the served small-M GEMV.
+
+Format (ported from the OKC bf16 board champion's sm_c12 format, problems/bf16/champion.py sm_c12_bytes l.663 /
+sm_c12_unpack l.686 / sm_pack_format l.709: low byte + sign + a 3-bit code of the upper seven exponent bits in a window):
+  v = BF16 bits; lo = v & 0xFF (exponent LSB + 7 mantissa bits); s = v >> 15; eh = (v >> 8) & 0x7F (upper 7 exponent bits).
+  nib = s << 3 | d with d = eh - base[n] when 0 <= d < 7, else d = 7 (ESC).  base is per W row (GRAN 'row') or one value for
+  the matrix (GRAN 'matrix'); it maximises the count of eh in [base, base + 7).
+  LO [N, K] uint8 = lo.  CD [N, K/2] uint8: inside each 256-wide K tile t, byte (n, 128 t + j) = nib(n, 256 t + j) |
+  nib(n, 256 t + 128 + j) << 4, so the low nibbles code the tile's first K half and the high nibbles its second half.
+  1.5 bytes per weight + 1 byte per row.
+  Differences from the board: (1) the window has 7 slots, not 8: code 7 marks an escape IN BAND; (2) an escape is not
+  repaired from an escape list: the kernel reads that element from the resident BF16 original (the served path keeps it for
+  prefill) with a masked load, so the tile fed to the dot is the original BF16 tile bit for bit; (3) base per row by default.
+  pack_c12 checks the round trip bitwise (bits_equal(unpack_c12(pack), w)) and returns None if it fails (the caller then keeps the served path).
+
+Kernel: the served sglang kernels/ops/gemm/sm12x_bf16_gemv.py _gemv_kernel (md5 7c173a3f) shape exactly: BN 32 columns per
+program, BK 256, x rows padded to MP 16, num_warps 4, FP32 accumulation in ONE in-place mma chain over K (Triton 3.7.1 ttgir:
+#mma v2 warpsPerCTA [1, 4], tt.dot(x, w, acc)); here each 256 tile is two chained dots of K 128 (the same 16 m16n8k16 steps
+in the same K order on the same accumulator), so outputs equal the served kernel's bit for bit when the decoded tile equals
+the BF16 tile. BF16 out is RTNE of the FP32 sum (acc.to(bf16)); FP32 out stores the sum.
+Test paths (CPU interpreter only): DEC=1 stores the decoded tile bits instead of the GEMV; F32=1 runs the dot in FP32 'ieee'
+(the interpreter's BF16 dot is broken; work_decode memory note)."""
+import torch
+import triton
+import triton.language as tl
+
+BN, BK = 32, 256
+HK = BK // 2
+WIN = 7  # in-window code values 0..6; 7 = escape
+ESC = 7
+
+
+@triton.jit
+def _c12_gemv_kernel(X, W, LO, CD, BASE, Y, M, N, K, SX, SW, SY,
+                     BN: tl.constexpr, BK: tl.constexpr, MP: tl.constexpr, DEC: tl.constexpr, F32: tl.constexpr,
+                     CTRL: tl.constexpr = 0, DIAG: tl.constexpr = 0):
+    HK: tl.constexpr = BK // 2
+    pid = tl.program_id(0)
+    cols = pid * BN + tl.arange(0, BN)
+    rows = tl.arange(0, MP)
+    cm = cols[None, :] < N
+    c64 = cols[None, :].to(tl.int64)
+    base = tl.load(BASE + cols, cols < N, other=0).to(tl.int32)[None, :]
+    kh = tl.arange(0, HK)
+    acc = tl.zeros((MP, BN), tl.float32)
+    acc2 = tl.zeros((MP, BN), tl.float32)  # CTRL=1 only (failing control: second K halves on their own chain)
+    for k0 in range(0, K, BK):
+        ka = k0 + kh
+        kb = ka + HK
+        cd = tl.load(CD + c64 * (K // 2) + (k0 // 2 + kh)[:, None], cm, other=0).to(tl.int32)
+        lo_a = tl.load(LO + c64 * K + ka[:, None], cm, other=0).to(tl.int32)
+        lo_b = tl.load(LO + c64 * K + kb[:, None], cm, other=0).to(tl.int32)
+        na = cd & 15
+        nb = cd >> 4
+        ea = (na & 7) == 7
+        eb = (nb & 7) == 7
+        ba = (((na >> 3) << 15) | ((base + (na & 7)) << 8) | lo_a).to(tl.uint16).to(tl.bfloat16, bitcast=True)
+        bb = (((nb >> 3) << 15) | ((base + (nb & 7)) << 8) | lo_b).to(tl.uint16).to(tl.bfloat16, bitcast=True)
+        if DIAG == 1:  # timing only: no escape loads (escaped elements decode wrong)
+            wa = ba
+            wb = bb
+        elif DIAG == 2:  # timing / structure only: the raw BF16 tile, no packed bytes used (must equal the served output)
+            wa = tl.load(W + c64 * SW + ka[:, None], cm, other=0.0)
+            wb = tl.load(W + c64 * SW + kb[:, None], cm, other=0.0)
+        else:
+            oa = tl.load(W + c64 * SW + ka[:, None], ea & cm, other=0.0)
+            ob = tl.load(W + c64 * SW + kb[:, None], eb & cm, other=0.0)
+            wa = tl.where(ea, oa, ba)
+            wb = tl.where(eb, ob, bb)
+        if DEC:
+            tl.store(Y + c64 * K + ka[:, None], wa.to(tl.int16, bitcast=True), cm)
+            tl.store(Y + c64 * K + kb[:, None], wb.to(tl.int16, bitcast=True), cm)
+        else:
+            xa = tl.load(X + rows[:, None] * SX + ka[None, :], rows[:, None] < M, other=0.0)
+            xb = tl.load(X + rows[:, None] * SX + kb[None, :], rows[:, None] < M, other=0.0)
+            if F32:
+                acc = tl.dot(xa.to(tl.float32), wa.to(tl.float32), acc, input_precision="ieee")
+                acc = tl.dot(xb.to(tl.float32), wb.to(tl.float32), acc, input_precision="ieee")
+            elif CTRL:
+                acc = tl.dot(xa, wa, acc)
+                acc2 = tl.dot(xb, wb, acc2)
+            else:
+                acc = tl.dot(xa, wa, acc)
+                acc = tl.dot(xb, wb, acc)
+    if CTRL:
+        acc = acc + acc2
+    if not DEC:
+        tl.store(Y + rows[:, None] * SY + cols[None, :], acc.to(Y.dtype.element_ty), (rows[:, None] < M) & cm)
+
+
+def _hist_bases(eh: torch.Tensor) -> torch.Tensor:
+    """Per-row window base maximising the count of eh in [base, base + WIN); eh [rows, K] int64 in 0..127."""
+    h = torch.zeros(eh.shape[0], 128, dtype=torch.int32, device=eh.device)
+    h.scatter_add_(1, eh, torch.ones_like(eh, dtype=torch.int32))
+    c = torch.nn.functional.pad(h.cumsum(1), (1, 0))  # c[:, i] = count of eh < i
+    return (c[:, WIN:] - c[:, :-WIN]).argmax(1)  # [rows] in 0..128 - WIN
+
+
+def _matrix_base(w: torch.Tensor, rows: int) -> int:
+    h = torch.zeros(128, dtype=torch.int64, device=w.device)
+    for r0 in range(0, w.shape[0], rows):
+        h += torch.bincount(((w[r0:r0 + rows].view(torch.int16).to(torch.int32) >> 8) & 0x7F).flatten(), minlength=128)
+    h = h.cpu()
+    return int(torch.stack([h[b:b + WIN].sum() for b in range(128 - WIN + 1)]).argmax())
+
+
+def pack_c12(w: torch.Tensor, gran: str = "row", check: bool = True, rows: int = 8192):
+    """w [N, K] BF16 (K % 256 == 0, unit column stride) -> dict(lo, cd, base, n_esc, ...) or None if the bitwise round trip
+    fails. Works in row chunks of `rows` (temporaries ~ rows x K x 8 B), so packing a 926 MB LM head stays small."""
+    assert w.dtype == torch.bfloat16 and w.dim() == 2 and w.shape[1] % BK == 0 and w.stride(1) == 1, (w.dtype, w.shape)
+    n, k = w.shape
+    dev = w.device
+    lo = torch.empty((n, k), dtype=torch.uint8, device=dev)
+    cd = torch.empty((n, k // 2), dtype=torch.uint8, device=dev)
+    base = torch.empty((n,), dtype=torch.uint8, device=dev)
+    mb = _matrix_base(w, rows) if gran == "matrix" else None
+    n_esc = 0
+    for r0 in range(0, n, rows):
+        r1 = min(n, r0 + rows)
+        v = w[r0:r1].view(torch.int16).to(torch.int32) & 0xFFFF
+        eh = (v >> 8) & 0x7F
+        b = _hist_bases(eh.long()) if mb is None else torch.full((r1 - r0,), mb, dtype=torch.int64, device=dev)
+        d = eh - b[:, None].to(torch.int32)
+        inw = (d >= 0) & (d < WIN)
+        nib = ((v >> 15) << 3) | torch.where(inw, d, torch.full_like(d, ESC))
+        nt = nib.view(r1 - r0, k // BK, 2, HK)
+        cd[r0:r1] = (nt[:, :, 0] | (nt[:, :, 1] << 4)).reshape(r1 - r0, k // 2).to(torch.uint8)
+        lo[r0:r1] = (v & 0xFF).to(torch.uint8)
+        base[r0:r1] = b.to(torch.uint8)
+        n_esc += int((~inw).sum())
+        del v, eh, d, inw, nib, nt
+    pk = {"lo": lo, "cd": cd, "base": base, "n_esc": n_esc, "shape": (n, k), "gran": gran}
+    if check and not check_c12(pk, w, rows):
+        return None
+    return pk
+
+
+def bits_equal(a: torch.Tensor, b: torch.Tensor) -> bool:
+    """Bitwise equality of two BF16 tensors (torch.equal on the float view fails on NaN)."""
+    return a.shape == b.shape and torch.equal(a.contiguous().view(torch.int16), b.contiguous().view(torch.int16))
+
+
+def unpack_c12(pk, w_orig: torch.Tensor, r0: int = 0, r1: int | None = None) -> torch.Tensor:
+    """Reference decode (torch) of rows [r0, r1): in-window elements from the 12-bit fields, escapes from the resident original."""
+    n, k = pk["shape"]
+    r1 = n if r1 is None else r1
+    cd = pk["cd"][r0:r1].to(torch.int32).view(r1 - r0, k // BK, 1, HK)
+    nib = torch.cat([cd & 15, cd >> 4], dim=2).view(r1 - r0, k)
+    bits = ((nib >> 3) << 15) | ((pk["base"][r0:r1].to(torch.int32)[:, None] + (nib & 7)) << 8) | pk["lo"][r0:r1].to(torch.int32)
+    bits = torch.where((nib & 7) == ESC, w_orig[r0:r1].view(torch.int16).to(torch.int32) & 0xFFFF, bits)
+    return bits.to(torch.int16).view(torch.bfloat16)  # int32 -> int16 keeps the low 16 bits
+
+
+def check_c12(pk, w: torch.Tensor, rows: int = 8192) -> bool:
+    """Bitwise round trip unpack_c12(pack) == w, in row chunks."""
+    n, k = pk["shape"]
+    if tuple(w.shape) != (n, k):
+        return False
+    return all(bits_equal(unpack_c12(pk, w, r0, min(n, r0 + rows)), w[r0:r0 + rows]) for r0 in range(0, n, rows))
+
+
+def packed_bytes(pk) -> int:
+    return pk["lo"].numel() + pk["cd"].numel() + pk["base"].numel()
+
+
+CFG = (32, 4, 3)  # (BN, num_warps, num_stages); any BN / warps / stages keep the per-element chain (k16 steps in K order)
+
+
+def c12_gemv(x: torch.Tensor, w: torch.Tensor, pk, out_dtype=None, out=None, cfg=None, _dec=False, _f32=False, _ctrl=0, _diag=0, mp=None):
+    """x[..., K] @ w[N, K]^T from the packed copy (w = the resident original: escapes only), FP32 accumulation in the served
+    _gemv_kernel's order; out_dtype BF16 by default or into out ([M, N] view with unit column stride). No bias."""
+    n, k = pk["shape"]
+    assert tuple(w.shape) == (n, k) and w.stride(1) == 1 and x.shape[-1] == k
+    lead = x.shape[:-1]
+    x2 = x.reshape(-1, k)
+    m = x2.shape[0]
+    if _dec:
+        out = torch.empty((n, k), device=w.device, dtype=torch.int16)
+    elif out is None:
+        out = torch.empty((m, n), device=x.device, dtype=out_dtype or x.dtype)
+    if m or _dec:
+        bn, nw, ns = cfg or CFG
+        mp = mp or (16 if m <= 16 else 32 if m <= 32 else 64)  # rows padded to MP (the served route: always 16, m <= 16)
+        assert m <= mp, (m, mp)
+        _c12_gemv_kernel[(triton.cdiv(n, bn),)](
+            x2, w, pk["lo"], pk["cd"], pk["base"], out, m, n, k, x2.stride(0), w.stride(0), out.stride(0),
+            BN=bn, BK=BK, MP=mp, DEC=_dec, F32=_f32, CTRL=_ctrl, DIAG=_diag, num_warps=nw, num_stages=ns)
+    return out if _dec else out.view(*lead, n)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_cuda.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_cuda.py
new file mode 100644
index 0000000000000000000000000000000000000000..61d2c9437752e5e296d0217fb1caaac330c97c13
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_cuda.py
@@ -0,0 +1,365 @@
+"""n75 build 2 (inkling2-spark packed seat, 2026-11-22) + n137 build 2 (stack seat, 2026-11-24: c12m3_kernel / c12m3_gemv, the stacked 3-source qkvr visit in one launch; c12m_kernel and c12m_gemv unchanged): the same exact 12-bit format as n75_c12 (low byte + sign + 3-bit code of
+the upper 7 exponent bits in a per-row 7-slot window, code 7 = escape read from the resident BF16 original), streamed by a CUDA
+kernel in mma.sync B-fragment order. The FP32 order is the served Triton _gemv_kernel's: per output ONE in-place
+mma.sync.m16n8k16.row.col.f32.bf16.bf16.f32 chain over K in 16-wide steps, A = x rows (rows >= M are zero, as the served masked
+load), B = the W tile; only the operand delivery differs, so outputs equal the served kernel's bit for bit.
+
+Stream layout (pack_frag): warp tile t = 8 output columns, unit u = 8 k16 steps (128 k). Lane l owns column n = 8 t + l / 4 and,
+per step j, the B fragment b0 = W[n][16 s + 2 (l % 4) + {0, 1}], b1 = W[n][16 s + 8 + 2 (l % 4) + {0, 1}] (s = 8 u + j). Per
+(t, u): 3 segments x 32 lanes x 16 B: seg 0 / 1 = the lane's 32 low bytes (value 4 j + 2 r + h), seg 2 = 16 code bytes, byte
+4 q + i = nib(step 2 q, value i) | nib(step 2 q + 1, value i) << 4. 1.5 B per weight + 1 B per row (the same base array).
+Kernel: persistent CTAs of NW warps; x staged once per CTA in shared memory in A-fragment order; per unit one 3 x 16 B load per
+lane (prefetched one unit ahead), SWAR decode ((c & 0x07070707) + base * 0x01010101) | ((c << 4) & 0x80808080) and two
+__byte_perm per step; an escape (any code byte == 7) takes a branch that reads the original element. M <= 16, K % 128 == 0,
+N % 8 == 0; BF16 out = RTNE of the FP32 sum (cvt.rn), FP32 out = the sum."""
+import os
+import torch
+
+U = 8  # k16 steps per unit
+
+CUDA_SRC = r'''
+#include 
+#include 
+#include 
+#include 
+
+__device__ __forceinline__ void mma16816(float (&c)[4], uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t b0, uint32_t b1) {
+  asm volatile("mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, {%8,%9}, {%0,%1,%2,%3};\n"
+               : "+f"(c[0]), "+f"(c[1]), "+f"(c[2]), "+f"(c[3])
+               : "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(b0), "r"(b1));
+}
+
+// MT 1: rows 0-7 (a1 = a3 = 0); MT 2: rows 0-15. F32: FP32 out, else BF16 (RTNE).
+template 
+__global__ void __launch_bounds__(NW * 32) c12m_kernel(const uint4* __restrict__ wp, const uint8_t* __restrict__ basep,
+    const uint16_t* __restrict__ W, const uint16_t* __restrict__ x, void* __restrict__ outp,
+    int M, int N, int K, int SX, int SW, int SY) {
+  extern __shared__ uint4 xs[];  // [steps][32 lanes]: MT 1 -> uint2 (a0, a2), MT 2 -> uint4 (a0, a1, a2, a3)
+  const int steps = K >> 4, NU = steps / 8, ntiles = N >> 3;
+  uint2* xs2 = reinterpret_cast(xs);
+  for (int i = threadIdx.x; i < steps * 32; i += NW * 32) {
+    const int s = i >> 5, l = i & 31, r = l >> 2, kq = s * 16 + (l & 3) * 2;
+    uint32_t a0 = 0, a1 = 0, a2 = 0, a3 = 0;
+    if (r < M) { a0 = *reinterpret_cast(x + (size_t)r * SX + kq); a2 = *reinterpret_cast(x + (size_t)r * SX + kq + 8); }
+    if (MT == 2 && r + 8 < M) { a1 = *reinterpret_cast(x + (size_t)(r + 8) * SX + kq); a3 = *reinterpret_cast(x + (size_t)(r + 8) * SX + kq + 8); }
+    if (MT == 1) xs2[i] = make_uint2(a0, a2); else xs[i] = make_uint4(a0, a1, a2, a3);
+  }
+  __syncthreads();
+  const int warp = threadIdx.x >> 5, lane = threadIdx.x & 31, stride = gridDim.x * NW;
+  int t = blockIdx.x * NW + warp;
+  if (t >= ntiles) return;
+  const int mytiles = (ntiles - 1 - t) / stride + 1, total = mytiles * NU;
+  // flat loop over this warp's (tile, unit) pairs, one unit prefetched ahead
+  const uint4* p = wp + (size_t)t * NU * 96 + lane;
+  uint4 c0 = __ldg(p), c1 = __ldg(p + 32), c2 = __ldg(p + 64);
+  float acc[4] = {0.f, 0.f, 0.f, 0.f};
+  int u = 0;
+  int n = t * 8 + (lane >> 2);
+  uint32_t base4 = (uint32_t)basep[n] * 0x01010101u;
+  const uint16_t* wrow = W + (size_t)n * SW;
+  for (int g = 0; g < total; ++g) {
+    uint4 d0, d1, d2;
+    const bool more = g + 1 < total;
+    if (more) {
+      const int tn = (u + 1 == NU) ? t + stride : t, un = (u + 1 == NU) ? 0 : u + 1;
+      const uint4* q = wp + ((size_t)tn * NU + un) * 96 + lane;
+      d0 = __ldg(q); d1 = __ldg(q + 32); d2 = __ldg(q + 64);
+    }
+    const uint32_t L[8] = {c0.x, c0.y, c0.z, c0.w, c1.x, c1.y, c1.z, c1.w};
+    const uint32_t Cw[4] = {c2.x, c2.y, c2.z, c2.w};
+#pragma unroll
+    for (int j = 0; j < 8; ++j) {
+      const uint32_t c4 = (j & 1) ? ((Cw[j >> 1] >> 4) & 0x0F0F0F0Fu) : (Cw[j >> 1] & 0x0F0F0F0Fu);
+      const uint32_t hi = ((c4 & 0x07070707u) + base4) | ((c4 << 4) & 0x80808080u);
+      uint32_t b0 = __byte_perm(L[j], hi, 0x5140), b1 = __byte_perm(L[j], hi, 0x7362);
+      const uint32_t e7 = c4 & 0x07070707u, f = e7 & (e7 >> 1) & (e7 >> 2) & 0x01010101u;
+      const int s = u * 8 + j;
+      if (f) {  // escape: the element comes from the resident BF16 original
+        const int kb = s * 16 + (lane & 3) * 2;
+#pragma unroll
+        for (int i = 0; i < 4; ++i) {
+          if ((f >> (8 * i)) & 1u) {
+            const uint32_t v = wrow[kb + (i >= 2 ? 8 : 0) + (i & 1)];
+            if (i == 0) b0 = (b0 & 0xFFFF0000u) | v;
+            else if (i == 1) b0 = (b0 & 0x0000FFFFu) | (v << 16);
+            else if (i == 2) b1 = (b1 & 0xFFFF0000u) | v;
+            else b1 = (b1 & 0x0000FFFFu) | (v << 16);
+          }
+        }
+      }
+      if (MT == 1) { const uint2 a = xs2[s * 32 + lane]; mma16816(acc, a.x, 0u, a.y, 0u, b0, b1); }
+      else { const uint4 a = xs[s * 32 + lane]; mma16816(acc, a.x, a.y, a.z, a.w, b0, b1); }
+    }
+    if (++u == NU) {  // tile done: D[r][c] with r = lane / 4 (+ 8), c = 8 t + 2 (lane % 4) + {0, 1}
+      const int r = lane >> 2, col = t * 8 + (lane & 3) * 2;
+      if (F32) {
+        float* o = reinterpret_cast(outp);
+        if (r < M) *reinterpret_cast(o + (size_t)r * SY + col) = make_float2(acc[0], acc[1]);
+        if (MT == 2 && r + 8 < M) *reinterpret_cast(o + (size_t)(r + 8) * SY + col) = make_float2(acc[2], acc[3]);
+      } else {
+        __nv_bfloat16* o = reinterpret_cast<__nv_bfloat16*>(outp);
+        if (r < M) *reinterpret_cast<__nv_bfloat162*>(o + (size_t)r * SY + col) = __floats2bfloat162_rn(acc[0], acc[1]);
+        if (MT == 2 && r + 8 < M) *reinterpret_cast<__nv_bfloat162*>(o + (size_t)(r + 8) * SY + col) = __floats2bfloat162_rn(acc[2], acc[3]);
+      }
+      acc[0] = acc[1] = acc[2] = acc[3] = 0.f;
+      u = 0; t += stride;
+      if (t < ntiles) { n = t * 8 + (lane >> 2); base4 = (uint32_t)basep[n] * 0x01010101u; wrow = W + (size_t)n * SW; }
+    }
+    if (more) { c0 = d0; c1 = d1; c2 = d2; }
+  }
+}
+
+// n137 build 2: c12m_kernel for the stacked 3-source qkvr visit in ONE launch. Identical per-element code; the CTA's 128-row range (grid =
+// one tile per warp, the host refuses otherwise) picks its x source (rows [0, b1) and [b3, N): x0; [b1, b2): x1; [b2, b3): x2) and its output
+// block (src * blk elements: the [3M, N] buffer of the stock chunk(3) layout). Bounds are multiples of NW * 8 rows (host-checked).
+// MT 1: rows 0-7 (a1 = a3 = 0); MT 2: rows 0-15. F32: FP32 out, else BF16 (RTNE).
+template 
+__global__ void __launch_bounds__(NW * 32) c12m3_kernel(const uint4* __restrict__ wp, const uint8_t* __restrict__ basep,
+    const uint16_t* __restrict__ W, const uint16_t* __restrict__ x0, const uint16_t* __restrict__ x1, const uint16_t* __restrict__ x2,
+    void* __restrict__ outp, int M, int N, int K, int SX, int SW, int SY, int b1, int b2, int b3, long long blk) {
+  const int row0 = blockIdx.x * NW * 8;
+  const int src = (row0 < b1 || row0 >= b3) ? 0 : (row0 < b2 ? 1 : 2);
+  const uint16_t* __restrict__ x = src == 0 ? x0 : (src == 1 ? x1 : x2);
+  const long long ob = (long long)src * blk;
+  extern __shared__ uint4 xs[];  // [steps][32 lanes]: MT 1 -> uint2 (a0, a2), MT 2 -> uint4 (a0, a1, a2, a3)
+  const int steps = K >> 4, NU = steps / 8, ntiles = N >> 3;
+  uint2* xs2 = reinterpret_cast(xs);
+  for (int i = threadIdx.x; i < steps * 32; i += NW * 32) {
+    const int s = i >> 5, l = i & 31, r = l >> 2, kq = s * 16 + (l & 3) * 2;
+    uint32_t a0 = 0, a1 = 0, a2 = 0, a3 = 0;
+    if (r < M) { a0 = *reinterpret_cast(x + (size_t)r * SX + kq); a2 = *reinterpret_cast(x + (size_t)r * SX + kq + 8); }
+    if (MT == 2 && r + 8 < M) { a1 = *reinterpret_cast(x + (size_t)(r + 8) * SX + kq); a3 = *reinterpret_cast(x + (size_t)(r + 8) * SX + kq + 8); }
+    if (MT == 1) xs2[i] = make_uint2(a0, a2); else xs[i] = make_uint4(a0, a1, a2, a3);
+  }
+  __syncthreads();
+  const int warp = threadIdx.x >> 5, lane = threadIdx.x & 31, stride = gridDim.x * NW;
+  int t = blockIdx.x * NW + warp;
+  if (t >= ntiles) return;
+  const int mytiles = (ntiles - 1 - t) / stride + 1, total = mytiles * NU;
+  // flat loop over this warp's (tile, unit) pairs, one unit prefetched ahead
+  const uint4* p = wp + (size_t)t * NU * 96 + lane;
+  uint4 c0 = __ldg(p), c1 = __ldg(p + 32), c2 = __ldg(p + 64);
+  float acc[4] = {0.f, 0.f, 0.f, 0.f};
+  int u = 0;
+  int n = t * 8 + (lane >> 2);
+  uint32_t base4 = (uint32_t)basep[n] * 0x01010101u;
+  const uint16_t* wrow = W + (size_t)n * SW;
+  for (int g = 0; g < total; ++g) {
+    uint4 d0, d1, d2;
+    const bool more = g + 1 < total;
+    if (more) {
+      const int tn = (u + 1 == NU) ? t + stride : t, un = (u + 1 == NU) ? 0 : u + 1;
+      const uint4* q = wp + ((size_t)tn * NU + un) * 96 + lane;
+      d0 = __ldg(q); d1 = __ldg(q + 32); d2 = __ldg(q + 64);
+    }
+    const uint32_t L[8] = {c0.x, c0.y, c0.z, c0.w, c1.x, c1.y, c1.z, c1.w};
+    const uint32_t Cw[4] = {c2.x, c2.y, c2.z, c2.w};
+#pragma unroll
+    for (int j = 0; j < 8; ++j) {
+      const uint32_t c4 = (j & 1) ? ((Cw[j >> 1] >> 4) & 0x0F0F0F0Fu) : (Cw[j >> 1] & 0x0F0F0F0Fu);
+      const uint32_t hi = ((c4 & 0x07070707u) + base4) | ((c4 << 4) & 0x80808080u);
+      uint32_t b0 = __byte_perm(L[j], hi, 0x5140), b1 = __byte_perm(L[j], hi, 0x7362);
+      const uint32_t e7 = c4 & 0x07070707u, f = e7 & (e7 >> 1) & (e7 >> 2) & 0x01010101u;
+      const int s = u * 8 + j;
+      if (f) {  // escape: the element comes from the resident BF16 original
+        const int kb = s * 16 + (lane & 3) * 2;
+#pragma unroll
+        for (int i = 0; i < 4; ++i) {
+          if ((f >> (8 * i)) & 1u) {
+            const uint32_t v = wrow[kb + (i >= 2 ? 8 : 0) + (i & 1)];
+            if (i == 0) b0 = (b0 & 0xFFFF0000u) | v;
+            else if (i == 1) b0 = (b0 & 0x0000FFFFu) | (v << 16);
+            else if (i == 2) b1 = (b1 & 0xFFFF0000u) | v;
+            else b1 = (b1 & 0x0000FFFFu) | (v << 16);
+          }
+        }
+      }
+      if (MT == 1) { const uint2 a = xs2[s * 32 + lane]; mma16816(acc, a.x, 0u, a.y, 0u, b0, b1); }
+      else { const uint4 a = xs[s * 32 + lane]; mma16816(acc, a.x, a.y, a.z, a.w, b0, b1); }
+    }
+    if (++u == NU) {  // tile done: D[r][c] with r = lane / 4 (+ 8), c = 8 t + 2 (lane % 4) + {0, 1}
+      const int r = lane >> 2, col = t * 8 + (lane & 3) * 2;
+      if (F32) {
+        float* o = reinterpret_cast(outp) + ob;
+        if (r < M) *reinterpret_cast(o + (size_t)r * SY + col) = make_float2(acc[0], acc[1]);
+        if (MT == 2 && r + 8 < M) *reinterpret_cast(o + (size_t)(r + 8) * SY + col) = make_float2(acc[2], acc[3]);
+      } else {
+        __nv_bfloat16* o = reinterpret_cast<__nv_bfloat16*>(outp) + ob;
+        if (r < M) *reinterpret_cast<__nv_bfloat162*>(o + (size_t)r * SY + col) = __floats2bfloat162_rn(acc[0], acc[1]);
+        if (MT == 2 && r + 8 < M) *reinterpret_cast<__nv_bfloat162*>(o + (size_t)(r + 8) * SY + col) = __floats2bfloat162_rn(acc[2], acc[3]);
+      }
+      acc[0] = acc[1] = acc[2] = acc[3] = 0.f;
+      u = 0; t += stride;
+      if (t < ntiles) { n = t * 8 + (lane >> 2); base4 = (uint32_t)basep[n] * 0x01010101u; wrow = W + (size_t)n * SW; }
+    }
+    if (more) { c0 = d0; c1 = d1; c2 = d2; }
+  }
+}
+
+template 
+static void launch(const at::Tensor& wp, const at::Tensor& base, const at::Tensor& W, const at::Tensor& x, at::Tensor& out,
+                   int64_t M, int64_t N, int64_t K, int64_t SX, int64_t SY, int64_t grid) {
+  const int smem = (int)(K / 16) * 32 * (MT == 1 ? 8 : 16);
+  auto kern = c12m_kernel;
+  static int set = 0;
+  if (set < smem) { C10_CUDA_CHECK(cudaFuncSetAttribute(kern, cudaFuncAttributeMaxDynamicSharedMemorySize, smem)); set = smem; }
+  if (grid <= 0) {
+    int occ = 0, dev = 0, sms = 0;
+    C10_CUDA_CHECK(cudaGetDevice(&dev));
+    C10_CUDA_CHECK(cudaDeviceGetAttribute(&sms, cudaDevAttrMultiProcessorCount, dev));
+    C10_CUDA_CHECK(cudaOccupancyMaxActiveBlocksPerMultiprocessor(&occ, kern, NW * 32, smem));
+    const int64_t need = (N / 8 + NW - 1) / NW;
+    grid = std::min(need, (int64_t)std::max(occ, 1) * sms);
+  }
+  kern<<<(int)grid, NW * 32, smem, at::cuda::getCurrentCUDAStream()>>>(
+      reinterpret_cast(wp.data_ptr()), base.data_ptr(), reinterpret_cast(W.data_ptr()),
+      reinterpret_cast(x.data_ptr()), out.data_ptr(), (int)M, (int)N, (int)K, (int)SX, (int)W.stride(0), (int)SY);
+  C10_CUDA_KERNEL_LAUNCH_CHECK();
+}
+
+void c12m(at::Tensor wp, at::Tensor base, at::Tensor W, at::Tensor x, at::Tensor out, int64_t M, int64_t SX, int64_t SY,
+          int64_t nw, int64_t grid) {
+  const int64_t N = W.size(0), K = W.size(1);
+  const bool f32 = out.scalar_type() == at::kFloat;
+  const int mt = M <= 8 ? 1 : 2;
+#define C12M_CASE(NWV, MTV, F)  if (nw == NWV && mt == MTV && f32 == F) return launch(wp, base, W, x, out, M, N, K, SX, SY, grid);
+  C12M_CASE(4, 1, false) C12M_CASE(4, 1, true) C12M_CASE(4, 2, false) C12M_CASE(4, 2, true)
+  C12M_CASE(8, 1, false) C12M_CASE(8, 1, true) C12M_CASE(8, 2, false) C12M_CASE(8, 2, true)
+  C12M_CASE(16, 1, false) C12M_CASE(16, 1, true) C12M_CASE(16, 2, false) C12M_CASE(16, 2, true)
+  TORCH_CHECK(false, "c12m: unsupported nw ", nw);
+}
+
+
+template 
+static void launch3(const at::Tensor& wp, const at::Tensor& base, const at::Tensor& W, const at::Tensor& x0, const at::Tensor& x1,
+                    const at::Tensor& x2, at::Tensor& out, int64_t M, int64_t N, int64_t K, int64_t SX, int64_t SY, int64_t b1, int64_t b2, int64_t b3) {
+  const int smem = (int)(K / 16) * 32 * (MT == 1 ? 8 : 16);
+  auto kern = c12m3_kernel;
+  static int set = 0;
+  if (set < smem) { C10_CUDA_CHECK(cudaFuncSetAttribute(kern, cudaFuncAttributeMaxDynamicSharedMemorySize, smem)); set = smem; }
+  int occ = 0, dev = 0, sms = 0;
+  C10_CUDA_CHECK(cudaGetDevice(&dev));
+  C10_CUDA_CHECK(cudaDeviceGetAttribute(&sms, cudaDevAttrMultiProcessorCount, dev));
+  C10_CUDA_CHECK(cudaOccupancyMaxActiveBlocksPerMultiprocessor(&occ, kern, NW * 32, smem));
+  const int64_t need = (N / 8 + NW - 1) / NW;
+  TORCH_CHECK(need <= (int64_t)std::max(occ, 1) * sms, "c12m3: one tile per warp needs ", need, " CTAs, residency ", occ * sms);
+  TORCH_CHECK(b1 % (NW * 8) == 0 && b2 % (NW * 8) == 0 && b3 % (NW * 8) == 0 && b1 <= b2 && b2 <= b3 && b3 <= N, "c12m3: bounds not CTA-aligned");
+  kern<<<(int)need, NW * 32, smem, at::cuda::getCurrentCUDAStream()>>>(
+      reinterpret_cast(wp.data_ptr()), base.data_ptr(), reinterpret_cast(W.data_ptr()),
+      reinterpret_cast(x0.data_ptr()), reinterpret_cast(x1.data_ptr()), reinterpret_cast(x2.data_ptr()),
+      out.data_ptr(), (int)M, (int)N, (int)K, (int)SX, (int)W.stride(0), (int)SY, (int)b1, (int)b2, (int)b3, (long long)(M * SY));
+  C10_CUDA_KERNEL_LAUNCH_CHECK();
+}
+
+void c12m3(at::Tensor wp, at::Tensor base, at::Tensor W, at::Tensor x0, at::Tensor x1, at::Tensor x2, at::Tensor out, int64_t M, int64_t SX,
+           int64_t SY, int64_t nw, int64_t b1, int64_t b2, int64_t b3) {
+  const int64_t N = W.size(0), K = W.size(1);
+  const bool f32 = out.scalar_type() == at::kFloat;
+  const int mt = M <= 8 ? 1 : 2;
+#define C12M3_CASE(NWV, MTV, F)  if (nw == NWV && mt == MTV && f32 == F) return launch3(wp, base, W, x0, x1, x2, out, M, N, K, SX, SY, b1, b2, b3);
+  C12M3_CASE(4, 1, false) C12M3_CASE(4, 2, false) C12M3_CASE(8, 1, false) C12M3_CASE(8, 2, false) C12M3_CASE(16, 1, false) C12M3_CASE(16, 2, false)
+  TORCH_CHECK(false, "c12m3: unsupported nw ", nw, " or FP32 out");
+}
+
+PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { m.def("c12m", &c12m); m.def("c12m3", &c12m3); }
+'''
+
+_EXT = None
+
+
+def build(verbose=False, build_dir=None):
+    """Compile the extension (torch cpp_extension, sm_121a). Returns the module."""
+    global _EXT
+    if _EXT is None:
+        from torch.utils.cpp_extension import load_inline
+        arch = os.environ.get("N75_CUDA_ARCH", "121a")
+        kw = {}
+        if build_dir:
+            os.makedirs(build_dir, exist_ok=True)
+            kw["build_directory"] = build_dir
+        _EXT = load_inline("n75_c12m3", cpp_sources="", cuda_sources=CUDA_SRC, verbose=verbose, with_cuda=True,
+                           extra_cuda_cflags=["-O3", f"-gencode=arch=compute_{arch},code=sm_{arch}", "-Xptxas=-v"], **kw)
+    return _EXT
+
+
+def pack_frag(pk, rows: int = 2048) -> torch.Tensor:
+    """Fragment-order stream [T, NU, 3, 32, 16] uint8 from an n75_c12 pack (lo [N, K], cd [N, K/2] in 256-tile half layout)."""
+    BK, HK = 256, 128  # n75_c12's CD tile layout (no import: the module path differs between the kit and the server)
+    n, k = pk["shape"]
+    assert n % 8 == 0 and k % 128 == 0 and k % BK == 0, (n, k)
+    T, NU = n // 8, k // 128
+    out = torch.empty((T, NU, 3, 32, 16), dtype=torch.uint8, device=pk["lo"].device)
+    for r0 in range(0, n, rows):
+        r1 = min(n, r0 + rows); t0, t1 = r0 // 8, r1 // 8
+        lo = pk["lo"][r0:r1]
+        cd = pk["cd"][r0:r1].view(r1 - r0, k // BK, 1, HK)
+        nib = torch.cat([cd & 15, cd >> 4], dim=2).view(r1 - r0, k)
+        # [T, nl, NU, j, r, q, h] -> [T, NU, nl, q, j, r, h]: lane = 4 nl + q, value = 4 j + 2 r + h
+        lp = lo.view(t1 - t0, 8, NU, 8, 2, 4, 2).permute(0, 2, 1, 5, 3, 4, 6).reshape(t1 - t0, NU, 32, 32)
+        np_ = nib.view(t1 - t0, 8, NU, 8, 2, 4, 2).permute(0, 2, 1, 5, 3, 4, 6).reshape(t1 - t0, NU, 32, 8, 4)
+        code = (np_[:, :, :, 0::2, :] | (np_[:, :, :, 1::2, :] << 4)).reshape(t1 - t0, NU, 32, 16)
+        out[t0:t1] = torch.stack([lp[..., :16], lp[..., 16:], code], dim=2)
+    return out
+
+
+SMEM_MAX = 101376  # per-block dynamic shared memory on sm_120 / sm_121 (99 KB)
+
+
+def fits(k, m):
+    """Whether build 2's shared x stage (K / 16 steps x 32 lanes x 8 B, 16 B above 8 rows) fits one block."""
+    return m <= 16 and (k // 16) * 32 * (8 if m <= 8 else 16) <= SMEM_MAX
+
+
+def operands_ok(x2, out, k, m):
+    """Build 2 reads x as 4-byte pairs and stores 2-element pairs: aligned, even-strided operands only."""
+    if not (fits(k, m) and x2.stride(1) == 1 and x2.stride(0) % 2 == 0 and x2.data_ptr() % 4 == 0):
+        return False
+    if out is None:
+        return True
+    return out.stride(-1) == 1 and (out.dim() < 2 or out.stride(0) % 2 == 0) and out.data_ptr() % (2 * out.element_size()) == 0
+
+
+def c12m_gemv(x, w, pk, frag, out_dtype=None, out=None, nw=8, grid=0):
+    """x[..., K] @ w[N, K]^T from the fragment stream (w = the resident original, escapes only); M <= 16."""
+    n, k = pk["shape"]
+    lead = x.shape[:-1]
+    x2 = x.reshape(-1, k)
+    m = x2.shape[0]
+    if not operands_ok(x2, out, k, m):
+        raise ValueError(f"c12m_gemv: unsupported operands (m {m}, k {k}, x stride {x2.stride()}, out "
+                         f"{None if out is None else (out.stride(), out.data_ptr() % 16)})")
+    if out is None:
+        out = torch.empty((m, n), device=x.device, dtype=out_dtype or x.dtype)
+    if m:
+        build().c12m(frag, pk["base"], w, x2, out, m, x2.stride(0), out.stride(0), nw, grid)
+    return out.view(*lead, n)
+
+
+def c12m3_gemv(x0, x1, x2, w, pk, frag, buf, bounds, nw=16):
+    """n137 build 2: the stacked 3-source qkvr visit in one launch. x0 / x1 / x2 [M, K] (q / k / v sources), buf [3M, N] (the stock chunk(3)
+    layout): rows [0, b1) and [b3, N) of source 0 go to buf[0:M], rows [b1, b2) of source 1 to buf[M:2M], rows [b2, b3) of source 2 to
+    buf[2M:3M]; every element = c12m_gemv's (the same per-element chain). Raises ValueError on operands it does not take (caller falls back)."""
+    n, k = pk["shape"]
+    m = x0.shape[0]
+    b1, b2, b3 = bounds
+    if not (x0.dim() == x1.dim() == x2.dim() == 2 and x0.shape == x1.shape == x2.shape and x0.shape[1] == k
+            and x0.stride() == x1.stride() == x2.stride() and all(operands_ok(t, None, k, m) for t in (x0, x1, x2))):
+        raise ValueError("c12m3_gemv: sources")
+    if not (buf.dim() == 2 and tuple(buf.shape) == (3 * m, n) and buf.is_contiguous() and buf.dtype == x0.dtype and operands_ok(x0, buf, k, m)):
+        raise ValueError("c12m3_gemv: buffer")
+    if not (0 < m <= 16 and all(b % (nw * 8) == 0 for b in bounds) and b1 <= b2 <= b3 <= n):
+        raise ValueError("c12m3_gemv: shape / bounds")
+    build().c12m3(frag, pk["base"], w, x0, x1, x2, buf, m, x0.stride(0), buf.stride(0), nw, b1, b2, b3)
+    return buf
+
+
+def unpack_frag_reference(frag, pk):
+    """CPU / torch inverse of pack_frag on the low bytes and codes (test only): returns (lo, nib) [N, K]."""
+    n, k = pk["shape"]
+    T, NU = n // 8, k // 128
+    lp = torch.cat([frag[:, :, 0], frag[:, :, 1]], dim=-1)  # [T, NU, 32, 32]
+    lo = lp.view(T, NU, 8, 4, 8, 2, 2).permute(0, 2, 1, 4, 5, 3, 6).reshape(n, k)
+    c = frag[:, :, 2].view(T, NU, 32, 4, 4)
+    nb = torch.stack([c & 15, c >> 4], dim=4).view(T, NU, 32, 8, 4)  # [.., q, (lo/hi -> j = 2q + w), i]
+    nib = nb.view(T, NU, 8, 4, 8, 2, 2).permute(0, 2, 1, 4, 5, 3, 6).reshape(n, k)
+    return lo, nib
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_install.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_install.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9ac37dcacb1369d3189778c3cd8c3c25ee18124
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n75_install.py
@@ -0,0 +1,343 @@
+"""n75 (inkling2-spark packed seat, 2026-11-22): exact 12-bit packed BF16 weights on the served small-M GEMV route.
+[n137 build 2, stack seat 2026-11-24: N75_STACK_FUSED=1 (with N75_C12 attn,stack) runs each stacked 3-source qkvr visit of <= 16 rows per
+source as ONE n75_cuda.c12m3_gemv launch (each 128-row CTA reads its own source; the same per-element chain); any operand it does not take
+falls back to the per-slice loop below (counted as an n75 miss); unset = this file's 088711f7 behaviour.]
+
+N75_C12 (env, comma list; empty or unset = off, nothing patched): attn = qkvr + wo_ud of every Inkling2Attention, lm = the
+target LM head, stack (with attn) = the stacked 3-source qkvr call at <= 16 rows per source runs per source on the packed rows it
+keeps (q / r / gate / sinks rows for the q source, k rows for k, v rows for v) into a [3M, N] buffer whose returned views are
+the stock chunk(3) / split views: exact ONLY IF the stock stacked F.linear at 3M rows equals the per-source Triton chain (mb1
+STOCK rows), so it is a separate switch. N75_C12_CFG = "BN,warps,stages" or per class "qkvr=BN/warps/stages,..." (default n75_c12.CFG). N75_C12_CHECK = 1: check mode (below).
+
+What changes: sglang.srt.layers.quantization.unquant._sm12x_bf16_gemv (the module global that UnquantizedLinearMethod.apply /
+apply_into and sm12x_fp32_lm_head call for BF16 operands of <= 16 rows, N >= 2048, set by initialize_bf16_gemm_config in the
+scheduler before the model loads) is wrapped: when the weight is one of the packed ones (same storage pointer, shape and
+stride as when packed) and there is no bias, the call runs n75_c12.c12_gemv on the 12-bit copy, which reproduces the served
+Triton _gemv_kernel's FP32 chain (one in-place m16n8k16 chain over K) on the same BF16 values bit for bit; every other call
+takes the served kernel unchanged. Calls that never reach that route (prefill GEMMs, the stacked 24-row qkvr, > 16 rows, the
+1-row b12x LM head) are untouched. Packing (and its bitwise round-trip check, n75_c12.pack_c12) runs at the first
+DECODE / TARGET-VERIFY Inkling2Attention forward outside graph capture (a graph warmup: full_cuda_graph_backend runs two eager
+warmups per shape after the KV pool exists), not at the first forward of any mode: n35's copies made at the first forward
+shrank the pool (D1b 556,416 vs n54 563,328 tokens), so that forward precedes pool sizing. The LM head is packed at the first
+logits call after that. The BF16 originals stay (prefill and escapes read them). A weight that fails the round trip keeps the served path (logged).
+Reach: every wrapped call is counted per class in Python (capture and eager), printed as 'N75REACH ...' lines.
+Check mode (N75_C12_CHECK=1): each packed call also runs the served kernel and the split-chain control (n75_c12 CTRL=1, a
+neighbouring order that must differ), RETURNS THE PACKED OUTPUT, and adds into a device counter [0] packed words != served
+(both-NaN excluded), [1] calls, [2] words compared, [3] control words != served, [4] both-NaN words, [5] rows; the counter is
+copied into pinned host memory by a one-program Triton kernel per call (graph replays too) and a daemon thread prints
+'N75CHECK ...' when it changes (n50's check-mode pattern, work_stack/n54/patch/inkling2_loop.py)."""
+import logging, os, sys, threading, time
+
+import torch
+import triton
+import triton.language as tl
+
+logger = logging.getLogger(__name__)
+SEL = {s.strip() for s in os.environ.get("N75_C12", "").split(",") if s.strip()}
+CHECK = os.environ.get("N75_C12_CHECK", "0") == "1"
+STACK_FUSED = os.environ.get("N75_STACK_FUSED", "") == "1"  # n137 build 2 (stack seat, 2026-11-24): one 3-source launch per stacked visit
+def _cfgs():
+    """N75_C12_CFG: 'BN,warps,stages' for every class, or per class 'qkvr=32/4/2,wo_ud=16/2/2,lm_head=64/8/2'; unset = n75_c12.CFG.
+    Any config keeps the served per-element chain, so mixing configs by class keeps the outputs exact."""
+    raw = os.environ.get("N75_C12_CFG", "").strip()
+    out = {c: None for c in ("qkvr", "wo_ud", "lm_head")}
+    if not raw:
+        return out
+    if "=" not in raw:
+        t = tuple(int(v) for v in raw.split(","))
+        return {c: t for c in out}
+    for part in filter(None, (q.strip() for q in raw.split(","))):
+        c, v = part.split("=")
+        out[c.strip()] = tuple(int(u) for u in v.strip().split("/"))
+    return out
+
+
+CFGC = _cfgs()
+CFG = None  # per call: CFGC[class]
+
+
+def _per_class(var, default, conv):
+    """'v' (every class) or 'qkvr=v,wo_ud=v,lm_head=v' -> {cls: v}; missing classes take default."""
+    raw = os.environ.get(var, "").strip()
+    out = {c: default for c in ("qkvr", "wo_ud", "lm_head")}
+    if raw and "=" not in raw:
+        return {c: conv(raw) for c in out}
+    for part in filter(None, (q.strip() for q in raw.split(","))):
+        c, v = part.split("=")
+        out[c.strip()] = conv(v.strip())
+    return out
+
+
+KERN = _per_class("N75_C12_KERNEL", "triton", str)  # triton = n75_c12 (build 1), cuda = n75_cuda (build 2); same output bits
+CUDA_NW = _per_class("N75_C12_CUDA_NW", 8, int)
+S = {"mods": [], "done": False, "reg": {}, "lm_done": False, "orig": None, "reach": {}, "miss": {}}
+_COUNT = None
+_HOST = None
+_INSTALLED = False
+
+
+@triton.jit
+def _n75_publish(Src, Dst, N: tl.constexpr):
+    i = tl.arange(0, N)
+    tl.store(Dst + i, tl.load(Src + i))
+
+
+def _line(c):
+    return (f"N75CHECK words={c[0]} calls={c[1]} compared={c[2]} ctl_words={c[3]} nan_both={c[4]} rows={c[5]}"
+            f" stack_words={c[6]} stack_compared={c[7]}"
+            f" t={time.strftime('%H:%M:%S', time.gmtime())}")
+
+
+def _check_init(device):
+    global _COUNT, _HOST
+    _COUNT = torch.zeros(8, dtype=torch.int64, device=device)
+    _HOST = torch.zeros(8, dtype=torch.int64, pin_memory=True)
+    print(f"N75CHECK init capturing={torch.cuda.is_current_stream_capturing()} pid={os.getpid()}", file=sys.stderr, flush=True)
+
+    def report():
+        last = None
+        while True:
+            time.sleep(10)
+            c = _HOST.tolist()
+            if c != last:
+                print(_line(c), file=sys.stderr, flush=True)
+                last = c
+
+    threading.Thread(target=report, daemon=True, name="n75check").start()
+
+
+def _words(t):
+    return t.view(torch.int32) if t.dtype == torch.float32 else t.view(torch.int16)
+
+
+def _wrapped(x, weight, bias=None, out_dtype=None, out=None):
+    from sglang.srt.models.inkling_common import n75_c12 as C
+    e = S["reg"].get(weight.data_ptr())
+    if (e is None or bias is not None or e["shape"] != tuple(weight.shape) or e["stride"] != tuple(weight.stride())
+            or x.numel() // max(1, x.shape[-1]) > 16):
+        if e is not None:
+            S["miss"][e["cls"]] = S["miss"].get(e["cls"], 0) + 1
+        return S["orig"](x, weight, bias, out_dtype, out)
+    S["reach"][e["cls"]] = S["reach"].get(e["cls"], 0) + 1
+    run = _runner(e)
+    if not CHECK:
+        return run(x, weight, out_dtype, out)
+    if _COUNT is None:
+        _check_init(x.device)
+    ref = S["orig"](x, weight, None, out_dtype or (out.dtype if out is not None else None), None)
+    ctl = C.c12_gemv(x, weight, e["pk"], out_dtype=ref.dtype, cfg=CFGC.get(e["cls"].split()[0]), _ctrl=1)
+    y = run(x, weight, out_dtype, out)
+    yw, rw, cw = _words(y.reshape(ref.shape)), _words(ref), _words(ctl.reshape(ref.shape))
+    rn = torch.isnan(ref)
+    both = torch.isnan(y.reshape(ref.shape)) & rn
+    _COUNT[0] += ((yw != rw) & ~both).sum()
+    _COUNT[1] += 1
+    _COUNT[2] += ref.numel()
+    _COUNT[3] += ((cw != rw) & ~(torch.isnan(ctl.reshape(ref.shape)) & rn)).sum()
+    _COUNT[4] += both.sum()
+    _COUNT[5] += ref.numel() // ref.shape[-1]
+    _n75_publish[(1,)](_COUNT, _HOST, 8)
+    return y
+
+
+def _runner(e):
+    """The packed GEMV for a registered weight: build 1 (Triton) or build 2 (CUDA fragment stream), same output bits."""
+    from sglang.srt.models.inkling_common import n75_c12 as C
+    if e.get("frag") is not None:
+        from sglang.srt.models.inkling_common import n75_cuda as G
+        nw = CUDA_NW[e["cls"]] if e["cls"] in CUDA_NW else 8
+        def run(x, w, od, out):
+            x2 = x.reshape(-1, x.shape[-1])
+            if G.operands_ok(x2, out, x2.shape[1], x2.shape[0]):
+                return G.c12m_gemv(x, w, e["pk"], e["frag"], out_dtype=od, out=out, nw=nw)
+            if e["pk"].get("lo") is not None:
+                return C.c12_gemv(x, w, e["pk"], out_dtype=od, out=out, cfg=CFGC.get(e["cls"].split()[0]))
+            S["miss"]["build 2 operands"] = S["miss"].get("build 2 operands", 0) + 1
+            return S["orig"](x, w, None, od, out)
+        return run
+    cfg = CFGC.get(e["cls"].split()[0])
+    return lambda x, w, od, out: C.c12_gemv(x, w, e["pk"], out_dtype=od, out=out, cfg=cfg)
+
+
+def _register(cls, w):
+    from sglang.srt.models.inkling_common import n75_c12 as C
+    t0 = time.time()
+    if w.dtype != torch.bfloat16 or w.dim() != 2 or w.shape[1] % C.BK or w.stride(1) != 1:
+        logger.warning("n75: %s %s not packable (dtype %s stride %s): served path", cls, tuple(w.shape), w.dtype, w.stride())
+        return 0
+    pk = C.pack_c12(w, "row")
+    if pk is None:
+        logger.warning("n75: %s %s FAILED the bitwise round trip: served path", cls, tuple(w.shape))
+        return 0
+    nbytes = C.packed_bytes(pk)
+    e = {"cls": cls, "pk": pk, "shape": tuple(w.shape), "stride": tuple(w.stride()), "frag": None}
+    if KERN.get(cls.split()[0], "triton") == "cuda":
+        from sglang.srt.models.inkling_common import n75_cuda as G
+        try:
+            if w.shape[0] % 8 or w.shape[1] % 128 or not G.fits(w.shape[1], 16):
+                raise ValueError(f"shape {tuple(w.shape)} outside build 2")
+            G.build()  # torch extension under /root/.cache (the mounted CACHE_DIR): compiled at the first boot, reused after
+            e["frag"] = G.pack_frag(pk)
+            if not CHECK and G.fits(w.shape[1], 16):  # Triton operands: only for check mode's control
+                pk["lo"] = pk["cd"] = None
+        except Exception as ex:  # no nvcc / build error / shape: this class stays on build 1 (same output bits)
+            logger.warning("n75: build 2 unavailable for %s %s (%s: %s): build 1 (Triton)", cls, tuple(w.shape), type(ex).__name__, str(ex)[:200])
+            e["frag"] = None
+    S["reg"][w.data_ptr()] = e
+    S.setdefault("esc", {}).setdefault(cls, [0, 0])
+    S["esc"][cls][0] += pk["n_esc"]; S["esc"][cls][1] += w.numel()
+    S.setdefault("ptime", 0.0)
+    S["ptime"] += time.time() - t0
+    return nbytes
+
+
+def _prepare():
+    if torch.cuda.is_current_stream_capturing():
+        logger.warning("n75: first forward inside graph capture: packed path OFF (served kernels only)")
+        S["done"] = True
+        return
+    from sglang.srt.layers.quantization import unquant as U
+    if U._sm12x_bf16_gemv is None:
+        logger.warning("n75: unquant._sm12x_bf16_gemv is None (not the SM12x auto backend): packed path OFF")
+        S["done"] = True
+        return
+    tot = 0
+    if "attn" in SEL:
+        for m in S["mods"]:
+            for name in ("qkvr", "wo_ud"):
+                lin = m._modules[name]
+                if getattr(lin, "bias", None) is not None:
+                    logger.warning("n75: %s has a bias: served path", name)
+                    continue
+                tot += _register(name, lin.weight.data)
+    if "lm" in SEL:
+        _patch_lm()
+    torch.cuda.synchronize()
+    S["orig"] = U._sm12x_bf16_gemv
+    U._sm12x_bf16_gemv = _wrapped
+    S["done"] = True
+    _start_reach_log()
+    esc = {c: f"{e[0] / e[1] * 1e4:.2f}/1e4" for c, e in S.get("esc", {}).items()}
+    logger.warning("n75 packed: %d attention modules, %d weights, %.1f MB packed (escapes %s), pack+check %.1f s, cfg %s, "
+                   "kernel %s cuda nw %s, check %s", len(S["mods"]), len(S["reg"]), tot / 1e6, esc, S.get("ptime", 0.0), CFGC, KERN,
+                   CUDA_NW, CHECK)
+
+
+def _patch_lm():
+    """The LM head weight is packed at the first logits call outside capture (inkling2.py is still importing when this file's
+    install() runs, as n35 found); the call itself then takes the wrapped route."""
+    from sglang.srt.models import inkling2 as I
+    lp = I.Inkling2LogitsProcessor
+    orig_head = lp._compute_lm_head
+
+    def compute_lm_head(self, hidden_states, lm_head, embedding_bias=None, *, out=None):
+        if not S["lm_done"] and S["done"] and not torch.cuda.is_current_stream_capturing():
+            S["lm_done"] = True
+            b = _register("lm_head", lm_head.weight.data)
+            torch.cuda.synchronize()
+            logger.warning("n75: LM head packed %s, %.1f MB", tuple(lm_head.weight.shape), b / 1e6)
+        elif not S["lm_done"] and S["done"]:
+            S["miss"]["lm_head first seen in capture"] = S["miss"].get("lm_head first seen in capture", 0) + 1
+        return orig_head(self, hidden_states, lm_head, embedding_bias, out=out)
+
+    lp._compute_lm_head = compute_lm_head
+    logger.warning("n75: LM head hook installed")
+
+
+def _start_reach_log():
+    def report():
+        last = None
+        while True:
+            time.sleep(15)
+            c = (dict(S["reach"]), dict(S["miss"]))
+            if c != last:
+                print(f"N75REACH calls {c[0]} misses {c[1]} t={time.strftime('%H:%M:%S', time.gmtime())}", file=sys.stderr, flush=True)
+                last = c
+
+    threading.Thread(target=report, daemon=True, name="n75reach").start()
+
+
+def _install_stack(cls):
+    orig_ps = cls._project_sources
+
+    def ps(self, sources):
+        e = S["reg"].get(self.qkvr.weight.data_ptr()) if S["done"] else None
+        x = sources.q
+        if (e is None or len({id(sources.q), id(sources.k), id(sources.v)}) != 3 or x.dim() != 2 or x.shape[0] > 16
+                or not (sources.k.shape == sources.v.shape == x.shape)):
+            return orig_ps(self, sources)
+        from sglang.srt.models.inkling_common import n75_c12 as C
+        w = self.qkvr.weight
+        sq, sk, sv, sr, sg, ss = self.split_sizes[:6]
+        o_k, o_v, o_r = sq, sq + sk, sq + sk + sv
+        end = o_r + sr + sg + ss
+        n = w.shape[0]
+        if end != n or e["shape"] != tuple(w.shape):
+            return orig_ps(self, sources)
+        m = x.shape[0]
+        buf = torch.empty((3 * m, n), dtype=x.dtype, device=x.device)
+        pk = e["pk"]
+        if STACK_FUSED and e["frag"] is not None:  # n137 build 2: the whole visit in one 3-source launch (same per-element chain)
+            from sglang.srt.models.inkling_common import n75_cuda as G
+            try:
+                G.c12m3_gemv(sources.q, sources.k, sources.v, w, pk, e["frag"], buf, (o_k, o_v, o_r), nw=CUDA_NW.get("qkvr", 16))
+                S["reach"]["qkvr stack"] = S["reach"].get("qkvr stack", 0) + 1
+                S["reach"]["qkvr stack fused"] = S["reach"].get("qkvr stack fused", 0) + 1
+                q_proj, k_proj, v_proj = (p.split(self.split_sizes, dim=-1)[:6] for p in buf.chunk(3))
+                q, _, _, r, gate, sinks = q_proj
+                return (q, k_proj[1], v_proj[2], r, gate, sinks)
+            except (ValueError, RuntimeError) as ex:
+                S["miss"][f"stack fused: {type(ex).__name__}"] = S["miss"].get(f"stack fused: {type(ex).__name__}", 0) + 1
+        for src, rb, (r0, r1) in ((sources.q, 0, (0, o_k)), (sources.q, 0, (o_r, end)), (sources.k, 1, (o_k, o_v)), (sources.v, 2, (o_v, o_r))):
+            sl = {"lo": None if pk["lo"] is None else pk["lo"][r0:r1], "cd": None if pk["cd"] is None else pk["cd"][r0:r1],
+                  "base": pk["base"][r0:r1], "shape": (r1 - r0, w.shape[1]), "n_esc": 0}
+            dst = buf[rb * m:(rb + 1) * m, r0:r1]
+            if e["frag"] is not None and r0 % 8 == 0 and r1 % 8 == 0:
+                _runner({"cls": "qkvr", "pk": sl, "frag": e["frag"][r0 // 8:r1 // 8]})(src, w[r0:r1], None, dst)
+            elif sl["lo"] is not None:
+                C.c12_gemv(src, w[r0:r1], sl, out=dst, cfg=CFGC.get("qkvr"))
+            else:
+                return orig_ps(self, sources)
+        S["reach"]["qkvr stack"] = S["reach"].get("qkvr stack", 0) + 1
+        q_proj, k_proj, v_proj = (p.split(self.split_sizes, dim=-1)[:6] for p in buf.chunk(3))
+        q, _, _, r, gate, sinks = q_proj
+        mine = (q, k_proj[1], v_proj[2], r, gate, sinks)
+        if CHECK:  # counter [6] stacked-path words != the stock stacked path, [7] words compared
+            if _COUNT is None:
+                _check_init(x.device)
+            ref = orig_ps(self, sources)
+            for a, b in zip(mine, ref):
+                _COUNT[6] += (_words(a) != _words(b)).sum()
+                _COUNT[7] += a.numel()
+            _n75_publish[(1,)](_COUNT, _HOST, 8)
+        return mine
+
+    cls._project_sources = ps
+    logger.warning("n75: stacked 3-source qkvr per source on the packed rows (switch 'stack')")
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED or not SEL:
+        return
+    from sglang.srt.models.inkling_common import inkling2_attn as A
+    cls = A.Inkling2Attention
+    orig_init, orig_fwd = cls.__init__, cls._forward
+
+    def init(self, *a, **kw):
+        orig_init(self, *a, **kw)
+        S["mods"].append(self)
+
+    def fwd(self, *a, **kw):
+        if not S["done"]:
+            fb = kw.get("forward_batch", a[2] if len(a) > 2 else None)
+            m = getattr(fb, "forward_mode", None)
+            if m is not None and (m.is_decode() or m.is_target_verify()):
+                _prepare()
+        return orig_fwd(self, *a, **kw)
+
+    cls.__init__, cls._forward = init, fwd
+    if "stack" in SEL and "attn" in SEL:
+        _install_stack(cls)
+    _INSTALLED = True
+    logger.warning("n75 installed: %s check %s", sorted(SEL), CHECK)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n78_head.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n78_head.py
new file mode 100644
index 0000000000000000000000000000000000000000..06a424aab8030c6bae5bfb6405de7b01eb6db762
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n78_head.py
@@ -0,0 +1,312 @@
+"""n78 SERVER FORM: certified greedy LM head, S8 (inkling2-spark packed seat, 2026-11-23); + the n140 INT6 screen behind N140_I6
+(decode seat, 2026-11-24: see the N140 knobs below; the n78 text that follows describes the S8 form, which N140_I6 unset keeps). Mounted beside the image's
+models/inkling_common modules with n78_kern.py; one install line in patch/inkling2_attn.py. With N78_CERT unset or not '1'
+install() returns at once and the served path is n54's exactly.
+
+WHAT CHANGES. Only target-verify LM-head calls of 8 rows (bs 1; 16 rows = bs 2 stays served until it has its own bitwise read) whose operands are exactly the served sm12x FP32
+case (BF16 [M, 2304] x, the model's own lm_head weight, an FP32 [M, padded] contiguous out buffer, no bias) run
+n78_kern.Cert.run (INT8 screen, bound, tile select, served-body exact pass) in place of the sm12x GEMV. Everything after it is
+the served code, unchanged: the softcap in place, the padded-id mask, the folded epilogue's argmax. Every other call (prefill,
+decode, draft, > 16 rows, any shape or dtype off the case) takes the original _compute_lm_head.
+
+EXACTNESS. On a certified step the buffer holds the served FP32 logits bitwise on every tile that can hold the row maximum and
+-inf elsewhere, so the first-max token is the served one (results.md 'RULE n78 mb' + amendments 1-2, 'n78 mb78' rows).
+THE FULL HEAD WHENEVER THE CERTIFICATE IS NOT MET:
+  - a device FLAG word, 0 by default: 0 = the exact pass computes every tile with the served body (bitwise the served head) and
+    the screen exits. TargetVerifyExecutor.run_non_compact sets it to 1 only for a step that is all greedy AND
+    verify_logits_adjustments_are_noop AND not return_logprob AND no grammar AND no watermark candidates, and sets it back to 0
+    when the call returns (fail closed: run_compact, eager paths that bypass run_non_compact and capture never see 1);
+  - in the kernels: a non-finite screen value or bound, or f(max lo) - e <= -cap, computes every tile;
+  - install refuses (served path) if a debug / recording switch that reads full verify logits on greedy steps is set (BLOCKERS).
+e = 2 x the exhaustively measured monotonicity defect of the image's softcap kernel (mb78: 1.9073486328125e-06); any e >= the
+true defect is sound. N78_E overrides (a larger value only widens the tile set).
+
+N78_CHECK=1 (check boot only, never a timed candidate): inside the same graph the served GEMV is also run into a second buffer
+and softcapped, and device counters accumulate: calls, rows whose certified first-max differs from the served one (must stay 0),
+computed tiles, and a CONTROL (the whole bound scaled to 0, same kernels) whose mismatching rows must be > 0 over a replay.
+Lines: N78CERT (state, once), N78REACH (host: flag-1 / flag-0 steps by bs, routed / unrouted head calls), N78CHECK (device)."""
+import json, logging, os, sys, threading, time
+
+import torch
+
+logger = logging.getLogger(__name__)
+ON = os.environ.get("N78_CERT", "") == "1"
+CHECK = os.environ.get("N78_CHECK", "") == "1"
+E = float(os.environ.get("N78_E", "3.814697265625e-06"))
+BN = int(os.environ.get("N78_BN", "128"))
+ROWS = tuple(int(v) for v in os.environ.get("N78_ROWS", "8").split(","))   # 16 rows (bs 2) has NO exactness read yet: off
+REPORT_S = float(os.environ.get("N78_REPORT_S", "30"))
+TEST_CPU = os.environ.get("N78_TEST_CPU", "") == "1"   # CPU pre-flight only (interpreter, FP32 test dot)
+# n140 rider (decode seat, 2026-11-24): N140_I6=1 replaces ONLY the screen (K1) by the INT6 CUDA screen of n140_kern.py (n78's own
+# pack(W, 6) tables, B-fragment stream, 357.8 MB instead of S8's 473.6 MB; S8's pack is then not built); N140_EXACT E1 (default:
+# n78's exact pass) | E3 (needed tiles first, same served body). Unset: this file is n78's served path exactly.
+I6 = os.environ.get("N140_I6", "") == "1"
+I6_EXACT = os.environ.get("N140_EXACT", "E1")
+VERIFY_MOD = "sglang.srt.speculative.dspark_components.dspark_verify"
+BLOCKERS = ("SGLANG_DSPARK_DEBUG_DUMP", "SGLANG_DSPARK_ENABLE_SPS_RECORD", "SGLANG_DSPARK_BLOCK_ACCEPT_ESTIMATE_PATH",
+            "SGLANG_DSPARK_STS_COLLECT_PATH", "SGLANG_DSPARK_DEBUG_CONFIDENCE_METRICS", "SGLANG_DSPARK_LOG_SPS_PRED_INTERVAL",
+            "SGLANG_DSPARK_BLOCK_ACCEPT_ONLINE_INTERVAL", "SGLANG_SIMULATE_ACC_LEN", "SGLANG_SIMULATE_ACC_TOKEN_MODE",
+            "SGLANG_SIMULATE_ACC_METHOD", "SGLANG_SIMULATE_ACC_GREEDY", "SGLANG_DSPARK_SIMULATE_FOLD")
+S = {"certs": {}, "W": None, "flag": None, "ready": False, "failed": None, "reach": {}, "lp_done": False, "spec_done": False,
+     "tls": threading.local(), "chk": None, "threads": []}
+_INSTALLED = False
+_LOCK = threading.Lock()
+
+
+def _count(k, n=1):
+    with _LOCK:
+        S["reach"][k] = S["reach"].get(k, 0) + n
+
+
+def _capturing():
+    return torch.cuda.is_available() and torch.cuda.is_current_stream_capturing()
+
+
+def _prepare(lp, x, lm_head):
+    """Outside capture, at the first decode / target-verify logits call (after the KV pool is sized): pack the head, build one
+    Cert per row count, compile every kernel on warm buffers. Any failure leaves the served path (S['failed'])."""
+    from sglang.srt.models.inkling_common import n78_kern as K
+    if TEST_CPU:
+        softcap = lambda t, cap: t.copy_(torch.tanh(t / torch.tensor(cap, dtype=torch.float32)) * torch.tensor(cap, dtype=torch.float32))
+        served = None
+    else:
+        from sglang.kernels.ops.activation.softcap import softcap_inplace_logits as softcap
+        from sglang.kernels.ops.gemm.sm12x_bf16_gemv import sm12x_bf16_gemv as served
+    W = lm_head.weight
+    V, KK = W.shape
+    vocab, cap = int(lp.config.vocab_size), float(lp.shard_softcap)
+    if not (W.dtype == torch.bfloat16 and W.is_contiguous() and V % 32 == 0 and KK % 192 == 0 and KK % 256 == 0 and 0 < vocab <= V and cap > 0):
+        raise RuntimeError("head off the certified case")
+    t = time.time()
+    if I6:
+        from sglang.srt.models.inkling_common import n140_kern as N6
+        if I6_EXACT not in ("E1", "E3"):
+            raise RuntimeError(f"N140_EXACT {I6_EXACT}")
+        ext6 = N6.build_emu() if TEST_CPU else N6.build()
+        pk = N6.pack6f(W)
+        mk = lambda M: N6.Cert6(W, pk, vocab, E, M, softcap, ext=ext6, exact=I6_EXACT, testf32=TEST_CPU, cap=cap)
+    else:
+        pk = K.pack(W, 8)
+        mk = lambda M: K.Cert(W, pk, vocab, E, M, softcap, bn=BN, exact="E1", testf32=TEST_CPU, cap=cap)
+    flag = torch.zeros(1, dtype=torch.int32, device=W.device)
+    certs = {}
+    for M in ROWS:
+        c = mk(M)
+        c.flag = flag
+        xw = torch.zeros((M, KK), dtype=torch.bfloat16, device=W.device)
+        ow = torch.empty((M, V), dtype=torch.float32, device=W.device)
+        for v in (1, 0):
+            flag.fill_(v)
+            c.run(xw, ow)
+        if CHECK:
+            c.ref = torch.empty((M, V), dtype=torch.float32, device=W.device)
+            c.ctl = torch.empty((M, V), dtype=torch.float32, device=W.device)
+            c.mine = torch.empty((M, V), dtype=torch.float32, device=W.device)
+            _check(c, xw, ow, served, softcap, cap, vocab)
+        certs[M] = c
+    flag.fill_(0)
+    if CHECK:
+        S["chk"] = torch.zeros(6, dtype=torch.int64, device=W.device)   # calls, flag-1 calls, mismatch rows, tiles, ctl mismatch rows, ctl tiles
+    S.update(certs=certs, W=W, flag=flag, served=served, softcap=softcap, cap=cap, vocab=vocab, ready=True)
+    print("N78CERT " + json.dumps({"state": "ready", "form": ("I6-" + I6_EXACT) if I6 else "S8", "bn": 32 if I6 else BN, "e": E, "rows": list(ROWS), "check": CHECK, "vocab": vocab,
+                                   "padded": V, "cap": cap, "packed_mb": round(pk["bytes"] / 1e6, 1), "prepare_s": round(time.time() - t, 1)},
+                                  sort_keys=True), file=sys.stderr, flush=True)
+
+
+def _check(c, x, out, served, softcap, cap, vocab, acc=None):
+    """CHECK mode, capturable: out holds the certified head output BEFORE the softcap. Reference = the served GEMV; control =
+    the same kernels with the whole bound scaled to 0. Counters are device adds (replayed with the graph)."""
+    if served is None:   # CPU pre-flight: the served-body kernel with every tile needed
+        from sglang.srt.models.inkling_common import n78_kern as K
+        full = torch.ones_like(c.need)
+        K._exact_kernel[(c.T,)](x, c.W, c.ref, full, c.M, c.V, c.K, x.stride(0), c.W.stride(0), c.ref.stride(0), BN=32, BK=256, MP=16, TESTF32=True)
+    else:
+        served(x, c.W, out_dtype=torch.float32, out=c.ref)
+    softcap(c.ref, cap)
+    tiles = c.need.sum()
+    mine = c.mine
+    mine.copy_(out)
+    softcap(mine, cap)
+    mism = (torch.argmax(mine[:, :vocab], dim=-1) != torch.argmax(c.ref[:, :vocab], dim=-1)).sum()
+    cn = c.cn
+    c.cn = 0.0
+    try:
+        c.screen(x, qterm=0.0)
+        c.select()
+        c.exact_pass(x, c.ctl)
+    finally:
+        c.cn = cn
+    softcap(c.ctl, cap)
+    cm = (torch.argmax(c.ctl[:, :vocab], dim=-1) != torch.argmax(c.ref[:, :vocab], dim=-1)).sum()
+    if acc is not None:
+        acc[0] += 1
+        acc[1] += c.flag[0]
+        acc[2] += mism
+        acc[3] += tiles
+        acc[4] += cm
+        acc[5] += c.need.sum()
+
+
+def _route(lp, x, lm_head, bias, out):
+    """The Cert for this call, or None with the reason counted (the original head then runs)."""
+    if not getattr(S["tls"], "verify", False):
+        return None
+    why = None
+    if not S["ready"]:
+        why = "not ready"
+    elif x.dim() != 2 or x.shape[0] not in S["certs"]:
+        why = f"rows {tuple(x.shape)[0] if x.dim() == 2 else 'nd'}"
+    elif bias is not None or out is None:
+        why = "bias or no out buffer"
+    elif not (TEST_CPU or x.is_cuda) or x.dtype != torch.bfloat16 or not x.is_contiguous() or x.shape[1] != S["W"].shape[1]:
+        why = "x off the case"
+    elif getattr(lm_head, "weight", None) is not S["W"]:
+        why = "another head weight"
+    elif out.dtype != torch.float32 or tuple(out.shape) != (x.shape[0], S["W"].shape[0]) or not out.is_contiguous() or out.device != x.device:
+        why = "out off the case"
+    elif not getattr(lp, "use_fp32_lm_head", False) or float(getattr(lp, "shard_softcap", 0) or 0) != S["cap"]:
+        why = "softcap / fp32 off the case"
+    elif I6 and (x.data_ptr() % 16 != 0 or (x.shape[0] > 1 and x.stride(0) % 8 != 0)):
+        why = "x alignment (n140 screen needs 16-byte rows)"   # the extension would refuse: take the original head instead
+    if why is not None:
+        _count(f"verify head unrouted: {why}")
+        return None
+    return S["certs"][x.shape[0]]
+
+
+def _patch_lp():
+    if S["lp_done"]:
+        return
+    I = sys.modules.get("sglang.srt.models.inkling2")
+    cls = getattr(I, "Inkling2LogitsProcessor", None)
+    if cls is None:
+        _count("Inkling2LogitsProcessor not found at the first attention init")
+        return
+    S["lp_done"] = True
+    o_get, o_head = cls._get_logits, cls._compute_lm_head
+
+    def get_logits(self, hidden_states, lm_head, logits_metadata, *a, **kw):
+        mode = getattr(logits_metadata, "forward_mode", None)
+        tv = mode is not None and bool(mode.is_target_verify())
+        if not S["spec_done"]:
+            _patch_spec()
+        if not S["ready"] and S["failed"] is None and not _capturing():
+            dec = mode is not None and hasattr(mode, "is_decode") and bool(mode.is_decode())
+            if (tv or dec) and (TEST_CPU or hidden_states.is_cuda):
+                try:
+                    _prepare(self, hidden_states, lm_head)
+                    _start_threads()
+                except Exception as e:  # serve on with the original head
+                    S["failed"] = f"{type(e).__name__}: {str(e)[:200]}"
+                    print("N78CERT " + json.dumps({"state": "failed", "why": S["failed"]}), file=sys.stderr, flush=True)
+        S["tls"].verify = tv
+        try:
+            return o_get(self, hidden_states, lm_head, logits_metadata, *a, **kw)
+        finally:
+            S["tls"].verify = False
+
+    def compute_lm_head(self, hidden_states, lm_head, embedding_bias=None, *, out=None):
+        c = _route(self, hidden_states, lm_head, embedding_bias, out)
+        if c is None:
+            return o_head(self, hidden_states, lm_head, embedding_bias, out=out)
+        c.run(hidden_states, out)
+        if CHECK:
+            _check(c, hidden_states, out, S["served"], S["softcap"], S["cap"], S["vocab"], S["chk"])
+        S["softcap"](out, self.shard_softcap)
+        if not _capturing():
+            _count(f"verify head routed rows {hidden_states.shape[0]} eager")
+        else:
+            _count(f"verify head routed rows {hidden_states.shape[0]} capture")
+        return out
+
+    cls._get_logits, cls._compute_lm_head = get_logits, compute_lm_head
+    logger.warning("n78 cert: Inkling2LogitsProcessor._get_logits / _compute_lm_head wrapped")
+
+
+def flag_for(batch, sampling_info, noop):
+    from sglang.srt.models.inkling_common import n78_kern as K
+    return K.flag_value(all_greedy=sampling_info is None or bool(sampling_info.is_all_greedy), adjustments_noop=bool(noop(sampling_info)),
+                        return_logprob=bool(batch.return_logprob), grammar=bool(batch.has_grammar),
+                        watermark=bool(getattr(sampling_info, "has_watermark_candidates", False)))
+
+
+def _patch_spec():
+    V = sys.modules.get(VERIFY_MOD)
+    if V is None or S["spec_done"]:
+        return
+    S["spec_done"] = True
+    TE, noop = V.TargetVerifyExecutor, V.verify_logits_adjustments_are_noop
+    o_rnc = TE.run_non_compact
+
+    def rnc(self, *a, **kw):
+        fl = S["flag"]
+        v = 0
+        if fl is not None and not _capturing():
+            try:
+                b = kw["batch"]
+                v = flag_for(b, kw["sampling_info"], noop)
+                _count(f"step bs {len(b.reqs)} flag {v}")
+            except Exception as e:   # unknown step kind: the full head
+                v = 0
+                _count(f"flag error {type(e).__name__}")
+            if v:
+                fl.fill_(1)
+        try:
+            return o_rnc(self, *a, **kw)
+        finally:
+            if v:
+                fl.fill_(0)
+
+    TE.run_non_compact = rnc
+    logger.warning("n78 cert: TargetVerifyExecutor.run_non_compact wrapped (flag word)")
+
+
+def _reporter():
+    last = None
+    while True:
+        time.sleep(REPORT_S)
+        try:
+            with _LOCK:
+                r = dict(S["reach"])
+            chk = S["chk"].tolist() if S["chk"] is not None else None
+            cur = (r, chk)
+            if cur != last:
+                t = time.strftime("%H:%M:%S", time.gmtime())
+                print(f"N78REACH {json.dumps(r, sort_keys=True)} t={t}", file=sys.stderr, flush=True)
+                if chk is not None:
+                    print("N78CHECK " + json.dumps({"calls": chk[0], "flag1_calls": chk[1], "mismatch_rows": chk[2], "tiles": chk[3],
+                                                    "control_mismatch_rows": chk[4], "control_tiles": chk[5]}, sort_keys=True) + f" t={t}",
+                          file=sys.stderr, flush=True)
+                last = cur
+        except Exception as e:
+            _count(f"reporter {type(e).__name__}")
+
+
+def _start_threads():
+    if S["threads"] or TEST_CPU:
+        return
+    t = threading.Thread(target=_reporter, daemon=True, name="n78report")
+    t.start()
+    S["threads"].append(t)
+
+
+def install():
+    global _INSTALLED
+    if _INSTALLED or not ON:
+        return
+    bl = [k for k in BLOCKERS if os.environ.get(k, "") not in ("", "0", "false", "False")]
+    if bl:
+        print("N78CERT " + json.dumps({"state": "refused", "blockers": bl}), file=sys.stderr, flush=True)
+        return
+    from sglang.srt.models.inkling_common import inkling2_attn as A
+    cls = A.Inkling2Attention
+    orig_init = cls.__init__
+
+    def init(self, *a, **kw):
+        orig_init(self, *a, **kw)
+        if not S["lp_done"]:
+            _patch_lp()
+
+    cls.__init__ = init
+    _INSTALLED = True
+    logger.warning("n78 cert installed: %s bn %d e %.3e check %s", ("I6-" + I6_EXACT) if I6 else "S8", 32 if I6 else BN, E, CHECK)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n78_kern.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n78_kern.py
new file mode 100644
index 0000000000000000000000000000000000000000..39141e46cd79c60967c3273c0acda4b12a6700f0
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n78_kern.py
@@ -0,0 +1,417 @@
+"""n78 certified greedy LM head: GPU kernels + host packers (packed seat, 2026-11-23; kit for 'RULE n78 mb', kit-only amendment).
+
+One certified head call (x [M <= 16, 2304] BF16, the served head W [201,024, 2304] BF16) = six launches, all graph-safe (fixed grids):
+  K0 _xnorm_kernel   per-row group norms ||x_g|| (12 groups of 192) and ||x||, rounded up (x 1 + 2^-10).
+  K1 _screen_kernel  S =  from a packed quantized head (BITS 8 / 6 / 4, FP16 scale per (row, 192-group)); bound
+                     B = (qterm * sum_g ||x_g|| R_vg + CN N_v ||x||) (1 + 2^-18), slop = (|S| + B) 2^-20 + 1e-30,
+                     lo = S - B - slop, hi = S + B + slop; writes per (row, 32-id tile) the max of hi over REAL ids into
+                     FB[r, t], per (row, CTA) the max of lo over real ids into LOC, and a per-CTA non-finite flag.
+                     dbg != 0 also writes S, lo, hi per id (mb78 bar checks only).
+  K2 _reduce_kernel  per row r < M: max over CTAs of LOC -> FB[r, T]; any non-finite -> OKW[r] = 0.
+  (served)           the image's softcap_inplace_logits(FB, cap) in place: f is the served softcap kernel itself.
+  K3 _select_kernel  NEED[t] = 1 iff flag == 0, or not certifiable (a non-finite S / B, or f(max lo) - e <= -cap or
+                     non-finite), or some row r < M has f(H_rt) + 3e >= f(max_v lo_rv).
+  K4 _exact_kernel   the served sm12x _gemv_kernel body (BN 32, BK 256, MP 16, same loop) for tiles with NEED, -inf
+                     elsewhere (E1: branch; _exact_masked_kernel E2: the served loop with need-masked weight loads).
+Then the served softcap, padded mask and argmax run unchanged.
+
+Certificate (tile-max form of 'RULE n78 mb'): the rule's per-id test is 'f(hi_v) + 2e >= m, m = max_v f(lo_v)'. This kit
+tests per 32-id tile with H_rt = max of hi over the tile's real ids and m'_r = f(max_v lo_rv) (one f per row and tile):
+  sound for any e: with u = argmax lo, m' = f(lo_u) <= f(L_u) + e <= Y + e (lo_u <= L_u, e = max_{a<=b} f(a) - f(b));
+  for every served maximiser j in tile t: f(H_rt) >= f(hi_j) - e >= f(L_j) - 2e = Y - 2e >= m' - 3e, so t is computed
+  exactly; non-computed tiles read f(-inf) = -cap < m' - e <= Y (guard), so the lowest index holding Y is the served token.
+  At e = 0 (f non-decreasing) max f(lo) = f(max lo) and max_v f(hi_v) = f(max_v hi_v), so the tile decisions equal the
+  per-id rule's exactly; at e > 0 the tile set is a superset (tests/test_kern_cpu.py T3).
+CPU test path: TESTF32 (constexpr) replaces only the dot (FP32 operands, input_precision 'ieee'); the unpack is the same code."""
+import math
+
+import torch
+import triton
+import triton.language as tl
+
+TILE = 32          # the served kernel's BN: one exact tile = 32 vocab ids
+GROUP = 192        # quantization group along K
+CAP = 30.0
+SBK = 64           # screen K block (3 per group)
+
+
+def c_acc(k):
+    """MMA-chain accumulation model per unit of ||x|| ||w|| (knapcio's form; mb78 bar (1) tests it on every row and id)."""
+    return (k / 16 * 17 + 32) * 2.0 ** -23
+
+
+def flag_value(all_greedy, adjustments_noop, return_logprob, grammar, watermark):
+    """Server-form flag per <= 16-row verify step: 1 = certified head allowed, 0 = the full head (exact everywhere)."""
+    return int(bool(all_greedy) and bool(adjustments_noop) and not return_logprob and not grammar and not watermark)
+
+
+# ------------------------------------------------------------------------------------------------ K4: exact passes
+@triton.jit
+def _exact_kernel(X, W, Y, NEED, M, N, K, SX, SW, SY, BN: tl.constexpr, BK: tl.constexpr, MP: tl.constexpr,
+                  TESTF32: tl.constexpr = False):
+    pid = tl.program_id(0)
+    cols = pid * BN + tl.arange(0, BN)
+    rows = tl.arange(0, MP)
+    if tl.load(NEED + pid) != 0:
+        acc = tl.zeros((MP, BN), tl.float32)
+        for k0 in range(0, K, BK):
+            ks = k0 + tl.arange(0, BK)
+            w = tl.load(
+                W + cols[None, :].to(tl.int64) * SW + ks[:, None],
+                (cols[None, :] < N) & (ks[:, None] < K),
+                other=0,
+            )
+            x = tl.load(
+                X + rows[:, None] * SX + ks[None, :],
+                (rows[:, None] < M) & (ks[None, :] < K),
+                other=0,
+            )
+            if TESTF32:
+                acc += tl.dot(x.to(tl.float32), w.to(tl.float32), input_precision="ieee")
+            else:
+                acc += tl.dot(x, w)
+        tl.store(
+            Y + rows[:, None] * SY + cols[None, :],
+            acc.to(Y.dtype.element_ty),
+            (rows[:, None] < M) & (cols[None, :] < N),
+        )
+    else:
+        tl.store(Y + rows[:, None] * SY + cols[None, :], tl.full((MP, BN), float("-inf"), tl.float32),
+                 (rows[:, None] < M) & (cols[None, :] < N))
+
+
+@triton.jit
+def _exact_masked_kernel(X, W, Y, NEED, M, N, K, SX, SW, SY, BN: tl.constexpr, BK: tl.constexpr, MP: tl.constexpr,
+                         TESTF32: tl.constexpr = False):
+    pid = tl.program_id(0)
+    cols = pid * BN + tl.arange(0, BN)
+    rows = tl.arange(0, MP)
+    need = tl.load(NEED + pid) != 0
+    acc = tl.zeros((MP, BN), tl.float32)
+    for k0 in range(0, K, BK):
+        ks = k0 + tl.arange(0, BK)
+        w = tl.load(
+            W + cols[None, :].to(tl.int64) * SW + ks[:, None],
+            (cols[None, :] < N) & (ks[:, None] < K) & need,
+            other=0,
+        )
+        x = tl.load(
+            X + rows[:, None] * SX + ks[None, :],
+            (rows[:, None] < M) & (ks[None, :] < K),
+            other=0,
+        )
+        if TESTF32:
+            acc += tl.dot(x.to(tl.float32), w.to(tl.float32), input_precision="ieee")
+        else:
+            acc += tl.dot(x, w)
+    acc = tl.where(need, acc, float("-inf"))
+    tl.store(
+        Y + rows[:, None] * SY + cols[None, :],
+        acc.to(Y.dtype.element_ty),
+        (rows[:, None] < M) & (cols[None, :] < N),
+    )
+
+
+@triton.jit
+def _exact_rev_kernel(X, W, Y, NEED, M, N, K, SX, SW, SY, BN: tl.constexpr, BK: tl.constexpr, MP: tl.constexpr,
+                      TESTF32: tl.constexpr = False):
+    """CONTROL (c): E1 with its K chunks in reversed order; must differ from the served head."""
+    pid = tl.program_id(0)
+    cols = pid * BN + tl.arange(0, BN)
+    rows = tl.arange(0, MP)
+    if tl.load(NEED + pid) != 0:
+        acc = tl.zeros((MP, BN), tl.float32)
+        for i0 in range(0, K, BK):
+            k0 = K - BK - i0
+            ks = k0 + tl.arange(0, BK)
+            w = tl.load(W + cols[None, :].to(tl.int64) * SW + ks[:, None], (cols[None, :] < N) & (ks[:, None] < K), other=0)
+            x = tl.load(X + rows[:, None] * SX + ks[None, :], (rows[:, None] < M) & (ks[None, :] < K), other=0)
+            if TESTF32:
+                acc += tl.dot(x.to(tl.float32), w.to(tl.float32), input_precision="ieee")
+            else:
+                acc += tl.dot(x, w)
+        tl.store(Y + rows[:, None] * SY + cols[None, :], acc, (rows[:, None] < M) & (cols[None, :] < N))
+    else:
+        tl.store(Y + rows[:, None] * SY + cols[None, :], tl.full((MP, BN), float("-inf"), tl.float32),
+                 (rows[:, None] < M) & (cols[None, :] < N))
+
+
+# ------------------------------------------------------------------------------------------------ K0: x norms
+@triton.jit
+def _xnorm_kernel(X, XG, XN, M, SX, NG: tl.constexpr, GROUP: tl.constexpr, GP: tl.constexpr, MP: tl.constexpr):
+    rows = tl.arange(0, MP)
+    j = tl.arange(0, GP)
+    tot = tl.zeros((MP,), tl.float32)
+    for g in tl.static_range(NG):
+        x = tl.load(X + rows[:, None] * SX + g * GROUP + j[None, :], (rows[:, None] < M) & (j[None, :] < GROUP), other=0)
+        x = x.to(tl.float32)
+        ss = tl.sum(x * x, axis=1)
+        tl.store(XG + rows * NG + g, tl.sqrt_rn(ss) * (1.0 + 2.0 ** -10))
+        tot += ss
+    tl.store(XN + rows, tl.sqrt_rn(tot) * (1.0 + 2.0 ** -10))
+
+
+# ------------------------------------------------------------------------------------------------ K1: screens
+@triton.jit
+def _wsub(a0, a1, bb, s: tl.constexpr, BITS: tl.constexpr):
+    """Decode sub-block s (16 K x BN ids) of a 64-K block: 4-bit plane a0 / a1 (+ 2-bit plane bb for BITS 6) -> FP32 ints."""
+    if s % 2 == 0:
+        a = a0
+    else:
+        a = a1
+    nib = (a >> (4 * (s // 2))) & 0xF
+    if BITS == 6:
+        v = nib | (((bb >> (2 * s)) & 0x3) << 4)
+        w = v.to(tl.float32) - 32.0
+    else:
+        w = nib.to(tl.float32) - 8.0
+    return w
+
+
+@triton.jit
+def _screen_kernel(X, Q, QB, SC, R, NV, XG, XN, FLAG, FB, LOC, BAD, DS, DLO, DHI,
+                   M, N, NREAL, SX, SQ, SQB, T1, NCTA, qterm, cn, dbg,
+                   BITS: tl.constexpr, BN: tl.constexpr, MP: tl.constexpr, NG: tl.constexpr, GROUP: tl.constexpr,
+                   TESTF32: tl.constexpr = False):
+    pid = tl.program_id(0)
+    if tl.load(FLAG) != 0:
+        cols = pid * BN + tl.arange(0, BN)
+        rows = tl.arange(0, MP)
+        cm = cols < N
+        acc = tl.zeros((MP, BN), tl.float32)
+        bq = tl.zeros((MP, BN), tl.float32)
+        for g in range(NG):
+            part = tl.zeros((MP, BN), tl.float32)
+            for jb in tl.static_range(GROUP // 64):
+                kb = g * GROUP + jb * 64
+                if BITS == 8:
+                    kk = kb + tl.arange(0, 64)
+                    q = tl.load(Q + cols[None, :].to(tl.int64) * SQ + kk[:, None], cm[None, :], other=0)
+                    xk = tl.load(X + rows[:, None] * SX + kk[None, :], rows[:, None] < M, other=0)
+                    if TESTF32:
+                        part += tl.dot(xk.to(tl.float32), q.to(tl.float32), input_precision="ieee")
+                    else:
+                        part += tl.dot(xk, q.to(tl.float32).to(tl.bfloat16))
+                else:
+                    j16 = tl.arange(0, 16)
+                    base = Q + cols[None, :].to(tl.int64) * SQ + kb // 2
+                    a0 = tl.load(base + j16[:, None], cm[None, :], other=0)
+                    a1 = tl.load(base + 16 + j16[:, None], cm[None, :], other=0)
+                    if BITS == 6:
+                        bb = tl.load(QB + cols[None, :].to(tl.int64) * SQB + kb // 4 + j16[:, None], cm[None, :], other=0)
+                    else:
+                        bb = a0
+                    for s in tl.static_range(4):
+                        w = _wsub(a0, a1, bb, s, BITS)
+                        xk = tl.load(X + rows[:, None] * SX + kb + 16 * s + j16[None, :], rows[:, None] < M, other=0)
+                        if TESTF32:
+                            part += tl.dot(xk.to(tl.float32), w, input_precision="ieee")
+                        else:
+                            part += tl.dot(xk, w.to(tl.bfloat16))
+            sc = tl.load(SC + cols * NG + g, cm, other=0).to(tl.float32)
+            acc += part * sc[None, :]
+            rg = tl.load(R + cols * NG + g, cm, other=0).to(tl.float32)
+            xg = tl.load(XG + rows * NG + g)
+            bq += xg[:, None] * rg[None, :]
+        nv = tl.load(NV + cols, cm, other=0)
+        xn = tl.load(XN + rows)
+        b = (qterm * bq + cn * (xn[:, None] * nv[None, :])) * (1.0 + 2.0 ** -18)
+        slop = (tl.abs(acc) + b) * (2.0 ** -20) + 1e-30
+        lo = acc - b - slop
+        hi = acc + b + slop
+        valid = (rows[:, None] < M) & cm[None, :]
+        fin = (acc == acc) & (tl.abs(acc) < float("inf")) & (b == b) & (tl.abs(b) < float("inf"))
+        bad = tl.max(tl.max(tl.where(valid, tl.where(fin, 0, 1), 0), axis=1), axis=0)
+        tl.store(BAD + pid, bad)
+        real = (rows[:, None] < M) & (cols[None, :] < NREAL)
+        hm = tl.where(real, hi, float("-inf"))
+        lm = tl.where(real, lo, float("-inf"))
+        ht = tl.max(tl.reshape(hm, (MP, BN // 32, 32)), axis=2)
+        tt = pid * (BN // 32) + tl.arange(0, BN // 32)
+        tl.store(FB + rows[:, None] * T1 + tt[None, :], ht, (rows[:, None] < M) & (tt[None, :] < T1 - 1))
+        tl.store(LOC + rows * NCTA + pid, tl.max(lm, axis=1), rows < M)
+        if dbg != 0:
+            o = rows[:, None] * N + cols[None, :]
+            tl.store(DS + o, acc, valid)
+            tl.store(DLO + o, lo, valid)
+            tl.store(DHI + o, hi, valid)
+
+
+# ------------------------------------------------------------------------------------------------ K2 / K3
+@triton.jit
+def _reduce_kernel(LOC, BAD, FB, OKW, FLAG, NCTA, T, T1, BLOCK: tl.constexpr):
+    r = tl.program_id(0)
+    if tl.load(FLAG) != 0:
+        m = tl.full((BLOCK,), float("-inf"), tl.float32)
+        bad = tl.zeros((BLOCK,), tl.int32)
+        for c0 in range(0, NCTA, BLOCK):
+            o = c0 + tl.arange(0, BLOCK)
+            v = tl.load(LOC + r * NCTA + o, o < NCTA, other=float("-inf"))
+            m = tl.maximum(m, v)
+            bad = tl.maximum(bad, tl.load(BAD + o, o < NCTA, other=0))
+            bad = tl.maximum(bad, tl.where(v == v, 0, 1))
+        tl.store(FB + r * T1 + T, tl.max(m, axis=0))
+        tl.store(OKW + r, 1 - tl.max(bad, axis=0))
+
+
+@triton.jit
+def _select_kernel(FB, OKW, FLAG, NEED, M, T, T1, e1, e3, cap, BLOCK: tl.constexpr, MP: tl.constexpr):
+    pid = tl.program_id(0)
+    t = pid * BLOCK + tl.arange(0, BLOCK)
+    tm = t < T
+    rows = tl.arange(0, MP)
+    rm = rows < M
+    fm = tl.load(FB + rows * T1 + T, rm, other=0.0)
+    okw = tl.load(OKW + rows, rm, other=1)
+    good = tl.where(rm, ((okw != 0) & (fm - e1 > -cap) & (tl.abs(fm) < float("inf"))).to(tl.int32), 1)
+    ok = (tl.min(good, axis=0) == 1) & (tl.load(FLAG) != 0)
+    fh = tl.load(FB + rows[:, None] * T1 + t[None, :], rm[:, None] & tm[None, :], other=float("-inf"))
+    cand = tl.max(tl.where(rm[:, None] & (fh + e3 >= fm[:, None]), 1, 0), axis=0)
+    need = tl.where(ok, cand, 1)
+    tl.store(NEED + t, need, tm)
+
+
+# ------------------------------------------------------------------------------------------------ host: packing
+def _up16(target):
+    """FP64 (> 0) -> FP16 rounded toward +inf (finite inputs; one bit step on the positive range)."""
+    h = target.to(torch.float16)
+    b = h.view(torch.int16)
+    b = torch.where(h.to(torch.float64) < target, b + 1, b)
+    return b.view(torch.float16)
+
+
+def _up32(target):
+    f = target.to(torch.float32)
+    return torch.where(f.to(torch.float64) < target, torch.nextafter(f, torch.full_like(f, math.inf)), f)
+
+
+def pack(W, bits, group=GROUP, chunk=8192):
+    """W [V, K] BF16 (any device) -> dict: q (BITS 8: int8 [V, K]; 6 / 4: uint8 nibble plane [V, K / 2]), qb (BITS 6: uint8
+    2-bit plane [V, K / 4], else a 1-byte stub), sc FP16 [V, NG] (scale, rounded up), R FP16 [V, NG] (||W_g - D_g||, up),
+    N FP32 [V] (max(||W_v||, ||D_v||), up). D = q * sc exactly (FP64); decode(pk) gives it."""
+    V, K = W.shape
+    NG = K // group
+    qmax = 2 ** (bits - 1) - 1
+    dev = W.device
+    if bits == 8:
+        q_all = torch.empty((V, K), dtype=torch.int8, device=dev)
+    else:
+        q_all = torch.empty((V, K // 2), dtype=torch.uint8, device=dev)
+    qb_all = torch.empty((V, K // 4), dtype=torch.uint8, device=dev) if bits == 6 else torch.zeros(16, dtype=torch.uint8, device=dev)
+    sc_all = torch.empty((V, NG), dtype=torch.float16, device=dev)
+    R_all = torch.empty((V, NG), dtype=torch.float16, device=dev)
+    N_all = torch.empty((V,), dtype=torch.float32, device=dev)
+    for a in range(0, V, chunk):
+        w = W[a:a + chunk].to(torch.float64)
+        n = w.shape[0]
+        wg = w.view(n, NG, group)
+        amax = wg.abs().amax(-1, keepdim=True)
+        s16 = torch.where(amax > 0, _up16(torch.where(amax > 0, amax / qmax, torch.ones_like(amax))), torch.zeros_like(amax, dtype=torch.float16))
+        s = s16.to(torch.float64)
+        q = torch.where(s > 0, torch.clamp(torch.round(wg / torch.where(s > 0, s, torch.ones_like(s))), -qmax, qmax), torch.zeros_like(wg))
+        D = (q * s).view(n, K)
+        sc_all[a:a + n] = s16.view(n, NG)
+        R_all[a:a + n] = _up16((w - D).view(n, NG, group).pow(2).sum(-1).sqrt() * (1 + 2.0 ** -40) + 1e-300)
+        N_all[a:a + n] = _up32(torch.maximum(w.norm(dim=1), D.norm(dim=1)) * (1 + 2.0 ** -40) + 1e-300)
+        qi = q.view(n, K).to(torch.int32)
+        if bits == 8:
+            q_all[a:a + n] = qi.to(torch.int8)
+            continue
+        f = (qi + (qmax + 1)).view(n, K // 64, 4, 16)  # field in [1, 2 qmax + 1]; (s, j) = k - kb = 16 s + j
+        lo4 = f & 0xF
+        b0 = lo4[:, :, 0] | (lo4[:, :, 2] << 4)
+        b1 = lo4[:, :, 1] | (lo4[:, :, 3] << 4)
+        q_all[a:a + n] = torch.stack([b0, b1], dim=2).reshape(n, K // 2).to(torch.uint8)
+        if bits == 6:
+            h2 = (f >> 4) & 0x3
+            qb_all[a:a + n] = (h2[:, :, 0] | (h2[:, :, 1] << 2) | (h2[:, :, 2] << 4) | (h2[:, :, 3] << 6)).reshape(n, K // 4).to(torch.uint8)
+    return {"bits": bits, "q": q_all, "qb": qb_all, "sc": sc_all, "R": R_all, "N": N_all, "V": V, "K": K, "NG": NG,
+            "bytes": q_all.numel() * q_all.element_size() + (qb_all.numel() if bits == 6 else 0)
+            + sc_all.numel() * 2 + R_all.numel() * 2 + N_all.numel() * 4}
+
+
+def decode(pk, rows=slice(None)):
+    """Host reference decoder: D [n, K] FP64 for the given vocab rows (independent of the kernel's decode)."""
+    bits, K, NG = pk["bits"], pk["K"], pk["NG"]
+    qmax = 2 ** (bits - 1) - 1
+    if bits == 8:
+        q = pk["q"][rows].to(torch.int64)
+    else:
+        by = pk["q"][rows].to(torch.int64)
+        n = by.shape[0]
+        by = by.view(n, K // 64, 2, 16)
+        lo = torch.stack([by[:, :, 0] & 0xF, by[:, :, 1] & 0xF, by[:, :, 0] >> 4, by[:, :, 1] >> 4], dim=2)  # [n, K/64, 4, 16]
+        if bits == 6:
+            hb = pk["qb"][rows].to(torch.int64).view(n, K // 64, 16)
+            hi = torch.stack([(hb >> (2 * s)) & 0x3 for s in range(4)], dim=2)
+            f = lo | (hi << 4)
+        else:
+            f = lo
+        q = (f - (qmax + 1)).reshape(n, K)
+    s = pk["sc"][rows].to(torch.float64).repeat_interleave(GROUP, dim=1)
+    return q.to(torch.float64) * s
+
+
+# ------------------------------------------------------------------------------------------------ host: one head
+class Cert:
+    """Buffers + launches of one certified head for a fixed (form, M, x buffer, out buffer). run() is capturable."""
+
+    def __init__(self, W, pk, vocab, e, M, softcap_fn, bn=64, nw=4, ns=None, exact="E1", testf32=False, cap=CAP):
+        dev = W.device
+        V, K = W.shape
+        assert V % TILE == 0 and K % GROUP == 0 and K % 256 == 0 and M <= 16 and bn % 32 == 0
+        self.W, self.pk, self.vocab, self.M, self.K, self.V = W, pk, vocab, M, K, V
+        self.T = V // TILE
+        self.T1 = self.T + 1
+        self.bn, self.nw, self.ns, self.exact, self.testf32, self.cap = bn, nw, ns, exact, testf32, cap
+        self.NCTA = triton.cdiv(V, bn)
+        self.e = float(e)
+        # FP32 evaluation margin of 'fh + 3e >= fm' and 'fm - e > -cap' when e > 0 (|f| <= cap < 32: ulp <= 2^-19)
+        self.e1 = self.e + (2.0 ** -18 if self.e > 0 else 0.0)
+        self.e3 = 3.0 * self.e + (2.0 ** -18 if self.e > 0 else 0.0)
+        self.cn = 2.0 * c_acc(K)
+        self.softcap_fn = softcap_fn
+        z = lambda *s, dt=torch.float32: torch.zeros(s, dtype=dt, device=dev)
+        self.xg, self.xn = z(16, pk["NG"]), z(16)
+        self.loc, self.bad = z(16, self.NCTA), z(self.NCTA, dt=torch.int32)
+        self.fb, self.okw = z(16, self.T1), z(16, dt=torch.int32)
+        self.need = torch.ones(self.T, dtype=torch.int32, device=dev)
+        self.flag = torch.ones(1, dtype=torch.int32, device=dev)
+        self.dummy = z(1)
+        self.dbg = None
+
+    def debug_buffers(self):
+        dev = self.W.device
+        self.dbg = tuple(torch.empty((self.M, self.V), dtype=torch.float32, device=dev) for _ in range(3))  # S, lo, hi
+        return self.dbg
+
+    def screen(self, x, qterm=1.0, dbg=False):
+        pk = self.pk
+        ds, dlo, dhi = self.dbg if dbg else (self.dummy, self.dummy, self.dummy)
+        kw = {"num_warps": self.nw}
+        if self.ns is not None:
+            kw["num_stages"] = self.ns
+        _xnorm_kernel[(1,)](x, self.xg, self.xn, self.M, x.stride(0), NG=pk["NG"], GROUP=GROUP, GP=256, MP=16, num_warps=4)
+        _screen_kernel[(self.NCTA,)](x, pk["q"], pk["qb"], pk["sc"], pk["R"], pk["N"], self.xg, self.xn, self.flag,
+                                     self.fb, self.loc, self.bad, ds, dlo, dhi,
+                                     self.M, self.V, self.vocab, x.stride(0), pk["q"].stride(0),
+                                     pk["qb"].stride(0) if pk["bits"] == 6 else 0, self.T1, self.NCTA,
+                                     float(qterm), self.cn, 1 if dbg else 0,
+                                     BITS=pk["bits"], BN=self.bn, MP=16, NG=pk["NG"], GROUP=GROUP, TESTF32=self.testf32, **kw)
+
+    def select(self):
+        _reduce_kernel[(self.M,)](self.loc, self.bad, self.fb, self.okw, self.flag, self.NCTA, self.T, self.T1, BLOCK=1024, num_warps=4)
+        self.softcap_fn(self.fb, self.cap)
+        _select_kernel[(triton.cdiv(self.T, 1024),)](self.fb, self.okw, self.flag, self.need, self.M, self.T, self.T1,
+                                                     self.e1, self.e3, self.cap, BLOCK=1024, MP=16, num_warps=4)
+
+    def exact_pass(self, x, out, kernel=None):
+        k = kernel or (_exact_kernel if self.exact == "E1" else _exact_masked_kernel)
+        k[(self.T,)](x, self.W, out, self.need, self.M, self.V, self.K, x.stride(0), self.W.stride(0), out.stride(0),
+                     BN=32, BK=256, MP=16, TESTF32=self.testf32, num_warps=4)
+
+    def run(self, x, out, qterm=1.0, dbg=False):
+        self.screen(x, qterm, dbg)
+        self.select()
+        self.exact_pass(x, out)
+        return out
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n80_cuda.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n80_cuda.py
new file mode 100644
index 0000000000000000000000000000000000000000..136c1b7df454c5cb691b87d908e7d022bad7d355
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n80_cuda.py
@@ -0,0 +1,171 @@
+"""n80_cuda.py (inkling2-spark decode seat, tree n80, 2026-11-24): K-chunked variant of n75 build 2 for drafter linears whose K is
+too large for build 2's one shared x stage (DSpark drafter down_proj: K 9216 needs 147 KB at M <= 8). Same 12-bit fragment stream
+(n75_cuda.pack_frag of an n75_c12.pack_c12 "row" pack), same decode / escape / store code (copied verbatim from c12m_kernel),
+same per-element FP32 order (one in-order mma.sync chain over K per output tile) -> bit-identical to c12m and to the served
+sm12x_bf16_gemv. x is restaged per chunk of CH k16 steps between CTA barriers; every warp walks the same rounds and chunks.
+Generated (inline script, decode seat) from work_stack/n137/b2/n75_cuda.py 0ab557d0 (the packed seat's build 2 + the stack seat's n137)."""
+import os
+import torch
+
+SMEM_MAX = 101376
+CUDA_SRC = r'''
+#include 
+#include 
+#include 
+#include 
+
+__device__ __forceinline__ void mma16816(float (&c)[4], uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t b0, uint32_t b1) {
+  asm volatile("mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, {%8,%9}, {%0,%1,%2,%3};\n"
+               : "+f"(c[0]), "+f"(c[1]), "+f"(c[2]), "+f"(c[3])
+               : "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(b0), "r"(b1));
+}
+
+// n80 c12mk: n75 build 2's c12m_kernel with x staged in K chunks of CH k16 steps (CH % 8 == 0) instead of whole, for K too large for
+// one shared x stage (the drafter's down_proj, K 9216). Every warp walks the same rounds (one tile per warp per round) and chunks
+// between CTA barriers; per tile the accumulator runs ONE in-order mma.sync chain over K exactly as c12m_kernel (and the served
+// Triton _gemv_kernel), so outputs are bit-identical. Decode / escape / store code is c12m_kernel's, copied by gen. BF16 out only.
+template 
+__global__ void __launch_bounds__(NW * 32) c12mk_kernel(const uint4* __restrict__ wp, const uint8_t* __restrict__ basep,
+    const uint16_t* __restrict__ W, const uint16_t* __restrict__ x, __nv_bfloat16* __restrict__ o,
+    int M, int N, int K, int SX, int SW, int SY, int CH) {
+  extern __shared__ uint4 xs[];
+  uint2* xs2 = reinterpret_cast(xs);
+  const int steps = K >> 4, NU = steps / 8, ntiles = N >> 3;
+  const int warp = threadIdx.x >> 5, lane = threadIdx.x & 31, stride = gridDim.x * NW;
+  const int rounds = (ntiles + stride - 1) / stride;
+  for (int rd = 0; rd < rounds; ++rd) {
+    const int t = blockIdx.x * NW + warp + rd * stride;
+    const bool valid = t < ntiles;
+    float acc[4] = {0.f, 0.f, 0.f, 0.f};
+    const int n = valid ? t * 8 + (lane >> 2) : 0;
+    const uint32_t base4 = valid ? (uint32_t)basep[n] * 0x01010101u : 0u;
+    const uint16_t* wrow = W + (size_t)n * SW;
+    for (int s0 = 0; s0 < steps; s0 += CH) {
+      const int s1 = min(steps, s0 + CH);
+      __syncthreads();  // every warp finished reading the previous chunk
+      for (int i = threadIdx.x; i < (s1 - s0) * 32; i += NW * 32) {
+        const int s = s0 + (i >> 5), l = i & 31, r = l >> 2, kq = s * 16 + (l & 3) * 2;
+        uint32_t a0 = 0, a1 = 0, a2 = 0, a3 = 0;
+        if (r < M) { a0 = *reinterpret_cast(x + (size_t)r * SX + kq); a2 = *reinterpret_cast(x + (size_t)r * SX + kq + 8); }
+        if (MT == 2 && r + 8 < M) { a1 = *reinterpret_cast(x + (size_t)(r + 8) * SX + kq); a3 = *reinterpret_cast(x + (size_t)(r + 8) * SX + kq + 8); }
+        if (MT == 1) xs2[i] = make_uint2(a0, a2); else xs[i] = make_uint4(a0, a1, a2, a3);
+      }
+      __syncthreads();
+      if (valid) {
+        const int u0 = s0 >> 3, u1 = s1 >> 3;
+        const uint4* p = wp + ((size_t)t * NU + u0) * 96 + lane;
+        uint4 c0 = __ldg(p), c1 = __ldg(p + 32), c2 = __ldg(p + 64);
+        for (int u = u0; u < u1; ++u) {
+          uint4 d0, d1, d2;
+          const bool more = u + 1 < u1;
+          if (more) { const uint4* q = wp + ((size_t)t * NU + u + 1) * 96 + lane; d0 = __ldg(q); d1 = __ldg(q + 32); d2 = __ldg(q + 64); }
+        const uint32_t L[8] = {c0.x, c0.y, c0.z, c0.w, c1.x, c1.y, c1.z, c1.w};
+        const uint32_t Cw[4] = {c2.x, c2.y, c2.z, c2.w};
+    #pragma unroll
+        for (int j = 0; j < 8; ++j) {
+          const uint32_t c4 = (j & 1) ? ((Cw[j >> 1] >> 4) & 0x0F0F0F0Fu) : (Cw[j >> 1] & 0x0F0F0F0Fu);
+          const uint32_t hi = ((c4 & 0x07070707u) + base4) | ((c4 << 4) & 0x80808080u);
+          uint32_t b0 = __byte_perm(L[j], hi, 0x5140), b1 = __byte_perm(L[j], hi, 0x7362);
+          const uint32_t e7 = c4 & 0x07070707u, f = e7 & (e7 >> 1) & (e7 >> 2) & 0x01010101u;
+          const int s = u * 8 + j, sl = s - s0;
+          if (f) {  // escape: the element comes from the resident BF16 original
+            const int kb = s * 16 + (lane & 3) * 2;
+    #pragma unroll
+            for (int i = 0; i < 4; ++i) {
+              if ((f >> (8 * i)) & 1u) {
+                const uint32_t v = wrow[kb + (i >= 2 ? 8 : 0) + (i & 1)];
+                if (i == 0) b0 = (b0 & 0xFFFF0000u) | v;
+                else if (i == 1) b0 = (b0 & 0x0000FFFFu) | (v << 16);
+                else if (i == 2) b1 = (b1 & 0xFFFF0000u) | v;
+                else b1 = (b1 & 0x0000FFFFu) | (v << 16);
+              }
+            }
+          }
+          if (MT == 1) { const uint2 a = xs2[sl * 32 + lane]; mma16816(acc, a.x, 0u, a.y, 0u, b0, b1); }
+          else { const uint4 a = xs[sl * 32 + lane]; mma16816(acc, a.x, a.y, a.z, a.w, b0, b1); }
+        }
+          if (more) { c0 = d0; c1 = d1; c2 = d2; }
+        }
+      }
+    }
+    if (valid) {  // c12m_kernel's BF16 store: D[r][c] with r = lane / 4 (+ 8), c = 8 t + 2 (lane % 4) + {0, 1}
+      const int r = lane >> 2, col = t * 8 + (lane & 3) * 2;
+      if (r < M) *reinterpret_cast<__nv_bfloat162*>(o + (size_t)r * SY + col) = __floats2bfloat162_rn(acc[0], acc[1]);
+      if (MT == 2 && r + 8 < M) *reinterpret_cast<__nv_bfloat162*>(o + (size_t)(r + 8) * SY + col) = __floats2bfloat162_rn(acc[2], acc[3]);
+    }
+  }
+}
+
+template 
+static void launchk(const at::Tensor& wp, const at::Tensor& base, const at::Tensor& W, const at::Tensor& x, at::Tensor& out,
+                    int64_t M, int64_t N, int64_t K, int64_t SX, int64_t SY, int64_t CH, int64_t grid) {
+  const int smem = (int)CH * 32 * (MT == 1 ? 8 : 16);
+  auto kern = c12mk_kernel;
+  static int set = 0;
+  if (set < smem) { C10_CUDA_CHECK(cudaFuncSetAttribute(kern, cudaFuncAttributeMaxDynamicSharedMemorySize, smem)); set = smem; }
+  if (grid <= 0) {
+    int occ = 0, dev = 0, sms = 0;
+    C10_CUDA_CHECK(cudaGetDevice(&dev));
+    C10_CUDA_CHECK(cudaDeviceGetAttribute(&sms, cudaDevAttrMultiProcessorCount, dev));
+    C10_CUDA_CHECK(cudaOccupancyMaxActiveBlocksPerMultiprocessor(&occ, kern, NW * 32, smem));
+    const int64_t need = (N / 8 + NW - 1) / NW;
+    grid = std::min(need, (int64_t)std::max(occ, 1) * sms);
+  }
+  kern<<<(int)grid, NW * 32, smem, at::cuda::getCurrentCUDAStream()>>>(
+      reinterpret_cast(wp.data_ptr()), base.data_ptr(), reinterpret_cast(W.data_ptr()),
+      reinterpret_cast(x.data_ptr()), reinterpret_cast<__nv_bfloat16*>(out.data_ptr()), (int)M, (int)N, (int)K,
+      (int)SX, (int)W.stride(0), (int)SY, (int)CH);
+  C10_CUDA_KERNEL_LAUNCH_CHECK();
+}
+
+void c12mk(at::Tensor wp, at::Tensor base, at::Tensor W, at::Tensor x, at::Tensor out, int64_t M, int64_t SX, int64_t SY,
+           int64_t nw, int64_t ch, int64_t grid) {
+  const int64_t N = W.size(0), K = W.size(1);
+  TORCH_CHECK(out.scalar_type() == at::kBFloat16, "c12mk: BF16 out only");
+  TORCH_CHECK(ch > 0 && ch % 8 == 0 && K % 128 == 0 && N % 8 == 0 && M >= 1 && M <= 16, "c12mk: bad shape / chunk");
+  const int mt = M <= 8 ? 1 : 2;
+#define C12MK_CASE(NWV, MTV)  if (nw == NWV && mt == MTV) return launchk(wp, base, W, x, out, M, N, K, SX, SY, ch, grid);
+  C12MK_CASE(4, 1) C12MK_CASE(4, 2) C12MK_CASE(8, 1) C12MK_CASE(8, 2) C12MK_CASE(16, 1) C12MK_CASE(16, 2)
+  TORCH_CHECK(false, "c12mk: unsupported nw ", nw);
+}
+
+PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { m.def("c12mk", &c12mk); }
+'''
+_EXT = None
+
+
+def build(verbose=False, build_dir=None):
+    global _EXT
+    if _EXT is None:
+        from torch.utils.cpp_extension import load_inline
+        arch = os.environ.get("N75_CUDA_ARCH", "121a")
+        kw = {"build_directory": build_dir} if build_dir else {}
+        if build_dir:
+            os.makedirs(build_dir, exist_ok=True)
+        _EXT = load_inline("n80_c12mk", cpp_sources="", cuda_sources=CUDA_SRC, verbose=verbose, with_cuda=True,
+                           extra_cuda_cflags=["-O3", f"-gencode=arch=compute_{arch},code=sm_{arch}", "-Xptxas=-v"], **kw)
+    return _EXT
+
+
+def max_ch(m):
+    """Largest chunk (k16 steps, multiple of 8) whose x stage fits one block."""
+    per = 32 * (8 if m <= 8 else 16)
+    return (SMEM_MAX // per) // 8 * 8
+
+
+def c12mk_gemv(x, w, pk, frag, out=None, nw=8, ch=0, grid=0):
+    """x[..., K] @ w[N, K]^T (BF16 out) from the fragment stream, x staged in chunks of ch k16 steps (0 = the largest that fits)."""
+    n, k = pk["shape"]
+    lead = x.shape[:-1]
+    x2 = x.reshape(-1, k)
+    m = x2.shape[0]
+    if not (1 <= m <= 16 and x2.dtype == torch.bfloat16 and x2.stride(1) == 1 and x2.stride(0) % 2 == 0 and x2.data_ptr() % 4 == 0):
+        raise ValueError(f"c12mk_gemv: unsupported operands (m {m}, k {k}, x stride {x2.stride()})")
+    ch = ch or max_ch(m)
+    ch = min(ch, (k // 16 + 7) // 8 * 8)
+    if out is None:
+        out = torch.empty((m, n), device=x.device, dtype=torch.bfloat16)
+    elif not (out.dtype == torch.bfloat16 and out.stride(-1) == 1 and (out.dim() < 2 or out.stride(0) % 2 == 0) and out.data_ptr() % 4 == 0):
+        raise ValueError("c12mk_gemv: unsupported out")
+    build().c12mk(frag, pk["base"], w, x2, out, m, x2.stride(0), out.stride(0) if out.dim() > 1 else n, nw, ch, grid)
+    return out.view(*lead, n)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n80_draft.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n80_draft.py
new file mode 100644
index 0000000000000000000000000000000000000000..a937eb2e29c4dd8d0ab7a4a259b59bc484c64739
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n80_draft.py
@@ -0,0 +1,147 @@
+"""n80 rider (inkling2-spark decode seat, 2026-11-24; DRAFT, not run on the image): exact 12-bit packed DSpark drafter linears on
+n75's packed registry (S6: n75_install.py df7cb3e4, n75_cuda.py 0ab557d0, n75_c12.py bb969a78) and the served <= 16-row
+sm12x_bf16_gemv route. Bitwise to the served drafter GEMV, so draft tokens, acceptance and outputs are unchanged.
+
+Knobs (env): N80_DRAFT ('' or unset = off, nothing patched; A = n75 build 2 on the drafter linears whose K fits its one shared x
+stage; B = A + n80_cuda.c12mk on the others, i.e. down_proj K 9216), N80_NW (c12m warps for drafter classes, default 16),
+N80_MK_NW (c12mk warps, default 8), N80_SKIP (comma list of linears left served, default kv_proj_ctx: mb1 read it +2 pct
+slower packed, N 2,048 being launch-bound). Needs n75 on (N75_C12 non-empty); otherwise logs and stays off.
+What it patches:
+  * n75_install._prepare (n75's own one-time hook at the first target DECODE / TARGET-VERIFY forward outside capture, after the
+    KV pool, before the draft model's graphs are captured): after the original, every DFlashDraftModel instance's BF16 linears
+    on the route (2-D, no bias, N >= 2048, K % 256 == 0) are packed:
+    - K that fits build 2 at 16 rows -> n75's registry as class 'draft ' with KERN 'cuda' (n75's build 2). An entry that
+      would fall back to build 1 (Triton: NOT bitwise, n75 mb1) is removed again, so that weight stays on the served path.
+    - (B) other K -> this module's registry, served by c12mk through one more wrapper around unquant._sm12x_bf16_gemv (the
+      function n75 installed). Everything else falls through to it.
+  The BF16 originals stay (escapes and > 16-row calls read them): about +297 MB (A) / +393 MB (B) device memory after the KV pool.
+Log prefix '[n80 pid=...]'."""
+import gc, logging, os
+
+import torch
+
+logger = logging.getLogger(__name__)
+FORM = os.environ.get("N80_DRAFT", "").strip().upper()
+NW = int(os.environ.get("N80_NW", "16"))
+MK_NW = int(os.environ.get("N80_MK_NW", "8"))
+LEAVES = ("qkv_proj", "kv_proj_ctx", "o_proj", "gate_up_proj", "down_proj")
+SKIP = {v.strip() for v in os.environ.get("N80_SKIP", "kv_proj_ctx").split(",") if v.strip()}
+_S = {"installed": False, "done": False, "mk": {}, "mk_calls": 0, "mk_miss": 0, "n75": 0, "bytes": 0}
+
+
+def _log(msg, *a):
+    logger.warning(f"[n80 pid={os.getpid()}] " + msg, *a)
+
+
+def _mods():
+    from sglang.srt.models.inkling_common import n75_c12 as C, n75_cuda as G, n75_install as N
+    try:
+        from sglang.srt.models.inkling_common import n80_cuda as K
+    except ImportError:
+        import n80_cuda as K
+    return C, G, N, K
+
+
+def _find_drafters(cls):
+    """Every instance of cls alive in this process, also when SGLang's graph-capture setup has run gc.freeze() (base_cuda_graph_runner):
+    frozen objects leave the normal generations, so gc.get_objects() alone returns none of them (stack seat, 2026-11-24: the first
+    composed boot of form B packed 0 drafters for this reason). unfreeze moves them back to the oldest generation, freeze restores the
+    state afterwards; no collection runs (gc stays as it was). type(o).__mro__ is used instead of isinstance: no __class__ lookups on
+    weakref proxies or other objects with hooked __class__."""
+    frozen = gc.get_freeze_count() > 0
+    if frozen:
+        gc.unfreeze()
+    try:
+        return [o for o in gc.get_objects() if cls in type(o).__mro__]
+    finally:
+        if frozen:
+            gc.freeze()
+
+
+def _register_drafter():
+    C, G, N, K = _mods()
+    if N.S.get("orig") is None:
+        _log("n75's wrapper is not installed (n75 prepared off): n80 off")
+        return
+    from sglang.srt.layers.linear import LinearBase
+    from sglang.srt.models.dflash import DFlashDraftModel
+    drafts = _find_drafters(DFlashDraftModel)
+    if not drafts:
+        _log("no DFlashDraftModel instance found (freeze count %d): n80 packs nothing, served path", gc.get_freeze_count())
+    N.KERN["draft"] = "cuda"
+    for d in drafts:
+        for name, m in d.named_modules():
+            leaf = name.split(".")[-1]
+            w, b = getattr(m, "weight", None), getattr(m, "bias", None)
+            if (not isinstance(m, LinearBase) or leaf not in LEAVES or leaf in SKIP or b is not None or not isinstance(w, torch.Tensor)
+                    or w.dtype != torch.bfloat16 or w.dim() != 2 or w.shape[0] < 2048 or w.shape[1] % 256 or w.stride(1) != 1):
+                continue
+            if G.fits(w.shape[1], 16):
+                nb = N._register("draft " + leaf, w.data)
+                e = N.S["reg"].get(w.data_ptr())
+                if e is None or e.get("frag") is None:  # build 1 is not bitwise: keep the served path for this weight
+                    N.S["reg"].pop(w.data_ptr(), None)
+                    _log("%s %s: no build 2 entry, served path", name, tuple(w.shape))
+                    continue
+                N.CUDA_NW["draft " + leaf] = NW
+                _S["n75"] += 1; _S["bytes"] += nb
+            elif FORM == "B":
+                pk = C.pack_c12(w.data, "row")
+                if pk is None:
+                    _log("%s %s FAILED the bitwise round trip: served path", name, tuple(w.shape))
+                    continue
+                frag = G.pack_frag(pk)
+                pk["lo"] = pk["cd"] = None  # c12mk reads the fragment stream, the base and (escapes) the original
+                _S["mk"][w.data_ptr()] = (pk, frag, tuple(w.shape), tuple(w.stride()))
+                _S["bytes"] += frag.numel() + pk["base"].numel()
+    if _S["mk"]:
+        K.build()
+        from sglang.srt.layers.quantization import unquant as U
+        prev = U._sm12x_bf16_gemv
+
+        def wrapped(x, weight, bias=None, out_dtype=None, out=None):
+            e = _S["mk"].get(weight.data_ptr())
+            if (e is not None and bias is None and out_dtype in (None, torch.bfloat16) and x.dtype == torch.bfloat16
+                    and e[2] == tuple(weight.shape) and e[3] == tuple(weight.stride()) and x.numel() // max(1, x.shape[-1]) <= 16):
+                try:
+                    y = K.c12mk_gemv(x, weight, e[0], e[1], out=out, nw=MK_NW)
+                    _S["mk_calls"] += 1
+                    return y
+                except ValueError:
+                    _S["mk_miss"] += 1
+            return prev(x, weight, bias, out_dtype, out)
+
+        U._sm12x_bf16_gemv = wrapped
+    torch.cuda.synchronize()
+    _log("drafter linears packed: %d DFlashDraftModel, %d on n75 build 2 (nw %d), %d on c12mk (nw %d), %.1f MB, form %s",
+         len(drafts), _S["n75"], NW, len(_S["mk"]), MK_NW, _S["bytes"] / 1e6, FORM)
+
+
+def install():
+    if _S["installed"]:
+        return
+    _S["installed"] = True
+    if FORM not in ("A", "B"):
+        _log("N80_DRAFT %r: off, nothing patched", FORM)
+        return
+    from sglang.srt.models.inkling_common import n75_install as N
+    if not N.SEL:
+        _log("n75 is off (N75_C12 empty): n80 off")
+        return
+    orig_prepare = N._prepare
+
+    def _prepare():
+        orig_prepare()
+        if not _S["done"]:
+            _S["done"] = True
+            try:
+                _register_drafter()
+            except Exception as e:  # never kill the server: remove drafter entries, served path
+                for k_, e_ in list(N.S["reg"].items()):
+                    if str(e_.get("cls", "")).startswith("draft "):
+                        N.S["reg"].pop(k_, None)
+                _S["mk"].clear()
+                _log("drafter packing failed (%r): n80 off, served path", e)
+
+    N._prepare = _prepare
+    _log("installed: form %s (packing at n75's first-decode prepare)", FORM)
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n86_riders.py b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n86_riders.py
new file mode 100644
index 0000000000000000000000000000000000000000..87677861d1256adb329bce2fcb2a21667c3372e5
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/patch/n86_riders.py
@@ -0,0 +1,448 @@
+"""n86 S1 riders (inkling2-spark stack seat, 2026-11-23): n54 + G1 + G2 (n71 riders, KEEP in mb2a-d) + the n75 build-2 rider gate.
+
+Mounted beside the image modules at srt/models/inkling_common/n86_riders.py; install() is called from the bottom of the mounted
+inkling2_attn.py (after n75's install). Every knob off = the n54 code path (nothing patched).
+
+G1 (N86_G1=1): the MLP short conv of an EXTEND batch of >= 2048 rows (the served tiled-kernel range, PREFILL_MIN_ROWS) writes the
+  layer's residual update directly (n71_sconvres.sconv_residual 09d3d221 = the image _sconv_prefill_kernel text + residual_add's
+  FP32 order / the block-boundary BF16 add); the sconv cache prepare and update stay the served calls, in the served order around
+  the conv. Gates (else the served path, counted): static weights, BF16 contiguous x / attention / partial of one shape, the
+  served cache shape.
+G2 (N86_G2=1): attn_res(normalize_values=True) + the RMSNorm it feeds in one kernel (n71_resnorm.resnorm d1054a4c) on the
+  NON-LOOP visits (messages is None) of EXTEND batches of >= N86_MIN_ROWS rows: attention side (local: attn_norm; global: the q /
+  k / v input norms into one [3, T, W] BF16 buffer) and MLP side (mlp_norm). Only the (side, sources, addend, queries) shapes
+  in N86_G2_SHAPES run fused (default: mb2d's 16 walk shapes minus ('mlp', 5, 1, 1), which mb2d measured slower, 1.694 -> 2.574
+  ms); other shapes, BF16 / contiguity / pre_weight / output-dtype misses and blocks-empty visits take the served calls.
+n75 gate (N75_C12 set): wraps n75_install._wrapped (n75_install.py 088711f7 unchanged) before its _prepare installs it, so the
+  packed GEMV runs only where RULE n86 S1 (i)-(ii) show coverage: build 2 (registered entry has a CUDA fragment stream), M in
+  N86_N75_MS (default 8,16: bitwise in mb1 BITC and timed in TIMEC), weight shape in {qkvr 8600x2304, wo_ud 2304x3072, LM head
+  201024x2304} and class in N86_N75_CLASSES; every other call takes S['orig'] (the served kernel), counted.
+
+FAIL CLOSED: install() checks the md5 of the nine image files the patch derives from (inkling2.py, inkling2_attn_res.py,
+inkling2_sconv.py, sconv.py, inkling2_norm.py and the AttnRes / sconv / RMSNorm / residual_add kernel files) and that each of the
+three text edits of the served Inkling2DecoderLayer._forward matches exactly once; on any miss G1 and G2 stay off (logged).
+The patched _forward is the image's source with three guarded insertions, exec'd in inkling2's module globals.
+Reach: Python counters per path (graph capture + eager calls) printed as 'N86REACH ...' lines; graph replays are not counted
+here (the check boot's profiler census counts kernels)."""
+import hashlib, logging, os, sys, textwrap, threading, time
+
+import torch
+
+logger = logging.getLogger(__name__)
+
+G1 = os.environ.get("N86_G1", "0") == "1"
+G2 = os.environ.get("N86_G2", "0") == "1"
+MIN_ROWS = int(os.environ.get("N86_MIN_ROWS", "2048") or 2048)
+G1_MIN_ROWS = 2048  # the image short_convolution's PREFILL_MIN_ROWS (asserted at install against the module)
+_DEFAULT_G2 = ("attn:2:0:1,attn:2:0:3,attn:3:0:1,attn:3:0:3,attn:4:0:1,attn:4:0:3,attn:5:0:1,attn:5:0:3,"
+               "mlp:2:0:1,mlp:2:1:1,mlp:3:0:1,mlp:3:1:1,mlp:4:0:1,mlp:4:1:1,mlp:5:0:1")
+
+
+def _shapes(raw):
+    out = set()
+    for part in filter(None, (p.strip() for p in raw.split(","))):
+        side, n, ad, q = part.split(":")
+        out.add((side, int(n), int(ad), int(q)))
+    return out
+
+
+G2_SHAPES = _shapes(os.environ.get("N86_G2_SHAPES") or _DEFAULT_G2)  # empty / unset = the default list
+N75_MS = {int(v) for v in (os.environ.get("N86_N75_MS") or "8,16").split(",") if v.strip()}
+N75_CLASSES = {v.strip() for v in (os.environ.get("N86_N75_CLASSES") or "qkvr,wo_ud,lm_head").split(",") if v.strip()}
+N75_SHAPES = {"qkvr": (8600, 2304), "wo_ud": (2304, 3072), "lm_head": (201024, 2304)}
+
+# md5 of the image files the patch derives from (image lmsysorg/sglang@sha256:efac853b..., checked 11-23 on the Spark)
+IMAGE_MD5 = {
+    "sglang.srt.models.inkling2": "5db5443befb09e9a846d2fad560bb7cb",
+    "sglang.srt.models.inkling_common.inkling2_attn_res": "803b43bfe76e190f0bf92c61269c2ae2",
+    "sglang.srt.models.inkling_common.inkling2_sconv": "8ca39087d78cfacc0d580144a39c726e",
+    "sglang.srt.models.inkling_common.sconv": "f2d226bdb97182a70b76f24bee3a9ff5",
+    "sglang.srt.models.inkling_common.inkling2_norm": "a1aa0ab904b384f7ab6e61e1af7a3a0f",
+    "sglang.kernels.ops.attention.inkling2_attn_res": "4da6f04bca81772dcc6109bc67fc1730",
+    "sglang.kernels.ops.mamba.inkling2_sconv": "f65e89067b7fa7d76b9b7c3e4bacea26",
+    "sglang.kernels.ops.layernorm.inkling2_rms_norm": "e1be9289e74eb22350b0206f4244f941",
+    "sglang.kernels.ops.elementwise.inkling2_residual_add": "c42560e64d3629b070582e0d7c09525e",
+}
+FORWARD_MD5 = "466a152cc7f66083a999dbf15f926fb8"  # dedented source of the image Inkling2DecoderLayer._forward
+
+# ---- the three guarded insertions into the served _forward (each anchor must match exactly once) ----
+EDITS = (
+    ("    attn_input = self._attention_input(\n"
+     "        state.attention_input(self.layer_id), messages\n"
+     "    )\n",
+     "    attn_input = _n86_g2_attention(self, state, forward_batch, messages)\n"
+     "    if attn_input is None:\n"
+     "        attn_input = self._attention_input(\n"
+     "            state.attention_input(self.layer_id), messages\n"
+     "        )\n"),
+    ("    mlp_input = state.mlp_input(self.layer_id, attention)\n"
+     "    if messages is not None:\n"
+     "        mlp_input = messages.mix(\n"
+     "            self.layer_id - self.config.loop_core_layers.start,\n"
+     "            (mlp_input,),\n"
+     "            self.controller_weights,\n"
+     "            \"mlp\",\n"
+     "        )[0]\n"
+     "    mlp_input = self.mlp_norm(mlp_input)\n",
+     "    mlp_input = _n86_g2_mlp(self, state, attention, forward_batch, messages)\n"
+     "    if mlp_input is None:\n"
+     "        mlp_input = state.mlp_input(self.layer_id, attention)\n"
+     "        if messages is not None:\n"
+     "            mlp_input = messages.mix(\n"
+     "                self.layer_id - self.config.loop_core_layers.start,\n"
+     "                (mlp_input,),\n"
+     "                self.controller_weights,\n"
+     "                \"mlp\",\n"
+     "            )[0]\n"
+     "        mlp_input = self.mlp_norm(mlp_input)\n"),
+    ("    mlp = self.mlp_sconv(mlp, positions, forward_batch)\n"
+     "    state.finalize_layer(self.layer_id, attention, mlp)\n",
+     "    if _n86_g1(self, state, attention, mlp, forward_batch):\n"
+     "        return\n"
+     "    mlp = self.mlp_sconv(mlp, positions, forward_batch)\n"
+     "    state.finalize_layer(self.layer_id, attention, mlp)\n"),
+)
+
+R = {"g1": {}, "g2": {}, "served": {}, "n75": {}, "modes": {}}
+K = {"sconv_residual": None, "resnorm": None, "pdl": None, "AttentionSources": None}
+_NW_CACHE = {}
+_STATE = {"installed": False, "patched": False, "why": "not installed"}
+
+
+def _bump(d, k):
+    d[k] = d.get(k, 0) + 1
+
+
+def _served(reason):
+    _bump(R["served"], reason)
+    return None
+
+
+def _md5_file(path):
+    with open(path, "rb") as f:
+        return hashlib.md5(f.read()).hexdigest()
+
+
+def served_forward_source(path):
+    """The dedented source of Inkling2DecoderLayer._forward from the image file (ast segment)."""
+    import ast
+    src = open(path).read()
+    for node in ast.walk(ast.parse(src)):
+        if isinstance(node, ast.ClassDef) and node.name == "Inkling2DecoderLayer":
+            for f in node.body:
+                if isinstance(f, ast.FunctionDef) and f.name == "_forward":
+                    return textwrap.dedent(ast.get_source_segment(src, f, padded=True))
+    return None
+
+
+def patched_forward_source(served):
+    out = served if served.endswith("\n") else served + "\n"  # the ast segment ends without one
+    for old, new in EDITS:
+        if out.count(old) != 1:
+            raise ValueError(f"n86: edit anchor found {out.count(old)} times: {old.splitlines()[0].strip()!r}")
+        out = out.replace(old, new)
+    return out
+
+
+def _mode_ok(forward_batch):
+    """EXTEND batches only (the served ShortConvolution.forward's extend = not decode and not verify); draft modes excluded."""
+    m = forward_batch.forward_mode
+    _bump(R["modes"], getattr(m, "name", str(m)))
+    if m.is_decode() or m.is_target_verify() or not m.is_extend():
+        return False
+    for attr in ("is_draft_extend", "is_draft_extend_v2"):
+        f = getattr(m, attr, None)
+        if f is not None and f():
+            return False
+    return True
+
+
+DEVICE_OK = lambda x: x.is_cuda  # noqa: E731  (the CPU pre-flight replaces it; served kernels need CUDA tensors)
+
+
+def _bf16_rows(xs, shape):
+    return all(x.dtype == torch.bfloat16 and x.is_contiguous() and tuple(x.shape) == shape and DEVICE_OK(x) for x in xs)
+
+
+def _queries(attn_res, kind, layer_idx, queries):
+    """block_attn_res's effective queries, exactly: unsqueeze a 1-D query, the cached scaled query (view) or q.float() * W**-0.5."""
+    if queries.ndim == 1:
+        queries = queries.unsqueeze(0)
+    scaled = attn_res.scaled_query(kind, layer_idx)
+    eff = scaled.view(queries.shape) if scaled is not None else queries.float() * (queries.shape[-1] ** -0.5)
+    return eff.contiguous()
+
+
+def _norms_ok(norms):
+    n0 = norms[0]
+    return all(n.pre_weight is None and n.weight is not None and n.output_dtype == torch.bfloat16 and n.eps == n0.eps
+               and n.weight.dtype == n0.weight.dtype and n.weight.is_contiguous() and n.weight.dim() == 1 for n in norms)
+
+
+def _stacked_norm_weight(norms):
+    """[3, W] q / k / v norm weights. Cached only when built outside graph capture (a persistent allocation); inside a
+    capture the stack is recorded into the graph (a 27 KB copy per replay)."""
+    key = tuple((n.weight.data_ptr(), n.weight._version) for n in norms)
+    w = _NW_CACHE.get(key)
+    if w is not None:
+        return w
+    w = torch.stack([n.weight for n in norms]).contiguous()
+    if not torch.cuda.is_current_stream_capturing():
+        _NW_CACHE[key] = w
+    else:
+        _bump(R["g2"], "nw stacked in capture")
+    return w
+
+
+def _n86_g2_attention(layer, state, forward_batch, messages):
+    if not G2:
+        return None
+    if messages is not None:
+        return _served("g2 attn: loop pass (messages)")
+    if not state.blocks:
+        return _served("g2 attn: blocks empty (no attn_res)")
+    partial = state.partial
+    if not _mode_ok(forward_batch):
+        return _served("g2 attn: not extend")
+    T, W = partial.shape
+    if T < MIN_ROWS:
+        return _served("g2 attn: rows < min")
+    ar = state.attn_res
+    if not ar.normalize_values:
+        return _served("g2 attn: normalize_values False")
+    sources = [*state.blocks, partial]
+    local = layer.is_local
+    Q = 1 if local else 3
+    key = ("attn", len(sources), 0, Q)
+    if key not in G2_SHAPES:
+        return _served(f"g2 shape {key} served")
+    if not _bf16_rows(sources, (T, W)):
+        return _served("g2 attn: dtype / layout")
+    norms = (layer.attn_norm,) if local else (layer.q_input_norm, layer.k_input_norm, layer.v_input_norm)
+    if not _norms_ok(norms):
+        return _served("g2 attn: norm config")
+    q = _queries(ar, "attn", layer.layer_id, ar.attn_query(layer.layer_id))
+    if tuple(q.shape) != (Q, W) or q.dtype != torch.float32:
+        return _served("g2 attn: query shape")
+    nw = norms[0].weight if local else _stacked_norm_weight(norms)
+    y = partial.new_empty((Q, T, W), dtype=torch.bfloat16)
+    K["resnorm"](sources, None, q, nw, y, 1e-6, norms[0].eps)
+    _bump(R["g2"], key)
+    if local:
+        return y[0]
+    return K["AttentionSources"](y[0], y[1], y[2])
+
+
+def _n86_g2_mlp(layer, state, attention, forward_batch, messages):
+    if not G2:
+        return None
+    if messages is not None:
+        return _served("g2 mlp: loop pass (messages)")
+    if not _mode_ok(forward_batch):
+        return _served("g2 mlp: not extend")
+    T, W = state.partial.shape
+    if T < MIN_ROWS:
+        return _served("g2 mlp: rows < min")
+    ar = state.attn_res
+    if not ar.normalize_values:
+        return _served("g2 mlp: normalize_values False")
+    if ar.is_block_boundary(layer.layer_id):           # mlp_input: blocks + [partial], partial block = attention
+        sources, addend = [*state.blocks, state.partial, attention], None
+    else:                                             # mlp_input: blocks, (partial, attention) = last source + addend
+        sources, addend = [*state.blocks, state.partial], attention
+    key = ("mlp", len(sources), int(addend is not None), 1)
+    if key not in G2_SHAPES:
+        return _served(f"g2 shape {key} served")
+    if not _bf16_rows(sources + ([addend] if addend is not None else []), (T, W)):
+        return _served("g2 mlp: dtype / layout")
+    norm = layer.mlp_norm
+    if not _norms_ok((norm,)):
+        return _served("g2 mlp: norm config")
+    q = _queries(ar, "mlp", layer.layer_id, ar.mlp_queries[layer.layer_id])
+    if tuple(q.shape) != (1, W) or q.dtype != torch.float32:
+        return _served("g2 mlp: query shape")
+    y = state.partial.new_empty((1, T, W), dtype=torch.bfloat16)
+    K["resnorm"](sources, addend, q, norm.weight, y, 1e-6, norm.eps)
+    _bump(R["g2"], key)
+    return y[0]
+
+
+def _n86_g1(layer, state, attention, mlp, forward_batch):
+    if not G1:
+        return False
+    if not isinstance(mlp, torch.Tensor):
+        _served("g1: routed output")
+        return False
+    if not _mode_ok(forward_batch):
+        _served("g1: not extend")
+        return False
+    sc = layer.mlp_sconv
+    if getattr(sc, "is_dynamic", True):
+        _served("g1: dynamic sconv")
+        return False
+    T = mlp.shape[0]
+    if T < G1_MIN_ROWS or mlp.dim() != 2:
+        _served("g1: rows < 2048")
+        return False
+    boundary = state.attn_res.is_block_boundary(layer.layer_id)
+    xs = [mlp, attention] + ([] if boundary else [state.partial])
+    if not _bf16_rows(xs, tuple(mlp.shape)):
+        _served("g1: dtype / layout")
+        return False
+    weight = sc._weight_2d()
+    cache = sc._sconv_cache()
+    width = weight.shape[1]
+    if cache.ndim != 3 or tuple(cache.shape[1:]) != (width - 1, mlp.shape[1]) or weight.dim() != 2:
+        _served("g1: cache shape")
+        return False
+    meta = sc._conv_state(forward_batch)
+    sc._prepare_extend_sconv_cache(forward_batch, cache, mlp, meta.track_conv_indices)   # served order: prepare, conv, update
+    holder = []
+
+    def update(partial):
+        out = K["sconv_residual"](mlp, weight, cache, meta.precomputed, attention, partial, use_pdl=K["pdl"])
+        holder.append(out)
+        return out
+
+    from sglang.srt.models.inkling_common.kernels.sconv import update_sconv_cache
+    # finalize_layer_with: boundary -> blocks.append(partial), partial = update(None); else partial = update(partial)
+    state.finalize_layer_with(layer.layer_id, update)
+    update_sconv_cache(
+        x=mlp,
+        sconv_cache=cache,
+        cache_indices=meta.cache_indices,
+        has_initial_state=meta.has_initial_state,
+        query_start_loc=meta.query_start_loc,
+    )
+    _bump(R["g1"], "boundary" if boundary else "residual")
+    return True
+
+
+def build_forward(served_src, module_globals):
+    """Exec the patched _forward in the inkling2 module globals (helpers injected under _n86_* names)."""
+    module_globals["_n86_g2_attention"] = _n86_g2_attention
+    module_globals["_n86_g2_mlp"] = _n86_g2_mlp
+    module_globals["_n86_g1"] = _n86_g1
+    ns = {}
+    exec(compile(patched_forward_source(served_src), "", "exec"), module_globals, ns)
+    return ns["_forward"]
+
+
+def _check_files():
+    bad = []
+    for mod, want in IMAGE_MD5.items():
+        m = sys.modules.get(mod)
+        if m is None:
+            __import__(mod)
+            m = sys.modules[mod]
+        got = _md5_file(m.__file__)
+        if got != want:
+            bad.append(f"{mod} {got[:8]} != {want[:8]}")
+    return bad
+
+
+def _patch_layer():
+    """Runs at the first Inkling2Attention construction (inkling2.py has finished importing by then)."""
+    if _STATE["patched"] or not (G1 or G2):
+        return
+    _STATE["patched"] = True
+    try:
+        bad = _check_files()
+        if bad:
+            _STATE["why"] = f"image files differ: {bad}"
+            logger.warning("n86: G1 / G2 OFF (served path): %s", _STATE["why"])
+            return
+        I = sys.modules["sglang.srt.models.inkling2"]
+        src = served_forward_source(I.__file__)
+        if src is None or hashlib.md5(src.encode()).hexdigest() != FORWARD_MD5:
+            _STATE["why"] = "served _forward source differs"
+            logger.warning("n86: G1 / G2 OFF (served path): %s", _STATE["why"])
+            return
+        from sglang.kernels.ops.mamba import inkling2_sconv as KS
+        if KS.PREFILL_MIN_ROWS != G1_MIN_ROWS:
+            _STATE["why"] = f"PREFILL_MIN_ROWS {KS.PREFILL_MIN_ROWS}"
+            logger.warning("n86: G1 / G2 OFF: %s", _STATE["why"])
+            return
+        from sglang.kernels.jit.utils import is_arch_support_pdl
+        from sglang.srt.models.inkling_common.n71_resnorm import resnorm
+        from sglang.srt.models.inkling_common.n71_sconvres import sconv_residual
+        K.update(sconv_residual=sconv_residual, resnorm=resnorm, pdl=bool(is_arch_support_pdl()),
+                 AttentionSources=I.AttentionSources)
+        I.Inkling2DecoderLayer._forward = build_forward(src, I.__dict__)
+        _STATE["why"] = "patched"
+        logger.warning("n86: Inkling2DecoderLayer._forward patched (G1 %s, G2 %s, min rows %d, G2 shapes %d, pdl %s)",
+                       G1, G2, MIN_ROWS, len(G2_SHAPES), K["pdl"])
+    except Exception as ex:  # fail closed
+        _STATE["why"] = f"{type(ex).__name__}: {str(ex)[:300]}"
+        logger.warning("n86: G1 / G2 OFF (served path) after an install error: %s", _STATE["why"])
+
+
+def _n75_gate():
+    """Restrict n75's wrapper (installed into unquant by n75's own _prepare) to the covered (class, shape, M) on build 2."""
+    from sglang.srt.models.inkling_common import n75_install as X
+    if not X.SEL:
+        return
+    orig = X._wrapped
+
+    def gated(x, weight, bias=None, out_dtype=None, out=None):
+        e = X.S["reg"].get(weight.data_ptr())
+        if e is not None:
+            m = x.numel() // max(1, x.shape[-1])
+            cls = e["cls"]
+            why = None
+            if e.get("frag") is None:
+                why = "not build 2"
+            elif cls.startswith("draft "):  # S7 (n151): n80's drafter linears ('draft ', build 2 at <= 16 rows): no class / shape / M gate;
+                if m <= 16:                 # > 16 rows falls to n75's own wrapper, which returns the served kernel. Packed calls counted below.
+                    _bump(R["n75"], f"{cls} M{m} packed")
+                return orig(x, weight, bias, out_dtype, out)
+            elif cls not in N75_CLASSES:
+                why = "class off"
+            elif tuple(weight.shape) != N75_SHAPES.get(cls):
+                why = "shape off"
+            elif m not in N75_MS:
+                why = f"M {m} off" if m <= 16 else None   # > 16 rows: n75's own wrapper returns the served kernel
+            if why is not None:
+                _bump(R["n75"], f"{cls} {why}")
+                return X.S["orig"](x, weight, bias, out_dtype, out)
+            if m in N75_MS:
+                _bump(R["n75"], f"{cls} M{m} packed")
+        return orig(x, weight, bias, out_dtype, out)
+
+    X._wrapped = gated
+    logger.warning("n86: n75 gate installed: classes %s, M %s, build 2 only", sorted(N75_CLASSES), sorted(N75_MS))
+
+
+def _reporter():
+    def run():
+        last = None
+        while True:
+            time.sleep(15)
+            c = repr((R["g1"], R["g2"], R["n75"], R["served"]))
+            if c != last:
+                print(f"N86REACH g1 {R['g1']} g2 {R['g2']} n75 {R['n75']} served {R['served']} modes {R['modes']} "
+                      f"state {_STATE['why']!r} t={time.strftime('%H:%M:%S', time.gmtime())}", file=sys.stderr, flush=True)
+                last = c
+
+    threading.Thread(target=run, daemon=True, name="n86reach").start()
+
+
+def install():
+    if _STATE["installed"]:
+        return
+    _STATE["installed"] = True
+    if G1 or G2:
+        from sglang.srt.models.inkling_common import inkling2_attn as A
+        cls = A.Inkling2Attention
+        orig_init = cls.__init__
+
+        def init(self, *a, **kw):
+            _patch_layer()
+            orig_init(self, *a, **kw)
+
+        cls.__init__ = init
+    if os.environ.get("N75_C12", "").strip():
+        _n75_gate()
+    if G1 or G2 or os.environ.get("N75_C12", "").strip():
+        _reporter()
+    logger.warning("n86 installed: G1 %s G2 %s N75_C12 %r", G1, G2, os.environ.get("N75_C12", ""))
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/serve/inkling2_mtp.py b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/inkling2_mtp.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c77a6e549d5321263d97523c0a9a1aa615a4a20
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/inkling2_mtp.py
@@ -0,0 +1,667 @@
+import json
+import logging
+import os
+from collections.abc import Iterable
+
+import torch
+from torch import nn
+
+from sglang.kernels.ops.speculative.inkling2_mtp import (
+    mix_rmsnorm,
+    rnn_gates,
+    rnn_inputs,
+)
+from sglang.srt.distributed.device_communicators.vocab_gather import (
+    make_vocab_gather,
+)
+from sglang.srt.layers.layernorm import RMSNorm
+from sglang.srt.layers.linear import QKVParallelLinear
+from sglang.srt.layers.logits_processor import should_apply_lm_head_quant_method
+from sglang.srt.mem_cache.memory_pool import KVWriteLoc, layer_window_locs
+from sglang.srt.mem_cache.swa_memory_pool import SWAKVPool
+from sglang.srt.model_loader.weight_utils import default_weight_loader
+from sglang.srt.models.dflash import DFlashDraftModel
+from sglang.srt.models.dspark import (
+    BaseDSparkMarkovHead,
+    DSparkDraftModel,
+    VocabShard,
+    gather_and_crop_vocab,
+    project_through_lm_head,
+)
+from sglang.srt.runtime_context import get_parallel, get_platform
+
+logger = logging.getLogger(__name__)
+# n3 ds-sl (inkling2-spark dspark seat, 2026-11-20): shortlist-vocab draft head. When set, the draft's base logits and its
+# markov step bias are computed only over the token ids listed in this JSON file and written into full-width rows whose
+# other columns hold _SL_FILL (base) / 0 (bias), so every consumer downstream sees the usual [.., vocab] shapes and real
+# token ids. Draft-only: the target verify, and so the greedy output, is untouched; off-list tokens can only be rejected.
+_SL_PATH = os.environ.get("SGLANG_INKLING2_DRAFT_SHORTLIST") or None
+_SL_FILL = -1.0e4
+
+
+class Inkling2MTPHead(BaseDSparkMarkovHead):
+    def __init__(self, vocab_size, markov_rank, hidden_size, rms_norm_eps):
+        super().__init__()
+        self.vocab_size = vocab_size
+        self.hidden_size = hidden_size
+        self.markov_rank = markov_rank
+        self.markov_w1 = nn.Embedding(vocab_size, markov_rank)
+        self.rnn_proj = nn.Linear(2 * markov_rank + 2 * hidden_size, 3 * markov_rank)
+        self.hidden_out = nn.Linear(markov_rank, hidden_size)
+        self.dflare_norm = RMSNorm(hidden_size, eps=rms_norm_eps)
+        self._fold_weight = None
+        self._fold_bias = None
+        self._gather_logits = None
+        self._get_staged_f = None
+        self._sl_ids = None
+
+    @torch.no_grad()
+    def attach_fold(self, weight, multiplier):
+        assert weight.ndim == 2 and weight.shape[1] == self.hidden_size
+        self._fold_weight = weight.new_empty((weight.shape[0], self.markov_rank))
+        self._fold_bias = weight.new_empty((weight.shape[0],))
+        self.refresh_fold(weight, multiplier)
+
+    @torch.no_grad()
+    def refresh_fold(self, weight, multiplier):
+        assert self._fold_weight is not None and self._fold_bias is not None
+        assert weight.shape == (self._fold_weight.shape[0], self.hidden_size)
+        projection = self.hidden_out.weight.double()
+        bias = self.hidden_out.bias.double()
+        for start in range(0, weight.shape[0], 4096):
+            rows = slice(start, min(start + 4096, weight.shape[0]))
+            head = weight[rows].double()
+            folded_weight, folded_bias = head @ projection, head @ bias
+            if multiplier:
+                folded_weight /= multiplier
+                folded_bias /= multiplier
+            self._fold_weight[rows].copy_(folded_weight)
+            self._fold_bias[rows].copy_(folded_bias)
+        if self._sl_ids is not None:
+            self.attach_shortlist(self._sl_ids, self._sl_width)
+
+    @torch.no_grad()
+    def attach_shortlist(self, ids, width):
+        self._sl_ids, self._sl_width = ids, int(width)
+        self._sl_fw = self._fold_weight.index_select(0, ids).contiguous()
+        self._sl_fb = self._fold_bias.index_select(0, ids).contiguous()
+
+    def get_prev_embeddings(self, token_ids):
+        return self.markov_w1(token_ids.long())
+
+    def _rnn_step(self, state, prev_tokens, hidden, f_rnn):
+        inputs = rnn_inputs(state, prev_tokens, self.markov_w1.weight, hidden, f_rnn)
+        return rnn_gates(self.rnn_proj(inputs), state)
+
+    def init_state(self, hidden_states):
+        batch_size = hidden_states.shape[0]
+        assert self._get_staged_f is not None
+        f_rnn = self._get_staged_f()
+        assert f_rnn is not None and f_rnn.shape[0] >= batch_size
+        assert f_rnn.shape[1] == self.hidden_size
+        return (
+            hidden_states.new_zeros(batch_size, self.markov_rank),
+            f_rnn[:batch_size].to(hidden_states.dtype),
+        )
+
+    def step_bias(self, prev_tokens, *, hidden_states, state):
+        state, f_rnn = state
+        state, latent = self._rnn_step(state, prev_tokens, hidden_states, f_rnn)
+        if self._sl_ids is not None:
+            part = torch.addmm(self._sl_fb, latent.to(self._sl_fw.dtype), self._sl_fw.T)
+            bias = part.new_zeros((part.shape[0], self._sl_width))
+            bias.index_copy_(1, self._sl_ids, part)
+            return bias, (state, f_rnn)
+        assert self._fold_weight is not None and self._fold_bias is not None
+        assert self._gather_logits is not None
+        bias = torch.addmm(
+            self._fold_bias, latent.to(self._fold_weight.dtype), self._fold_weight.T
+        )
+        if self.vocab_shard is None:
+            bias = self._gather_logits(bias)
+        return bias, (state, f_rnn)
+
+    def step_logits_dtype(self, base_dtype):
+        return torch.promote_types(base_dtype, self._fold_weight.dtype)
+
+
+class Inkling2ForConditionalGenerationMTP(DSparkDraftModel):
+    fall_back_to_pt_during_load = False
+    allow_patterns_overrides = ["mtp.safetensors"]
+    safetensors_index_file = None
+    supports_pre_gather_target_hidden_projection = False
+    supports_fused_context_kv = False
+    folds_static_verify_commit = True
+
+    def __init__(self, config, quant_config=None, prefix=""):
+        if quant_config is not None:
+            raise ValueError("Inkling2 MTP requires BF16 checkpoint weights")
+        if config.q_bias or config.o_bias:
+            raise ValueError(
+                "Inkling2 MTP does not support attention projection biases"
+            )
+        DFlashDraftModel.__init__(
+            self, config, quant_config=quant_config, prefix=prefix
+        )
+        hidden, eps = config.hidden_size, config.rms_norm_eps
+        self.block_size = config.block_size
+        self.gamma = self.block_size - 1
+        self.sample_from_anchor = False
+        self.num_stages = config.num_hidden_layers
+        self.num_context_features = len(config.target_layer_ids)
+        self.logits_mup_width_multiplier = None
+        self.fc = self.hidden_norm = None
+        self.lm_head = None
+        self.confidence_head = None
+        self.markov_head = Inkling2MTPHead(
+            config.padded_vocab_size, config.markov_rank, hidden, eps
+        )
+        self.markov_head.step_softcap = config.final_logit_softcapping or None
+        self.markov_head.step_vocab_limit = config.unpadded_vocab_size
+        self.fuse_weight = nn.Parameter(
+            torch.zeros(self.num_stages + 1, self.num_context_features),
+            requires_grad=False,
+        )
+        self.mask_embed = nn.Parameter(torch.zeros(hidden), requires_grad=False)
+        self._fuse_alpha = None
+        self._f_rnn_rows = None
+        self._f_rnn_buf = None
+        self._sl_ids = None
+        for layer_id, layer in enumerate(self.layers):
+            attn = layer.self_attn
+            attn.attn.window_anchor_at_start = layer_id in config.local_layer_ids
+            attn.attn.num_splits = (
+                0
+                if get_platform().is_sm90 or layer_id not in config.local_layer_ids
+                else 1
+            )
+            attn.attn.pack_gqa = True
+            attn.kv_proj_ctx = QKVParallelLinear(
+                hidden_size=hidden,
+                head_size=attn.head_dim,
+                total_num_heads=0,
+                total_num_kv_heads=attn.total_num_kv_heads,
+                bias=False,
+            )
+            attn.k_norm_ctx = RMSNorm(attn.head_dim, eps=eps)
+            layer.dflare_norm = RMSNorm(hidden, eps=eps)
+
+    def set_block_size(self, block_size):
+        if block_size != self.block_size:
+            raise ValueError("Inkling2 MTP requires the checkpoint's block size")
+
+    def attach_shared_modules(self, *, embed_tokens, lm_head):
+        if should_apply_lm_head_quant_method(lm_head, lm_head.quant_method):
+            raise ValueError("Inkling2 MTP requires an unquantized target LM head")
+        self.embed_tokens, self.lm_head = embed_tokens, lm_head
+        self.markov_head.attach_fold(lm_head.weight, self.logits_mup_width_multiplier)
+        self.markov_head._gather_logits = self._gather_logits
+        self.markov_head._get_staged_f = lambda: self._f_rnn_rows
+        if _SL_PATH:
+            self._attach_shortlist(_SL_PATH)
+        if lm_head.tp_size > 1:
+            group = (
+                get_parallel().attn_tp_group
+                if lm_head.use_attn_tp_group
+                else get_parallel().tp_group
+            )
+            assert group.world_size == lm_head.tp_size
+            assert (
+                lm_head.num_embeddings_per_partition * lm_head.tp_size
+                == lm_head.num_embeddings_padded
+            )
+            self.markov_head.vocab_size = int(lm_head.org_vocab_size)
+            shard = lm_head.shard_indices
+            self.markov_head.vocab_shard = VocabShard(
+                start=int(shard.org_vocab_start_index),
+                width=int(shard.org_vocab_end_index - shard.org_vocab_start_index),
+                gather=make_vocab_gather(
+                    group,
+                    local_width=int(lm_head.num_embeddings_per_partition),
+                    dtype=lm_head.weight.dtype,
+                ),
+            )
+
+    @torch.no_grad()
+    def _attach_shortlist(self, path):
+        if self.lm_head.tp_size > 1:
+            raise ValueError("SGLANG_INKLING2_DRAFT_SHORTLIST supports TP1 only")
+        with open(path) as f:
+            ids = sorted({int(i) for i in json.load(f)})
+        width = int(self.lm_head.org_vocab_size)
+        limit = self.markov_head.step_vocab_limit or width
+        if not ids or ids[0] < 0 or ids[-1] >= min(width, limit):
+            raise ValueError(f"shortlist ids must lie in [0, {min(width, limit)})")
+        weight = self.lm_head.weight
+        sl = torch.tensor(ids, dtype=torch.long, device=weight.device)
+        self._sl_ids, self._sl_width = sl, width
+        self._sl_w = weight.index_select(0, sl).contiguous()
+        self.markov_head.attach_shortlist(sl, width)
+        logger.info(
+            "Inkling2 MTP shortlist draft head: %d of %d tokens (%s).", len(ids), width, path
+        )
+
+    def _gather_logits(self, logits):
+        return gather_and_crop_vocab(logits, self.lm_head)
+
+    def compute_base_logits(self, hidden):
+        assert self.lm_head is not None
+        if self.logits_mup_width_multiplier:
+            hidden = hidden / self.logits_mup_width_multiplier
+        if self._sl_ids is not None:
+            part = torch.matmul(hidden.to(self._sl_w.dtype), self._sl_w.T)
+            logits = part.new_full((part.shape[0], self._sl_width), _SL_FILL)
+            logits.index_copy_(1, self._sl_ids, part)
+            return logits, None
+        logits = project_through_lm_head(hidden, self.lm_head)
+        if self.markov_head.vocab_shard is None:
+            logits = self._gather_logits(logits)
+        return logits, None
+
+    def forward_embed(self, input_ids):
+        assert self.embed_tokens is not None
+        ids = input_ids.view(-1, self.block_size)
+        hidden = (
+            self.mask_embed.to(self.embed_tokens.weight.dtype)
+            .expand(ids.shape[0], self.block_size, -1)
+            .clone()
+        )
+        hidden[:, 0, :] = self.embed_tokens(ids[:, 0]).to(hidden.dtype)
+        return hidden.view(-1, hidden.shape[-1])
+
+    def ensure_propose_staging(self, req_pool_size):
+        if self._f_rnn_buf is None:
+            self._f_rnn_buf = self.mask_embed.new_zeros(
+                req_pool_size + 1, self.config.hidden_size
+            )
+        elif self._f_rnn_buf.shape[0] != req_pool_size + 1:
+            raise ValueError(
+                "MTP request pool changed after recurrent state allocation"
+            )
+
+    def _mix_norm(self, targets, row, norm):
+        assert self._fuse_alpha is not None
+        alpha = self._fuse_alpha[row].to(targets.dtype)
+        return mix_rmsnorm(targets, alpha, norm.weight, norm.variance_epsilon)
+
+    def compute_f_rnn(self, target_hidden_last):
+        targets = target_hidden_last.view(
+            target_hidden_last.shape[0],
+            self.num_context_features,
+            self.config.hidden_size,
+        )
+        return self._mix_norm(targets, -1, self.markov_head.dflare_norm)
+
+    def store_f_rnn(self, req_pool_indices, target_hidden_rows):
+        assert self._f_rnn_buf is not None
+        features = self.compute_f_rnn(target_hidden_rows)
+        self._f_rnn_buf.index_copy_(
+            0, req_pool_indices.view(-1).long(), features.to(self._f_rnn_buf.dtype)
+        )
+
+    def store_verify_commit(
+        self, *, req_pool_indices, verify_hidden, commit_lens, stride, valid=None
+    ):
+        bs = commit_lens.shape[0]
+        rows = torch.arange(bs, device=verify_hidden.device)
+        last_hidden = verify_hidden.view(bs, stride, -1)[rows, commit_lens.long() - 1]
+        indices = req_pool_indices[:bs].view(-1).long()
+        if valid is not None:
+            indices = torch.where(valid, indices, self._f_rnn_buf.shape[0] - 1)
+        self.store_f_rnn(indices, last_hidden)
+
+    @torch.no_grad()
+    def forward(self, input_ids, positions, forward_batch, input_embeds=None, **kwargs):
+        batch_size, remainder = divmod(input_ids.numel(), self.block_size)
+        assert remainder == 0
+        assert self._f_rnn_buf is not None
+        self._f_rnn_rows = self._f_rnn_buf.index_select(
+            0, forward_batch.req_pool_indices.view(-1)[:batch_size].long()
+        )
+        input_embeds = self.forward_embed(input_ids)
+        return DFlashDraftModel.forward(
+            self,
+            input_ids,
+            positions,
+            forward_batch,
+            input_embeds=input_embeds,
+            **kwargs,
+        )
+
+    def project_target_hidden(self, target_hidden):
+        raise RuntimeError(
+            "Inkling2 MTP requires a separate target mixture for every layer"
+        )
+
+    def write_target_hidden_kv(
+        self,
+        *,
+        target_hidden,
+        pool,
+        positions,
+        cache_loc,
+        cache_loc_2d=None,
+        commit_lens=None,
+        target_hidden_is_projected=False,
+        swa_loc=None,
+    ):
+        if target_hidden_is_projected:
+            raise ValueError("Inkling2 MTP requires unprojected target hidden states")
+        targets = target_hidden.view(
+            target_hidden.shape[0], self.num_context_features, self.config.hidden_size
+        )
+        if swa_loc is None and isinstance(pool, SWAKVPool):
+            # Static verify capture can supply only full-space locations.
+            swa_loc = pool.translate_loc_from_full_to_swa(cache_loc)
+        for i, layer in enumerate(self.layers):
+            attn = layer.self_attn
+            context = self._mix_norm(targets, i, layer.dflare_norm)
+            kv, _ = attn.kv_proj_ctx(context.to(attn.kv_proj_ctx.weight.dtype))
+            k, v = kv.split([attn.kv_size, attn.kv_size], dim=-1)
+            k = attn.k_norm_ctx(k.reshape(-1, attn.head_dim)).view_as(k)
+            k = attn.apply_k_rope(positions, k)
+            k = k.view(-1, attn.num_kv_heads, attn.head_dim)
+            v = v.view(-1, attn.num_kv_heads, attn.head_dim)
+            if cache_loc_2d is not None and commit_lens is not None:
+                pool.layer_router.layer(attn.attn.layer_id).store_prefix(
+                    attn.attn,
+                    KVWriteLoc(
+                        cache_loc_2d,
+                        window_locs=layer_window_locs(
+                            pool,
+                            attn.attn.layer_id,
+                            None if swa_loc is None else swa_loc.view_as(cache_loc_2d),
+                        ),
+                        physical=True,
+                    ),
+                    commit_lens,
+                    k,
+                    v,
+                    attn.attn.k_scale,
+                    attn.attn.v_scale,
+                )
+            else:
+                pool.layer_router.layer(attn.attn.layer_id).store(
+                    attn.attn,
+                    KVWriteLoc(
+                        cache_loc,
+                        window_locs=layer_window_locs(
+                            pool, attn.attn.layer_id, swa_loc
+                        ),
+                        physical=True,
+                    ),
+                    k,
+                    v,
+                    attn.attn.k_scale,
+                    attn.attn.v_scale,
+                )
+
+    def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
+        params = {
+            name: param
+            for name, param in self.named_parameters()
+            if not name.startswith(("embed_tokens.", "lm_head."))
+        }
+        mapping = (
+            (".q_proj.", ".qkv_proj.", "q"),
+            (".k_proj.", ".qkv_proj.", "k"),
+            (".v_proj.", ".qkv_proj.", "v"),
+            (".k_proj_ctx.", ".kv_proj_ctx.", "k"),
+            (".v_proj_ctx.", ".kv_proj_ctx.", "v"),
+            (".gate_proj.", ".gate_up_proj.", 0),
+            (".up_proj.", ".gate_up_proj.", 1),
+        )
+        loaded, shards = set(), {}
+        for checkpoint_name, weight in weights:
+            name, shard = checkpoint_name, None
+            for source, destination, shard_id in mapping:
+                if source in name:
+                    name, shard = name.replace(source, destination), shard_id
+                    break
+            if name not in params:
+                raise ValueError(
+                    f"Unrecognized MTP checkpoint tensor: {checkpoint_name}"
+                )
+            param = params[name]
+            if weight.dtype != torch.bfloat16 or param.dtype != weight.dtype:
+                raise ValueError(
+                    f"{checkpoint_name}: MTP requires BF16 parameters and checkpoint weights"
+                )
+            loader = getattr(param, "weight_loader", default_weight_loader)
+            if shard is None:
+                if name in loaded:
+                    raise ValueError(
+                        f"Duplicate MTP checkpoint tensor: {checkpoint_name}"
+                    )
+                loader(param, weight)
+            else:
+                if name in loaded and name not in shards:
+                    raise ValueError(
+                        f"MTP checkpoint mixes packed and unpacked tensors: {checkpoint_name}"
+                    )
+                pieces = shards.setdefault(name, set())
+                if shard in pieces:
+                    raise ValueError(
+                        f"Duplicate MTP checkpoint tensor: {checkpoint_name}"
+                    )
+                loader(param, weight, shard)
+                pieces.add(shard)
+            loaded.add(name)
+        missing = set(params) - loaded
+        for name, pieces in shards.items():
+            expected = (
+                {"q", "k", "v"}
+                if ".qkv_proj." in name
+                else {"k", "v"}
+                if ".kv_proj_ctx." in name
+                else {0, 1}
+            )
+            if pieces != expected:
+                missing.add(f"{name} shards {sorted(expected - pieces)}")
+        if missing:
+            raise ValueError(f"Missing MTP checkpoint tensors: {sorted(missing)}")
+        fuse_alpha = torch.softmax(self.fuse_weight.float(), dim=-1).to(
+            self.fuse_weight.dtype
+        )
+        if self._fuse_alpha is None:
+            self._fuse_alpha = fuse_alpha
+        else:
+            self._fuse_alpha.copy_(fuse_alpha)
+        return loaded
+
+
+EntryClass = Inkling2ForConditionalGenerationMTP
+
+
+# n38 (inkling2-spark decode seat, 2026-11-21): MXFP8 W8A16 drafter dense layers (draft-only numerics: the target verifies
+# every draft, so outputs stay the target's greedy tokens; acceptance may move). With N38_DRAFT_W8=1, after load_weights every
+# BF16 linear of this draft model (qkv_proj, kv_proj_ctx, o_proj, gate_up_proj, down_proj; K % 256 == 0, no bias) gets an
+# e4m3 copy with power-of-2 scales per 32 K-elements (n35_w8gemv.quantize_mx8), and UnquantizedLinearMethod.apply sends calls
+# of <= 128 rows on such layers to n35_w8gemv.w8_gemv (n33 microbench: drafter mlp up 185 -> 100 us, down 186 -> 106 us).
+# Larger calls (prompt-chunk context projections) keep the BF16 path. Off when N38_DRAFT_W8 != 1: this file = 822cddb7 then.
+if os.environ.get("N38_DRAFT_W8") == "1":
+    from sglang.srt.layers.linear import LinearBase as _N38LinearBase
+    from sglang.srt.layers.quantization import unquant as _n38_unquant
+
+    _n38_orig_load = Inkling2ForConditionalGenerationMTP.load_weights
+    _n38_orig_apply = _n38_unquant.UnquantizedLinearMethod.apply
+
+    def _n38_load_weights(self, weights):
+        out = _n38_orig_load(self, weights)
+        from sglang.srt.models.inkling_common.n35_w8gemv import quantize_mx8
+        n = tot = 0
+        for _, m in self.named_modules():
+            w = getattr(m, "weight", None)
+            b = getattr(m, "bias", None)
+            if (isinstance(m, _N38LinearBase) and isinstance(w, torch.Tensor) and w.dim() == 2 and w.dtype == torch.bfloat16
+                    and w.shape[1] % 256 == 0 and (b is None or not bool(b.abs().max() > 0))):
+                m._n38_w8 = quantize_mx8(w.data)
+                n += 1; tot += w.numel()
+        logger.warning("n38: drafter W8 copies for %d linears, %.0f MB FP8", n, tot / 1e6)
+        return out
+
+    def _n38_apply(self, layer, x, bias=None, *a, **kw):
+        q = getattr(layer, "_n38_w8", None)
+        if (q is not None and not a and not kw and bias is None and x.dtype == torch.bfloat16  # no device sync here (graph capture)
+                and 0 < x.numel() // x.shape[-1] <= 128):
+            from sglang.srt.models.inkling_common.n35_w8gemv import w8_gemv
+            return w8_gemv(x, *q)
+        return _n38_orig_apply(self, layer, x, bias, *a, **kw)
+
+    Inkling2ForConditionalGenerationMTP.load_weights = _n38_load_weights
+    _n38_unquant.UnquantizedLinearMethod.apply = _n38_apply
+    logger.warning("n38: drafter W8 dispatch installed")
+
+
+# n41 (inkling2-spark decode seat, 2026-11-21): context-augmented shortlist draft head (draft-only numerics; off unless
+# N41_CTX_SL > 0 and the shortlist is on). Per request the prompt's own off-shortlist token ids (the N41_CTX_SL most recent
+# distinct ones, computed once per request on CPU from req.origin_input_ids when DSparkWorkerV2.forward_batch_generation first
+# sees the request in its pool slot; last 128K prompt tokens) are written to a [req_pool + 1, X] table (pinned, non_blocking); the draft forward gathers the table rows of its
+# requests by forward_batch.req_pool_indices (inside the draft graph), compute_base_logits adds hidden @ lm_head[E]^T for those
+# columns and step_bias adds the folded Markov bias for them (scatter into the full-width rows the shortlist head already builds).
+# Empty table slots hold the first shortlist id (its column is rewritten with a value of the same dot product). n33 probe4:
+# 13.9 pct of sessions-eval rejections are off-shortlist targets (5.5 pct with the full-vocab head).
+_N41_X = int(os.environ.get("N41_CTX_SL", "0"))
+if _N41_X > 0 and _SL_PATH:
+    import numpy as _n41_np
+
+    _N41 = {"model": None, "slot_rid": {}, "mask": None, "pad": None, "n": 0, "sizes": [], "patched": False}
+    _n41_orig_staging = Inkling2ForConditionalGenerationMTP.ensure_propose_staging
+    _n41_orig_forward = Inkling2ForConditionalGenerationMTP.forward
+    _n41_orig_base = Inkling2ForConditionalGenerationMTP.compute_base_logits
+    _n41_orig_bias = Inkling2MTPHead.step_bias
+
+    def _n41_staging(self, req_pool_size):
+        _n41_orig_staging(self, req_pool_size)
+        if getattr(self, "_n41_tab", None) is None and self._sl_ids is not None:
+            pad = int(self._sl_ids[0])
+            self._n41_tab = torch.full((req_pool_size + 1, _N41_X), pad, dtype=torch.long, device=self._sl_ids.device)
+            # pinned staging rows, one per pool slot: the H2D copy is non_blocking (a pageable copy would stall the host until
+            # the stream drains, up to a step per new request); a slot is refilled only after its request has finished.
+            try:
+                self._n41_pin = torch.full((req_pool_size + 1, _N41_X), pad, dtype=torch.long).pin_memory() if torch.cuda.is_available() else None
+            except Exception as e:  # never fail the boot: fall back to a pageable copy
+                logger.warning("n41: pinned staging unavailable (%r): pageable copies", e); self._n41_pin = None
+            mask = _n41_np.zeros(self._sl_width, dtype=bool); mask[self._sl_ids.cpu().numpy()] = True
+            _N41.update(model=self, mask=mask, pad=pad)
+            _n41_patch_worker()
+            logger.warning("n41: context shortlist table %s (X %d)", tuple(self._n41_tab.shape), _N41_X)
+
+    def _n41_forward(self, input_ids, positions, forward_batch, input_embeds=None, **kwargs):
+        out = _n41_orig_forward(self, input_ids, positions, forward_batch, input_embeds=input_embeds, **kwargs)
+        tab = getattr(self, "_n41_tab", None)
+        if tab is not None and self._f_rnn_rows is not None:
+            bs = self._f_rnn_rows.shape[0]
+            self._n41_rows = tab.index_select(0, forward_batch.req_pool_indices.view(-1)[:bs].long())
+        return out
+
+    def _n41_base(self, hidden):
+        logits, extra = _n41_orig_base(self, hidden)
+        rows = getattr(self, "_n41_rows", None)
+        self.markov_head._n41_ctx = None
+        if rows is None or self._sl_ids is None or hidden.shape[0] % rows.shape[0]:
+            return logits, extra
+        bs, x = rows.shape; g = hidden.shape[0] // bs
+        h = hidden / self.logits_mup_width_multiplier if self.logits_mup_width_multiplier else hidden
+        w = self.lm_head.weight.index_select(0, rows.view(-1)).view(bs, x, -1)
+        part = torch.bmm(h.view(bs, g, -1).to(w.dtype), w.transpose(1, 2))
+        logits.view(bs, g, -1).scatter_(2, rows[:, None, :].expand(bs, g, x), part.to(logits.dtype))
+        mh = self.markov_head
+        mh._n41_ctx = (rows, mh._fold_weight.index_select(0, rows.view(-1)).view(bs, x, -1), mh._fold_bias.index_select(0, rows.view(-1)).view(bs, x))
+        return logits, extra
+
+    def _n41_bias(self, prev_tokens, *, hidden_states, state):
+        bias, state2 = _n41_orig_bias(self, prev_tokens, hidden_states=hidden_states, state=state)
+        ctx = getattr(self, "_n41_ctx", None)
+        if ctx is None or self._sl_ids is None:
+            return bias, state2
+        rows, fw, fb = ctx
+        latent = self._n41_latent
+        if latent.shape[0] != rows.shape[0]:
+            return bias, state2
+        part = torch.baddbmm(fb.unsqueeze(1), latent.to(fw.dtype).unsqueeze(1), fw.transpose(1, 2)).squeeze(1)
+        bias.scatter_(1, rows, part.to(bias.dtype))
+        return bias, state2
+
+    _n41_orig_rnn = Inkling2MTPHead._rnn_step
+
+    def _n41_rnn(self, state, prev_tokens, hidden, f_rnn):
+        state, latent = _n41_orig_rnn(self, state, prev_tokens, hidden, f_rnn)
+        self._n41_latent = latent
+        return state, latent
+
+    def _n41_fill(reqs):
+        m = _N41["model"]
+        if m is None:
+            return
+        import time as _n41_time
+        _t0 = _n41_time.perf_counter(); _n0 = _N41["n"]
+        try:
+            _n41_fill_rows(m, reqs)
+        finally:
+            if _N41["n"] > _n0:
+                _N41.setdefault("host_s", 0.0); _N41["host_s"] += _n41_time.perf_counter() - _t0
+
+    def _n41_fill_rows(m, reqs):
+        for req in reqs:
+            kv = getattr(req, "kv", None)
+            slot = getattr(kv, "req_pool_idx", None) if kv is not None else getattr(req, "req_pool_idx", None)
+            if slot is None or _N41["slot_rid"].get(slot) == req.rid:
+                continue
+            ids = _n41_np.asarray(req.origin_input_ids[-131072:], dtype=_n41_np.int64)  # bound host work per request
+            ids = ids[(ids >= 0) & (ids < len(_N41["mask"]))]
+            off = ids[~_N41["mask"][ids]][::-1]
+            uniq, first = _n41_np.unique(off, return_index=True)
+            recent = uniq[_n41_np.argsort(first)][:_N41_X]
+            row = _n41_np.full(_N41_X, _N41["pad"], dtype=_n41_np.int64); row[: len(recent)] = recent
+            if m._n41_pin is not None:
+                m._n41_pin[slot].copy_(torch.from_numpy(row))
+                m._n41_tab[slot].copy_(m._n41_pin[slot], non_blocking=True)
+            else:
+                m._n41_tab[slot].copy_(torch.from_numpy(row))
+            _N41["slot_rid"][slot] = req.rid; _N41["n"] += 1; _N41["sizes"].append(len(uniq))
+            if _N41["n"] in (1, 10, 32, 50) or _N41["n"] % 64 == 0:
+                s = sorted(_N41["sizes"])
+                logger.warning("n41: %d requests filled; distinct off-shortlist context ids median %d p90 %d max %d (X %d); host fill %.1f ms per request",
+                               _N41["n"], s[len(s) // 2], s[int(0.9 * (len(s) - 1))], s[-1], _N41_X, 1000 * _N41.get("host_s", 0.0) / max(1, _N41["n"] - 1))
+
+    def _n41_patch_worker():
+        if _N41["patched"]:
+            return
+        import sys as _sys
+        mod = _sys.modules.get("sglang.srt.speculative.dspark_components.dspark_worker_v2")
+        cls = getattr(mod, "DSparkWorkerV2", None) if mod is not None else None
+        if cls is None:
+            logger.warning("n41: DSparkWorkerV2 not loaded: context table stays empty")
+            return
+        orig = cls.forward_batch_generation
+
+        def forward_batch_generation(self, batch, *a, **kw):
+            try:
+                _n41_fill(getattr(batch, "reqs", ()) or ())
+            except Exception as e:  # never break serving: the table just stays as it is
+                logger.warning("n41: fill failed: %r", e)
+            return orig(self, batch, *a, **kw)
+
+        cls.forward_batch_generation = forward_batch_generation
+        _N41["patched"] = True
+        logger.warning("n41: DSparkWorkerV2.forward_batch_generation hook installed")
+
+    Inkling2ForConditionalGenerationMTP.ensure_propose_staging = _n41_staging
+    Inkling2ForConditionalGenerationMTP.forward = _n41_forward
+    Inkling2ForConditionalGenerationMTP.compute_base_logits = _n41_base
+    Inkling2MTPHead.step_bias = _n41_bias
+    Inkling2MTPHead._rnn_step = _n41_rnn
+    logger.warning("n41: context-augmented shortlist installed (X %d)", _N41_X)
+
+
+# n105 (inkling2-spark rnnhoist seat, 2026-11-23): exact bitwise hoisted Markov RNN projection on bs=1 draft walk
+# (CERT90: precompute W_f + W_h once in init_state with TwoSum-FP32 + Higham/Rump interval certificate, read only W_s
+# per step with inline exact stride-16 fixup on ~7 pct tripped rows; bs != 1 keeps served _rnn_step). Off unless
+# N105_RNNHOIST=1 (off = S3 ff39c84d verbatim). Pointer-offset walk-step recovery adapts MIT code from
+# knapcio/Inkling-2-Mini-1x-DGX-Spark (Copyright (c) 2026 Zbigniew Majewski, MIT License).
+if os.environ.get("N105_RNNHOIST") == "1":
+    import sys as _n105_sys
+    from sglang.srt.models.inkling_common import n105_rnnhoist as _n105_mod
+    _n105_mod.install(_n105_sys.modules[__name__])
+
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/serve/mixpin.sh b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/mixpin.sh
new file mode 100644
index 0000000000000000000000000000000000000000..3ebdd6ef92c75bc8a50903c6acc24d668bc4f10f
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/mixpin.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+# Mix-guard (dflash; the RULE in work_dflash/PICKUP.md, SUPERVISOR 17:0xZ): a derived drafter mix loads only with BOTH its own sha256
+# and the sha256 of the base drafter model.safetensors it was built from pinned and matching. serve.sh runs this inside the container
+# before launch_server (once; never in sitecustomize, which every Python process runs). Refusal exits 78 with one fixed line.
+#   bash mixpin.sh MIX_FILE MIX_SHA256 BASE_MODEL_FILE BASE_SHA256
+set -uo pipefail
+mix=$1; mix_sha=$2; base=$3; base_sha=$4
+[[ $mix_sha =~ ^[0-9a-f]{64}$ && $base_sha =~ ^[0-9a-f]{64}$ ]] || { echo "[mixpin] REFUSED: both pins must be 64-hex sha256" >&2; exit 78; }
+got_base=$(sha256sum < "$base" | cut -c1-64) || { echo "[mixpin] REFUSED: base drafter unreadable" >&2; exit 78; }
+[[ $got_base == "$base_sha" ]] || { echo "[mixpin] REFUSED: base drafter ${got_base:0:8} != pinned ${base_sha:0:8} (this mix was not built from this drafter)" >&2; exit 78; }
+got_mix=$(sha256sum < "$mix" | cut -c1-64) || { echo "[mixpin] REFUSED: mix unreadable" >&2; exit 78; }
+[[ $got_mix == "$mix_sha" ]] || { echo "[mixpin] REFUSED: mix ${got_mix:0:8} != pinned ${mix_sha:0:8}" >&2; exit 78; }
+echo "[mixpin] mix ${got_mix:0:8} on base drafter ${got_base:0:8}: pins match"
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/serve/serve.sh b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/serve.sh
new file mode 100644
index 0000000000000000000000000000000000000000..5cfa7739835e4c74bb8cbd0d9172945275e76cfb
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/serve.sh
@@ -0,0 +1,189 @@
+#!/bin/bash
+# inkling2-spark: SGLang day-0 stack for thinkingmachines/Inkling-2-Mini on the DGX Spark (GB10, sm_121).
+# Source: the SGLang cookbook, DGX Spark + DSpark entry (sgl-project/sglang#51927, python/sglang/cli/_commands/
+#   thinkingmachines--Inkling-2-Mini.json, hw=dgx-spark mode=dspark, "verified"); model support = PR #51926 (open), shipped in
+#   the image lmsysorg/sglang:inkling-2-mini. Flags and env exactly as the cookbook, except:
+#   --context-length 262144 (ours: the cookbook sets none; the same cap as the vLLM Spark recipe, so both engines serve the
+#   same context) and --served-model-name / --api-key / port.
+# Knobs (env): NAME PORT API_KEY IMAGE (required); MODEL_DIR MEM CTX SPEC NUM_DRAFT CACHE_DIR SERVED EXTRA_ARGS.
+# n391-a (dflash, 2026-11-28; tree n391 / program B1) = S3b-p's serve.sh with a GENERAL DFlash2-family drafter gate: DRAFT_DIR
+#   (required) holds config.json + model.safetensors + SHA256SUMS listing exactly its files (all checked in the container);
+#   the stock Inkling integration script (incoai sglang_inkling_dflash2.py, sha 14223ae2) is mounted from DFLASH2_SCRIPT by sha;
+#   SGLANG_ENABLE_DFLASH_DRAFT_KV_RING = 1 iff every config.json layer_types entry is sliding_attention (stock refuses the ring
+#   for a mixed drafter), else 0. Nothing else changes.
+# n391-b form recipe (dflash; the mix-guard RULE in work_dflash/PICKUP.md) = n391-a's serve.sh + an optional DERIVED MIX: MIX_DIR (a dir
+#   holding Inkling-2-Mini-DFlash2-mix.safetensors) loads only with MIX_SHA256 (the mix) AND MIX_BASE_SHA256 (the base drafter
+#   model.safetensors it was built from) both pinned and matching (mixpin.sh, run here once before docker; refusal exit 78); it is then
+#   mounted read-only at /draft-mix and INKLING_DFLASH_MIX_PATH set; MIX_DIR/BUILT_FROM (written by the rebuild)
+#   must name MIX_BASE_SHA256 (provenance: a mix pinned beside a base it was not built from refuses). Without MIX_DIR no mix is mounted or named (= n391-a).
+# n2-proj1 (inkling2-spark prefill seat, 2026-11-20): the champion + per-source qkvr projection on 3-source attention visits (loop
+#   passes 2-3 and the global layers) at >= 512 tokens. The image stacks the three sources (3T rows) through the full 8,600-column
+#   qkvr weight and keeps a third of each output; here each source multiplies only the weight rows it uses (q/r/gate/sinks from
+#   q's source, k from k's, v from v's), F.linear on row slices of the same weight, the same cuBLAS path. Bitwise identical
+#   outputs (n2-probe1: logprobs and KLD equal to the digit). One file mounted over the image: ../patch/inkling2_attn.py (image
+#   file md5 b6d57038 + a guarded branch in _project_sources, switch SGLANG_INKLING_SPLIT_PROJ). Knob added: INK_PROJ_SPLIT
+#   (default 1; 0 = the patched file with the branch off).
+# n21-bs1 (inkling2-spark attn-global seat, 2026-11-21): n17-slp1 + n13-bs1's global-layer band-split FA4 SM120 prefill kernel
+#   (FlashAttentionForwardSm120BandSplit, bitwise equal to the image kernel). Adds the same two mounted files as n13-bs1
+#   (../patch/n13_fwd.py at fa4_sm120/n13_fwd.py, ../patch/n13_attn_global.py) and n13-bs1's patch/inkling2_attn.py
+#   (n17-slp1's = n2-proj1's file + 2 lines installing the hook). Replaces only FlashAttentionForwardSm120.mma for
+#   has_bias, not is_local, not pack_gqa kernels; the draft head files (serve/inkling2_mtp.py, sl.json) are n17-slp1's.
+# n32-ikb2 (inkling2-spark attn-bias seat, 2026-11-21): n32-ikb1 + the same in-kernel bias producer on the GLOBAL layers too:
+#   n13's band-split kernel (its consumer mma and unswizzled bias tile, n13_fwd.py unchanged) is built as
+#   FlashAttentionForwardSm120BandSplitRelProd (n32_fwd.py generated with N32_GLOBAL = 1), so the global einsum + ShearingBias
+#   are not run either. This touches n13's global path (supervisor ruling 2026-11-21: n13 unseated, attn-bias owns the change).
+#   Knob added: INK_N32_GLOBAL (default 1; 0 = sliding-only, = n32-ikb1's behaviour under this recipe's kernel file).
+# n32-ikb1 (inkling2-spark attn-bias seat, 2026-11-21): n21-bs1 + the sliding-layer prefill rel bias computed inside the FA4 SM120
+#   kernel (FlashAttentionForwardSm120RelProd: the DMA warp builds each sheared bias tile with mma.sync m16n8k16 + RTNE, bitwise
+#   equal to the served einsum + ShearingBias + FA4 path in work_attnbias mb1). Adds ../patch/n32_fwd.py at fa4_sm120/n32_fwd.py
+#   (its own FA4 AOT fingerprint) and ../patch/n32_attn_local.py, and ../patch/inkling2_attn.py = n21's file + the guarded rel_bias
+#   line + the hook install. Knobs added: INK_N32 (default 1; 0 = served bias path, same mounted files), ADMIN=1
+#   (--admin-api-key API_KEY, for /start_profile), EXTRA_DOCKER (extra docker run options, e.g. -v .../prof:/prof).
+# n14x37 (inkling2-spark moe seat, 2026-11-22; composition owned by the moe seat per the supervisor's ruling): decode's
+#   cands/n41-k2 recipe (n48's ikb2 attention files untouched + n35 / n37 / n38 / n41 decode files) + n14's exact SM120 MoE prefill
+#   visit (../patch/n14_moe.py f9435cd7 + ../patch/n14_quant.cuh afdcb38b, calls >= 512 tokens; n37 only touches <= 128-token
+#   tiles, so the two never meet). ../patch/inkling2_attn.py = n41-k2's 1579708b + the n14 install block. Knob N14_MOE (default qc;
+#   empty = the image MoE path). Manifests: work_moe/n14x37.py (x37 knobs) and work_moe/n14n37.py (exact: n14 + n37 only).
+# n54 (inkling2-spark stack seat, 2026-11-22): n51's recipe (cands/n14x37 = n48 + n14 qc + n37, run with the n14n37 ENV) + n50's
+#   exact fused loop controller: ../patch/inkling2_loop.py (image kernels/ops/elementwise/inkling2_loop.py caaaefb4 + the n50
+#   dispatch) and ../patch/n15_fused.py (the fused kernel, build 4 380adeee), both mounted over / beside the image module.
+#   Knobs N50 (default 1 = prefill-size calls run the fused kernel; 0 = the served kernels with the same files; check = served +
+#   fused + a failing control, returns the fused output, mismatch counter in pinned host memory printed as N50CHECK lines) and
+#   N50_MIN (default 1000 tokens; decode / verify sizes always take the served kernels).
+# n75 (inkling2-spark packed seat, 2026-11-22): n54 + exact 12-bit packed BF16 weights on the served small-M GEMV route:
+#   ../patch/n75_install.py + ../patch/n75_c12.py mounted beside the image modules; ../patch/inkling2_attn.py = n54's 1e3a8cae + the
+#   n75 install block. Knobs N75_C12 (attn = qkvr + wo_ud, lm = LM head; default empty = off, the n54 code path), N75_C12_CHECK
+#   (1 = served + packed + a failing control per call, returns the packed output, N75CHECK lines), N75_C12_CFG (BN,warps,stages),
+#   N75_C12_KERNEL (triton | cuda | per class 'qkvr=cuda,...': build 1 / build 2 (../patch/n75_cuda.py), same output bits),
+#   N75_C12_CUDA_NW (warps per CTA of build 2, one value or per class).
+# n86 S1 (inkling2-spark stack seat, 2026-11-23): n54 + n71 riders G1 / G2 + the n75 build-2 rider (RULE n86 S1): ../patch/n86_riders.py,
+#   ../patch/n71_sconvres.py (09d3d221) and ../patch/n71_resnorm.py (d1054a4c) mounted beside the image modules; ../patch/inkling2_attn.py
+#   = n75's 8771c89c + the n86 install block. Knobs N86_G1 / N86_G2 (1 = on; default 0 = the n54 code path), N86_MIN_ROWS (G2 rows
+#   gate, default 2048), N86_G2_SHAPES (fused G2 shapes), N86_N75_MS (packed GEMV rows, default 8,16), N86_N75_CLASSES.
+# n64-p1 (inkling2-spark attn seat, 2026-11-22): n54 + n64's exact two-kernel global-layer prefill attention: kernel A
+#   (../patch/n64a_fwd.py at fa4_sm120/n64a_fwd.py: n54's band part, state store) + kernel B (../patch/n64b_fwd.py: 8 consumer
+#   warps under setmaxnreg on the far blocks, n54's far math, served finalize) via ../patch/n64_attn_global.py (installed
+#   after n32's hook in ../patch/inkling2_attn.py). Knobs N64 (default 1; 0 = n54's path with the same files), N64_MIN_K
+#   (KV span bound below which a call keeps n54's path; default 0), N64_PREALLOC (heads of the install-time workspace, 24).
+# n78 certified greedy LM head, S8 (inkling2-spark packed seat, 2026-11-23; recipe cands/ = cp -a cands/n54 + these files):
+#   n54 + ../patch/n78_head.py + ../patch/n78_kern.py mounted beside the image modules; ../patch/inkling2_attn.py = n54's 1e3a8cae
+#   + the n78 install block. Knobs N78_CERT (1 = bs-1 / bs-2 target-verify LM-head calls on all-greedy plain steps run the INT8
+#   screen + bound + served-body exact tiles, +474 MB; every other step and call runs the full served head; default empty = off,
+#   n54's path exactly) and N78_CHECK (1 = CHECK BOOT ONLY: the served head also runs in-graph and N78CHECK counters are printed).
+# n126 S4 (inkling2-spark stack seat, 2026-11-24): S3 (cands/n86-s3) + three exact riders, each off by its knob except a4 (a file):
+#   n115 a4 = ../patch/n32_fwd.py 7e0b8ca9 (S3's 115d2333 + the full-block consumer-built sliding bias; smaller blocks keep the served
+#   DMA producer); n124 F2b = ../patch/n52_moe.py c614ad75 + ../patch/n52_band.cuh e855abc8 (chunked NVFP4 gate_up GEMM, TB 16 bands,
+#   + the lean L2 swiglu-NVFP4 pass on NVFP4 MoE prefill calls >= 3,073 tokens; installed after n14 by ../patch/inkling2_attn.py =
+#   S3's c8bd1ccc + the n52 install block) with knobs N52_BAND (2 = on, default 0 = S3's MoE path), N52_FORM (f2), N52_TB (16),
+#   N52_LEAN (1), N52_RASTER (0; the f2 path forces AlongM); n105 build 3 = ../patch/n105_rnnhoist.py 4f3d50fa + serve/inkling2_mtp.py
+#   f68b1967 (S3's ff39c84d + the env-gated install) with knobs N105_RNNHOIST (1 = on, default empty = S3's drafter verbatim),
+#   N105_MODE, N105_PRE_NW, N105_STEP_NW, N105_CHECK (1 = CHECK BOOT ONLY: served RNN step + a failing control beside each hoisted step).
+# n419b (dflash, SUPERVISOR 07:3xZ 11-29, no-op cleanup in this NEW recipe only): the three DSpark-only envs
+# SGLANG_OPT_DSV41_DSPARK_{MID_FOLD,PREPARE_INPUTS_ONCE,SKIP_PREFILLED_INPUTS} are dropped; each is read only on the DSpark path
+# (dspark_draft_sampler.py, dspark_worker_v2.py / dspark_planner.py, decode_cuda_graph_runner.py:2083-2086 gated on is_dspark()).
+set -eu
+# n41-k2 (inkling2-spark decode seat, 2026-11-21): n39-k2 (ikb2-rebased) + n41: serve/inkling2_mtp.py = the n41 file (n17 822cddb7 + the n38 block
+#   + the env-gated n41 context-augmented shortlist: the most recent N41_CTX_SL distinct off-shortlist prompt token ids per request
+#   join the 32K draft shortlist; draft-only). Knob N41_CTX_SL (default 4096; 0 = n39-dec's drafter exactly).
+# n39-k2 (inkling2-spark decode seat, 2026-11-21): n32-ikb2 + the n39-dec decode stack, rebased for the case that ikb2 ships:
+#   n35 (patch/n35_w8.py + patch/n35_w8gemv.py: MXFP8 W8A16 qkvr / wo_ud on decode / verify only, knob N35_W8 attn | empty),
+#   n37 (patch/n37_tiles.py: NVFP4 grouped-GEMM decode tile_k N37_TILE_K, default 256, bitwise equal to the image config),
+#   n38 (serve/inkling2_mtp.py = the n17 file 822cddb7 + an env-gated block: W8 drafter linears when N38_DRAFT_W8=1, default 1).
+#   patch/inkling2_attn.py = ikb2's c1889915 + the n35 and n37 install blocks appended. Empty / 128 / 0 = ikb2 exactly.
+INK_N32=${INK_N32:-1}
+INK_N32_GLOBAL=${INK_N32_GLOBAL:-1}
+EXTRA_DOCKER=${EXTRA_DOCKER:-}
+ADMIN=${ADMIN:-0}; ADMIN_ARGS=(); [ "$ADMIN" = 1 ] && ADMIN_ARGS=(--admin-api-key "$API_KEY")
+# n17 (dspark seat, 2026-11-21, staged): n2-proj1 + ds-sl32. Adds the ds-sl32 shortlist-vocab DSpark draft head: serve/inkling2_mtp.py
+#   (image md5 35e23e4a + env-gated shortlist, md5 822cddb7) and serve/sl.json (32,768 ids, md5 389d362c), mounted only with SPEC=1.
+HERE=$(cd "$(dirname "$0")/.." && pwd)
+SDIR=$(cd "$(dirname "$0")" && pwd)
+INK_PROJ_SPLIT=${INK_PROJ_SPLIT:-1}
+N14_MOE=${N14_MOE-qc}
+KJ=/sgl-workspace/sglang/python/sglang/kernels/jit/csrc/inkling2
+N75_C12=${N75_C12:-}; N75_C12_CHECK=${N75_C12_CHECK:-0}; N75_C12_CFG=${N75_C12_CFG:-}
+N75_C12_KERNEL=${N75_C12_KERNEL:-}; N75_C12_CUDA_NW=${N75_C12_CUDA_NW:-}
+N86_G1=${N86_G1:-0}; N86_G2=${N86_G2:-0}; N86_MIN_ROWS=${N86_MIN_ROWS:-2048}; N86_G2_SHAPES=${N86_G2_SHAPES:-}
+N86_N75_MS=${N86_N75_MS:-8,16}; N86_N75_CLASSES=${N86_N75_CLASSES:-qkvr,wo_ud,lm_head}
+N78_CERT=${N78_CERT:-}; N78_CHECK=${N78_CHECK:-}
+N35_W8=${N35_W8-attn}
+N37_TILE_K=${N37_TILE_K:-256}
+N38_DRAFT_W8=${N38_DRAFT_W8:-1}
+N41_CTX_SL=${N41_CTX_SL:-4096}
+N50=${N50:-1}; N50_MIN=${N50_MIN:-1000}
+N64=${N64:-1}; N64_MIN_K=${N64_MIN_K:-0}; N64_PREALLOC=${N64_PREALLOC:-24}
+N52_BAND=${N52_BAND:-0}; N52_FORM=${N52_FORM:-f2}; N52_TB=${N52_TB:-16}; N52_LEAN=${N52_LEAN:-1}; N52_RASTER=${N52_RASTER:-0}
+N105_RNNHOIST=${N105_RNNHOIST:-}; N105_MODE=${N105_MODE:-}; N105_PRE_NW=${N105_PRE_NW:-}; N105_STEP_NW=${N105_STEP_NW:-}; N105_CHECK=${N105_CHECK:-}
+KO=/sgl-workspace/sglang/python/sglang/kernels/ops/elementwise
+MDL=/sgl-workspace/sglang/python/sglang/srt/models/inkling_common
+: "${NAME:?}" "${PORT:?}" "${IMAGE:?}"   # standing copy: API_KEY optional (serve.sh.orig requires it)
+MODEL_DIR=${MODEL_DIR:-/workspace/models/Inkling-2-Mini}; MEM=${MEM:-0.45}; CTX=${CTX:-262144}
+SPEC=${SPEC:-1}; NUM_DRAFT=${NUM_DRAFT:-8}; CACHE_DIR=${CACHE_DIR:-/workspace/eat-inkling/cache/sglang}; SERVED=${SERVED:-inkling-2-mini}
+EXTRA_ARGS=${EXTRA_ARGS:-}
+FA=/sgl-workspace/sglang/python/sglang/kernels/ops/attention/fa4_sm120
+mkdir -p "$CACHE_DIR"
+[ "$SPEC" = dflash2 ] || { echo "n292 requires SPEC=dflash2" >&2; exit 2; }
+DRAFT_DIR=${DRAFT_DIR:?DRAFT_DIR: a DFlash2-family drafter dir with SHA256SUMS}
+DFLASH2_SCRIPT=${DFLASH2_SCRIPT:-/workspace/eat-inkling/drafters/dflash2-4f9088ea/sglang_inkling_dflash2.py}
+[ -f "$DRAFT_DIR/model.safetensors" ] && [ -f "$DRAFT_DIR/config.json" ] && [ -f "$DRAFT_DIR/SHA256SUMS" ] || { echo "no DFlash2-family drafter at $DRAFT_DIR" >&2; exit 1; }
+# n419b: plain-text docs (LICENSE, NOTICE, README.md, MD5SUMS) may sit uncovered in the drafter dir (the lane's copies list only
+# config.json + model.safetensors); every other file must be listed, and the listed files are sha256-checked in the container below
+docs='LICENSE|NOTICE|README\.md|MD5SUMS'
+listed=$(awk '{print $2}' "$DRAFT_DIR/SHA256SUMS" | grep -vxE "$docs" | sort); present=$(cd "$DRAFT_DIR" && ls -A | grep -vxE "SHA256SUMS|$docs" | sort)
+[ "$listed" = "$present" ] && grep -q ' config\.json$' "$DRAFT_DIR/SHA256SUMS" && grep -q ' model\.safetensors$' "$DRAFT_DIR/SHA256SUMS" || { echo "files in $DRAFT_DIR differ from its SHA256SUMS" >&2; exit 1; }
+printf '%s  %s\n' 14223ae2f3aa1d661da67cf0143ec33070d952a6e28a119e6cec64fcc0bebe50 "$DFLASH2_SCRIPT" | sha256sum -c --quiet - || { echo "integration script $DFLASH2_SCRIPT is not 14223ae2" >&2; exit 1; }
+DFLASH2_SHA256=$(awk '{print $1" "$2}' "$DRAFT_DIR/SHA256SUMS")
+MIX_ARGS=()
+if [ -n "${MIX_DIR:-}" ]; then
+  [ "$(cat "$MIX_DIR/BUILT_FROM" 2>/dev/null)" = "${MIX_BASE_SHA256:-}" ] || { echo "[mixpin] REFUSED: $MIX_DIR/BUILT_FROM does not name the pinned base drafter (provenance: written by the rebuild)" >&2; exit 78; }
+  bash "$HERE/serve/mixpin.sh" "$MIX_DIR/Inkling-2-Mini-DFlash2-mix.safetensors" "${MIX_SHA256:-}" "$DRAFT_DIR/model.safetensors" "${MIX_BASE_SHA256:-}" || exit 78
+  MIX_ARGS=(-v "$MIX_DIR":/draft-mix:ro -e INKLING_DFLASH_MIX_PATH=/draft-mix/Inkling-2-Mini-DFlash2-mix.safetensors)
+fi
+RING=$(python3 -I -c 'import json, sys; t = json.load(open(sys.argv[1])).get("layer_types") or []; print(1 if t and all(x == "sliding_attention" for x in t) else 0)' "$DRAFT_DIR/config.json") || { echo "unreadable $DRAFT_DIR/config.json" >&2; exit 1; }
+docker rm -f "$NAME" > /dev/null 2>&1 || true
+# shellcheck disable=SC2086
+exec docker run --pull=never -d --name "$NAME" --gpus all --ipc=host --shm-size 32g \
+  -p ${BIND:-127.0.0.1}:$PORT:30000 \
+  -e MAX_JOBS=4 -e HF_HUB_OFFLINE=1 -e DO_NOT_TRACK=1 -e SGLANG_DISABLE_USAGE_STATS=1 \
+  -v "$MODEL_DIR":/model:ro -v "$CACHE_DIR":/root/.cache \
+  -v "$HERE/patch/inkling2_attn.py":$MDL/inkling2_attn.py:ro -e SGLANG_INKLING_SPLIT_PROJ="$INK_PROJ_SPLIT" \
+  -v "$HERE/patch/n13_attn_global.py":$MDL/n13_attn_global.py:ro -v "$HERE/patch/n13_fwd.py":$FA/n13_fwd.py:ro \
+  -v "$HERE/patch/n75_install.py":$MDL/n75_install.py:ro -v "$HERE/patch/n75_c12.py":$MDL/n75_c12.py:ro \
+  -v "$HERE/patch/n75_cuda.py":$MDL/n75_cuda.py:ro -e N75_C12_KERNEL="$N75_C12_KERNEL" -e N75_C12_CUDA_NW="$N75_C12_CUDA_NW" \
+  -e N75_C12="$N75_C12" -e N75_C12_CHECK="$N75_C12_CHECK" -e N75_C12_CFG="$N75_C12_CFG" \
+  -v "$HERE/patch/n86_riders.py":$MDL/n86_riders.py:ro -v "$HERE/patch/n71_sconvres.py":$MDL/n71_sconvres.py:ro \
+  -v "$HERE/patch/n71_resnorm.py":$MDL/n71_resnorm.py:ro -e N86_G1="$N86_G1" -e N86_G2="$N86_G2" -e N86_MIN_ROWS="$N86_MIN_ROWS" \
+  -e N86_G2_SHAPES="$N86_G2_SHAPES" -e N86_N75_MS="$N86_N75_MS" -e N86_N75_CLASSES="$N86_N75_CLASSES" \
+  -v "$HERE/patch/n78_head.py":$MDL/n78_head.py:ro -v "$HERE/patch/n78_kern.py":$MDL/n78_kern.py:ro -e N78_CERT="$N78_CERT" -e N78_CHECK="$N78_CHECK" \
+  -v "$HERE/patch/n35_w8.py":$MDL/n35_w8.py:ro -v "$HERE/patch/n35_w8gemv.py":$MDL/n35_w8gemv.py:ro -e N35_W8="$N35_W8" \
+  -v "$HERE/patch/n14_moe.py":$MDL/n14_moe.py:ro -v "$HERE/patch/n14_quant.cuh":$KJ/n14_quant.cuh:ro -e N14_MOE="$N14_MOE" \
+  -v "$HERE/patch/n52_moe.py":$MDL/n52_moe.py:ro -v "$HERE/patch/n52_band.cuh":$KJ/n52_band.cuh:ro \
+  -e N52_BAND="$N52_BAND" -e N52_FORM="$N52_FORM" -e N52_TB="$N52_TB" -e N52_LEAN="$N52_LEAN" -e N52_RASTER="$N52_RASTER" \
+  -v "$HERE/patch/n105_rnnhoist.py":$MDL/n105_rnnhoist.py:ro -e N105_RNNHOIST="$N105_RNNHOIST" -e N105_MODE="$N105_MODE" \
+  -e N105_PRE_NW="$N105_PRE_NW" -e N105_STEP_NW="$N105_STEP_NW" -e N105_CHECK="$N105_CHECK" \
+  -v "$HERE/patch/n37_tiles.py":$MDL/n37_tiles.py:ro -e N37_TILE_K="$N37_TILE_K" -e N38_DRAFT_W8="$N38_DRAFT_W8" -e N41_CTX_SL="$N41_CTX_SL" \
+  -v "$HERE/patch/n32_attn_local.py":$MDL/n32_attn_local.py:ro -v "$HERE/patch/n32_fwd.py":$FA/n32_fwd.py:ro \
+  -v "$HERE/patch/inkling2_loop.py":$KO/inkling2_loop.py:ro -v "$HERE/patch/n15_fused.py":$KO/n15_fused.py:ro \
+  -e SGLANG_INKLING_N50="$N50" -e SGLANG_INKLING_N50_MIN_TOKENS="$N50_MIN" \
+  -e SGLANG_INKLING_N32="$INK_N32" -e SGLANG_INKLING_N32_GLOBAL="$INK_N32_GLOBAL" \
+  -v "$HERE/patch/n64a_fwd.py":$FA/n64a_fwd.py:ro -v "$HERE/patch/n64b_fwd.py":$FA/n64b_fwd.py:ro \
+  -v "$HERE/patch/n64_attn_global.py":$MDL/n64_attn_global.py:ro -e SGLANG_INKLING_N64="$N64" \
+  -e SGLANG_INKLING_N64_MIN_K="$N64_MIN_K" -e SGLANG_INKLING_N64_PREALLOC_HEADS="$N64_PREALLOC" $EXTRA_DOCKER \
+  -e SGLANG_OPT_INKLING2_VERIFY_REL_BIAS_KERNEL=1 \
+  -e MALLOC_MMAP_THRESHOLD_=1048576 \
+  -e SGLANG_ENABLE_DFLASH_DRAFT_KV_RING="$RING" -e DFLASH2_SHA256="$DFLASH2_SHA256" -v "$DRAFT_DIR":/draft:ro \
+  -v "$DFLASH2_SCRIPT":/draft-script/sglang_inkling_dflash2.py:ro "${MIX_ARGS[@]}" \
+  --entrypoint bash "$IMAGE" \
+  -c 'mkdir -p /root/.cache/dflash2-logs; exec > >(tee -a /root/.cache/dflash2-logs/server-$(date -u +%Y%m%dT%H%M%SZ).log) 2>&1
+               (cd /draft && printf "%s\n" "$DFLASH2_SHA256" | sed "s/ /  /" | sha256sum -c --quiet -) || {
+                 echo "DFlash2 drafter files do not match the pinned sha256" >&2; exit 1; }
+               echo "[n391-serve] DFLASH draft KV ring env $SGLANG_ENABLE_DFLASH_DRAFT_KV_RING (1 iff every draft layer is sliding_attention)"
+               python3 -I /draft-script/sglang_inkling_dflash2.py && exec python3 "$@"' dflash2 \
+  -m sglang.launch_server --model-path /model --served-model-name "$SERVED" \
+  --tp 1 --ep 1 --attention-backend fa4 --dtype bfloat16 --page-size 128 \
+  --speculative-algorithm DFLASH --speculative-draft-model-path /draft --speculative-num-draft-tokens 8 --speculative-draft-attention-backend fa4 --speculative-use-block-verification \
+  --max-running-requests 48 --cuda-graph-max-bs-decode=48 \
+  --mem-fraction-static "$MEM" --context-length "$CTX" \
+  --grammar-backend xgrammar --reasoning-parser inkling --tool-call-parser inkling2 \
+  --enable-metrics --host 0.0.0.0 --port 30000 ${API_KEY:+--api-key "$API_KEY"} --weight-loader-disable-mmap --swa-full-tokens-ratio 0.037 \
+  --max-mamba-cache-size 512 --max-prefill-tokens 8192 $EXTRA_ARGS
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/serve/serve.sh.orig b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/serve.sh.orig
new file mode 100644
index 0000000000000000000000000000000000000000..a3de69ea7006aeff270cd800a618e9012a07bda4
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/serve.sh.orig
@@ -0,0 +1,189 @@
+#!/bin/bash
+# inkling2-spark: SGLang day-0 stack for thinkingmachines/Inkling-2-Mini on the DGX Spark (GB10, sm_121).
+# Source: the SGLang cookbook, DGX Spark + DSpark entry (sgl-project/sglang#51927, python/sglang/cli/_commands/
+#   thinkingmachines--Inkling-2-Mini.json, hw=dgx-spark mode=dspark, "verified"); model support = PR #51926 (open), shipped in
+#   the image lmsysorg/sglang:inkling-2-mini. Flags and env exactly as the cookbook, except:
+#   --context-length 262144 (ours: the cookbook sets none; the same cap as the vLLM Spark recipe, so both engines serve the
+#   same context) and --served-model-name / --api-key / port.
+# Knobs (env): NAME PORT API_KEY IMAGE (required); MODEL_DIR MEM CTX SPEC NUM_DRAFT CACHE_DIR SERVED EXTRA_ARGS.
+# n391-a (dflash, 2026-11-28; tree n391 / program B1) = S3b-p's serve.sh with a GENERAL DFlash2-family drafter gate: DRAFT_DIR
+#   (required) holds config.json + model.safetensors + SHA256SUMS listing exactly its files (all checked in the container);
+#   the stock Inkling integration script (incoai sglang_inkling_dflash2.py, sha 14223ae2) is mounted from DFLASH2_SCRIPT by sha;
+#   SGLANG_ENABLE_DFLASH_DRAFT_KV_RING = 1 iff every config.json layer_types entry is sliding_attention (stock refuses the ring
+#   for a mixed drafter), else 0. Nothing else changes.
+# n391-b form recipe (dflash; the mix-guard RULE in work_dflash/PICKUP.md) = n391-a's serve.sh + an optional DERIVED MIX: MIX_DIR (a dir
+#   holding Inkling-2-Mini-DFlash2-mix.safetensors) loads only with MIX_SHA256 (the mix) AND MIX_BASE_SHA256 (the base drafter
+#   model.safetensors it was built from) both pinned and matching (mixpin.sh, run here once before docker; refusal exit 78); it is then
+#   mounted read-only at /draft-mix and INKLING_DFLASH_MIX_PATH set; MIX_DIR/BUILT_FROM (written by the rebuild)
+#   must name MIX_BASE_SHA256 (provenance: a mix pinned beside a base it was not built from refuses). Without MIX_DIR no mix is mounted or named (= n391-a).
+# n2-proj1 (inkling2-spark prefill seat, 2026-11-20): the champion + per-source qkvr projection on 3-source attention visits (loop
+#   passes 2-3 and the global layers) at >= 512 tokens. The image stacks the three sources (3T rows) through the full 8,600-column
+#   qkvr weight and keeps a third of each output; here each source multiplies only the weight rows it uses (q/r/gate/sinks from
+#   q's source, k from k's, v from v's), F.linear on row slices of the same weight, the same cuBLAS path. Bitwise identical
+#   outputs (n2-probe1: logprobs and KLD equal to the digit). One file mounted over the image: ../patch/inkling2_attn.py (image
+#   file md5 b6d57038 + a guarded branch in _project_sources, switch SGLANG_INKLING_SPLIT_PROJ). Knob added: INK_PROJ_SPLIT
+#   (default 1; 0 = the patched file with the branch off).
+# n21-bs1 (inkling2-spark attn-global seat, 2026-11-21): n17-slp1 + n13-bs1's global-layer band-split FA4 SM120 prefill kernel
+#   (FlashAttentionForwardSm120BandSplit, bitwise equal to the image kernel). Adds the same two mounted files as n13-bs1
+#   (../patch/n13_fwd.py at fa4_sm120/n13_fwd.py, ../patch/n13_attn_global.py) and n13-bs1's patch/inkling2_attn.py
+#   (n17-slp1's = n2-proj1's file + 2 lines installing the hook). Replaces only FlashAttentionForwardSm120.mma for
+#   has_bias, not is_local, not pack_gqa kernels; the draft head files (serve/inkling2_mtp.py, sl.json) are n17-slp1's.
+# n32-ikb2 (inkling2-spark attn-bias seat, 2026-11-21): n32-ikb1 + the same in-kernel bias producer on the GLOBAL layers too:
+#   n13's band-split kernel (its consumer mma and unswizzled bias tile, n13_fwd.py unchanged) is built as
+#   FlashAttentionForwardSm120BandSplitRelProd (n32_fwd.py generated with N32_GLOBAL = 1), so the global einsum + ShearingBias
+#   are not run either. This touches n13's global path (supervisor ruling 2026-11-21: n13 unseated, attn-bias owns the change).
+#   Knob added: INK_N32_GLOBAL (default 1; 0 = sliding-only, = n32-ikb1's behaviour under this recipe's kernel file).
+# n32-ikb1 (inkling2-spark attn-bias seat, 2026-11-21): n21-bs1 + the sliding-layer prefill rel bias computed inside the FA4 SM120
+#   kernel (FlashAttentionForwardSm120RelProd: the DMA warp builds each sheared bias tile with mma.sync m16n8k16 + RTNE, bitwise
+#   equal to the served einsum + ShearingBias + FA4 path in work_attnbias mb1). Adds ../patch/n32_fwd.py at fa4_sm120/n32_fwd.py
+#   (its own FA4 AOT fingerprint) and ../patch/n32_attn_local.py, and ../patch/inkling2_attn.py = n21's file + the guarded rel_bias
+#   line + the hook install. Knobs added: INK_N32 (default 1; 0 = served bias path, same mounted files), ADMIN=1
+#   (--admin-api-key API_KEY, for /start_profile), EXTRA_DOCKER (extra docker run options, e.g. -v .../prof:/prof).
+# n14x37 (inkling2-spark moe seat, 2026-11-22; composition owned by the moe seat per the supervisor's ruling): decode's
+#   cands/n41-k2 recipe (n48's ikb2 attention files untouched + n35 / n37 / n38 / n41 decode files) + n14's exact SM120 MoE prefill
+#   visit (../patch/n14_moe.py f9435cd7 + ../patch/n14_quant.cuh afdcb38b, calls >= 512 tokens; n37 only touches <= 128-token
+#   tiles, so the two never meet). ../patch/inkling2_attn.py = n41-k2's 1579708b + the n14 install block. Knob N14_MOE (default qc;
+#   empty = the image MoE path). Manifests: work_moe/n14x37.py (x37 knobs) and work_moe/n14n37.py (exact: n14 + n37 only).
+# n54 (inkling2-spark stack seat, 2026-11-22): n51's recipe (cands/n14x37 = n48 + n14 qc + n37, run with the n14n37 ENV) + n50's
+#   exact fused loop controller: ../patch/inkling2_loop.py (image kernels/ops/elementwise/inkling2_loop.py caaaefb4 + the n50
+#   dispatch) and ../patch/n15_fused.py (the fused kernel, build 4 380adeee), both mounted over / beside the image module.
+#   Knobs N50 (default 1 = prefill-size calls run the fused kernel; 0 = the served kernels with the same files; check = served +
+#   fused + a failing control, returns the fused output, mismatch counter in pinned host memory printed as N50CHECK lines) and
+#   N50_MIN (default 1000 tokens; decode / verify sizes always take the served kernels).
+# n75 (inkling2-spark packed seat, 2026-11-22): n54 + exact 12-bit packed BF16 weights on the served small-M GEMV route:
+#   ../patch/n75_install.py + ../patch/n75_c12.py mounted beside the image modules; ../patch/inkling2_attn.py = n54's 1e3a8cae + the
+#   n75 install block. Knobs N75_C12 (attn = qkvr + wo_ud, lm = LM head; default empty = off, the n54 code path), N75_C12_CHECK
+#   (1 = served + packed + a failing control per call, returns the packed output, N75CHECK lines), N75_C12_CFG (BN,warps,stages),
+#   N75_C12_KERNEL (triton | cuda | per class 'qkvr=cuda,...': build 1 / build 2 (../patch/n75_cuda.py), same output bits),
+#   N75_C12_CUDA_NW (warps per CTA of build 2, one value or per class).
+# n86 S1 (inkling2-spark stack seat, 2026-11-23): n54 + n71 riders G1 / G2 + the n75 build-2 rider (RULE n86 S1): ../patch/n86_riders.py,
+#   ../patch/n71_sconvres.py (09d3d221) and ../patch/n71_resnorm.py (d1054a4c) mounted beside the image modules; ../patch/inkling2_attn.py
+#   = n75's 8771c89c + the n86 install block. Knobs N86_G1 / N86_G2 (1 = on; default 0 = the n54 code path), N86_MIN_ROWS (G2 rows
+#   gate, default 2048), N86_G2_SHAPES (fused G2 shapes), N86_N75_MS (packed GEMV rows, default 8,16), N86_N75_CLASSES.
+# n64-p1 (inkling2-spark attn seat, 2026-11-22): n54 + n64's exact two-kernel global-layer prefill attention: kernel A
+#   (../patch/n64a_fwd.py at fa4_sm120/n64a_fwd.py: n54's band part, state store) + kernel B (../patch/n64b_fwd.py: 8 consumer
+#   warps under setmaxnreg on the far blocks, n54's far math, served finalize) via ../patch/n64_attn_global.py (installed
+#   after n32's hook in ../patch/inkling2_attn.py). Knobs N64 (default 1; 0 = n54's path with the same files), N64_MIN_K
+#   (KV span bound below which a call keeps n54's path; default 0), N64_PREALLOC (heads of the install-time workspace, 24).
+# n78 certified greedy LM head, S8 (inkling2-spark packed seat, 2026-11-23; recipe cands/ = cp -a cands/n54 + these files):
+#   n54 + ../patch/n78_head.py + ../patch/n78_kern.py mounted beside the image modules; ../patch/inkling2_attn.py = n54's 1e3a8cae
+#   + the n78 install block. Knobs N78_CERT (1 = bs-1 / bs-2 target-verify LM-head calls on all-greedy plain steps run the INT8
+#   screen + bound + served-body exact tiles, +474 MB; every other step and call runs the full served head; default empty = off,
+#   n54's path exactly) and N78_CHECK (1 = CHECK BOOT ONLY: the served head also runs in-graph and N78CHECK counters are printed).
+# n126 S4 (inkling2-spark stack seat, 2026-11-24): S3 (cands/n86-s3) + three exact riders, each off by its knob except a4 (a file):
+#   n115 a4 = ../patch/n32_fwd.py 7e0b8ca9 (S3's 115d2333 + the full-block consumer-built sliding bias; smaller blocks keep the served
+#   DMA producer); n124 F2b = ../patch/n52_moe.py c614ad75 + ../patch/n52_band.cuh e855abc8 (chunked NVFP4 gate_up GEMM, TB 16 bands,
+#   + the lean L2 swiglu-NVFP4 pass on NVFP4 MoE prefill calls >= 3,073 tokens; installed after n14 by ../patch/inkling2_attn.py =
+#   S3's c8bd1ccc + the n52 install block) with knobs N52_BAND (2 = on, default 0 = S3's MoE path), N52_FORM (f2), N52_TB (16),
+#   N52_LEAN (1), N52_RASTER (0; the f2 path forces AlongM); n105 build 3 = ../patch/n105_rnnhoist.py 4f3d50fa + serve/inkling2_mtp.py
+#   f68b1967 (S3's ff39c84d + the env-gated install) with knobs N105_RNNHOIST (1 = on, default empty = S3's drafter verbatim),
+#   N105_MODE, N105_PRE_NW, N105_STEP_NW, N105_CHECK (1 = CHECK BOOT ONLY: served RNN step + a failing control beside each hoisted step).
+# n419b (dflash, SUPERVISOR 07:3xZ 11-29, no-op cleanup in this NEW recipe only): the three DSpark-only envs
+# SGLANG_OPT_DSV41_DSPARK_{MID_FOLD,PREPARE_INPUTS_ONCE,SKIP_PREFILLED_INPUTS} are dropped; each is read only on the DSpark path
+# (dspark_draft_sampler.py, dspark_worker_v2.py / dspark_planner.py, decode_cuda_graph_runner.py:2083-2086 gated on is_dspark()).
+set -eu
+# n41-k2 (inkling2-spark decode seat, 2026-11-21): n39-k2 (ikb2-rebased) + n41: serve/inkling2_mtp.py = the n41 file (n17 822cddb7 + the n38 block
+#   + the env-gated n41 context-augmented shortlist: the most recent N41_CTX_SL distinct off-shortlist prompt token ids per request
+#   join the 32K draft shortlist; draft-only). Knob N41_CTX_SL (default 4096; 0 = n39-dec's drafter exactly).
+# n39-k2 (inkling2-spark decode seat, 2026-11-21): n32-ikb2 + the n39-dec decode stack, rebased for the case that ikb2 ships:
+#   n35 (patch/n35_w8.py + patch/n35_w8gemv.py: MXFP8 W8A16 qkvr / wo_ud on decode / verify only, knob N35_W8 attn | empty),
+#   n37 (patch/n37_tiles.py: NVFP4 grouped-GEMM decode tile_k N37_TILE_K, default 256, bitwise equal to the image config),
+#   n38 (serve/inkling2_mtp.py = the n17 file 822cddb7 + an env-gated block: W8 drafter linears when N38_DRAFT_W8=1, default 1).
+#   patch/inkling2_attn.py = ikb2's c1889915 + the n35 and n37 install blocks appended. Empty / 128 / 0 = ikb2 exactly.
+INK_N32=${INK_N32:-1}
+INK_N32_GLOBAL=${INK_N32_GLOBAL:-1}
+EXTRA_DOCKER=${EXTRA_DOCKER:-}
+ADMIN=${ADMIN:-0}; ADMIN_ARGS=(); [ "$ADMIN" = 1 ] && ADMIN_ARGS=(--admin-api-key "$API_KEY")
+# n17 (dspark seat, 2026-11-21, staged): n2-proj1 + ds-sl32. Adds the ds-sl32 shortlist-vocab DSpark draft head: serve/inkling2_mtp.py
+#   (image md5 35e23e4a + env-gated shortlist, md5 822cddb7) and serve/sl.json (32,768 ids, md5 389d362c), mounted only with SPEC=1.
+HERE=$(cd "$(dirname "$0")/.." && pwd)
+SDIR=$(cd "$(dirname "$0")" && pwd)
+INK_PROJ_SPLIT=${INK_PROJ_SPLIT:-1}
+N14_MOE=${N14_MOE-qc}
+KJ=/sgl-workspace/sglang/python/sglang/kernels/jit/csrc/inkling2
+N75_C12=${N75_C12:-}; N75_C12_CHECK=${N75_C12_CHECK:-0}; N75_C12_CFG=${N75_C12_CFG:-}
+N75_C12_KERNEL=${N75_C12_KERNEL:-}; N75_C12_CUDA_NW=${N75_C12_CUDA_NW:-}
+N86_G1=${N86_G1:-0}; N86_G2=${N86_G2:-0}; N86_MIN_ROWS=${N86_MIN_ROWS:-2048}; N86_G2_SHAPES=${N86_G2_SHAPES:-}
+N86_N75_MS=${N86_N75_MS:-8,16}; N86_N75_CLASSES=${N86_N75_CLASSES:-qkvr,wo_ud,lm_head}
+N78_CERT=${N78_CERT:-}; N78_CHECK=${N78_CHECK:-}
+N35_W8=${N35_W8-attn}
+N37_TILE_K=${N37_TILE_K:-256}
+N38_DRAFT_W8=${N38_DRAFT_W8:-1}
+N41_CTX_SL=${N41_CTX_SL:-4096}
+N50=${N50:-1}; N50_MIN=${N50_MIN:-1000}
+N64=${N64:-1}; N64_MIN_K=${N64_MIN_K:-0}; N64_PREALLOC=${N64_PREALLOC:-24}
+N52_BAND=${N52_BAND:-0}; N52_FORM=${N52_FORM:-f2}; N52_TB=${N52_TB:-16}; N52_LEAN=${N52_LEAN:-1}; N52_RASTER=${N52_RASTER:-0}
+N105_RNNHOIST=${N105_RNNHOIST:-}; N105_MODE=${N105_MODE:-}; N105_PRE_NW=${N105_PRE_NW:-}; N105_STEP_NW=${N105_STEP_NW:-}; N105_CHECK=${N105_CHECK:-}
+KO=/sgl-workspace/sglang/python/sglang/kernels/ops/elementwise
+MDL=/sgl-workspace/sglang/python/sglang/srt/models/inkling_common
+: "${NAME:?}" "${PORT:?}" "${API_KEY:?}" "${IMAGE:?}"
+MODEL_DIR=${MODEL_DIR:-/workspace/models/Inkling-2-Mini}; MEM=${MEM:-0.45}; CTX=${CTX:-262144}
+SPEC=${SPEC:-1}; NUM_DRAFT=${NUM_DRAFT:-8}; CACHE_DIR=${CACHE_DIR:-/workspace/eat-inkling/cache/sglang}; SERVED=${SERVED:-inkling-2-mini}
+EXTRA_ARGS=${EXTRA_ARGS:-}
+FA=/sgl-workspace/sglang/python/sglang/kernels/ops/attention/fa4_sm120
+mkdir -p "$CACHE_DIR"
+[ "$SPEC" = dflash2 ] || { echo "n292 requires SPEC=dflash2" >&2; exit 2; }
+DRAFT_DIR=${DRAFT_DIR:?DRAFT_DIR: a DFlash2-family drafter dir with SHA256SUMS}
+DFLASH2_SCRIPT=${DFLASH2_SCRIPT:-/workspace/eat-inkling/drafters/dflash2-4f9088ea/sglang_inkling_dflash2.py}
+[ -f "$DRAFT_DIR/model.safetensors" ] && [ -f "$DRAFT_DIR/config.json" ] && [ -f "$DRAFT_DIR/SHA256SUMS" ] || { echo "no DFlash2-family drafter at $DRAFT_DIR" >&2; exit 1; }
+# n419b: plain-text docs (LICENSE, NOTICE, README.md, MD5SUMS) may sit uncovered in the drafter dir (the lane's copies list only
+# config.json + model.safetensors); every other file must be listed, and the listed files are sha256-checked in the container below
+docs='LICENSE|NOTICE|README\.md|MD5SUMS'
+listed=$(awk '{print $2}' "$DRAFT_DIR/SHA256SUMS" | grep -vxE "$docs" | sort); present=$(cd "$DRAFT_DIR" && ls -A | grep -vxE "SHA256SUMS|$docs" | sort)
+[ "$listed" = "$present" ] && grep -q ' config\.json$' "$DRAFT_DIR/SHA256SUMS" && grep -q ' model\.safetensors$' "$DRAFT_DIR/SHA256SUMS" || { echo "files in $DRAFT_DIR differ from its SHA256SUMS" >&2; exit 1; }
+printf '%s  %s\n' 14223ae2f3aa1d661da67cf0143ec33070d952a6e28a119e6cec64fcc0bebe50 "$DFLASH2_SCRIPT" | sha256sum -c --quiet - || { echo "integration script $DFLASH2_SCRIPT is not 14223ae2" >&2; exit 1; }
+DFLASH2_SHA256=$(awk '{print $1" "$2}' "$DRAFT_DIR/SHA256SUMS")
+MIX_ARGS=()
+if [ -n "${MIX_DIR:-}" ]; then
+  [ "$(cat "$MIX_DIR/BUILT_FROM" 2>/dev/null)" = "${MIX_BASE_SHA256:-}" ] || { echo "[mixpin] REFUSED: $MIX_DIR/BUILT_FROM does not name the pinned base drafter (provenance: written by the rebuild)" >&2; exit 78; }
+  bash "$HERE/serve/mixpin.sh" "$MIX_DIR/Inkling-2-Mini-DFlash2-mix.safetensors" "${MIX_SHA256:-}" "$DRAFT_DIR/model.safetensors" "${MIX_BASE_SHA256:-}" || exit 78
+  MIX_ARGS=(-v "$MIX_DIR":/draft-mix:ro -e INKLING_DFLASH_MIX_PATH=/draft-mix/Inkling-2-Mini-DFlash2-mix.safetensors)
+fi
+RING=$(python3 -I -c 'import json, sys; t = json.load(open(sys.argv[1])).get("layer_types") or []; print(1 if t and all(x == "sliding_attention" for x in t) else 0)' "$DRAFT_DIR/config.json") || { echo "unreadable $DRAFT_DIR/config.json" >&2; exit 1; }
+docker rm -f "$NAME" > /dev/null 2>&1 || true
+# shellcheck disable=SC2086
+exec docker run --pull=never -d --name "$NAME" --gpus all --ipc=host --shm-size 32g \
+  -p 127.0.0.1:$PORT:30000 \
+  -e MAX_JOBS=4 -e HF_HUB_OFFLINE=1 -e DO_NOT_TRACK=1 -e SGLANG_DISABLE_USAGE_STATS=1 \
+  -v "$MODEL_DIR":/model:ro -v "$CACHE_DIR":/root/.cache \
+  -v "$HERE/patch/inkling2_attn.py":$MDL/inkling2_attn.py:ro -e SGLANG_INKLING_SPLIT_PROJ="$INK_PROJ_SPLIT" \
+  -v "$HERE/patch/n13_attn_global.py":$MDL/n13_attn_global.py:ro -v "$HERE/patch/n13_fwd.py":$FA/n13_fwd.py:ro \
+  -v "$HERE/patch/n75_install.py":$MDL/n75_install.py:ro -v "$HERE/patch/n75_c12.py":$MDL/n75_c12.py:ro \
+  -v "$HERE/patch/n75_cuda.py":$MDL/n75_cuda.py:ro -e N75_C12_KERNEL="$N75_C12_KERNEL" -e N75_C12_CUDA_NW="$N75_C12_CUDA_NW" \
+  -e N75_C12="$N75_C12" -e N75_C12_CHECK="$N75_C12_CHECK" -e N75_C12_CFG="$N75_C12_CFG" \
+  -v "$HERE/patch/n86_riders.py":$MDL/n86_riders.py:ro -v "$HERE/patch/n71_sconvres.py":$MDL/n71_sconvres.py:ro \
+  -v "$HERE/patch/n71_resnorm.py":$MDL/n71_resnorm.py:ro -e N86_G1="$N86_G1" -e N86_G2="$N86_G2" -e N86_MIN_ROWS="$N86_MIN_ROWS" \
+  -e N86_G2_SHAPES="$N86_G2_SHAPES" -e N86_N75_MS="$N86_N75_MS" -e N86_N75_CLASSES="$N86_N75_CLASSES" \
+  -v "$HERE/patch/n78_head.py":$MDL/n78_head.py:ro -v "$HERE/patch/n78_kern.py":$MDL/n78_kern.py:ro -e N78_CERT="$N78_CERT" -e N78_CHECK="$N78_CHECK" \
+  -v "$HERE/patch/n35_w8.py":$MDL/n35_w8.py:ro -v "$HERE/patch/n35_w8gemv.py":$MDL/n35_w8gemv.py:ro -e N35_W8="$N35_W8" \
+  -v "$HERE/patch/n14_moe.py":$MDL/n14_moe.py:ro -v "$HERE/patch/n14_quant.cuh":$KJ/n14_quant.cuh:ro -e N14_MOE="$N14_MOE" \
+  -v "$HERE/patch/n52_moe.py":$MDL/n52_moe.py:ro -v "$HERE/patch/n52_band.cuh":$KJ/n52_band.cuh:ro \
+  -e N52_BAND="$N52_BAND" -e N52_FORM="$N52_FORM" -e N52_TB="$N52_TB" -e N52_LEAN="$N52_LEAN" -e N52_RASTER="$N52_RASTER" \
+  -v "$HERE/patch/n105_rnnhoist.py":$MDL/n105_rnnhoist.py:ro -e N105_RNNHOIST="$N105_RNNHOIST" -e N105_MODE="$N105_MODE" \
+  -e N105_PRE_NW="$N105_PRE_NW" -e N105_STEP_NW="$N105_STEP_NW" -e N105_CHECK="$N105_CHECK" \
+  -v "$HERE/patch/n37_tiles.py":$MDL/n37_tiles.py:ro -e N37_TILE_K="$N37_TILE_K" -e N38_DRAFT_W8="$N38_DRAFT_W8" -e N41_CTX_SL="$N41_CTX_SL" \
+  -v "$HERE/patch/n32_attn_local.py":$MDL/n32_attn_local.py:ro -v "$HERE/patch/n32_fwd.py":$FA/n32_fwd.py:ro \
+  -v "$HERE/patch/inkling2_loop.py":$KO/inkling2_loop.py:ro -v "$HERE/patch/n15_fused.py":$KO/n15_fused.py:ro \
+  -e SGLANG_INKLING_N50="$N50" -e SGLANG_INKLING_N50_MIN_TOKENS="$N50_MIN" \
+  -e SGLANG_INKLING_N32="$INK_N32" -e SGLANG_INKLING_N32_GLOBAL="$INK_N32_GLOBAL" \
+  -v "$HERE/patch/n64a_fwd.py":$FA/n64a_fwd.py:ro -v "$HERE/patch/n64b_fwd.py":$FA/n64b_fwd.py:ro \
+  -v "$HERE/patch/n64_attn_global.py":$MDL/n64_attn_global.py:ro -e SGLANG_INKLING_N64="$N64" \
+  -e SGLANG_INKLING_N64_MIN_K="$N64_MIN_K" -e SGLANG_INKLING_N64_PREALLOC_HEADS="$N64_PREALLOC" $EXTRA_DOCKER \
+  -e SGLANG_OPT_INKLING2_VERIFY_REL_BIAS_KERNEL=1 \
+  -e MALLOC_MMAP_THRESHOLD_=1048576 \
+  -e SGLANG_ENABLE_DFLASH_DRAFT_KV_RING="$RING" -e DFLASH2_SHA256="$DFLASH2_SHA256" -v "$DRAFT_DIR":/draft:ro \
+  -v "$DFLASH2_SCRIPT":/draft-script/sglang_inkling_dflash2.py:ro "${MIX_ARGS[@]}" \
+  --entrypoint bash "$IMAGE" \
+  -c 'mkdir -p /root/.cache/dflash2-logs; exec > >(tee -a /root/.cache/dflash2-logs/server-$(date -u +%Y%m%dT%H%M%SZ).log) 2>&1
+               (cd /draft && printf "%s\n" "$DFLASH2_SHA256" | sed "s/ /  /" | sha256sum -c --quiet -) || {
+                 echo "DFlash2 drafter files do not match the pinned sha256" >&2; exit 1; }
+               echo "[n391-serve] DFLASH draft KV ring env $SGLANG_ENABLE_DFLASH_DRAFT_KV_RING (1 iff every draft layer is sliding_attention)"
+               python3 -I /draft-script/sglang_inkling_dflash2.py && exec python3 "$@"' dflash2 \
+  -m sglang.launch_server --model-path /model --served-model-name "$SERVED" \
+  --tp 1 --ep 1 --attention-backend fa4 --dtype bfloat16 --page-size 128 \
+  --speculative-algorithm DFLASH --speculative-draft-model-path /draft --speculative-num-draft-tokens 8 --speculative-draft-attention-backend fa4 --speculative-use-block-verification \
+  --max-running-requests 48 --cuda-graph-max-bs-decode=48 \
+  --mem-fraction-static "$MEM" --context-length "$CTX" \
+  --grammar-backend xgrammar --reasoning-parser inkling --tool-call-parser inkling2 \
+  --enable-metrics --host 0.0.0.0 --port 30000 --api-key "$API_KEY" --weight-loader-disable-mmap --swa-full-tokens-ratio 0.037 \
+  --max-mamba-cache-size 512 --max-prefill-tokens 8192 $EXTRA_ARGS
diff --git a/recipe/stack/cands/n419j3-2416d17a/recipe/serve/sl.json b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/sl.json
new file mode 100644
index 0000000000000000000000000000000000000000..000d388661eb28dd6d0f261cd3fcba25a766f223
--- /dev/null
+++ b/recipe/stack/cands/n419j3-2416d17a/recipe/serve/sl.json
@@ -0,0 +1 @@
+[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 99, 100, 103, 105, 106, 107, 112, 114, 116, 120, 121, 126, 135, 138, 140, 147, 148, 153, 155, 158, 170, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 224, 225, 226, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 243, 246, 247, 248, 249, 252, 253, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 286, 289, 290, 291, 292, 293, 295, 296, 297, 300, 301, 302, 304, 305, 306, 307, 308, 309, 310, 311, 313, 314, 315, 316, 317, 318, 319, 320, 322, 323, 324, 325, 326, 327, 329, 330, 331, 332, 334, 335, 336, 337, 338, 339, 340, 341, 344, 345, 346, 347, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 384, 385, 386, 391, 392, 393, 397, 406, 407, 427, 452, 482, 483, 508, 542, 543, 544, 547, 551, 587, 588, 589, 590, 601, 623, 626, 627, 628, 635, 648, 661, 664, 665, 666, 667, 673, 675, 693, 694, 696, 713, 714, 715, 716, 729, 730, 731, 745, 746, 747, 755, 761, 762, 764, 767, 768, 778, 779, 780, 781, 782, 784, 785, 786, 787, 788, 789, 791, 792, 793, 794, 796, 797, 798, 799, 800, 801, 802, 804, 805, 806, 807, 808, 809, 813, 814, 815, 816, 818, 819, 820, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 834, 835, 837, 838, 839, 840, 842, 845, 846, 848, 849, 850, 852, 853, 854, 855, 856, 861, 862, 863, 864, 865, 866, 867, 868, 869, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 887, 888, 889, 890, 891, 895, 896, 897, 898, 899, 900, 902, 903, 904, 905, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 927, 928, 929, 930, 931, 932, 933, 941, 942, 943, 944, 945, 946, 947, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 970, 971, 976, 977, 978, 979, 981, 982, 983, 984, 985, 986, 987, 992, 993, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1008, 1009, 1010, 1011, 1012, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1082, 1083, 1085, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1125, 1126, 1141, 1142, 1143, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1167, 1168, 1169, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1196, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1232, 1233, 1234, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1264, 1265, 1267, 1268, 1269, 1270, 1271, 1272, 1274, 1276, 1277, 1278, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1293, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1339, 1341, 1342, 1343, 1345, 1346, 1347, 1349, 1350, 1353, 1354, 1355, 1356, 1357, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1373, 1374, 1375, 1376, 1377, 1404, 1406, 1407, 1408, 1410, 1411, 1412, 1413, 1414, 1415, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1476, 1477, 1478, 1479, 1481, 1482, 1484, 1485, 1486, 1487, 1488, 1489, 1491, 1492, 1494, 1495, 1496, 1498, 1499, 1500, 1502, 1503, 1504, 1506, 1507, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1539, 1540, 1541, 1542, 1543, 1545, 1546, 1547, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1603, 1604, 1605, 1606, 1607, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1628, 1629, 1630, 1631, 1632, 1633, 1635, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1647, 1648, 1649, 1651, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1707, 1708, 1709, 1711, 1712, 1714, 1715, 1716, 1717, 1719, 1720, 1721, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1744, 1745, 1746, 1747, 1748, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1758, 1759, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1769, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1780, 1781, 1782, 1783, 1784, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1795, 1796, 1798, 1800, 1801, 1802, 1804, 1805, 1807, 1808, 1809, 1810, 1860, 1861, 1862, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1874, 1877, 1879, 1880, 1881, 1884, 1885, 1886, 1887, 1889, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1900, 1901, 1902, 1905, 1906, 1908, 1909, 1910, 1911, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1944, 1945, 1947, 1948, 1950, 1951, 1952, 1953, 1954, 1955, 1957, 1958, 1959, 1961, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1979, 1980, 1982, 1983, 1984, 1986, 1987, 1988, 1989, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2083, 2084, 2085, 2086, 2087, 2089, 2090, 2092, 2093, 2095, 2096, 2097, 2098, 2099, 2101, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2112, 2113, 2115, 2117, 2118, 2119, 2120, 2121, 2122, 2125, 2126, 2127, 2128, 2129, 2131, 2133, 2134, 2135, 2137, 2138, 2140, 2141, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2156, 2157, 2158, 2160, 2161, 2164, 2165, 2168, 2169, 2170, 2171, 2172, 2174, 2175, 2176, 2177, 2178, 2179, 2181, 2183, 2184, 2186, 2187, 2188, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2217, 2218, 2220, 2221, 2222, 2225, 2226, 2227, 2228, 2229, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2240, 2241, 2242, 2244, 2247, 2248, 2250, 2251, 2253, 2254, 2255, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2280, 2281, 2285, 2286, 2287, 2288, 2289, 2290, 2386, 2387, 2388, 2389, 2390, 2392, 2393, 2394, 2397, 2398, 2399, 2400, 2401, 2402, 2404, 2405, 2407, 2409, 2410, 2411, 2412, 2414, 2419, 2420, 2421, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2443, 2444, 2445, 2446, 2447, 2449, 2450, 2451, 2452, 2453, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2469, 2470, 2471, 2472, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2484, 2485, 2488, 2489, 2490, 2491, 2492, 2494, 2495, 2496, 2497, 2499, 2502, 2503, 2504, 2505, 2507, 2511, 2512, 2514, 2515, 2516, 2517, 2519, 2520, 2521, 2523, 2525, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2536, 2537, 2538, 2539, 2540, 2541, 2545, 2546, 2547, 2549, 2550, 2551, 2552, 2553, 2554, 2556, 2557, 2558, 2559, 2560, 2564, 2566, 2567, 2568, 2569, 2571, 2573, 2574, 2577, 2578, 2579, 2582, 2583, 2584, 2585, 2586, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2596, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2608, 2613, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2627, 2628, 2629, 2633, 2634, 2635, 2636, 2637, 2639, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2653, 2655, 2657, 2658, 2660, 2662, 2663, 2664, 2666, 2667, 2668, 2669, 2671, 2673, 2677, 2678, 2681, 2682, 2685, 2686, 2687, 2689, 2690, 2691, 2693, 2697, 2698, 2701, 2702, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2713, 2714, 2715, 2716, 2717, 2718, 2720, 2721, 2722, 2723, 2724, 2725, 2727, 2728, 2853, 2855, 2856, 2863, 2864, 2865, 2866, 2872, 2874, 2876, 2877, 2878, 2879, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2900, 2901, 2902, 2903, 2905, 2906, 2908, 2910, 2911, 2912, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2929, 2931, 2932, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2945, 2946, 2947, 2948, 2949, 2951, 2952, 2953, 2955, 2956, 2957, 2959, 2960, 2961, 2962, 2963, 2965, 2967, 2968, 2969, 2970, 2971, 2973, 2974, 2976, 2978, 2979, 2980, 2985, 2986, 2988, 2991, 2992, 2993, 2994, 2995, 2997, 2998, 2999, 3000, 3001, 3002, 3003, 3005, 3006, 3011, 3013, 3014, 3016, 3017, 3018, 3020, 3022, 3023, 3024, 3026, 3028, 3029, 3030, 3031, 3034, 3035, 3036, 3037, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3049, 3050, 3051, 3052, 3053, 3054, 3056, 3058, 3059, 3061, 3062, 3063, 3067, 3068, 3070, 3071, 3072, 3074, 3075, 3077, 3078, 3079, 3081, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3094, 3095, 3097, 3098, 3102, 3103, 3104, 3105, 3107, 3108, 3109, 3111, 3112, 3113, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3124, 3125, 3126, 3127, 3129, 3131, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3142, 3143, 3144, 3145, 3146, 3148, 3149, 3150, 3151, 3153, 3154, 3156, 3158, 3159, 3160, 3163, 3164, 3165, 3168, 3169, 3170, 3172, 3173, 3175, 3176, 3178, 3179, 3181, 3182, 3183, 3186, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3202, 3203, 3205, 3206, 3207, 3208, 3211, 3213, 3214, 3216, 3217, 3218, 3219, 3220, 3223, 3224, 3226, 3227, 3230, 3231, 3233, 3234, 3236, 3237, 3238, 3240, 3241, 3243, 3244, 3246, 3247, 3249, 3250, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3263, 3264, 3265, 3267, 3268, 3269, 3272, 3274, 3277, 3279, 3281, 3284, 3285, 3286, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3297, 3300, 3301, 3304, 3307, 3309, 3310, 3311, 3312, 3314, 3316, 3317, 3318, 3319, 3320, 3321, 3323, 3324, 3326, 3328, 3329, 3330, 3331, 3333, 3334, 3335, 3336, 3339, 3340, 3341, 3344, 3345, 3346, 3347, 3349, 3350, 3352, 3353, 3354, 3355, 3356, 3357, 3360, 3364, 3365, 3368, 3369, 3371, 3372, 3373, 3374, 3377, 3378, 3379, 3381, 3383, 3385, 3386, 3387, 3388, 3394, 3396, 3397, 3398, 3401, 3402, 3404, 3405, 3406, 3408, 3413, 3414, 3415, 3416, 3417, 3420, 3421, 3422, 3423, 3426, 3427, 3429, 3430, 3431, 3433, 3435, 3437, 3439, 3440, 3441, 3444, 3445, 3446, 3447, 3448, 3590, 3591, 3593, 3594, 3596, 3598, 3601, 3602, 3605, 3607, 3609, 3613, 3616, 3618, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3628, 3629, 3630, 3631, 3632, 3633, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3644, 3646, 3647, 3648, 3651, 3653, 3654, 3655, 3657, 3659, 3660, 3661, 3662, 3665, 3666, 3667, 3668, 3669, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3679, 3680, 3683, 3685, 3687, 3688, 3690, 3691, 3693, 3694, 3695, 3697, 3699, 3701, 3702, 3703, 3704, 3705, 3706, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3717, 3718, 3719, 3720, 3721, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3734, 3737, 3738, 3740, 3741, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3754, 3757, 3758, 3759, 3761, 3762, 3764, 3765, 3766, 3767, 3768, 3771, 3772, 3774, 3775, 3776, 3777, 3778, 3780, 3782, 3783, 3784, 3785, 3786, 3787, 3790, 3791, 3794, 3795, 3796, 3797, 3800, 3801, 3802, 3808, 3809, 3811, 3812, 3814, 3815, 3818, 3820, 3821, 3826, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3840, 3844, 3846, 3848, 3849, 3850, 3851, 3853, 3854, 3856, 3859, 3861, 3862, 3863, 3864, 3865, 3867, 3869, 3875, 3877, 3880, 3882, 3883, 3884, 3885, 3886, 3888, 3890, 3892, 3895, 3898, 3899, 3900, 3901, 3902, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3916, 3917, 3921, 3923, 3928, 3931, 3932, 3934, 3936, 3938, 3941, 3942, 3943, 3944, 3946, 3947, 3948, 3951, 3953, 3954, 3955, 3958, 3959, 3960, 3965, 3966, 3970, 3971, 3972, 3973, 3975, 3977, 3978, 3980, 3981, 3983, 3984, 3985, 3986, 3987, 3989, 3996, 3997, 3998, 4000, 4001, 4002, 4003, 4006, 4008, 4009, 4010, 4011, 4013, 4014, 4017, 4018, 4019, 4023, 4024, 4027, 4028, 4030, 4033, 4034, 4035, 4036, 4043, 4044, 4046, 4047, 4049, 4050, 4051, 4055, 4056, 4058, 4060, 4061, 4062, 4063, 4065, 4066, 4067, 4068, 4069, 4071, 4073, 4076, 4077, 4078, 4079, 4081, 4082, 4094, 4096, 4098, 4100, 4102, 4104, 4105, 4109, 4112, 4113, 4114, 4115, 4116, 4117, 4119, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4131, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4142, 4144, 4145, 4148, 4150, 4151, 4152, 4153, 4159, 4161, 4162, 4164, 4165, 4166, 4167, 4169, 4170, 4178, 4179, 4181, 4182, 4183, 4184, 4186, 4188, 4189, 4192, 4195, 4198, 4199, 4200, 4202, 4205, 4207, 4208, 4209, 4210, 4211, 4212, 4219, 4221, 4222, 4226, 4227, 4228, 4230, 4231, 4232, 4235, 4237, 4239, 4240, 4242, 4245, 4246, 4247, 4249, 4250, 4251, 4252, 4253, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4266, 4267, 4268, 4269, 4270, 4271, 4274, 4275, 4276, 4277, 4280, 4282, 4284, 4290, 4294, 4295, 4297, 4298, 4300, 4302, 4303, 4304, 4306, 4307, 4308, 4309, 4311, 4312, 4313, 4315, 4318, 4321, 4323, 4324, 4326, 4329, 4331, 4332, 4334, 4338, 4339, 4341, 4343, 4344, 4345, 4348, 4350, 4352, 4356, 4357, 4361, 4362, 4364, 4366, 4367, 4373, 4374, 4376, 4377, 4381, 4385, 4387, 4388, 4389, 4390, 4392, 4393, 4395, 4396, 4400, 4401, 4402, 4405, 4406, 4407, 4411, 4412, 4413, 4414, 4415, 4419, 4421, 4424, 4427, 4428, 4429, 4435, 4436, 4437, 4438, 4440, 4444, 4446, 4447, 4452, 4454, 4457, 4458, 4459, 4460, 4462, 4465, 4471, 4473, 4474, 4475, 4476, 4477, 4481, 4486, 4487, 4489, 4491, 4492, 4493, 4495, 4496, 4499, 4501, 4504, 4505, 4506, 4508, 4510, 4512, 4513, 4518, 4519, 4522, 4528, 4529, 4534, 4535, 4539, 4542, 4547, 4548, 4550, 4553, 4554, 4556, 4557, 4559, 4560, 4561, 4562, 4567, 4568, 4570, 4574, 4575, 4576, 4580, 4581, 4582, 4586, 4588, 4589, 4590, 4591, 4592, 4593, 4597, 4598, 4601, 4602, 4603, 4604, 4605, 4607, 4609, 4611, 4616, 4617, 4618, 4621, 4622, 4625, 4627, 4628, 4630, 4631, 4632, 4633, 4637, 4640, 4643, 4646, 4649, 4652, 4655, 4656, 4658, 4660, 4662, 4663, 4665, 4666, 4670, 4673, 4675, 4676, 4679, 4681, 4684, 4685, 4686, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4698, 4700, 4701, 4702, 4704, 4706, 4708, 4709, 4710, 4711, 4713, 4714, 4717, 4718, 4721, 4724, 4725, 4729, 4732, 4735, 4739, 4740, 4741, 4743, 4744, 4745, 4746, 4750, 4752, 4753, 4754, 4756, 4757, 4758, 4759, 4760, 4765, 4766, 4768, 4770, 4773, 4775, 4777, 4780, 4783, 4786, 4787, 4788, 4789, 4792, 4794, 4795, 4799, 4801, 4802, 4803, 4804, 4806, 4808, 4809, 4813, 4814, 4816, 4820, 4822, 4823, 4824, 4826, 4828, 4830, 4831, 4832, 4833, 4835, 4836, 4838, 4840, 4841, 4844, 4845, 4846, 4847, 4848, 4851, 4852, 4854, 4855, 4856, 4861, 4862, 4865, 4867, 4869, 4870, 4871, 4873, 4875, 4877, 4879, 4881, 4882, 4886, 4887, 4890, 4893, 4894, 4896, 4898, 4901, 4902, 4903, 4904, 4905, 4907, 4910, 4912, 4913, 4914, 4915, 4917, 4918, 4920, 4924, 4925, 4927, 4928, 4929, 4930, 4931, 4932, 4935, 4938, 4939, 4940, 4941, 4943, 4944, 4945, 4946, 4947, 4949, 4950, 4953, 4958, 4959, 4960, 4963, 4964, 4967, 4970, 4972, 4973, 4975, 4976, 4982, 4983, 4985, 4987, 4988, 4989, 4992, 4993, 4995, 4996, 5001, 5005, 5006, 5008, 5009, 5010, 5013, 5014, 5017, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5149, 5150, 5151, 5152, 5154, 5155, 5156, 5157, 5158, 5159, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5179, 5180, 5181, 5182, 5184, 5186, 5187, 5188, 5189, 5190, 5191, 5193, 5194, 5195, 5197, 5199, 5201, 5205, 5209, 5210, 5211, 5212, 5213, 5215, 5216, 5218, 5219, 5263, 5266, 5267, 5284, 5306, 5312, 5331, 5332, 5393, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5406, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5429, 5430, 5434, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5468, 5469, 5470, 5471, 5472, 5473, 5475, 5476, 5477, 5478, 5479, 5485, 5487, 5527, 5621, 5623, 5625, 5626, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5648, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5760, 6276, 6282, 6300, 6303, 6343, 6347, 6352, 6360, 6376, 6378, 6390, 6392, 6393, 6397, 6398, 6448, 6449, 6528, 6586, 6632, 6633, 6647, 6732, 6949, 8625, 8695, 8876, 8879, 9199, 9611, 9889, 9932, 9934, 9935, 10243, 10248, 10400, 10638, 11389, 11874, 12135, 12446, 12599, 12688, 13298, 13474, 13736, 14792, 15088, 15115, 15181, 15515, 15737, 15809, 15815, 16729, 16772, 16794, 17145, 17291, 17619, 17789, 18097, 18128, 18670, 18727, 18807, 18808, 19282, 19433, 19777, 20597, 20598, 20599, 20600, 20742, 21029, 21373, 21409, 22177, 22178, 22718, 23032, 23033, 23037, 23048, 23056, 23058, 23059, 23063, 23064, 23065, 23067, 23068, 23069, 23071, 23107, 23172, 23289, 23678, 23824, 23996, 24293, 24620, 24641, 25173, 25208, 25638, 25650, 25671, 25754, 25758, 25762, 25763, 25764, 25767, 25769, 25770, 25777, 25783, 25846, 25849, 25850, 25852, 25856, 25858, 25860, 25861, 25864, 25867, 25871, 25874, 25876, 25883, 25884, 25886, 25893, 25894, 25898, 25905, 25906, 25914, 25915, 25917, 25922, 25924, 25927, 25960, 25965, 25966, 25968, 25975, 25984, 25994, 25995, 25996, 25998, 26001, 26007, 26012, 26013, 26014, 26017, 26020, 26022, 26024, 26027, 26031, 26032, 26039, 26046, 26047, 26049, 26050, 26053, 26058, 26059, 26060, 26116, 26119, 26124, 26126, 26127, 26134, 26137, 26139, 26140, 26191, 26194, 26195, 26196, 26199, 26200, 26205, 26206, 26209, 26210, 26218, 26221, 26222, 26224, 26225, 26228, 26229, 26232, 26234, 26276, 26283, 26316, 26318, 26322, 26326, 26329, 26333, 26334, 26342, 26343, 26353, 26355, 26356, 26357, 26360, 26364, 26365, 26370, 26378, 26389, 26390, 26393, 26396, 26444, 26460, 26467, 26487, 26488, 26497, 26501, 26510, 26511, 26514, 26516, 26519, 26523, 26524, 26528, 26529, 26530, 26555, 26560, 26564, 26566, 26569, 26570, 26571, 26575, 26578, 26580, 26589, 26594, 26595, 26597, 26601, 26609, 26622, 26629, 26631, 26642, 26656, 26719, 26727, 26729, 26733, 26748, 26750, 26757, 26762, 26764, 26767, 26773, 26790, 26792, 26821, 26833, 26835, 26840, 26842, 26850, 26872, 26879, 26962, 26963, 26965, 26968, 26971, 26972, 26973, 26975, 26979, 26984, 26994, 26996, 27001, 27004, 27019, 27021, 27023, 27040, 27042, 27057, 27061, 27063, 27064, 27065, 27066, 27068, 27071, 27072, 27092, 27096, 27100, 27103, 27104, 27105, 27111, 27114, 27118, 27131, 27132, 27135, 27140, 27142, 27150, 27151, 27153, 27205, 27206, 27210, 27212, 27219, 27221, 27240, 27254, 27255, 27258, 27330, 27332, 27364, 27374, 27377, 27379, 27387, 27390, 27393, 27395, 27405, 27406, 27407, 27410, 27415, 27427, 27429, 27434, 27443, 27447, 27449, 27459, 27463, 27465, 27467, 27470, 27481, 27531, 27535, 27556, 27558, 27559, 27568, 27569, 27571, 27572, 27580, 27581, 27582, 27584, 27587, 27591, 27596, 27597, 27606, 27607, 27612, 27620, 27629, 27630, 27637, 27641, 27644, 27648, 27650, 27655, 27659, 27660, 27662, 27675, 27772, 27776, 27784, 27786, 27789, 27791, 27792, 27796, 27801, 27807, 27816, 27824, 27826, 27834, 27835, 27839, 27843, 27851, 27930, 27931, 27932, 27968, 27984, 27999, 28000, 28002, 28008, 28020, 28042, 28043, 28055, 28057, 28059, 28072, 28076, 28077, 28078, 28079, 28080, 28085, 28087, 28236, 28260, 28273, 28279, 28286, 28290, 28291, 28478, 28493, 28494, 28499, 28500, 28502, 28503, 28505, 28507, 28511, 28516, 28520, 28522, 28526, 28527, 28528, 28530, 28531, 28559, 28562, 28572, 28578, 28580, 28581, 28731, 28733, 28742, 28745, 28747, 28760, 28761, 28767, 28785, 28792, 28795, 28813, 28977, 28978, 28983, 28988, 28996, 28998, 29000, 29176, 29177, 29188, 29191, 29200, 29201, 29205, 29209, 29477, 29806, 29821, 29823, 29824, 29825, 29827, 30148, 30153, 30717, 30718, 30720, 30726, 30730, 30733, 30734, 30735, 30737, 30739, 30740, 30743, 30746, 30751, 30753, 30760, 30761, 30762, 30767, 30769, 30770, 30771, 30773, 30774, 30775, 30776, 30777, 30778, 30780, 30781, 30782, 30789, 30790, 30791, 30793, 30794, 30796, 30797, 30799, 30800, 30801, 30804, 30805, 30806, 30807, 30810, 30811, 30813, 30817, 30818, 30823, 30825, 30826, 30831, 30836, 30837, 30843, 30845, 30848, 30854, 30856, 30864, 30866, 30868, 30870, 30872, 30874, 30880, 30881, 30883, 30886, 30888, 30890, 30892, 30896, 30897, 30898, 30899, 30900, 30904, 30905, 30907, 30911, 30912, 30913, 30920, 30921, 30922, 30924, 30925, 30926, 30927, 30929, 30930, 30931, 30932, 30937, 30938, 30939, 30940, 30941, 30942, 30943, 30944, 30948, 30952, 30953, 30954, 30956, 30958, 30961, 30962, 30964, 30966, 30969, 30970, 30971, 30976, 30977, 30978, 30979, 30983, 30984, 30985, 30986, 30989, 30992, 30993, 30997, 30998, 31000, 31001, 31005, 31007, 31008, 31010, 31013, 31016, 31021, 31022, 31028, 31029, 31031, 31036, 31037, 31038, 31039, 31040, 31042, 31047, 31050, 31051, 31054, 31055, 31058, 31063, 31065, 31070, 31073, 31074, 31077, 31082, 31083, 31085, 31087, 31095, 31096, 31097, 31098, 31100, 31101, 31102, 31103, 31107, 31109, 31110, 31111, 31116, 31118, 31123, 31126, 31130, 31131, 31132, 31136, 31137, 31139, 31140, 31141, 31142, 31144, 31145, 31146, 31147, 31148, 31151, 31152, 31153, 31154, 31156, 31158, 31167, 31169, 31173, 31174, 31175, 31176, 31177, 31182, 31183, 31187, 31188, 31197, 31201, 31206, 31207, 31211, 31214, 31216, 31218, 31220, 31224, 31226, 31229, 31230, 31233, 31235, 31237, 31239, 31240, 31244, 31245, 31246, 31247, 31248, 31252, 31255, 31258, 31260, 31261, 31262, 31264, 31270, 31271, 31272, 31274, 31275, 31277, 31281, 31283, 31285, 31288, 31289, 31290, 31291, 31294, 31303, 31304, 31306, 31310, 31312, 31313, 31316, 31317, 31318, 31319, 31320, 31321, 31324, 31329, 31330, 31332, 31333, 31335, 31337, 31339, 31340, 31341, 31342, 31344, 31346, 31349, 31351, 31354, 31357, 31358, 31361, 31363, 31365, 31366, 31372, 31373, 31376, 31379, 31380, 31382, 31383, 31384, 31385, 31387, 31390, 31398, 31399, 31402, 31405, 31406, 31408, 31409, 31410, 31413, 31417, 31419, 31421, 31422, 31424, 31434, 31436, 31441, 31442, 31446, 31448, 31449, 31450, 31451, 31454, 31455, 31456, 31457, 31461, 31462, 31463, 31466, 31469, 31474, 31478, 31479, 31480, 31483, 31484, 31485, 31491, 31492, 31495, 31496, 31500, 31501, 31502, 31506, 31507, 31508, 31510, 31512, 31514, 31515, 31519, 31520, 31524, 31527, 31529, 31530, 31531, 31532, 31534, 31537, 31538, 31543, 31555, 31559, 31563, 31567, 31576, 31577, 31578, 31579, 31581, 31588, 31589, 31591, 31593, 31594, 31596, 31597, 31598, 31602, 31603, 31609, 31611, 31614, 31616, 31617, 31621, 31628, 31629, 31633, 31635, 31637, 31639, 31640, 31641, 31642, 31643, 31645, 31648, 31651, 31652, 31654, 31655, 31657, 31658, 31662, 31663, 31664, 31665, 31666, 31667, 31669, 31671, 31674, 31675, 31676, 31677, 31678, 31680, 31681, 31685, 31686, 31687, 31693, 31701, 31704, 31707, 31708, 31712, 31713, 31717, 31719, 31720, 31721, 31722, 31723, 31724, 31730, 31731, 31734, 31736, 31743, 31744, 31745, 31746, 31749, 31751, 31752, 31753, 31755, 31757, 31758, 31765, 31766, 31770, 31777, 31779, 31780, 31785, 31789, 31793, 31794, 31795, 31796, 31797, 31800, 31801, 31802, 31803, 31804, 31808, 31816, 31818, 31820, 31823, 31824, 31830, 31832, 31834, 31836, 31839, 31841, 31844, 31847, 31848, 31850, 31852, 31853, 31855, 31856, 31858, 31860, 31862, 31863, 31864, 31865, 31872, 31873, 31876, 31877, 31880, 31883, 31884, 31885, 31887, 31890, 31891, 31894, 31897, 31899, 31900, 31901, 31903, 31904, 31907, 31908, 31909, 31914, 31916, 31917, 31922, 31925, 31926, 31927, 31929, 31930, 31931, 31932, 31933, 31935, 31936, 31937, 31939, 31940, 31941, 31943, 31945, 31946, 31948, 31949, 31952, 31954, 31956, 31958, 31963, 31970, 31973, 31976, 31979, 31980, 31983, 31993, 31995, 31997, 31998, 32002, 32006, 32008, 32009, 32010, 32011, 32013, 32014, 32016, 32020, 32022, 32030, 32031, 32033, 32037, 32038, 32040, 32042, 32044, 32046, 32050, 32054, 32055, 32056, 32059, 32062, 32065, 32069, 32080, 32084, 32086, 32087, 32088, 32089, 32090, 32100, 32103, 32113, 32120, 32124, 32127, 32130, 32132, 32135, 32136, 32140, 32144, 32152, 32153, 32156, 32160, 32165, 32166, 32167, 32168, 32175, 32176, 32178, 32180, 32181, 32183, 32185, 32187, 32188, 32189, 32191, 32195, 32196, 32198, 32199, 32201, 32202, 32203, 32205, 32207, 32212, 32213, 32215, 32217, 32218, 32222, 32223, 32230, 32234, 32235, 32241, 32248, 32251, 32253, 32254, 32257, 32263, 32264, 32267, 32268, 32269, 32271, 32272, 32275, 32277, 32278, 32280, 32281, 32282, 32283, 32285, 32291, 32296, 32297, 32302, 32305, 32307, 32310, 32312, 32314, 32315, 32316, 32317, 32318, 32321, 32323, 32325, 32326, 32327, 32329, 32330, 32334, 32335, 32336, 32337, 32338, 32340, 32341, 32342, 32343, 32346, 32348, 32351, 32352, 32354, 32358, 32359, 32362, 32367, 32375, 32378, 32381, 32385, 32386, 32389, 32390, 32391, 32392, 32393, 32394, 32395, 32400, 32402, 32403, 32406, 32408, 32412, 32413, 32416, 32421, 32422, 32426, 32428, 32431, 32433, 32434, 32438, 32441, 32442, 32443, 32445, 32447, 32449, 32450, 32452, 32456, 32457, 32461, 32462, 32478, 32483, 32487, 32488, 32493, 32494, 32495, 32496, 32497, 32498, 32500, 32505, 32511, 32512, 32519, 32520, 32524, 32526, 32528, 32529, 32530, 32532, 32534, 32536, 32538, 32541, 32543, 32549, 32552, 32553, 32559, 32561, 32563, 32565, 32568, 32571, 32574, 32576, 32578, 32579, 32583, 32584, 32585, 32586, 32587, 32588, 32594, 32602, 32607, 32610, 32611, 32614, 32615, 32617, 32620, 32622, 32629, 32630, 32634, 32637, 32639, 32644, 32647, 32648, 32649, 32651, 32652, 32653, 32654, 32656, 32657, 32660, 32661, 32667, 32668, 32669, 32671, 32673, 32681, 32685, 32690, 32691, 32692, 32693, 32696, 32697, 32699, 32701, 32707, 32714, 32717, 32725, 32726, 32727, 32732, 32736, 32740, 32742, 32743, 32744, 32751, 32752, 32753, 32760, 32765, 32767, 32769, 32771, 32773, 32774, 32783, 32785, 32787, 32789, 32791, 32792, 32793, 32796, 32798, 32799, 32800, 32801, 32802, 32803, 32804, 32805, 32806, 32808, 32810, 32811, 32813, 32825, 32827, 32835, 32838, 32841, 32843, 32846, 32849, 32850, 32852, 32853, 32858, 32863, 32864, 32866, 32875, 32877, 32879, 32886, 32891, 32895, 32896, 32898, 32902, 32907, 32910, 32911, 32912, 32916, 32917, 32920, 32924, 32925, 32929, 32930, 32937, 32942, 32943, 32945, 32946, 32948, 32953, 32954, 32955, 32958, 32959, 32961, 32962, 32965, 32966, 32971, 32975, 32978, 32981, 32984, 32989, 32990, 32993, 32995, 32997, 33001, 33004, 33005, 33013, 33019, 33023, 33024, 33030, 33031, 33032, 33033, 33034, 33036, 33037, 33039, 33042, 33043, 33044, 33045, 33048, 33049, 33050, 33052, 33059, 33062, 33065, 33072, 33074, 33076, 33077, 33078, 33079, 33080, 33082, 33084, 33087, 33090, 33092, 33094, 33096, 33097, 33098, 33099, 33101, 33104, 33110, 33111, 33114, 33117, 33118, 33120, 33122, 33126, 33127, 33129, 33131, 33132, 33133, 33134, 33139, 33142, 33146, 33150, 33151, 33152, 33153, 33155, 33156, 33158, 33161, 33163, 33164, 33167, 33168, 33174, 33178, 33179, 33184, 33185, 33186, 33189, 33194, 33196, 33201, 33205, 33207, 33208, 33209, 33213, 33214, 33216, 33217, 33221, 33225, 33226, 33228, 33230, 33234, 33236, 33237, 33242, 33243, 33245, 33246, 33247, 33251, 33256, 33258, 33259, 33261, 33263, 33265, 33268, 33272, 33274, 33275, 33285, 33287, 33289, 33293, 33295, 33297, 33300, 33301, 33302, 33304, 33305, 33306, 33307, 33310, 33311, 33315, 33316, 33320, 33322, 33324, 33326, 33329, 33330, 33333, 33334, 33335, 33337, 33338, 33339, 33340, 33341, 33342, 33346, 33347, 33348, 33351, 33352, 33353, 33359, 33367, 33370, 33376, 33378, 33380, 33381, 33382, 33385, 33386, 33391, 33394, 33395, 33396, 33398, 33401, 33405, 33408, 33415, 33419, 33420, 33421, 33424, 33427, 33430, 33432, 33437, 33441, 33443, 33444, 33445, 33452, 33460, 33466, 33467, 33469, 33471, 33472, 33484, 33490, 33492, 33497, 33499, 33500, 33501, 33509, 33510, 33512, 33513, 33516, 33517, 33519, 33526, 33528, 33529, 33530, 33537, 33538, 33542, 33544, 33550, 33551, 33555, 33558, 33561, 33562, 33563, 33564, 33567, 33568, 33570, 33572, 33575, 33579, 33580, 33581, 33585, 33588, 33589, 33593, 33594, 33596, 33599, 33603, 33607, 33608, 33609, 33610, 33612, 33614, 33619, 33620, 33622, 33627, 33632, 33634, 33641, 33645, 33646, 33647, 33649, 33652, 33655, 33659, 33661, 33663, 33664, 33668, 33670, 33673, 33676, 33678, 33682, 33683, 33684, 33688, 33695, 33697, 33707, 33709, 33715, 33719, 33721, 33724, 33731, 33733, 33739, 33741, 33742, 33746, 33748, 33749, 33752, 33754, 33756, 33759, 33764, 33765, 33770, 33772, 33773, 33774, 33779, 33780, 33782, 33783, 33784, 33794, 33797, 33800, 33803, 33807, 33808, 33818, 33821, 33825, 33835, 33836, 33838, 33839, 33840, 33841, 33843, 33845, 33846, 33847, 33849, 33851, 33859, 33860, 33872, 33873, 33874, 33875, 33879, 33881, 33883, 33887, 33889, 33897, 33898, 33899, 33902, 33904, 33909, 33911, 33912, 33914, 33921, 33922, 33923, 33925, 33929, 33937, 33938, 33940, 33943, 33948, 33949, 33951, 33952, 33956, 33957, 33966, 33967, 33970, 33974, 33975, 33976, 33979, 33981, 33983, 33985, 33989, 33991, 33992, 33994, 33997, 34002, 34004, 34007, 34008, 34011, 34017, 34018, 34020, 34021, 34023, 34025, 34026, 34029, 34031, 34032, 34034, 34036, 34037, 34038, 34040, 34042, 34045, 34053, 34055, 34056, 34058, 34061, 34062, 34072, 34074, 34075, 34078, 34079, 34081, 34086, 34091, 34092, 34097, 34102, 34105, 34106, 34108, 34110, 34117, 34125, 34127, 34129, 34131, 34132, 34134, 34137, 34138, 34139, 34140, 34143, 34146, 34147, 34149, 34152, 34154, 34156, 34157, 34159, 34160, 34161, 34163, 34168, 34169, 34171, 34172, 34173, 34175, 34180, 34184, 34187, 34188, 34195, 34197, 34203, 34205, 34207, 34210, 34213, 34214, 34219, 34222, 34225, 34227, 34232, 34234, 34235, 34242, 34243, 34245, 34246, 34248, 34250, 34251, 34253, 34258, 34259, 34261, 34265, 34267, 34268, 34277, 34278, 34281, 34282, 34288, 34290, 34293, 34297, 34298, 34301, 34305, 34309, 34310, 34311, 34314, 34315, 34318, 34322, 34324, 34326, 34331, 34332, 34336, 34337, 34338, 34346, 34347, 34348, 34353, 34358, 34361, 34364, 34365, 34367, 34371, 34372, 34373, 34380, 34388, 34389, 34390, 34391, 34392, 34395, 34397, 34398, 34401, 34403, 34405, 34410, 34413, 34417, 34418, 34421, 34431, 34437, 34438, 34441, 34444, 34454, 34458, 34459, 34464, 34469, 34472, 34475, 34476, 34479, 34481, 34484, 34490, 34491, 34496, 34498, 34499, 34504, 34512, 34516, 34519, 34521, 34524, 34525, 34526, 34529, 34532, 34534, 34538, 34539, 34540, 34545, 34549, 34551, 34555, 34557, 34558, 34560, 34563, 34565, 34569, 34572, 34579, 34580, 34584, 34588, 34594, 34604, 34609, 34612, 34613, 34618, 34619, 34621, 34624, 34632, 34638, 34643, 34644, 34645, 34647, 34656, 34657, 34658, 34659, 34669, 34672, 34673, 34676, 34677, 34679, 34680, 34681, 34687, 34691, 34692, 34694, 34703, 34704, 34706, 34707, 34716, 34720, 34721, 34722, 34724, 34731, 34733, 34737, 34743, 34745, 34746, 34747, 34749, 34750, 34751, 34752, 34759, 34761, 34765, 34766, 34769, 34771, 34772, 34775, 34777, 34780, 34784, 34785, 34786, 34787, 34789, 34795, 34798, 34799, 34802, 34805, 34807, 34809, 34816, 34817, 34827, 34829, 34836, 34838, 34840, 34842, 34843, 34844, 34847, 34851, 34852, 34856, 34859, 34860, 34861, 34872, 34875, 34878, 34885, 34886, 34892, 34895, 34896, 34905, 34907, 34913, 34914, 34915, 34919, 34921, 34924, 34930, 34931, 34934, 34937, 34938, 34940, 34946, 34949, 34954, 34955, 34956, 34963, 34964, 34966, 34967, 34968, 34972, 34974, 34981, 34984, 34986, 34987, 34989, 34992, 35001, 35003, 35007, 35013, 35017, 35025, 35028, 35029, 35034, 35037, 35042, 35047, 35051, 35056, 35057, 35060, 35061, 35065, 35066, 35067, 35070, 35074, 35080, 35081, 35087, 35089, 35091, 35094, 35095, 35101, 35104, 35108, 35110, 35111, 35114, 35125, 35126, 35128, 35130, 35131, 35132, 35134, 35138, 35141, 35145, 35147, 35151, 35155, 35156, 35165, 35166, 35167, 35173, 35176, 35177, 35178, 35179, 35187, 35190, 35194, 35196, 35197, 35201, 35204, 35206, 35213, 35218, 35222, 35224, 35230, 35231, 35240, 35241, 35245, 35247, 35250, 35252, 35255, 35258, 35259, 35264, 35269, 35271, 35275, 35276, 35277, 35282, 35286, 35287, 35288, 35290, 35297, 35298, 35299, 35306, 35310, 35312, 35314, 35317, 35320, 35322, 35323, 35328, 35329, 35336, 35338, 35346, 35351, 35353, 35356, 35357, 35359, 35360, 35369, 35370, 35374, 35376, 35381, 35384, 35386, 35391, 35393, 35394, 35397, 35399, 35400, 35402, 35404, 35407, 35414, 35419, 35422, 35426, 35427, 35429, 35430, 35432, 35438, 35444, 35459, 35461, 35472, 35496, 35499, 35505, 35510, 35515, 35517, 35518, 35519, 35521, 35534, 35535, 35542, 35543, 35544, 35549, 35550, 35551, 35560, 35562, 35568, 35570, 35572, 35573, 35575, 35582, 35588, 35589, 35590, 35591, 35596, 35597, 35598, 35599, 35603, 35605, 35606, 35609, 35610, 35612, 35617, 35621, 35630, 35631, 35643, 35646, 35647, 35653, 35661, 35663, 35664, 35665, 35666, 35668, 35678, 35680, 35683, 35684, 35711, 35714, 35721, 35725, 35733, 35736, 35739, 35740, 35745, 35750, 35752, 35755, 35757, 35758, 35759, 35764, 35765, 35767, 35771, 35774, 35775, 35777, 35782, 35789, 35790, 35795, 35800, 35803, 35807, 35808, 35812, 35818, 35820, 35821, 35822, 35823, 35825, 35831, 35832, 35837, 35838, 35841, 35846, 35851, 35861, 35863, 35864, 35866, 35867, 35869, 35873, 35874, 35875, 35877, 35880, 35884, 35892, 35894, 35899, 35900, 35904, 35906, 35908, 35909, 35913, 35917, 35918, 35922, 35924, 35926, 35931, 35933, 35936, 35938, 35947, 35957, 35958, 35960, 35961, 35964, 35967, 35971, 35976, 35978, 35979, 35981, 35986, 35989, 35993, 36002, 36004, 36005, 36008, 36009, 36010, 36018, 36020, 36021, 36024, 36026, 36029, 36031, 36033, 36035, 36036, 36037, 36043, 36044, 36050, 36057, 36061, 36068, 36071, 36074, 36075, 36079, 36080, 36081, 36088, 36096, 36099, 36104, 36105, 36107, 36109, 36111, 36112, 36115, 36121, 36122, 36131, 36138, 36139, 36140, 36142, 36145, 36148, 36149, 36160, 36172, 36174, 36180, 36191, 36198, 36204, 36211, 36217, 36218, 36221, 36228, 36229, 36230, 36235, 36236, 36238, 36248, 36252, 36256, 36260, 36264, 36269, 36274, 36277, 36286, 36289, 36290, 36294, 36299, 36305, 36306, 36309, 36318, 36324, 36325, 36326, 36332, 36337, 36340, 36346, 36351, 36352, 36362, 36365, 36372, 36374, 36382, 36387, 36391, 36398, 36403, 36404, 36405, 36406, 36408, 36409, 36413, 36416, 36417, 36418, 36420, 36421, 36425, 36432, 36435, 36437, 36440, 36444, 36445, 36446, 36448, 36450, 36458, 36460, 36461, 36463, 36466, 36477, 36483, 36488, 36492, 36500, 36504, 36505, 36506, 36507, 36509, 36515, 36519, 36521, 36523, 36529, 36536, 36538, 36542, 36546, 36547, 36552, 36553, 36556, 36557, 36561, 36563, 36567, 36575, 36579, 36586, 36592, 36595, 36602, 36603, 36606, 36608, 36610, 36621, 36622, 36633, 36638, 36639, 36640, 36642, 36643, 36646, 36650, 36651, 36655, 36656, 36660, 36672, 36673, 36680, 36687, 36689, 36690, 36692, 36699, 36705, 36707, 36711, 36716, 36718, 36721, 36723, 36735, 36742, 36749, 36756, 36757, 36760, 36763, 36765, 36766, 36770, 36771, 36778, 36785, 36787, 36788, 36789, 36791, 36794, 36800, 36801, 36802, 36810, 36813, 36818, 36819, 36822, 36830, 36835, 36836, 36842, 36854, 36858, 36860, 36861, 36864, 36865, 36867, 36877, 36879, 36893, 36898, 36901, 36904, 36905, 36909, 36911, 36912, 36919, 36925, 36930, 36931, 36933, 36940, 36950, 36952, 36954, 36958, 36962, 36967, 36970, 36972, 36973, 36974, 36977, 36984, 36988, 36990, 36995, 37005, 37009, 37013, 37020, 37024, 37025, 37032, 37035, 37036, 37039, 37044, 37045, 37049, 37051, 37057, 37065, 37066, 37084, 37087, 37090, 37096, 37101, 37105, 37109, 37114, 37118, 37122, 37141, 37150, 37154, 37159, 37161, 37168, 37169, 37171, 37175, 37182, 37187, 37194, 37197, 37198, 37204, 37212, 37224, 37225, 37237, 37238, 37240, 37241, 37249, 37260, 37265, 37273, 37277, 37278, 37281, 37288, 37289, 37291, 37293, 37303, 37310, 37313, 37315, 37317, 37319, 37326, 37329, 37352, 37364, 37369, 37372, 37373, 37384, 37385, 37389, 37391, 37395, 37397, 37403, 37407, 37409, 37411, 37414, 37415, 37421, 37424, 37431, 37436, 37438, 37441, 37442, 37444, 37451, 37453, 37456, 37458, 37459, 37463, 37469, 37472, 37474, 37475, 37477, 37479, 37482, 37485, 37490, 37495, 37499, 37507, 37508, 37509, 37520, 37524, 37528, 37536, 37538, 37545, 37547, 37548, 37549, 37553, 37560, 37562, 37563, 37567, 37569, 37574, 37575, 37576, 37583, 37586, 37588, 37589, 37597, 37609, 37615, 37616, 37621, 37622, 37626, 37628, 37629, 37631, 37637, 37639, 37640, 37643, 37653, 37657, 37659, 37665, 37666, 37674, 37677, 37679, 37681, 37682, 37688, 37690, 37694, 37700, 37701, 37703, 37705, 37706, 37710, 37711, 37712, 37713, 37719, 37720, 37732, 37739, 37741, 37743, 37749, 37753, 37755, 37756, 37757, 37758, 37761, 37768, 37773, 37780, 37781, 37783, 37785, 37791, 37793, 37800, 37811, 37813, 37822, 37831, 37832, 37833, 37842, 37843, 37851, 37853, 37857, 37858, 37859, 37860, 37866, 37868, 37869, 37872, 37877, 37882, 37890, 37894, 37895, 37899, 37903, 37904, 37909, 37910, 37929, 37930, 37933, 37935, 37936, 37941, 37944, 37950, 37961, 37962, 37963, 37975, 37976, 37980, 37982, 37984, 37987, 37989, 37997, 38002, 38012, 38017, 38019, 38026, 38033, 38035, 38038, 38052, 38053, 38057, 38059, 38068, 38070, 38075, 38083, 38091, 38097, 38100, 38110, 38113, 38114, 38127, 38130, 38140, 38143, 38148, 38154, 38155, 38163, 38175, 38179, 38180, 38181, 38182, 38183, 38184, 38186, 38192, 38194, 38197, 38200, 38204, 38206, 38210, 38219, 38220, 38224, 38225, 38233, 38235, 38240, 38247, 38249, 38250, 38251, 38254, 38256, 38257, 38258, 38260, 38261, 38263, 38265, 38266, 38276, 38279, 38287, 38291, 38293, 38297, 38302, 38307, 38309, 38311, 38313, 38314, 38315, 38316, 38323, 38329, 38332, 38333, 38337, 38338, 38339, 38341, 38352, 38356, 38368, 38369, 38370, 38374, 38375, 38384, 38391, 38392, 38398, 38399, 38401, 38417, 38418, 38426, 38432, 38443, 38445, 38447, 38451, 38454, 38461, 38462, 38467, 38482, 38507, 38512, 38514, 38522, 38525, 38528, 38534, 38536, 38537, 38539, 38540, 38542, 38545, 38547, 38548, 38552, 38554, 38559, 38565, 38566, 38577, 38578, 38592, 38600, 38601, 38604, 38611, 38613, 38622, 38625, 38637, 38639, 38643, 38649, 38653, 38655, 38664, 38666, 38668, 38670, 38674, 38677, 38679, 38681, 38686, 38692, 38696, 38697, 38698, 38705, 38707, 38713, 38715, 38716, 38722, 38724, 38729, 38739, 38740, 38744, 38749, 38759, 38760, 38769, 38772, 38777, 38778, 38796, 38801, 38802, 38807, 38808, 38813, 38828, 38834, 38837, 38838, 38840, 38846, 38853, 38856, 38857, 38858, 38862, 38872, 38874, 38879, 38891, 38892, 38894, 38898, 38902, 38918, 38919, 38922, 38926, 38935, 38937, 38943, 38949, 38953, 38959, 38968, 38970, 38974, 38978, 38983, 38985, 38986, 38993, 38997, 39000, 39002, 39004, 39007, 39009, 39010, 39015, 39018, 39019, 39020, 39026, 39037, 39039, 39044, 39052, 39060, 39067, 39068, 39078, 39081, 39082, 39085, 39086, 39091, 39093, 39098, 39099, 39103, 39107, 39109, 39110, 39114, 39115, 39117, 39118, 39119, 39125, 39130, 39134, 39135, 39155, 39158, 39159, 39161, 39163, 39165, 39166, 39167, 39171, 39176, 39184, 39187, 39192, 39194, 39200, 39203, 39205, 39209, 39214, 39222, 39223, 39227, 39233, 39241, 39242, 39243, 39253, 39255, 39257, 39258, 39263, 39264, 39270, 39271, 39274, 39287, 39296, 39298, 39310, 39315, 39317, 39327, 39328, 39341, 39353, 39354, 39360, 39361, 39368, 39375, 39377, 39379, 39380, 39381, 39382, 39386, 39388, 39389, 39393, 39397, 39408, 39411, 39412, 39414, 39416, 39417, 39419, 39421, 39422, 39435, 39454, 39455, 39459, 39462, 39464, 39469, 39474, 39480, 39499, 39506, 39507, 39512, 39514, 39525, 39533, 39539, 39541, 39565, 39569, 39570, 39571, 39572, 39574, 39579, 39580, 39581, 39588, 39594, 39599, 39601, 39604, 39611, 39613, 39614, 39620, 39623, 39632, 39636, 39640, 39645, 39646, 39651, 39653, 39657, 39660, 39663, 39664, 39669, 39672, 39678, 39682, 39693, 39695, 39697, 39699, 39721, 39722, 39725, 39728, 39732, 39734, 39737, 39742, 39743, 39751, 39758, 39762, 39766, 39770, 39776, 39787, 39788, 39793, 39795, 39797, 39798, 39802, 39804, 39805, 39807, 39808, 39810, 39820, 39833, 39836, 39844, 39854, 39863, 39866, 39870, 39874, 39884, 39886, 39888, 39891, 39897, 39906, 39907, 39919, 39926, 39932, 39937, 39948, 39950, 39952, 39957, 39958, 39964, 39966, 39967, 39968, 39973, 39975, 39979, 39981, 39992, 39994, 39998, 40001, 40003, 40023, 40027, 40031, 40032, 40033, 40036, 40038, 40041, 40043, 40045, 40060, 40073, 40074, 40075, 40090, 40093, 40102, 40103, 40107, 40108, 40112, 40117, 40118, 40119, 40120, 40121, 40125, 40128, 40137, 40146, 40149, 40151, 40156, 40157, 40160, 40165, 40173, 40174, 40175, 40178, 40185, 40187, 40192, 40206, 40210, 40211, 40212, 40221, 40229, 40239, 40243, 40246, 40249, 40250, 40252, 40259, 40260, 40268, 40275, 40277, 40284, 40287, 40296, 40300, 40303, 40304, 40305, 40306, 40307, 40310, 40311, 40313, 40315, 40317, 40321, 40325, 40328, 40330, 40332, 40334, 40360, 40361, 40370, 40373, 40375, 40384, 40397, 40398, 40401, 40403, 40408, 40417, 40418, 40422, 40430, 40438, 40444, 40449, 40452, 40453, 40455, 40457, 40469, 40477, 40489, 40490, 40494, 40495, 40501, 40502, 40503, 40507, 40508, 40521, 40525, 40527, 40530, 40536, 40537, 40540, 40549, 40554, 40561, 40562, 40566, 40575, 40579, 40580, 40592, 40593, 40595, 40596, 40604, 40606, 40608, 40610, 40615, 40617, 40629, 40636, 40643, 40644, 40649, 40651, 40653, 40660, 40662, 40671, 40678, 40688, 40695, 40698, 40702, 40703, 40708, 40712, 40716, 40720, 40723, 40727, 40729, 40730, 40732, 40738, 40739, 40742, 40745, 40750, 40764, 40765, 40769, 40778, 40780, 40787, 40788, 40792, 40800, 40801, 40814, 40820, 40822, 40828, 40829, 40835, 40839, 40843, 40845, 40849, 40851, 40852, 40853, 40876, 40883, 40885, 40886, 40900, 40901, 40902, 40903, 40911, 40913, 40917, 40918, 40930, 40931, 40936, 40937, 40953, 40956, 40958, 40964, 40974, 40979, 40982, 40989, 40990, 40991, 40994, 40998, 41006, 41008, 41014, 41022, 41029, 41038, 41039, 41040, 41043, 41047, 41049, 41050, 41057, 41058, 41059, 41060, 41061, 41068, 41083, 41090, 41093, 41098, 41099, 41114, 41117, 41123, 41126, 41127, 41142, 41146, 41152, 41154, 41157, 41158, 41160, 41161, 41174, 41183, 41190, 41195, 41196, 41203, 41212, 41213, 41216, 41217, 41218, 41219, 41221, 41225, 41227, 41230, 41238, 41239, 41241, 41245, 41247, 41248, 41254, 41260, 41261, 41275, 41277, 41280, 41290, 41292, 41299, 41302, 41303, 41318, 41320, 41321, 41323, 41330, 41335, 41353, 41354, 41363, 41365, 41367, 41371, 41374, 41377, 41392, 41393, 41402, 41411, 41415, 41420, 41423, 41426, 41431, 41436, 41437, 41443, 41446, 41457, 41473, 41474, 41476, 41490, 41491, 41499, 41502, 41504, 41505, 41506, 41515, 41519, 41530, 41532, 41534, 41540, 41546, 41547, 41548, 41552, 41556, 41557, 41562, 41563, 41564, 41567, 41573, 41582, 41590, 41591, 41598, 41607, 41610, 41613, 41619, 41622, 41624, 41629, 41633, 41634, 41640, 41647, 41649, 41660, 41661, 41668, 41673, 41678, 41686, 41687, 41688, 41690, 41691, 41696, 41705, 41706, 41711, 41713, 41714, 41725, 41726, 41734, 41739, 41746, 41747, 41754, 41763, 41772, 41776, 41782, 41783, 41792, 41799, 41804, 41810, 41812, 41816, 41817, 41821, 41823, 41829, 41833, 41838, 41841, 41851, 41878, 41879, 41880, 41896, 41901, 41904, 41905, 41907, 41908, 41909, 41913, 41920, 41926, 41928, 41931, 41937, 41938, 41949, 41969, 41981, 41982, 41983, 41985, 41989, 41990, 41992, 41996, 42000, 42002, 42003, 42010, 42012, 42027, 42028, 42041, 42049, 42053, 42064, 42066, 42067, 42068, 42076, 42081, 42086, 42088, 42104, 42115, 42119, 42128, 42133, 42134, 42136, 42139, 42146, 42164, 42165, 42166, 42169, 42175, 42180, 42182, 42183, 42186, 42188, 42191, 42202, 42203, 42204, 42211, 42212, 42222, 42225, 42226, 42230, 42234, 42237, 42240, 42247, 42248, 42253, 42258, 42261, 42266, 42267, 42268, 42270, 42278, 42279, 42280, 42282, 42283, 42288, 42296, 42303, 42318, 42321, 42324, 42330, 42342, 42349, 42350, 42352, 42355, 42371, 42375, 42379, 42389, 42391, 42401, 42402, 42403, 42404, 42405, 42415, 42417, 42419, 42431, 42436, 42441, 42445, 42456, 42469, 42471, 42473, 42475, 42481, 42484, 42486, 42491, 42493, 42495, 42503, 42507, 42510, 42513, 42517, 42522, 42523, 42524, 42530, 42539, 42541, 42550, 42551, 42552, 42553, 42558, 42561, 42572, 42589, 42594, 42595, 42606, 42608, 42611, 42615, 42624, 42626, 42627, 42628, 42633, 42636, 42637, 42639, 42644, 42651, 42654, 42656, 42669, 42670, 42675, 42693, 42705, 42706, 42707, 42719, 42721, 42729, 42730, 42734, 42737, 42739, 42749, 42754, 42756, 42760, 42764, 42778, 42779, 42795, 42796, 42798, 42808, 42810, 42816, 42818, 42826, 42844, 42849, 42853, 42855, 42860, 42870, 42877, 42878, 42882, 42900, 42916, 42918, 42927, 42928, 42931, 42932, 42937, 42943, 42946, 42949, 42950, 42958, 42971, 42986, 43001, 43002, 43009, 43020, 43021, 43027, 43036, 43046, 43048, 43059, 43069, 43079, 43083, 43090, 43094, 43095, 43108, 43114, 43115, 43127, 43134, 43148, 43153, 43158, 43162, 43164, 43175, 43190, 43198, 43203, 43204, 43205, 43206, 43207, 43212, 43217, 43223, 43238, 43244, 43250, 43253, 43271, 43273, 43282, 43283, 43284, 43290, 43297, 43298, 43301, 43310, 43313, 43314, 43329, 43330, 43338, 43350, 43352, 43354, 43361, 43365, 43370, 43375, 43377, 43378, 43381, 43383, 43384, 43392, 43393, 43394, 43410, 43417, 43420, 43422, 43425, 43431, 43432, 43440, 43446, 43453, 43464, 43478, 43479, 43481, 43510, 43517, 43533, 43535, 43538, 43543, 43562, 43580, 43584, 43594, 43603, 43614, 43634, 43635, 43637, 43638, 43646, 43647, 43650, 43653, 43654, 43656, 43661, 43665, 43669, 43671, 43679, 43683, 43685, 43691, 43693, 43696, 43717, 43722, 43725, 43736, 43744, 43745, 43747, 43748, 43754, 43756, 43760, 43764, 43769, 43778, 43780, 43782, 43784, 43794, 43796, 43798, 43802, 43805, 43808, 43809, 43816, 43817, 43818, 43822, 43826, 43828, 43833, 43835, 43855, 43862, 43871, 43875, 43890, 43893, 43904, 43910, 43911, 43912, 43914, 43917, 43918, 43930, 43932, 43938, 43946, 43963, 43965, 43969, 43972, 43975, 43984, 43985, 43990, 44002, 44004, 44005, 44006, 44008, 44018, 44025, 44031, 44041, 44048, 44049, 44071, 44086, 44088, 44101, 44106, 44124, 44129, 44132, 44133, 44139, 44143, 44150, 44151, 44154, 44155, 44160, 44169, 44181, 44184, 44197, 44204, 44212, 44221, 44229, 44232, 44238, 44246, 44254, 44258, 44261, 44265, 44275, 44278, 44291, 44295, 44298, 44303, 44304, 44310, 44312, 44324, 44325, 44335, 44340, 44342, 44353, 44355, 44364, 44366, 44374, 44380, 44385, 44392, 44396, 44403, 44415, 44416, 44419, 44430, 44433, 44435, 44440, 44443, 44444, 44446, 44451, 44469, 44479, 44482, 44483, 44484, 44485, 44496, 44497, 44500, 44509, 44511, 44512, 44532, 44535, 44537, 44538, 44543, 44550, 44562, 44566, 44569, 44572, 44588, 44596, 44602, 44605, 44606, 44625, 44634, 44636, 44643, 44645, 44651, 44654, 44661, 44664, 44683, 44684, 44687, 44688, 44689, 44699, 44701, 44704, 44710, 44726, 44731, 44750, 44761, 44768, 44769, 44778, 44784, 44785, 44806, 44809, 44815, 44817, 44822, 44828, 44831, 44833, 44841, 44842, 44847, 44855, 44857, 44858, 44859, 44861, 44878, 44885, 44895, 44901, 44905, 44906, 44908, 44917, 44919, 44921, 44937, 44938, 44939, 44956, 44957, 44960, 44966, 44968, 44978, 44983, 45006, 45013, 45023, 45024, 45025, 45030, 45033, 45034, 45042, 45043, 45045, 45053, 45054, 45059, 45063, 45066, 45071, 45076, 45080, 45092, 45094, 45099, 45101, 45124, 45127, 45131, 45155, 45156, 45199, 45200, 45206, 45217, 45221, 45239, 45240, 45243, 45244, 45248, 45254, 45275, 45276, 45277, 45279, 45287, 45297, 45314, 45317, 45319, 45333, 45335, 45348, 45349, 45354, 45360, 45361, 45362, 45372, 45380, 45381, 45386, 45388, 45417, 45422, 45425, 45434, 45439, 45443, 45445, 45460, 45467, 45474, 45488, 45493, 45494, 45502, 45508, 45509, 45511, 45518, 45527, 45531, 45539, 45540, 45545, 45602, 45605, 45609, 45612, 45620, 45631, 45647, 45656, 45660, 45668, 45684, 45688, 45704, 45706, 45711, 45713, 45718, 45735, 45746, 45749, 45755, 45765, 45768, 45773, 45788, 45790, 45796, 45806, 45811, 45829, 45833, 45834, 45836, 45884, 45890, 45892, 45895, 45898, 45915, 45917, 45929, 45930, 45938, 45941, 45961, 45970, 45974, 45975, 45976, 45995, 45996, 45998, 46000, 46005, 46006, 46014, 46015, 46033, 46034, 46036, 46038, 46041, 46055, 46056, 46058, 46060, 46063, 46068, 46071, 46081, 46093, 46100, 46113, 46125, 46137, 46147, 46149, 46150, 46160, 46161, 46162, 46171, 46176, 46179, 46191, 46192, 46193, 46219, 46226, 46230, 46234, 46236, 46247, 46251, 46263, 46268, 46269, 46273, 46284, 46285, 46287, 46290, 46303, 46304, 46314, 46315, 46316, 46317, 46319, 46333, 46334, 46335, 46338, 46340, 46341, 46355, 46387, 46392, 46394, 46411, 46413, 46418, 46434, 46435, 46437, 46441, 46445, 46451, 46452, 46455, 46457, 46458, 46466, 46477, 46486, 46488, 46517, 46518, 46520, 46528, 46530, 46531, 46533, 46538, 46544, 46548, 46568, 46569, 46577, 46590, 46601, 46618, 46619, 46636, 46639, 46649, 46653, 46659, 46664, 46680, 46683, 46691, 46692, 46698, 46705, 46707, 46715, 46716, 46721, 46722, 46726, 46742, 46756, 46758, 46774, 46776, 46777, 46780, 46793, 46797, 46800, 46818, 46839, 46841, 46855, 46858, 46865, 46867, 46868, 46869, 46870, 46892, 46896, 46900, 46902, 46903, 46917, 46919, 46923, 46931, 46932, 46933, 46935, 46936, 46941, 46964, 46969, 46985, 46987, 46988, 46989, 47001, 47013, 47014, 47015, 47022, 47023, 47026, 47034, 47037, 47039, 47040, 47041, 47045, 47046, 47065, 47067, 47068, 47071, 47075, 47080, 47087, 47089, 47090, 47099, 47102, 47116, 47119, 47121, 47122, 47124, 47127, 47128, 47130, 47142, 47143, 47144, 47145, 47146, 47163, 47166, 47169, 47171, 47172, 47173, 47195, 47198, 47218, 47222, 47225, 47233, 47237, 47247, 47248, 47252, 47264, 47271, 47278, 47279, 47282, 47292, 47303, 47311, 47317, 47321, 47328, 47330, 47342, 47343, 47352, 47369, 47372, 47374, 47377, 47388, 47399, 47406, 47417, 47424, 47431, 47442, 47449, 47451, 47454, 47476, 47478, 47483, 47501, 47508, 47509, 47523, 47525, 47528, 47538, 47539, 47541, 47557, 47558, 47560, 47566, 47572, 47585, 47595, 47596, 47610, 47611, 47612, 47613, 47628, 47635, 47637, 47639, 47642, 47653, 47667, 47673, 47687, 47692, 47695, 47699, 47701, 47708, 47710, 47718, 47720, 47721, 47751, 47755, 47760, 47783, 47784, 47785, 47787, 47788, 47814, 47821, 47847, 47848, 47850, 47853, 47865, 47883, 47884, 47888, 47903, 47904, 47907, 47936, 47937, 47958, 47964, 47965, 47967, 47986, 47992, 48000, 48001, 48004, 48007, 48035, 48038, 48040, 48041, 48060, 48071, 48074, 48075, 48082, 48090, 48097, 48098, 48104, 48115, 48117, 48118, 48122, 48124, 48133, 48149, 48155, 48167, 48171, 48172, 48180, 48183, 48188, 48189, 48193, 48206, 48210, 48214, 48227, 48241, 48244, 48266, 48270, 48275, 48277, 48289, 48290, 48324, 48325, 48333, 48338, 48340, 48342, 48345, 48376, 48413, 48431, 48435, 48441, 48443, 48446, 48460, 48464, 48466, 48469, 48487, 48489, 48491, 48497, 48503, 48513, 48515, 48522, 48524, 48530, 48535, 48540, 48551, 48554, 48555, 48558, 48564, 48565, 48566, 48572, 48597, 48600, 48621, 48626, 48635, 48636, 48657, 48658, 48661, 48664, 48672, 48689, 48691, 48708, 48714, 48728, 48731, 48732, 48733, 48760, 48774, 48805, 48809, 48815, 48817, 48831, 48857, 48861, 48878, 48880, 48887, 48889, 48890, 48894, 48921, 48922, 48931, 48935, 48951, 48956, 48973, 48976, 48977, 48982, 48986, 48988, 49004, 49014, 49040, 49041, 49044, 49052, 49063, 49077, 49081, 49084, 49108, 49110, 49111, 49117, 49124, 49126, 49130, 49145, 49146, 49151, 49157, 49162, 49178, 49182, 49184, 49186, 49197, 49216, 49217, 49220, 49228, 49232, 49233, 49246, 49248, 49250, 49252, 49253, 49256, 49264, 49281, 49282, 49288, 49309, 49311, 49316, 49320, 49347, 49349, 49350, 49381, 49385, 49386, 49388, 49390, 49394, 49396, 49418, 49423, 49426, 49440, 49446, 49447, 49453, 49455, 49461, 49463, 49468, 49474, 49482, 49486, 49491, 49492, 49494, 49508, 49509, 49521, 49526, 49544, 49547, 49551, 49553, 49559, 49587, 49589, 49592, 49609, 49623, 49635, 49645, 49646, 49661, 49664, 49666, 49670, 49674, 49694, 49695, 49700, 49710, 49721, 49728, 49730, 49739, 49741, 49743, 49744, 49773, 49778, 49780, 49782, 49786, 49798, 49821, 49822, 49823, 49834, 49851, 49858, 49861, 49864, 49866, 49880, 49882, 49890, 49893, 49894, 49899, 49904, 49928, 49959, 49978, 49980, 49981, 49988, 49999, 50009, 50010, 50028, 50030, 50036, 50039, 50042, 50050, 50056, 50071, 50083, 50085, 50087, 50092, 50095, 50110, 50116, 50119, 50120, 50124, 50129, 50146, 50148, 50154, 50162, 50171, 50179, 50184, 50188, 50213, 50226, 50227, 50230, 50234, 50235, 50239, 50266, 50270, 50301, 50302, 50304, 50315, 50316, 50318, 50350, 50358, 50360, 50370, 50383, 50384, 50387, 50396, 50399, 50421, 50422, 50427, 50432, 50434, 50435, 50437, 50439, 50453, 50458, 50461, 50465, 50480, 50512, 50514, 50515, 50516, 50531, 50546, 50556, 50561, 50579, 50595, 50602, 50619, 50641, 50644, 50647, 50674, 50677, 50679, 50690, 50698, 50711, 50717, 50727, 50745, 50751, 50775, 50777, 50778, 50797, 50800, 50806, 50825, 50847, 50854, 50859, 50868, 50871, 50879, 50880, 50881, 50884, 50891, 50897, 50899, 50907, 50914, 50916, 50919, 50921, 50966, 50978, 50986, 50987, 50992, 51016, 51017, 51023, 51029, 51035, 51063, 51065, 51066, 51067, 51070, 51071, 51079, 51080, 51082, 51103, 51104, 51106, 51117, 51123, 51147, 51149, 51157, 51158, 51174, 51177, 51180, 51196, 51197, 51239, 51250, 51264, 51265, 51266, 51271, 51276, 51281, 51285, 51320, 51321, 51330, 51353, 51356, 51358, 51360, 51398, 51407, 51414, 51417, 51448, 51452, 51460, 51474, 51477, 51495, 51499, 51519, 51525, 51526, 51549, 51551, 51563, 51597, 51605, 51613, 51624, 51630, 51648, 51662, 51706, 51708, 51733, 51734, 51735, 51741, 51770, 51774, 51781, 51786, 51789, 51792, 51804, 51822, 51833, 51854, 51872, 51877, 51878, 51881, 51888, 51892, 51898, 51899, 51900, 51913, 51915, 51919, 51921, 51924, 51931, 51934, 51937, 51945, 51967, 51974, 51975, 51980, 51983, 51991, 51998, 52024, 52028, 52029, 52032, 52037, 52040, 52041, 52049, 52058, 52068, 52076, 52077, 52079, 52083, 52086, 52095, 52106, 52124, 52137, 52148, 52176, 52187, 52198, 52213, 52223, 52224, 52227, 52230, 52236, 52239, 52242, 52244, 52249, 52280, 52282, 52298, 52299, 52309, 52314, 52330, 52331, 52332, 52349, 52359, 52377, 52380, 52397, 52412, 52417, 52441, 52445, 52453, 52454, 52462, 52472, 52473, 52498, 52499, 52518, 52521, 52532, 52550, 52590, 52592, 52599, 52600, 52601, 52628, 52629, 52631, 52637, 52640, 52641, 52647, 52667, 52675, 52677, 52680, 52684, 52685, 52692, 52713, 52721, 52726, 52729, 52737, 52743, 52752, 52783, 52788, 52815, 52828, 52840, 52845, 52858, 52861, 52865, 52866, 52893, 52903, 52907, 52935, 52953, 52963, 52985, 53000, 53002, 53007, 53008, 53009, 53022, 53028, 53043, 53056, 53067, 53068, 53069, 53071, 53077, 53081, 53087, 53089, 53093, 53113, 53116, 53117, 53121, 53124, 53135, 53168, 53173, 53187, 53199, 53200, 53202, 53207, 53230, 53237, 53278, 53291, 53293, 53295, 53297, 53304, 53307, 53316, 53321, 53325, 53338, 53344, 53362, 53369, 53373, 53385, 53394, 53408, 53417, 53426, 53427, 53430, 53441, 53448, 53458, 53476, 53478, 53479, 53495, 53504, 53529, 53566, 53587, 53600, 53603, 53611, 53653, 53656, 53659, 53672, 53673, 53684, 53713, 53715, 53718, 53719, 53722, 53724, 53767, 53774, 53778, 53782, 53800, 53821, 53836, 53844, 53845, 53846, 53852, 53865, 53869, 53879, 53882, 53905, 53909, 53911, 53915, 53917, 53921, 53925, 53940, 53970, 53977, 53978, 53982, 53997, 54009, 54039, 54060, 54061, 54081, 54083, 54084, 54132, 54175, 54176, 54179, 54187, 54188, 54194, 54216, 54219, 54222, 54235, 54244, 54253, 54259, 54270, 54272, 54276, 54307, 54315, 54334, 54340, 54374, 54378, 54379, 54380, 54383, 54399, 54436, 54438, 54439, 54440, 54442, 54443, 54445, 54447, 54449, 54450, 54452, 54459, 54461, 54479, 54486, 54492, 54499, 54509, 54511, 54515, 54517, 54523, 54524, 54531, 54548, 54581, 54584, 54585, 54587, 54593, 54596, 54600, 54601, 54619, 54627, 54658, 54659, 54667, 54669, 54676, 54684, 54692, 54727, 54729, 54731, 54734, 54735, 54746, 54748, 54751, 54756, 54766, 54789, 54796, 54797, 54802, 54806, 54811, 54817, 54824, 54829, 54839, 54863, 54866, 54869, 54872, 54873, 54884, 54885, 54886, 54888, 54894, 54907, 54916, 54948, 54956, 54971, 54983, 55014, 55017, 55022, 55034, 55053, 55060, 55067, 55070, 55084, 55091, 55098, 55107, 55116, 55121, 55155, 55158, 55168, 55175, 55177, 55186, 55196, 55213, 55230, 55231, 55233, 55236, 55237, 55244, 55256, 55263, 55301, 55307, 55309, 55310, 55311, 55331, 55340, 55367, 55370, 55372, 55375, 55380, 55416, 55424, 55455, 55460, 55475, 55478, 55479, 55481, 55482, 55501, 55530, 55539, 55540, 55574, 55580, 55590, 55596, 55603, 55604, 55635, 55640, 55641, 55642, 55648, 55653, 55655, 55657, 55667, 55680, 55682, 55687, 55713, 55715, 55721, 55727, 55740, 55803, 55807, 55810, 55823, 55824, 55830, 55831, 55859, 55884, 55887, 55892, 55894, 55905, 55915, 55922, 55941, 55944, 55981, 56005, 56011, 56016, 56036, 56060, 56063, 56066, 56068, 56071, 56076, 56082, 56094, 56119, 56131, 56138, 56140, 56141, 56150, 56161, 56215, 56221, 56223, 56230, 56231, 56245, 56249, 56256, 56263, 56284, 56301, 56316, 56317, 56325, 56334, 56381, 56391, 56394, 56403, 56407, 56412, 56420, 56421, 56469, 56470, 56471, 56473, 56474, 56479, 56487, 56493, 56497, 56507, 56508, 56511, 56528, 56543, 56563, 56575, 56586, 56596, 56601, 56607, 56622, 56623, 56632, 56640, 56658, 56659, 56665, 56666, 56667, 56669, 56670, 56679, 56680, 56682, 56684, 56702, 56704, 56705, 56712, 56757, 56770, 56777, 56779, 56782, 56787, 56788, 56792, 56803, 56858, 56860, 56863, 56872, 56878, 56884, 56910, 56931, 56938, 56941, 56945, 56951, 56971, 57018, 57024, 57031, 57033, 57034, 57038, 57039, 57044, 57094, 57123, 57126, 57129, 57134, 57154, 57163, 57176, 57188, 57204, 57222, 57226, 57251, 57299, 57303, 57304, 57322, 57323, 57341, 57351, 57372, 57377, 57405, 57418, 57422, 57431, 57435, 57438, 57439, 57452, 57462, 57466, 57477, 57478, 57520, 57523, 57531, 57535, 57543, 57551, 57575, 57580, 57600, 57605, 57618, 57621, 57622, 57627, 57628, 57630, 57633, 57653, 57673, 57674, 57679, 57704, 57705, 57716, 57718, 57724, 57746, 57779, 57806, 57809, 57813, 57816, 57821, 57828, 57841, 57842, 57867, 57883, 57906, 57915, 57916, 57925, 57935, 57940, 57944, 57959, 57982, 57986, 57989, 58010, 58030, 58045, 58046, 58059, 58060, 58065, 58108, 58118, 58121, 58130, 58131, 58144, 58146, 58194, 58212, 58222, 58235, 58239, 58251, 58252, 58269, 58276, 58344, 58348, 58351, 58353, 58367, 58377, 58378, 58395, 58397, 58398, 58403, 58454, 58456, 58465, 58466, 58470, 58476, 58480, 58495, 58557, 58561, 58567, 58570, 58574, 58577, 58580, 58583, 58637, 58671, 58673, 58681, 58682, 58685, 58695, 58699, 58714, 58716, 58723, 58731, 58748, 58755, 58799, 58801, 58809, 58813, 58814, 58821, 58833, 58839, 58845, 58850, 58853, 58856, 58857, 58862, 58872, 58891, 58895, 58902, 58935, 58941, 58947, 58950, 58958, 58971, 58974, 58989, 58999, 59013, 59022, 59030, 59037, 59039, 59041, 59045, 59048, 59049, 59068, 59075, 59108, 59122, 59128, 59174, 59175, 59180, 59183, 59191, 59215, 59220, 59221, 59272, 59297, 59333, 59339, 59353, 59385, 59392, 59396, 59397, 59412, 59416, 59419, 59425, 59441, 59481, 59527, 59529, 59532, 59543, 59549, 59551, 59559, 59561, 59576, 59578, 59630, 59631, 59636, 59644, 59647, 59650, 59651, 59655, 59700, 59716, 59766, 59779, 59784, 59785, 59789, 59790, 59800, 59804, 59805, 59826, 59831, 59843, 59909, 59910, 59912, 59925, 59935, 59937, 59950, 59974, 59982, 60022, 60025, 60034, 60037, 60058, 60095, 60101, 60145, 60146, 60166, 60178, 60182, 60191, 60213, 60221, 60274, 60315, 60322, 60330, 60341, 60343, 60357, 60362, 60422, 60426, 60427, 60438, 60445, 60454, 60457, 60462, 60465, 60470, 60483, 60501, 60515, 60549, 60552, 60561, 60576, 60594, 60598, 60605, 60609, 60610, 60618, 60621, 60638, 60641, 60653, 60655, 60656, 60658, 60662, 60709, 60718, 60719, 60750, 60784, 60803, 60862, 60876, 60880, 60884, 60887, 60894, 60895, 60915, 60927, 60949, 60999, 61007, 61018, 61038, 61042, 61044, 61045, 61056, 61068, 61071, 61072, 61078, 61090, 61133, 61148, 61150, 61165, 61175, 61186, 61198, 61218, 61227, 61234, 61272, 61274, 61330, 61333, 61341, 61344, 61353, 61361, 61366, 61370, 61382, 61414, 61432, 61444, 61493, 61495, 61500, 61501, 61502, 61507, 61543, 61562, 61567, 61585, 61611, 61648, 61658, 61661, 61674, 61678, 61679, 61687, 61689, 61734, 61744, 61748, 61752, 61764, 61791, 61803, 61812, 61817, 61823, 61832, 61842, 61847, 61852, 61857, 61871, 61878, 61914, 61957, 61973, 61990, 61992, 61993, 61994, 61995, 62003, 62005, 62018, 62022, 62027, 62033, 62041, 62045, 62058, 62074, 62079, 62083, 62096, 62125, 62162, 62178, 62182, 62199, 62213, 62336, 62344, 62361, 62387, 62388, 62402, 62435, 62440, 62469, 62482, 62514, 62530, 62536, 62549, 62557, 62558, 62562, 62565, 62597, 62607, 62649, 62674, 62677, 62685, 62690, 62698, 62702, 62703, 62710, 62717, 62737, 62759, 62778, 62857, 62865, 62866, 62876, 62880, 62886, 62889, 62890, 62899, 62909, 62921, 62957, 62965, 62975, 63003, 63048, 63050, 63054, 63055, 63061, 63076, 63090, 63093, 63095, 63097, 63098, 63101, 63105, 63128, 63139, 63141, 63161, 63166, 63186, 63207, 63238, 63262, 63268, 63273, 63281, 63284, 63292, 63304, 63311, 63327, 63333, 63372, 63413, 63462, 63470, 63483, 63504, 63513, 63515, 63540, 63543, 63558, 63572, 63613, 63685, 63693, 63705, 63710, 63715, 63716, 63717, 63747, 63760, 63764, 63769, 63789, 63824, 63846, 63849, 63868, 63874, 63889, 63904, 63906, 63908, 63929, 63951, 63955, 63967, 63994, 64062, 64072, 64074, 64092, 64108, 64111, 64127, 64137, 64170, 64172, 64261, 64273, 64283, 64284, 64295, 64320, 64322, 64328, 64337, 64343, 64352, 64362, 64374, 64408, 64424, 64440, 64444, 64507, 64508, 64521, 64533, 64559, 64580, 64585, 64623, 64670, 64717, 64719, 64734, 64764, 64766, 64829, 64844, 64873, 64881, 64950, 64953, 64963, 64967, 64969, 64970, 64978, 64985, 65012, 65016, 65017, 65019, 65020, 65021, 65022, 65024, 65025, 65026, 65027, 65028, 65029, 65030, 65031, 65033, 65034, 65035, 65036, 65037, 65038, 65039, 65043, 65045, 65046, 65049, 65050, 65051, 65052, 65053, 65055, 65056, 65057, 65058, 65060, 65061, 65062, 65064, 65065, 65067, 65069, 65070, 65071, 65073, 65076, 65077, 65078, 65080, 65081, 65082, 65083, 65084, 65085, 65086, 65088, 65089, 65090, 65092, 65093, 65096, 65097, 65098, 65099, 65100, 65103, 65104, 65105, 65107, 65108, 65109, 65111, 65112, 65116, 65117, 65120, 65121, 65122, 65123, 65124, 65125, 65127, 65128, 65129, 65130, 65131, 65132, 65136, 65138, 65142, 65145, 65146, 65147, 65149, 65153, 65155, 65156, 65157, 65158, 65159, 65160, 65164, 65165, 65166, 65168, 65169, 65173, 65174, 65175, 65177, 65179, 65180, 65184, 65188, 65189, 65190, 65192, 65195, 65196, 65197, 65198, 65199, 65201, 65202, 65203, 65206, 65208, 65210, 65211, 65212, 65213, 65214, 65215, 65216, 65217, 65218, 65219, 65221, 65222, 65225, 65226, 65227, 65228, 65229, 65230, 65235, 65237, 65238, 65241, 65244, 65245, 65252, 65253, 65254, 65255, 65256, 65257, 65260, 65262, 65263, 65264, 65265, 65268, 65269, 65270, 65271, 65272, 65275, 65276, 65279, 65280, 65282, 65284, 65286, 65287, 65288, 65289, 65290, 65291, 65294, 65295, 65296, 65299, 65300, 65301, 65302, 65304, 65306, 65307, 65308, 65310, 65315, 65317, 65318, 65319, 65321, 65322, 65327, 65329, 65332, 65334, 65335, 65336, 65337, 65340, 65341, 65344, 65346, 65348, 65352, 65353, 65356, 65360, 65362, 65364, 65366, 65371, 65372, 65374, 65376, 65382, 65385, 65388, 65389, 65391, 65392, 65393, 65397, 65401, 65403, 65405, 65407, 65408, 65409, 65415, 65417, 65418, 65421, 65422, 65425, 65429, 65431, 65433, 65434, 65435, 65438, 65439, 65440, 65441, 65445, 65447, 65449, 65453, 65461, 65463, 65464, 65466, 65467, 65468, 65470, 65471, 65472, 65473, 65475, 65478, 65482, 65485, 65487, 65488, 65490, 65491, 65492, 65493, 65494, 65495, 65498, 65499, 65500, 65501, 65502, 65506, 65507, 65508, 65510, 65511, 65515, 65517, 65518, 65521, 65523, 65524, 65528, 65530, 65531, 65532, 65533, 65537, 65539, 65543, 65549, 65553, 65579, 65580, 65581, 65582, 65583, 65584, 65586, 65587, 65588, 65590, 65591, 65593, 65594, 65596, 65597, 65605, 65607, 65609, 65610, 65611, 65612, 65615, 65617, 65618, 65619, 65621, 65622, 65624, 65625, 65633, 65634, 65645, 65646, 65648, 65649, 65652, 65653, 65656, 65657, 65658, 65659, 65660, 65661, 65663, 65664, 65665, 65667, 65668, 65669, 65670, 65672, 65673, 65675, 65676, 65678, 65680, 65685, 65692, 65702, 65703, 65710, 65712, 65713, 65714, 65719, 65721, 65722, 65723, 65724, 65728, 65731, 65732, 65734, 65740, 65741, 65744, 65745, 65747, 65750, 65751, 65752, 65755, 65758, 65760, 65764, 65766, 65773, 65778, 65779, 65780, 65781, 65783, 65785, 65786, 65787, 65789, 65792, 65793, 65795, 65796, 65798, 65801, 65803, 65804, 65812, 65816, 65817, 65818, 65822, 65825, 65830, 65832, 65834, 65835, 65836, 65837, 65840, 65844, 65845, 65847, 65848, 65849, 65855, 65857, 65859, 65863, 65864, 65867, 65868, 65874, 65877, 65879, 65882, 65884, 65887, 65888, 65889, 65891, 65895, 65898, 65899, 65902, 65907, 65909, 65910, 65911, 65915, 65917, 65920, 65921, 65922, 65924, 65925, 65926, 65937, 65940, 65942, 65943, 65945, 65959, 65965, 65968, 65977, 65979, 65981, 65984, 65985, 65990, 65992, 65995, 65996, 66006, 66007, 66008, 66010, 66011, 66013, 66015, 66016, 66017, 66019, 66020, 66022, 66024, 66028, 66034, 66037, 66040, 66044, 66046, 66047, 66049, 66051, 66055, 66061, 66063, 66068, 66070, 66071, 66076, 66078, 66079, 66081, 66082, 66085, 66087, 66091, 66095, 66097, 66099, 66102, 66103, 66109, 66112, 66113, 66117, 66119, 66120, 66122, 66127, 66130, 66132, 66133, 66140, 66144, 66148, 66149, 66151, 66153, 66154, 66155, 66157, 66159, 66160, 66161, 66164, 66166, 66169, 66172, 66174, 66175, 66176, 66177, 66184, 66195, 66196, 66198, 66200, 66201, 66203, 66206, 66211, 66214, 66215, 66219, 66226, 66231, 66233, 66235, 66236, 66237, 66238, 66240, 66243, 66246, 66253, 66254, 66258, 66262, 66275, 66279, 66282, 66283, 66287, 66288, 66290, 66292, 66294, 66295, 66296, 66297, 66298, 66301, 66306, 66311, 66315, 66324, 66325, 66329, 66331, 66334, 66335, 66337, 66346, 66347, 66354, 66362, 66365, 66369, 66373, 66374, 66375, 66380, 66381, 66382, 66387, 66388, 66389, 66396, 66397, 66398, 66399, 66418, 66420, 66422, 66425, 66427, 66428, 66429, 66430, 66432, 66433, 66434, 66435, 66436, 66437, 66438, 66440, 66442, 66445, 66446, 66448, 66450, 66456, 66457, 66471, 66478, 66480, 66482, 66483, 66484, 66487, 66490, 66492, 66495, 66498, 66501, 66504, 66505, 66506, 66508, 66509, 66513, 66517, 66519, 66520, 66522, 66524, 66526, 66528, 66529, 66533, 66534, 66535, 66536, 66537, 66540, 66543, 66545, 66547, 66549, 66550, 66552, 66556, 66557, 66559, 66562, 66563, 66567, 66573, 66576, 66578, 66580, 66581, 66587, 66590, 66591, 66592, 66596, 66597, 66600, 66601, 66603, 66604, 66606, 66612, 66615, 66617, 66625, 66626, 66627, 66631, 66632, 66636, 66639, 66645, 66647, 66652, 66654, 66656, 66657, 66658, 66662, 66663, 66664, 66667, 66669, 66670, 66671, 66672, 66675, 66677, 66687, 66689, 66693, 66700, 66701, 66702, 66705, 66706, 66707, 66708, 66711, 66713, 66717, 66721, 66723, 66724, 66725, 66726, 66730, 66733, 66739, 66742, 66745, 66748, 66754, 66755, 66758, 66761, 66764, 66770, 66771, 66774, 66775, 66776, 66777, 66782, 66783, 66788, 66795, 66796, 66805, 66809, 66813, 66815, 66817, 66818, 66819, 66820, 66823, 66824, 66828, 66833, 66835, 66836, 66837, 66838, 66839, 66850, 66852, 66854, 66857, 66860, 66861, 66863, 66867, 66871, 66872, 66873, 66874, 66877, 66879, 66880, 66883, 66885, 66888, 66890, 66891, 66892, 66897, 66899, 66900, 66901, 66906, 66908, 66912, 66915, 66916, 66920, 66923, 66924, 66925, 66931, 66933, 66935, 66937, 66938, 66941, 66945, 66950, 66952, 66953, 66961, 66963, 66965, 66971, 66973, 66977, 66981, 66982, 66990, 66991, 66992, 66993, 66997, 66998, 66999, 67007, 67014, 67015, 67019, 67024, 67041, 67044, 67051, 67061, 67062, 67064, 67067, 67073, 67075, 67077, 67081, 67089, 67101, 67108, 67109, 67110, 67115, 67120, 67121, 67129, 67130, 67135, 67136, 67141, 67144, 67147, 67148, 67149, 67150, 67151, 67153, 67154, 67156, 67159, 67165, 67169, 67175, 67176, 67178, 67181, 67182, 67185, 67188, 67190, 67191, 67192, 67194, 67196, 67209, 67216, 67218, 67219, 67228, 67229, 67235, 67237, 67238, 67239, 67241, 67244, 67245, 67246, 67248, 67249, 67256, 67260, 67262, 67266, 67268, 67274, 67276, 67277, 67279, 67284, 67285, 67288, 67289, 67290, 67297, 67300, 67305, 67306, 67308, 67324, 67325, 67331, 67334, 67335, 67336, 67344, 67347, 67348, 67355, 67356, 67361, 67362, 67366, 67379, 67384, 67385, 67388, 67392, 67393, 67397, 67398, 67401, 67405, 67419, 67420, 67424, 67427, 67433, 67436, 67441, 67444, 67450, 67455, 67456, 67457, 67460, 67465, 67471, 67473, 67477, 67489, 67492, 67503, 67504, 67505, 67508, 67511, 67512, 67520, 67524, 67527, 67535, 67542, 67548, 67552, 67554, 67558, 67561, 67562, 67563, 67565, 67571, 67573, 67574, 67575, 67577, 67580, 67581, 67586, 67588, 67590, 67592, 67598, 67599, 67602, 67604, 67605, 67606, 67609, 67612, 67619, 67625, 67630, 67632, 67633, 67634, 67640, 67641, 67643, 67646, 67649, 67653, 67654, 67662, 67663, 67664, 67667, 67672, 67673, 67677, 67679, 67681, 67682, 67683, 67684, 67685, 67686, 67687, 67689, 67692, 67696, 67697, 67715, 67721, 67731, 67732, 67735, 67741, 67748, 67749, 67759, 67761, 67762, 67768, 67769, 67777, 67783, 67785, 67787, 67790, 67791, 67792, 67796, 67798, 67803, 67805, 67806, 67808, 67815, 67816, 67820, 67829, 67832, 67834, 67841, 67842, 67844, 67851, 67856, 67860, 67865, 67867, 67868, 67875, 67881, 67884, 67892, 67900, 67901, 67902, 67911, 67915, 67920, 67930, 67946, 67949, 67954, 67964, 67965, 67967, 67968, 67969, 67970, 67971, 67972, 67973, 67975, 67976, 67979, 67985, 67986, 67989, 67997, 67998, 68010, 68011, 68013, 68014, 68015, 68016, 68018, 68019, 68020, 68021, 68022, 68023, 68024, 68025, 68026, 68027, 68028, 68030, 68033, 68034, 68035, 68036, 68038, 68040, 68042, 68044, 68045, 68046, 68047, 68048, 68049, 68050, 68052, 68053, 68054, 68056, 68058, 68061, 68063, 68066, 68067, 68068, 68069, 68070, 68073, 68074, 68075, 68078, 68079, 68080, 68082, 68084, 68085, 68095, 68098, 68103, 68105, 68107, 68108, 68109, 68111, 68112, 68115, 68119, 68120, 68121, 68122, 68123, 68124, 68125, 68128, 68129, 68130, 68131, 68132, 68133, 68136, 68137, 68138, 68139, 68142, 68144, 68145, 68146, 68151, 68152, 68154, 68155, 68158, 68160, 68162, 68165, 68167, 68168, 68169, 68171, 68176, 68180, 68181, 68183, 68188, 68189, 68197, 68199, 68201, 68202, 68205, 68206, 68209, 68214, 68216, 68217, 68219, 68221, 68222, 68223, 68227, 68230, 68233, 68235, 68236, 68237, 68239, 68243, 68244, 68247, 68248, 68249, 68251, 68253, 68256, 68257, 68258, 68260, 68261, 68264, 68267, 68268, 68269, 68271, 68273, 68275, 68277, 68278, 68286, 68288, 68289, 68291, 68293, 68299, 68303, 68306, 68307, 68308, 68314, 68315, 68317, 68319, 68322, 68323, 68324, 68326, 68333, 68336, 68337, 68338, 68340, 68341, 68344, 68345, 68346, 68347, 68349, 68353, 68354, 68356, 68358, 68361, 68363, 68364, 68366, 68369, 68381, 68383, 68384, 68385, 68386, 68388, 68389, 68390, 68391, 68399, 68402, 68403, 68410, 68411, 68413, 68414, 68415, 68417, 68420, 68426, 68427, 68429, 68432, 68435, 68436, 68437, 68440, 68445, 68447, 68451, 68453, 68457, 68458, 68460, 68463, 68465, 68468, 68472, 68474, 68475, 68476, 68481, 68486, 68487, 68488, 68493, 68500, 68507, 68516, 68517, 68519, 68521, 68522, 68523, 68524, 68525, 68527, 68528, 68529, 68533, 68534, 68535, 68536, 68539, 68544, 68549, 68550, 68551, 68552, 68554, 68555, 68559, 68563, 68565, 68566, 68567, 68569, 68572, 68573, 68574, 68576, 68580, 68582, 68583, 68585, 68586, 68587, 68592, 68596, 68597, 68599, 68602, 68603, 68604, 68605, 68607, 68609, 68610, 68613, 68617, 68620, 68623, 68625, 68627, 68631, 68641, 68645, 68648, 68651, 68652, 68659, 68661, 68665, 68667, 68669, 68672, 68674, 68678, 68681, 68684, 68685, 68686, 68696, 68698, 68706, 68709, 68710, 68713, 68714, 68715, 68722, 68723, 68727, 68730, 68732, 68735, 68741, 68742, 68749, 68750, 68754, 68757, 68761, 68766, 68767, 68772, 68775, 68778, 68785, 68786, 68787, 68789, 68790, 68791, 68792, 68796, 68798, 68799, 68800, 68804, 68811, 68813, 68814, 68815, 68816, 68820, 68824, 68825, 68828, 68830, 68831, 68832, 68835, 68838, 68842, 68844, 68845, 68846, 68847, 68850, 68852, 68856, 68861, 68868, 68870, 68872, 68875, 68882, 68883, 68884, 68887, 68889, 68893, 68898, 68903, 68905, 68906, 68907, 68910, 68914, 68916, 68918, 68919, 68920, 68923, 68925, 68937, 68938, 68940, 68941, 68952, 68963, 68967, 68971, 68976, 68993, 68995, 68998, 69007, 69013, 69015, 69016, 69017, 69022, 69023, 69026, 69030, 69032, 69034, 69037, 69038, 69042, 69043, 69047, 69048, 69049, 69051, 69057, 69059, 69068, 69073, 69074, 69077, 69082, 69089, 69093, 69095, 69100, 69102, 69103, 69104, 69107, 69113, 69116, 69118, 69123, 69126, 69127, 69130, 69131, 69135, 69137, 69139, 69144, 69146, 69148, 69150, 69151, 69154, 69155, 69159, 69162, 69165, 69169, 69171, 69178, 69180, 69190, 69193, 69198, 69201, 69202, 69207, 69210, 69215, 69226, 69231, 69236, 69238, 69239, 69242, 69243, 69258, 69263, 69270, 69273, 69279, 69280, 69281, 69284, 69287, 69306, 69307, 69312, 69313, 69333, 69334, 69349, 69353, 69361, 69364, 69367, 69368, 69371, 69377, 69386, 69387, 69390, 69392, 69395, 69421, 69423, 69427, 69432, 69436, 69439, 69444, 69447, 69451, 69457, 69461, 69462, 69463, 69464, 69469, 69471, 69472, 69474, 69476, 69478, 69485, 69486, 69487, 69490, 69491, 69492, 69493, 69499, 69503, 69505, 69506, 69512, 69518, 69520, 69524, 69526, 69529, 69530, 69535, 69536, 69546, 69547, 69550, 69552, 69553, 69556, 69561, 69563, 69566, 69577, 69580, 69584, 69586, 69588, 69591, 69592, 69595, 69596, 69597, 69598, 69603, 69606, 69608, 69610, 69614, 69617, 69620, 69627, 69628, 69638, 69645, 69647, 69651, 69657, 69659, 69660, 69663, 69682, 69683, 69692, 69697, 69703, 69707, 69708, 69710, 69714, 69717, 69728, 69730, 69733, 69734, 69739, 69741, 69742, 69746, 69747, 69752, 69753, 69754, 69755, 69758, 69759, 69760, 69770, 69779, 69781, 69783, 69784, 69791, 69802, 69805, 69806, 69808, 69809, 69812, 69816, 69838, 69839, 69848, 69851, 69857, 69861, 69869, 69871, 69874, 69884, 69885, 69888, 69893, 69894, 69895, 69899, 69903, 69907, 69909, 69910, 69912, 69913, 69914, 69924, 69925, 69930, 69935, 69942, 69944, 69950, 69957, 69964, 69976, 69980, 69981, 69984, 69985, 69986, 69989, 69990, 69992, 69995, 70001, 70004, 70006, 70010, 70011, 70015, 70017, 70024, 70027, 70031, 70032, 70034, 70037, 70040, 70041, 70042, 70044, 70050, 70052, 70053, 70061, 70062, 70063, 70067, 70070, 70072, 70077, 70078, 70080, 70082, 70084, 70088, 70089, 70091, 70095, 70096, 70099, 70102, 70104, 70117, 70119, 70121, 70123, 70140, 70146, 70148, 70149, 70156, 70159, 70162, 70167, 70172, 70174, 70175, 70177, 70178, 70183, 70185, 70186, 70196, 70198, 70201, 70202, 70207, 70219, 70221, 70222, 70225, 70228, 70235, 70241, 70244, 70246, 70251, 70260, 70261, 70263, 70264, 70266, 70272, 70275, 70277, 70280, 70281, 70283, 70287, 70289, 70293, 70298, 70310, 70316, 70323, 70339, 70362, 70363, 70368, 70371, 70376, 70382, 70383, 70385, 70391, 70392, 70393, 70398, 70405, 70407, 70425, 70429, 70434, 70435, 70449, 70451, 70452, 70460, 70461, 70466, 70469, 70474, 70476, 70479, 70497, 70498, 70501, 70504, 70506, 70510, 70518, 70519, 70520, 70526, 70535, 70546, 70553, 70554, 70559, 70561, 70563, 70564, 70565, 70569, 70571, 70573, 70580, 70592, 70594, 70607, 70610, 70618, 70624, 70625, 70630, 70631, 70633, 70635, 70642, 70646, 70648, 70653, 70659, 70664, 70669, 70678, 70681, 70689, 70690, 70699, 70701, 70710, 70715, 70722, 70725, 70730, 70736, 70737, 70747, 70755, 70758, 70760, 70766, 70771, 70774, 70775, 70784, 70786, 70790, 70794, 70795, 70799, 70801, 70806, 70808, 70809, 70818, 70821, 70826, 70827, 70836, 70838, 70843, 70845, 70846, 70849, 70851, 70858, 70863, 70865, 70867, 70869, 70879, 70886, 70889, 70893, 70894, 70896, 70901, 70904, 70905, 70907, 70914, 70915, 70918, 70919, 70921, 70924, 70929, 70930, 70935, 70937, 70939, 70940, 70945, 70947, 70951, 70953, 70956, 70965, 70966, 70969, 70973, 70976, 70978, 70982, 70990, 70991, 70994, 71003, 71008, 71011, 71018, 71020, 71027, 71029, 71033, 71035, 71036, 71037, 71039, 71048, 71052, 71057, 71059, 71060, 71062, 71066, 71067, 71069, 71070, 71072, 71077, 71079, 71085, 71086, 71087, 71091, 71092, 71096, 71103, 71104, 71105, 71108, 71114, 71115, 71124, 71128, 71130, 71134, 71138, 71152, 71153, 71154, 71155, 71157, 71158, 71167, 71168, 71169, 71171, 71174, 71175, 71176, 71181, 71184, 71186, 71187, 71188, 71189, 71191, 71193, 71194, 71195, 71200, 71214, 71215, 71226, 71236, 71243, 71248, 71259, 71260, 71261, 71263, 71267, 71268, 71269, 71276, 71280, 71283, 71288, 71291, 71292, 71295, 71300, 71303, 71311, 71317, 71325, 71327, 71339, 71347, 71350, 71351, 71353, 71358, 71360, 71370, 71372, 71376, 71380, 71384, 71388, 71394, 71399, 71417, 71420, 71423, 71425, 71427, 71432, 71437, 71442, 71448, 71462, 71466, 71467, 71468, 71486, 71492, 71495, 71497, 71499, 71501, 71509, 71518, 71532, 71534, 71535, 71542, 71544, 71547, 71554, 71559, 71565, 71567, 71568, 71571, 71573, 71584, 71585, 71587, 71590, 71601, 71607, 71611, 71612, 71613, 71615, 71619, 71624, 71628, 71636, 71646, 71648, 71651, 71653, 71654, 71656, 71659, 71663, 71665, 71676, 71683, 71685, 71697, 71709, 71710, 71711, 71715, 71718, 71719, 71725, 71732, 71734, 71743, 71747, 71752, 71754, 71755, 71764, 71766, 71772, 71783, 71786, 71792, 71805, 71806, 71808, 71811, 71812, 71819, 71822, 71823, 71825, 71831, 71849, 71850, 71856, 71862, 71864, 71867, 71869, 71870, 71871, 71884, 71887, 71890, 71898, 71905, 71908, 71909, 71917, 71921, 71923, 71926, 71930, 71931, 71932, 71934, 71935, 71936, 71937, 71939, 71940, 71942, 71944, 71950, 71951, 71952, 71954, 71961, 71964, 71968, 71971, 71972, 71978, 71979, 71981, 71986, 71989, 71990, 71994, 71995, 72000, 72020, 72023, 72025, 72032, 72037, 72038, 72048, 72056, 72060, 72065, 72068, 72069, 72073, 72074, 72075, 72078, 72084, 72087, 72088, 72099, 72103, 72107, 72108, 72110, 72111, 72125, 72129, 72138, 72139, 72143, 72146, 72148, 72151, 72157, 72161, 72169, 72171, 72184, 72186, 72187, 72198, 72203, 72205, 72206, 72210, 72212, 72215, 72219, 72233, 72249, 72262, 72277, 72285, 72291, 72298, 72301, 72313, 72321, 72327, 72329, 72331, 72336, 72340, 72341, 72350, 72351, 72358, 72359, 72364, 72376, 72392, 72396, 72398, 72402, 72403, 72405, 72426, 72427, 72428, 72433, 72448, 72452, 72453, 72457, 72458, 72460, 72463, 72467, 72472, 72475, 72476, 72482, 72490, 72494, 72500, 72504, 72505, 72509, 72515, 72516, 72520, 72525, 72528, 72535, 72537, 72543, 72544, 72552, 72553, 72563, 72570, 72571, 72589, 72590, 72591, 72596, 72600, 72606, 72607, 72608, 72611, 72619, 72621, 72629, 72648, 72657, 72660, 72664, 72665, 72669, 72673, 72687, 72693, 72696, 72704, 72705, 72707, 72713, 72722, 72727, 72728, 72729, 72744, 72747, 72750, 72751, 72759, 72767, 72769, 72778, 72784, 72797, 72801, 72809, 72823, 72831, 72833, 72842, 72848, 72852, 72853, 72854, 72855, 72858, 72860, 72864, 72868, 72870, 72872, 72873, 72882, 72887, 72891, 72892, 72901, 72903, 72909, 72910, 72916, 72919, 72926, 72929, 72938, 72942, 72950, 72954, 72962, 72964, 72965, 72968, 72973, 72977, 72980, 72987, 72990, 72998, 72999, 73003, 73004, 73005, 73006, 73009, 73010, 73024, 73025, 73027, 73031, 73032, 73033, 73035, 73044, 73066, 73081, 73091, 73093, 73094, 73105, 73111, 73113, 73121, 73129, 73132, 73141, 73143, 73149, 73156, 73157, 73162, 73163, 73165, 73166, 73168, 73169, 73173, 73174, 73181, 73185, 73191, 73197, 73200, 73203, 73208, 73211, 73214, 73216, 73218, 73223, 73234, 73239, 73240, 73273, 73278, 73279, 73280, 73286, 73296, 73303, 73305, 73313, 73329, 73336, 73340, 73368, 73369, 73370, 73374, 73388, 73393, 73397, 73411, 73413, 73420, 73433, 73435, 73436, 73438, 73444, 73450, 73458, 73469, 73476, 73483, 73485, 73486, 73495, 73499, 73500, 73508, 73517, 73522, 73540, 73548, 73550, 73551, 73555, 73558, 73559, 73571, 73574, 73579, 73582, 73585, 73588, 73590, 73593, 73594, 73595, 73599, 73604, 73605, 73609, 73613, 73614, 73617, 73627, 73628, 73630, 73636, 73637, 73639, 73642, 73646, 73648, 73649, 73653, 73683, 73685, 73686, 73698, 73699, 73708, 73709, 73712, 73717, 73718, 73719, 73742, 73757, 73767, 73769, 73771, 73779, 73787, 73792, 73800, 73810, 73812, 73815, 73817, 73820, 73822, 73824, 73830, 73832, 73833, 73841, 73857, 73858, 73860, 73867, 73870, 73872, 73873, 73876, 73879, 73880, 73886, 73891, 73893, 73898, 73911, 73913, 73919, 73926, 73927, 73931, 73942, 73946, 73948, 73952, 73953, 73955, 73960, 73962, 73963, 73976, 73987, 73992, 73999, 74001, 74008, 74010, 74013, 74014, 74023, 74027, 74032, 74047, 74050, 74061, 74064, 74068, 74074, 74080, 74083, 74086, 74091, 74092, 74097, 74098, 74104, 74112, 74114, 74116, 74121, 74125, 74141, 74143, 74159, 74162, 74166, 74170, 74171, 74178, 74187, 74191, 74207, 74208, 74209, 74213, 74215, 74219, 74240, 74241, 74242, 74245, 74249, 74251, 74253, 74259, 74261, 74263, 74264, 74278, 74282, 74283, 74289, 74292, 74293, 74299, 74308, 74309, 74310, 74322, 74331, 74340, 74343, 74357, 74358, 74360, 74361, 74366, 74370, 74377, 74386, 74387, 74391, 74393, 74394, 74395, 74397, 74399, 74405, 74412, 74413, 74416, 74418, 74421, 74423, 74425, 74426, 74428, 74441, 74448, 74452, 74453, 74459, 74467, 74468, 74475, 74477, 74478, 74483, 74484, 74485, 74495, 74496, 74498, 74500, 74503, 74505, 74515, 74519, 74529, 74531, 74532, 74537, 74541, 74571, 74578, 74582, 74583, 74601, 74602, 74606, 74610, 74628, 74636, 74649, 74651, 74652, 74656, 74659, 74661, 74665, 74676, 74677, 74679, 74682, 74695, 74696, 74702, 74711, 74722, 74723, 74726, 74728, 74729, 74738, 74740, 74741, 74745, 74748, 74756, 74757, 74760, 74770, 74772, 74773, 74780, 74785, 74788, 74790, 74796, 74797, 74798, 74802, 74805, 74810, 74827, 74831, 74841, 74847, 74848, 74854, 74856, 74860, 74863, 74864, 74870, 74874, 74883, 74888, 74897, 74904, 74908, 74917, 74926, 74946, 74962, 74963, 74974, 74977, 74978, 74986, 74999, 75006, 75008, 75010, 75011, 75022, 75023, 75028, 75032, 75034, 75036, 75038, 75044, 75047, 75050, 75055, 75056, 75067, 75083, 75084, 75094, 75096, 75099, 75103, 75104, 75110, 75115, 75122, 75135, 75138, 75150, 75152, 75157, 75159, 75160, 75161, 75162, 75163, 75177, 75180, 75181, 75185, 75188, 75192, 75194, 75196, 75200, 75208, 75214, 75215, 75219, 75236, 75250, 75251, 75255, 75268, 75271, 75283, 75295, 75297, 75309, 75311, 75324, 75337, 75344, 75348, 75359, 75366, 75377, 75383, 75391, 75393, 75397, 75401, 75405, 75407, 75409, 75410, 75413, 75416, 75419, 75443, 75463, 75475, 75479, 75480, 75487, 75509, 75512, 75519, 75520, 75522, 75524, 75525, 75527, 75533, 75540, 75543, 75550, 75555, 75561, 75572, 75573, 75584, 75586, 75587, 75590, 75593, 75604, 75605, 75607, 75617, 75620, 75623, 75636, 75638, 75643, 75650, 75675, 75680, 75687, 75689, 75700, 75703, 75709, 75710, 75715, 75719, 75720, 75726, 75730, 75731, 75742, 75745, 75749, 75755, 75758, 75768, 75796, 75801, 75803, 75804, 75811, 75817, 75819, 75821, 75830, 75836, 75854, 75856, 75861, 75864, 75898, 75901, 75905, 75908, 75915, 75922, 75929, 75932, 75941, 75942, 75947, 75966, 75975, 75977, 75978, 75980, 75988, 76006, 76010, 76017, 76024, 76027, 76028, 76032, 76045, 76068, 76080, 76096, 76108, 76109, 76111, 76120, 76124, 76129, 76130, 76132, 76176, 76183, 76184, 76188, 76193, 76195, 76198, 76211, 76212, 76224, 76228, 76230, 76237, 76240, 76249, 76252, 76253, 76269, 76287, 76295, 76298, 76301, 76306, 76307, 76316, 76323, 76333, 76356, 76360, 76372, 76386, 76389, 76398, 76399, 76406, 76417, 76418, 76419, 76440, 76448, 76450, 76451, 76453, 76461, 76480, 76481, 76485, 76487, 76498, 76500, 76501, 76513, 76514, 76529, 76538, 76547, 76553, 76554, 76558, 76565, 76566, 76570, 76576, 76581, 76594, 76596, 76598, 76608, 76619, 76622, 76623, 76626, 76632, 76636, 76643, 76654, 76656, 76657, 76658, 76663, 76665, 76669, 76678, 76700, 76706, 76707, 76735, 76747, 76750, 76754, 76762, 76764, 76768, 76780, 76791, 76793, 76800, 76803, 76804, 76806, 76813, 76815, 76819, 76822, 76829, 76834, 76836, 76842, 76857, 76869, 76872, 76890, 76895, 76900, 76914, 76942, 76955, 76962, 76971, 76982, 76988, 76993, 77001, 77002, 77006, 77015, 77016, 77017, 77020, 77026, 77043, 77066, 77072, 77093, 77099, 77102, 77105, 77115, 77121, 77125, 77135, 77136, 77139, 77142, 77146, 77151, 77155, 77187, 77199, 77206, 77211, 77215, 77230, 77239, 77243, 77250, 77259, 77260, 77267, 77273, 77281, 77295, 77301, 77304, 77307, 77325, 77326, 77337, 77347, 77359, 77361, 77375, 77380, 77385, 77392, 77393, 77400, 77401, 77405, 77417, 77434, 77441, 77447, 77451, 77452, 77473, 77474, 77486, 77490, 77503, 77517, 77525, 77528, 77543, 77545, 77547, 77553, 77556, 77567, 77575, 77576, 77577, 77586, 77600, 77606, 77630, 77632, 77634, 77640, 77644, 77650, 77653, 77655, 77657, 77659, 77668, 77671, 77681, 77682, 77683, 77691, 77693, 77702, 77703, 77707, 77718, 77720, 77735, 77736, 77739, 77751, 77761, 77765, 77766, 77767, 77770, 77779, 77793, 77799, 77800, 77804, 77811, 77818, 77824, 77829, 77845, 77850, 77862, 77863, 77869, 77873, 77878, 77892, 77903, 77904, 77907, 77913, 77924, 77928, 77943, 77973, 77978, 77995, 78005, 78014, 78016, 78022, 78035, 78038, 78040, 78053, 78057, 78071, 78072, 78078, 78080, 78085, 78086, 78092, 78114, 78131, 78146, 78150, 78160, 78168, 78170, 78171, 78179, 78197, 78203, 78215, 78220, 78224, 78225, 78228, 78233, 78239, 78244, 78251, 78253, 78257, 78261, 78262, 78265, 78281, 78283, 78289, 78293, 78294, 78299, 78301, 78305, 78308, 78319, 78320, 78326, 78327, 78335, 78336, 78346, 78355, 78360, 78364, 78380, 78385, 78389, 78402, 78409, 78429, 78431, 78433, 78438, 78449, 78454, 78473, 78476, 78483, 78489, 78497, 78525, 78536, 78544, 78545, 78557, 78558, 78593, 78602, 78619, 78629, 78632, 78636, 78640, 78648, 78662, 78666, 78668, 78679, 78702, 78703, 78721, 78723, 78726, 78734, 78740, 78742, 78758, 78773, 78774, 78788, 78790, 78793, 78801, 78802, 78812, 78817, 78830, 78832, 78843, 78848, 78859, 78865, 78875, 78877, 78878, 78882, 78883, 78884, 78889, 78894, 78895, 78911, 78914, 78916, 78926, 78927, 78929, 78936, 78951, 78958, 78967, 78970, 78974, 78976, 78988, 78989, 78993, 78997, 79006, 79009, 79010, 79011, 79016, 79018, 79022, 79023, 79031, 79033, 79040, 79048, 79061, 79064, 79066, 79074, 79088, 79097, 79098, 79117, 79125, 79128, 79130, 79138, 79143, 79144, 79145, 79151, 79160, 79161, 79162, 79164, 79165, 79172, 79177, 79180, 79181, 79185, 79188, 79195, 79198, 79212, 79224, 79231, 79239, 79244, 79245, 79255, 79271, 79277, 79281, 79295, 79327, 79328, 79332, 79342, 79361, 79365, 79368, 79378, 79381, 79408, 79413, 79416, 79422, 79429, 79435, 79447, 79451, 79452, 79457, 79463, 79464, 79471, 79472, 79482, 79483, 79484, 79492, 79493, 79499, 79503, 79509, 79511, 79515, 79523, 79529, 79534, 79536, 79547, 79552, 79564, 79565, 79567, 79577, 79578, 79582, 79583, 79584, 79599, 79612, 79613, 79630, 79636, 79644, 79668, 79671, 79674, 79681, 79686, 79690, 79693, 79695, 79705, 79713, 79716, 79720, 79725, 79726, 79728, 79730, 79740, 79742, 79743, 79752, 79753, 79770, 79776, 79788, 79791, 79792, 79795, 79799, 79813, 79816, 79817, 79818, 79829, 79834, 79836, 79837, 79844, 79846, 79849, 79852, 79855, 79857, 79865, 79866, 79871, 79879, 79883, 79892, 79898, 79905, 79907, 79919, 79926, 79928, 79931, 79943, 79945, 79949, 79956, 79991, 80005, 80009, 80011, 80012, 80018, 80025, 80033, 80036, 80042, 80046, 80048, 80052, 80062, 80064, 80069, 80081, 80084, 80086, 80096, 80099, 80117, 80122, 80123, 80124, 80127, 80130, 80136, 80148, 80155, 80167, 80175, 80185, 80186, 80189, 80194, 80197, 80198, 80205, 80209, 80218, 80223, 80230, 80239, 80253, 80259, 80262, 80263, 80270, 80294, 80303, 80304, 80305, 80316, 80318, 80345, 80346, 80356, 80363, 80364, 80371, 80374, 80378, 80380, 80388, 80393, 80400, 80404, 80405, 80406, 80425, 80426, 80433, 80440, 80455, 80457, 80458, 80465, 80473, 80484, 80486, 80492, 80496, 80504, 80506, 80507, 80511, 80514, 80515, 80518, 80523, 80535, 80536, 80549, 80556, 80569, 80577, 80592, 80599, 80616, 80627, 80630, 80632, 80640, 80660, 80662, 80667, 80668, 80675, 80688, 80689, 80692, 80704, 80710, 80713, 80716, 80719, 80726, 80730, 80740, 80745, 80748, 80774, 80778, 80779, 80788, 80799, 80810, 80814, 80822, 80834, 80840, 80844, 80860, 80866, 80867, 80881, 80888, 80894, 80910, 80913, 80923, 80939, 80940, 80944, 80948, 80964, 80978, 80979, 80980, 80981, 81007, 81056, 81064, 81069, 81075, 81082, 81106, 81111, 81115, 81116, 81117, 81138, 81154, 81159, 81163, 81170, 81172, 81192, 81199, 81204, 81217, 81219, 81226, 81227, 81231, 81238, 81241, 81247, 81254, 81256, 81271, 81279, 81284, 81299, 81300, 81310, 81316, 81318, 81323, 81333, 81341, 81355, 81359, 81362, 81371, 81374, 81375, 81378, 81385, 81388, 81400, 81405, 81410, 81437, 81439, 81444, 81448, 81458, 81461, 81467, 81470, 81473, 81480, 81482, 81497, 81507, 81526, 81532, 81538, 81543, 81552, 81554, 81565, 81569, 81573, 81577, 81588, 81600, 81617, 81622, 81626, 81631, 81638, 81654, 81671, 81686, 81688, 81694, 81699, 81701, 81709, 81720, 81731, 81732, 81735, 81740, 81742, 81752, 81753, 81764, 81770, 81773, 81783, 81787, 81795, 81796, 81818, 81825, 81826, 81840, 81842, 81850, 81852, 81853, 81862, 81868, 81869, 81872, 81873, 81877, 81881, 81894, 81917, 81920, 81923, 81927, 81928, 81929, 81934, 81958, 81962, 81979, 81984, 81985, 81999, 82000, 82005, 82011, 82029, 82030, 82034, 82045, 82046, 82049, 82059, 82060, 82061, 82069, 82071, 82072, 82073, 82075, 82080, 82091, 82103, 82107, 82136, 82138, 82139, 82140, 82159, 82164, 82203, 82215, 82226, 82228, 82229, 82240, 82241, 82266, 82272, 82274, 82278, 82280, 82289, 82293, 82294, 82305, 82307, 82310, 82313, 82321, 82323, 82325, 82330, 82331, 82349, 82359, 82370, 82372, 82381, 82385, 82386, 82388, 82396, 82397, 82401, 82410, 82418, 82421, 82424, 82433, 82440, 82444, 82449, 82453, 82455, 82465, 82468, 82474, 82491, 82503, 82506, 82509, 82510, 82513, 82514, 82518, 82519, 82526, 82534, 82541, 82548, 82553, 82564, 82583, 82591, 82592, 82595, 82609, 82611, 82615, 82616, 82624, 82627, 82630, 82653, 82654, 82671, 82674, 82675, 82676, 82678, 82687, 82700, 82707, 82708, 82710, 82711, 82718, 82734, 82746, 82782, 82785, 82804, 82814, 82832, 82838, 82839, 82859, 82860, 82865, 82885, 82891, 82895, 82897, 82903, 82924, 82930, 82934, 82959, 82961, 82967, 82974, 82977, 82991, 82992, 82997, 83008, 83011, 83020, 83035, 83051, 83059, 83064, 83072, 83078, 83079, 83091, 83094, 83100, 83118, 83121, 83140, 83153, 83161, 83172, 83173, 83176, 83178, 83185, 83198, 83205, 83215, 83218, 83224, 83227, 83239, 83247, 83282, 83293, 83294, 83319, 83329, 83334, 83348, 83357, 83364, 83371, 83375, 83384, 83387, 83408, 83412, 83427, 83447, 83457, 83488, 83493, 83512, 83517, 83528, 83529, 83538, 83540, 83546, 83548, 83549, 83558, 83562, 83575, 83577, 83586, 83587, 83594, 83607, 83647, 83656, 83657, 83658, 83662, 83673, 83674, 83679, 83685, 83691, 83711, 83716, 83726, 83729, 83734, 83739, 83743, 83763, 83770, 83774, 83781, 83786, 83790, 83794, 83795, 83805, 83811, 83812, 83819, 83823, 83825, 83828, 83839, 83855, 83856, 83872, 83874, 83876, 83877, 83878, 83896, 83903, 83904, 83921, 83936, 83938, 83940, 83949, 83954, 83959, 83971, 83979, 83999, 84015, 84022, 84025, 84032, 84039, 84042, 84053, 84062, 84063, 84067, 84068, 84076, 84078, 84096, 84098, 84105, 84106, 84108, 84131, 84133, 84139, 84149, 84166, 84167, 84168, 84183, 84189, 84193, 84198, 84204, 84230, 84250, 84255, 84258, 84276, 84280, 84296, 84297, 84298, 84299, 84330, 84342, 84347, 84349, 84352, 84360, 84369, 84377, 84378, 84382, 84403, 84406, 84407, 84411, 84416, 84434, 84450, 84453, 84464, 84467, 84474, 84483, 84511, 84516, 84535, 84539, 84548, 84550, 84554, 84566, 84601, 84606, 84613, 84614, 84623, 84625, 84627, 84639, 84642, 84650, 84689, 84709, 84712, 84720, 84730, 84740, 84743, 84751, 84773, 84779, 84790, 84800, 84804, 84806, 84812, 84832, 84836, 84848, 84857, 84871, 84879, 84892, 84893, 84908, 84913, 84926, 84943, 84950, 84957, 84983, 84984, 84990, 84992, 85041, 85053, 85062, 85076, 85077, 85088, 85094, 85111, 85121, 85124, 85132, 85135, 85138, 85147, 85174, 85176, 85178, 85191, 85206, 85228, 85242, 85265, 85277, 85278, 85283, 85285, 85290, 85305, 85308, 85325, 85346, 85347, 85349, 85351, 85354, 85359, 85360, 85362, 85387, 85389, 85408, 85415, 85432, 85434, 85435, 85440, 85453, 85456, 85463, 85465, 85466, 85469, 85479, 85480, 85493, 85500, 85505, 85510, 85532, 85542, 85550, 85563, 85564, 85573, 85600, 85608, 85609, 85617, 85637, 85640, 85647, 85654, 85667, 85674, 85688, 85690, 85696, 85708, 85717, 85720, 85736, 85738, 85744, 85753, 85762, 85794, 85812, 85833, 85836, 85852, 85860, 85863, 85867, 85869, 85871, 85874, 85877, 85883, 85885, 85887, 85902, 85903, 85924, 85925, 85927, 85938, 85945, 85954, 85958, 85960, 85966, 85971, 85977, 85980, 85995, 85997, 85999, 86001, 86009, 86012, 86022, 86029, 86049, 86050, 86063, 86087, 86099, 86118, 86123, 86138, 86148, 86159, 86179, 86192, 86199, 86219, 86220, 86221, 86226, 86228, 86229, 86244, 86245, 86247, 86260, 86271, 86294, 86315, 86322, 86333, 86334, 86335, 86355, 86358, 86363, 86374, 86391, 86399, 86414, 86424, 86428, 86437, 86443, 86444, 86475, 86480, 86485, 86493, 86501, 86515, 86517, 86521, 86530, 86551, 86560, 86566, 86567, 86575, 86583, 86592, 86596, 86602, 86605, 86610, 86640, 86645, 86649, 86655, 86656, 86667, 86675, 86676, 86679, 86683, 86710, 86717, 86721, 86723, 86730, 86747, 86756, 86761, 86773, 86789, 86801, 86802, 86810, 86818, 86820, 86827, 86840, 86843, 86867, 86872, 86880, 86881, 86894, 86908, 86910, 86938, 86948, 86960, 86963, 86994, 86997, 87007, 87016, 87026, 87039, 87061, 87067, 87069, 87079, 87092, 87115, 87123, 87124, 87126, 87136, 87170, 87178, 87182, 87202, 87203, 87206, 87207, 87209, 87212, 87219, 87248, 87269, 87271, 87280, 87297, 87304, 87314, 87330, 87339, 87347, 87360, 87364, 87368, 87373, 87374, 87377, 87390, 87392, 87401, 87405, 87413, 87421, 87426, 87429, 87445, 87449, 87465, 87471, 87477, 87485, 87488, 87491, 87507, 87509, 87512, 87518, 87521, 87522, 87527, 87543, 87547, 87550, 87567, 87568, 87581, 87592, 87597, 87598, 87604, 87617, 87637, 87640, 87646, 87655, 87675, 87678, 87691, 87706, 87710, 87714, 87715, 87716, 87719, 87724, 87727, 87732, 87740, 87750, 87753, 87758, 87761, 87782, 87792, 87796, 87810, 87814, 87839, 87847, 87867, 87871, 87876, 87877, 87878, 87884, 87885, 87902, 87919, 87934, 87944, 87947, 87952, 87968, 87988, 87994, 87995, 88001, 88009, 88010, 88031, 88042, 88051, 88068, 88076, 88077, 88079, 88085, 88091, 88123, 88134, 88137, 88150, 88167, 88175, 88177, 88203, 88226, 88230, 88242, 88250, 88259, 88277, 88310, 88312, 88330, 88346, 88347, 88349, 88356, 88361, 88365, 88367, 88395, 88397, 88400, 88403, 88404, 88409, 88414, 88416, 88434, 88457, 88460, 88491, 88501, 88510, 88513, 88516, 88523, 88529, 88532, 88552, 88561, 88570, 88571, 88588, 88590, 88593, 88621, 88630, 88632, 88642, 88644, 88652, 88659, 88704, 88705, 88717, 88720, 88726, 88729, 88732, 88747, 88748, 88753, 88761, 88763, 88765, 88775, 88784, 88789, 88792, 88812, 88819, 88826, 88832, 88839, 88845, 88850, 88870, 88873, 88874, 88891, 88893, 88906, 88923, 88927, 88928, 88933, 88936, 88942, 88949, 88954, 88974, 88996, 89016, 89023, 89034, 89065, 89068, 89087, 89098, 89109, 89126, 89150, 89186, 89202, 89203, 89222, 89228, 89230, 89235, 89240, 89243, 89246, 89249, 89253, 89260, 89275, 89288, 89297, 89301, 89315, 89336, 89357, 89362, 89369, 89377, 89380, 89403, 89416, 89424, 89430, 89431, 89439, 89449, 89456, 89459, 89467, 89474, 89479, 89482, 89485, 89493, 89500, 89505, 89507, 89523, 89529, 89548, 89554, 89564, 89567, 89589, 89595, 89599, 89600, 89608, 89637, 89643, 89666, 89676, 89690, 89692, 89707, 89730, 89745, 89753, 89756, 89758, 89759, 89765, 89766, 89772, 89820, 89835, 89838, 89847, 89855, 89878, 89885, 89900, 89904, 89909, 89913, 89922, 89935, 89945, 89951, 89952, 89955, 89961, 89962, 89963, 89977, 89978, 89988, 89995, 90004, 90034, 90046, 90047, 90048, 90055, 90057, 90064, 90068, 90074, 90076, 90083, 90088, 90105, 90117, 90145, 90160, 90165, 90173, 90180, 90186, 90197, 90211, 90213, 90232, 90266, 90269, 90272, 90278, 90301, 90317, 90318, 90329, 90333, 90335, 90346, 90353, 90356, 90384, 90391, 90396, 90400, 90402, 90410, 90413, 90430, 90434, 90439, 90464, 90475, 90483, 90489, 90495, 90507, 90517, 90538, 90567, 90577, 90585, 90589, 90593, 90601, 90604, 90610, 90624, 90629, 90632, 90638, 90676, 90690, 90698, 90704, 90713, 90729, 90735, 90738, 90741, 90752, 90755, 90756, 90757, 90762, 90787, 90789, 90792, 90808, 90815, 90839, 90840, 90851, 90866, 90891, 90893, 90895, 90898, 90913, 90939, 90949, 90961, 90989, 90990, 90991, 90996, 91007, 91030, 91033, 91038, 91050, 91051, 91054, 91066, 91071, 91078, 91093, 91102, 91106, 91107, 91122, 91151, 91152, 91156, 91157, 91163, 91164, 91169, 91181, 91198, 91199, 91203, 91225, 91227, 91243, 91252, 91261, 91266, 91268, 91279, 91284, 91315, 91322, 91325, 91335, 91342, 91351, 91354, 91365, 91368, 91380, 91388, 91397, 91405, 91406, 91411, 91417, 91418, 91422, 91426, 91430, 91435, 91449, 91466, 91485, 91492, 91505, 91508, 91525, 91527, 91534, 91540, 91550, 91560, 91567, 91572, 91578, 91579, 91597, 91602, 91609, 91627, 91628, 91629, 91640, 91666, 91685, 91687, 91694, 91708, 91711, 91715, 91723, 91759, 91761, 91795, 91816, 91848, 91851, 91853, 91868, 91877, 91878, 91879, 91884, 91889, 91898, 91902, 91918, 91922, 91923, 91925, 91927, 91928, 91930, 91933, 91940, 91942, 91957, 91959, 91967, 91971, 92001, 92010, 92014, 92015, 92089, 92090, 92099, 92103, 92120, 92126, 92134, 92152, 92156, 92166, 92209, 92215, 92226, 92237, 92239, 92251, 92279, 92304, 92320, 92329, 92355, 92360, 92377, 92381, 92391, 92398, 92425, 92432, 92439, 92453, 92454, 92476, 92477, 92482, 92502, 92513, 92550, 92556, 92560, 92581, 92590, 92605, 92607, 92616, 92631, 92641, 92642, 92643, 92660, 92661, 92668, 92678, 92680, 92700, 92711, 92724, 92733, 92740, 92749, 92757, 92759, 92764, 92770, 92776, 92793, 92795, 92798, 92802, 92814, 92818, 92831, 92840, 92850, 92865, 92870, 92871, 92884, 92897, 92899, 92914, 92915, 92924, 92931, 92945, 92951, 92957, 92976, 92998, 93007, 93011, 93018, 93031, 93042, 93044, 93055, 93062, 93068, 93074, 93084, 93103, 93108, 93114, 93124, 93127, 93129, 93132, 93137, 93142, 93150, 93162, 93174, 93193, 93221, 93230, 93238, 93246, 93254, 93265, 93270, 93272, 93275, 93293, 93296, 93297, 93298, 93300, 93318, 93319, 93323, 93343, 93360, 93364, 93371, 93382, 93383, 93387, 93388, 93392, 93397, 93400, 93401, 93406, 93417, 93437, 93448, 93452, 93477, 93478, 93482, 93494, 93497, 93504, 93513, 93516, 93521, 93528, 93540, 93542, 93554, 93555, 93565, 93569, 93570, 93583, 93594, 93595, 93619, 93624, 93642, 93648, 93660, 93661, 93677, 93679, 93697, 93699, 93705, 93716, 93719, 93720, 93732, 93737, 93746, 93752, 93773, 93778, 93784, 93803, 93807, 93817, 93823, 93830, 93834, 93844, 93852, 93858, 93862, 93863, 93889, 93893, 93895, 93898, 93905, 93919, 93921, 93922, 93930, 93931, 93938, 93946, 93961, 93964, 93971, 93978, 93984, 93986, 94007, 94011, 94012, 94021, 94025, 94037, 94039, 94043, 94063, 94076, 94077, 94079, 94082, 94116, 94118, 94122, 94126, 94141, 94142, 94159, 94172, 94177, 94191, 94194, 94198, 94203, 94208, 94210, 94234, 94240, 94251, 94253, 94258, 94272, 94289, 94293, 94295, 94316, 94320, 94327, 94361, 94364, 94366, 94367, 94396, 94401, 94420, 94446, 94459, 94462, 94469, 94483, 94486, 94499, 94504, 94508, 94511, 94527, 94532, 94558, 94565, 94568, 94571, 94579, 94584, 94586, 94587, 94592, 94593, 94614, 94644, 94654, 94663, 94683, 94686, 94699, 94725, 94737, 94738, 94742, 94746, 94753, 94767, 94774, 94789, 94794, 94797, 94809, 94815, 94819, 94837, 94842, 94843, 94845, 94847, 94857, 94862, 94868, 94885, 94888, 94890, 94894, 94904, 94915, 94948, 94954, 94968, 94969, 94981, 94982, 94984, 94987, 94994, 95006, 95009, 95035, 95036, 95047, 95051, 95062, 95072, 95099, 95115, 95138, 95166, 95174, 95182, 95197, 95225, 95242, 95245, 95248, 95266, 95269, 95280, 95283, 95284, 95325, 95331, 95337, 95361, 95364, 95366, 95375, 95383, 95394, 95396, 95401, 95402, 95415, 95430, 95436, 95450, 95466, 95470, 95480, 95488, 95507, 95509, 95512, 95513, 95515, 95521, 95523, 95527, 95529, 95532, 95550, 95581, 95589, 95595, 95611, 95622, 95625, 95629, 95631, 95671, 95675, 95691, 95697, 95699, 95720, 95746, 95747, 95748, 95761, 95777, 95788, 95813, 95818, 95845, 95859, 95871, 95897, 95917, 95918, 95921, 95942, 95947, 95949, 95952, 95953, 95963, 95967, 95968, 95990, 96002, 96009, 96022, 96026, 96063, 96072, 96083, 96086, 96087, 96094, 96099, 96112, 96117, 96126, 96167, 96176, 96182, 96191, 96200, 96205, 96206, 96264, 96275, 96282, 96296, 96306, 96329, 96333, 96353, 96354, 96367, 96381, 96385, 96390, 96393, 96396, 96404, 96410, 96435, 96445, 96446, 96465, 96482, 96484, 96497, 96501, 96504, 96514, 96529, 96567, 96574, 96586, 96589, 96591, 96592, 96593, 96594, 96614, 96616, 96624, 96627, 96646, 96651, 96657, 96661, 96662, 96671, 96682, 96687, 96689, 96690, 96693, 96703, 96705, 96715, 96716, 96726, 96745, 96747, 96755, 96756, 96759, 96773, 96774, 96775, 96787, 96807, 96820, 96823, 96824, 96839, 96840, 96847, 96848, 96854, 96860, 96865, 96870, 96879, 96885, 96900, 96928, 96961, 96963, 96964, 96970, 96971, 96992, 96993, 96998, 97005, 97019, 97022, 97023, 97044, 97053, 97057, 97061, 97067, 97068, 97069, 97071, 97083, 97106, 97131, 97135, 97144, 97171, 97179, 97183, 97195, 97210, 97217, 97220, 97223, 97234, 97241, 97244, 97246, 97250, 97255, 97258, 97262, 97263, 97265, 97268, 97272, 97293, 97313, 97321, 97339, 97340, 97347, 97365, 97377, 97387, 97390, 97400, 97401, 97414, 97420, 97427, 97430, 97437, 97460, 97477, 97485, 97496, 97503, 97508, 97528, 97535, 97536, 97542, 97550, 97558, 97564, 97600, 97607, 97623, 97634, 97642, 97659, 97664, 97679, 97703, 97752, 97757, 97765, 97767, 97768, 97774, 97785, 97786, 97810, 97811, 97818, 97826, 97829, 97832, 97849, 97864, 97868, 97873, 97877, 97879, 97906, 97910, 97936, 97947, 97948, 97949, 97953, 97959, 97964, 97990, 97994, 98001, 98006, 98009, 98023, 98026, 98042, 98046, 98059, 98060, 98129, 98153, 98160, 98169, 98188, 98196, 98205, 98219, 98222, 98230, 98238, 98243, 98258, 98262, 98263, 98266, 98276, 98283, 98288, 98293, 98315, 98319, 98326, 98330, 98331, 98346, 98349, 98354, 98356, 98385, 98395, 98396, 98398, 98399, 98419, 98422, 98425, 98430, 98457, 98470, 98480, 98487, 98503, 98513, 98526, 98537, 98544, 98561, 98575, 98579, 98600, 98602, 98613, 98614, 98625, 98630, 98631, 98632, 98644, 98647, 98648, 98653, 98657, 98658, 98660, 98676, 98677, 98678, 98693, 98694, 98718, 98724, 98737, 98738, 98740, 98776, 98793, 98797, 98799, 98808, 98812, 98813, 98820, 98824, 98831, 98839, 98842, 98847, 98849, 98850, 98870, 98871, 98872, 98887, 98892, 98893, 98894, 98896, 98912, 98928, 98937, 98942, 98944, 98948, 98955, 98959, 98971, 98998, 98999, 99019, 99023, 99051, 99053, 99054, 99059, 99064, 99073, 99074, 99075, 99077, 99083, 99096, 99097, 99108, 99113, 99128, 99129, 99133, 99139, 99151, 99158, 99171, 99182, 99183, 99205, 99207, 99213, 99228, 99229, 99236, 99247, 99256, 99278, 99303, 99313, 99316, 99325, 99326, 99348, 99354, 99359, 99363, 99364, 99372, 99374, 99376, 99394, 99410, 99417, 99457, 99468, 99470, 99478, 99486, 99498, 99501, 99526, 99530, 99532, 99537, 99548, 99584, 99588, 99593, 99600, 99601, 99619, 99625, 99629, 99648, 99650, 99675, 99704, 99727, 99732, 99739, 99740, 99748, 99751, 99753, 99783, 99790, 99792, 99811, 99812, 99813, 99814, 99822, 99832, 99852, 99876, 99878, 99880, 99897, 99902, 99903, 99914, 99924, 99926, 99928, 99955, 99965, 99970, 99972, 99974, 99989, 99996, 100003, 100008, 100011, 100014, 100025, 100035, 100051, 100052, 100054, 100057, 100067, 100077, 100081, 100089, 100091, 100092, 100107, 100108, 100115, 100130, 100131, 100139, 100142, 100148, 100149, 100151, 100173, 100183, 100212, 100218, 100222, 100252, 100254, 100266, 100268, 100271, 100282, 100286, 100298, 100304, 100308, 100324, 100325, 100328, 100338, 100339, 100345, 100365, 100368, 100391, 100453, 100461, 100476, 100477, 100489, 100490, 100510, 100534, 100535, 100544, 100555, 100556, 100557, 100559, 100583, 100602, 100618, 100619, 100620, 100626, 100641, 100659, 100665, 100671, 100680, 100682, 100696, 100702, 100711, 100720, 100721, 100731, 100751, 100760, 100768, 100770, 100777, 100792, 100798, 100805, 100814, 100822, 100842, 100843, 100861, 100866, 100879, 100887, 100903, 100908, 100909, 100917, 100923, 100938, 100961, 100965, 100973, 100979, 100980, 100982, 100987, 101003, 101006, 101010, 101028, 101037, 101038, 101053, 101058, 101062, 101083, 101102, 101117, 101129, 101132, 101135, 101136, 101144, 101147, 101165, 101189, 101196, 101202, 101211, 101216, 101226, 101228, 101230, 101236, 101238, 101252, 101268, 101270, 101272, 101287, 101296, 101300, 101301, 101302, 101319, 101321, 101327, 101331, 101332, 101336, 101338, 101341, 101342, 101357, 101361, 101388, 101417, 101418, 101422, 101426, 101432, 101435, 101439, 101447, 101453, 101457, 101458, 101464, 101479, 101483, 101490, 101508, 101509, 101514, 101519, 101523, 101530, 101539, 101540, 101553, 101572, 101573, 101585, 101587, 101601, 101606, 101616, 101624, 101625, 101627, 101631, 101632, 101635, 101662, 101665, 101670, 101675, 101679, 101686, 101704, 101706, 101717, 101718, 101727, 101728, 101731, 101735, 101750, 101768, 101773, 101778, 101779, 101781, 101789, 101800, 101824, 101826, 101848, 101855, 101858, 101863, 101864, 101872, 101882, 101888, 101900, 101909, 101918, 101937, 101946, 101978, 101990, 101992, 101993, 102009, 102013, 102021, 102039, 102062, 102063, 102066, 102078, 102087, 102103, 102114, 102119, 102120, 102121, 102138, 102140, 102143, 102151, 102157, 102185, 102190, 102194, 102204, 102216, 102221, 102222, 102225, 102228, 102231, 102234, 102242, 102243, 102252, 102256, 102285, 102288, 102292, 102299, 102302, 102303, 102309, 102311, 102326, 102342, 102364, 102371, 102385, 102401, 102402, 102412, 102435, 102455, 102474, 102478, 102479, 102484, 102493, 102496, 102510, 102523, 102530, 102558, 102569, 102570, 102588, 102604, 102615, 102638, 102650, 102661, 102665, 102678, 102681, 102683, 102687, 102691, 102697, 102701, 102710, 102726, 102727, 102733, 102739, 102740, 102744, 102749, 102756, 102771, 102775, 102793, 102809, 102814, 102823, 102832, 102834, 102848, 102856, 102857, 102871, 102876, 102877, 102881, 102882, 102886, 102895, 102909, 102919, 102926, 102935, 102936, 102940, 102943, 102953, 102956, 102957, 102961, 102972, 102994, 102997, 103000, 103006, 103024, 103026, 103031, 103034, 103040, 103050, 103053, 103057, 103065, 103086, 103095, 103116, 103135, 103137, 103139, 103142, 103143, 103148, 103149, 103152, 103161, 103165, 103174, 103192, 103198, 103213, 103221, 103222, 103227, 103229, 103233, 103237, 103253, 103258, 103271, 103279, 103298, 103309, 103321, 103322, 103331, 103334, 103341, 103342, 103343, 103370, 103374, 103379, 103390, 103396, 103404, 103421, 103451, 103459, 103475, 103484, 103496, 103500, 103505, 103540, 103546, 103550, 103551, 103552, 103560, 103577, 103587, 103588, 103595, 103600, 103601, 103602, 103603, 103610, 103622, 103625, 103638, 103644, 103649, 103664, 103665, 103668, 103671, 103679, 103702, 103714, 103715, 103716, 103728, 103738, 103757, 103762, 103769, 103784, 103786, 103790, 103791, 103796, 103817, 103826, 103835, 103840, 103858, 103859, 103874, 103887, 103893, 103900, 103905, 103912, 103916, 103918, 103919, 103920, 103921, 103934, 103940, 103949, 103962, 103975, 103976, 103979, 103980, 103981, 103985, 103992, 104002, 104003, 104007, 104017, 104024, 104029, 104042, 104055, 104061, 104066, 104070, 104075, 104103, 104118, 104120, 104122, 104154, 104155, 104161, 104162, 104187, 104206, 104236, 104244, 104252, 104259, 104260, 104264, 104279, 104284, 104294, 104297, 104298, 104311, 104319, 104320, 104326, 104327, 104339, 104348, 104360, 104382, 104393, 104395, 104408, 104418, 104424, 104425, 104438, 104453, 104455, 104479, 104486, 104490, 104491, 104495, 104498, 104503, 104506, 104511, 104522, 104524, 104530, 104531, 104538, 104540, 104551, 104577, 104578, 104593, 104594, 104601, 104608, 104616, 104622, 104642, 104658, 104665, 104675, 104680, 104697, 104721, 104722, 104723, 104729, 104736, 104755, 104763, 104773, 104788, 104795, 104810, 104816, 104819, 104831, 104836, 104837, 104838, 104839, 104854, 104857, 104867, 104877, 104887, 104892, 104898, 104902, 104908, 104911, 104912, 104917, 104923, 104928, 104934, 104953, 104964, 104978, 104981, 105011, 105016, 105019, 105034, 105044, 105052, 105054, 105079, 105101, 105117, 105124, 105140, 105144, 105145, 105147, 105149, 105152, 105163, 105164, 105180, 105198, 105214, 105227, 105243, 105253, 105259, 105274, 105278, 105281, 105291, 105297, 105306, 105307, 105311, 105326, 105334, 105340, 105345, 105355, 105391, 105404, 105420, 105425, 105428, 105429, 105434, 105435, 105438, 105453, 105459, 105461, 105466, 105478, 105482, 105503, 105512, 105518, 105519, 105521, 105535, 105539, 105542, 105554, 105564, 105566, 105571, 105598, 105602, 105614, 105616, 105634, 105641, 105649, 105672, 105693, 105694, 105712, 105719, 105727, 105737, 105754, 105766, 105768, 105774, 105775, 105780, 105785, 105787, 105793, 105795, 105799, 105802, 105805, 105813, 105842, 105844, 105852, 105866, 105873, 105876, 105888, 105902, 105906, 105925, 105930, 105934, 105942, 105947, 105962, 105977, 105992, 105996, 106012, 106015, 106021, 106026, 106028, 106037, 106043, 106061, 106063, 106077, 106079, 106086, 106091, 106098, 106099, 106104, 106109, 106116, 106121, 106128, 106131, 106172, 106173, 106174, 106188, 106192, 106194, 106197, 106216, 106221, 106234, 106237, 106249, 106250, 106259, 106268, 106271, 106275, 106294, 106297, 106315, 106333, 106346, 106348, 106355, 106356, 106358, 106359, 106369, 106379, 106411, 106412, 106467, 106468, 106469, 106486, 106488, 106490, 106505, 106518, 106550, 106561, 106580, 106607, 106625, 106626, 106629, 106634, 106636, 106637, 106643, 106649, 106650, 106660, 106687, 106704, 106706, 106743, 106750, 106761, 106777, 106784, 106794, 106802, 106805, 106810, 106811, 106814, 106828, 106836, 106847, 106848, 106871, 106876, 106895, 106899, 106900, 106901, 106907, 106909, 106910, 106917, 106922, 106923, 106928, 106933, 106936, 106937, 106945, 106962, 106978, 106998, 107005, 107010, 107024, 107030, 107032, 107047, 107049, 107058, 107059, 107063, 107076, 107093, 107094, 107103, 107104, 107112, 107118, 107119, 107139, 107150, 107159, 107186, 107200, 107201, 107207, 107210, 107244, 107246, 107253, 107254, 107267, 107269, 107272, 107273, 107290, 107322, 107345, 107350, 107371, 107383, 107390, 107395, 107398, 107399, 107414, 107450, 107467, 107494, 107544, 107557, 107558, 107565, 107566, 107594, 107598, 107610, 107633, 107641, 107655, 107661, 107675, 107689, 107691, 107698, 107705, 107707, 107717, 107719, 107727, 107728, 107729, 107732, 107750, 107762, 107775, 107791, 107792, 107802, 107835, 107870, 107873, 107874, 107885, 107886, 107904, 107911, 107963, 107981, 107988, 107989, 107990, 107999, 108010, 108018, 108056, 108065, 108077, 108085, 108102, 108104, 108112, 108125, 108130, 108135, 108137, 108177, 108181, 108184, 108185, 108188, 108196, 108213, 108214, 108223, 108226, 108232, 108238, 108243, 108255, 108270, 108280, 108285, 108313, 108323, 108329, 108348, 108350, 108367, 108377, 108391, 108401, 108412, 108426, 108433, 108445, 108469, 108496, 108506, 108508, 108525, 108533, 108539, 108545, 108557, 108558, 108572, 108576, 108577, 108586, 108589, 108601, 108602, 108611, 108644, 108649, 108650, 108660, 108673, 108687, 108688, 108689, 108700, 108715, 108727, 108783, 108784, 108789, 108796, 108846, 108858, 108865, 108868, 108873, 108877, 108929, 108938, 108945, 108964, 108969, 108981, 109022, 109029, 109034, 109043, 109048, 109056, 109063, 109065, 109087, 109110, 109111, 109116, 109122, 109131, 109154, 109156, 109157, 109158, 109168, 109180, 109186, 109205, 109206, 109220, 109224, 109238, 109306, 109309, 109374, 109381, 109385, 109392, 109397, 109438, 109496, 109503, 109509, 109512, 109568, 109576, 109582, 109585, 109593, 109595, 109622, 109644, 109645, 109661, 109712, 109727, 109751, 109753, 109760, 109772, 109789, 109793, 109813, 109832, 109837, 109849, 109872, 109893, 109894, 109943, 109957, 109997, 110006, 110021, 110029, 110034, 110047, 110052, 110068, 110075, 110095, 110104, 110111, 110117, 110157, 110160, 110189, 110211, 110230, 110254, 110261, 110286, 110292, 110299, 110318, 110352, 110375, 110416, 110448, 110457, 110459, 110474, 110480, 110497, 110502, 110528, 110535, 110537, 110540, 110546, 110547, 110558, 110560, 110587, 110603, 110620, 110650, 110678, 110683, 110690, 110696, 110711, 110715, 110718, 110729, 110735, 110739, 110764, 110769, 110791, 110797, 110800, 110820, 110844, 110860, 110916, 110940, 110944, 110945, 110946, 110962, 110963, 110966, 110976, 111000, 111051, 111052, 111055, 111057, 111061, 111103, 111113, 111136, 111165, 111169, 111181, 111183, 111218, 111234, 111244, 111251, 111304, 111310, 111351, 111357, 111375, 111388, 111429, 111430, 111444, 111454, 111456, 111472, 111473, 111474, 111481, 111512, 111536, 111539, 111547, 111570, 111589, 111597, 111617, 111686, 111688, 111707, 111720, 111728, 111731, 111744, 111745, 111746, 111754, 111765, 111767, 111781, 111791, 111804, 111808, 111814, 111816, 111818, 111840, 111859, 111860, 111878, 111893, 111897, 111906, 111925, 111943, 111944, 111959, 111986, 112012, 112046, 112059, 112060, 112061, 112075, 112089, 112108, 112135, 112143, 112158, 112244, 112253, 112262, 112273, 112305, 112306, 112319, 112324, 112402, 112435, 112477, 112488, 112538, 112542, 112549, 112552, 112568, 112571, 112588, 112596, 112603, 112620, 112635, 112646, 112656, 112663, 112667, 112691, 112702, 112721, 112746, 112749, 112789, 112820, 112830, 112869, 112891, 112897, 112921, 112932, 112944, 112989, 113016, 113028, 113042, 113055, 113074, 113089, 113092, 113109, 113127, 113172, 113205, 113207, 113218, 113242, 113250, 113256, 113265, 113275, 113299, 113301, 113314, 113317, 113328, 113352, 113357, 113365, 113384, 113388, 113400, 113409, 113421, 113428, 113440, 113494, 113497, 113505, 113522, 113530, 113543, 113560, 113565, 113580, 113605, 113613, 113615, 113629, 113634, 113666, 113671, 113678, 113715, 113735, 113753, 113770, 113788, 113794, 113801, 113809, 113828, 113839, 113841, 113844, 113868, 113905, 113941, 113944, 113950, 113962, 113988, 113989, 113995, 113999, 114005, 114033, 114038, 114045, 114051, 114070, 114071, 114099, 114101, 114102, 114105, 114122, 114135, 114137, 114141, 114152, 114167, 114172, 114194, 114213, 114224, 114229, 114282, 114285, 114289, 114291, 114297, 114306, 114315, 114328, 114329, 114337, 114338, 114357, 114358, 114365, 114377, 114380, 114390, 114401, 114405, 114413, 114427, 114448, 114465, 114467, 114470, 114478, 114489, 114505, 114520, 114540, 114563, 114564, 114569, 114579, 114607, 114634, 114637, 114638, 114655, 114706, 114708, 114722, 114730, 114735, 114752, 114755, 114759, 114771, 114772, 114784, 114786, 114788, 114792, 114794, 114799, 114827, 114833, 114842, 114845, 114864, 114875, 114901, 114912, 114915, 114930, 114962, 114967, 114970, 114997, 115012, 115017, 115030, 115060, 115078, 115096, 115109, 115124, 115151, 115164, 115172, 115177, 115180, 115190, 115192, 115215, 115224, 115235, 115250, 115257, 115301, 115320, 115346, 115361, 115363, 115364, 115366, 115368, 115386, 115393, 115397, 115418, 115420, 115449, 115458, 115465, 115467, 115480, 115486, 115536, 115539, 115561, 115569, 115578, 115583, 115601, 115611, 115622, 115625, 115649, 115672, 115704, 115744, 115762, 115774, 115805, 115813, 115817, 115822, 115830, 115861, 115866, 115876, 115896, 115898, 115904, 115905, 115920, 115934, 115943, 115961, 115970, 115973, 115974, 115982, 116018, 116019, 116032, 116034, 116035, 116052, 116053, 116067, 116075, 116098, 116117, 116145, 116175, 116228, 116278, 116300, 116350, 116351, 116361, 116364, 116438, 116454, 116496, 116505, 116542, 116545, 116553, 116568, 116595, 116605, 116608, 116640, 116677, 116680, 116695, 116720, 116721, 116750, 116769, 116881, 116884, 116897, 116909, 116917, 116937, 116944, 116968, 116994, 117004, 117008, 117011, 117015, 117033, 117047, 117060, 117069, 117086, 117097, 117104, 117119, 117154, 117195, 117196, 117201, 117226, 117233, 117246, 117289, 117295, 117297, 117352, 117379, 117381, 117401, 117407, 117417, 117443, 117444, 117468, 117470, 117483, 117493, 117494, 117514, 117522, 117542, 117551, 117564, 117567, 117617, 117650, 117662, 117671, 117674, 117675, 117699, 117713, 117762, 117787, 117810, 117836, 117837, 117888, 117892, 117901, 117907, 117921, 117969, 117981, 118009, 118021, 118025, 118026, 118100, 118133, 118160, 118163, 118171, 118174, 118183, 118188, 118189, 118208, 118211, 118224, 118230, 118273, 118298, 118316, 118331, 118336, 118345, 118358, 118359, 118369, 118371, 118390, 118392, 118404, 118405, 118455, 118458, 118469, 118488, 118492, 118495, 118500, 118518, 118533, 118549, 118562, 118570, 118576, 118597, 118602, 118651, 118664, 118667, 118708, 118720, 118737, 118742, 118746, 118771, 118785, 118797, 118801, 118830, 118834, 118860, 118947, 118960, 118989, 118994, 119056, 119071, 119112, 119121, 119132, 119163, 119179, 119184, 119204, 119208, 119250, 119267, 119311, 119350, 119416, 119421, 119449, 119478, 119526, 119555, 119565, 119603, 119682, 119700, 119704, 119718, 119743, 119765, 119797, 119799, 119810, 119823, 119831, 119836, 119858, 119864, 119890, 119974, 119984, 119999, 120029, 120048, 120063, 120065, 120081, 120100, 120102, 120113, 120125, 120139, 120157, 120211, 120219, 120229, 120251, 120277, 120293, 120324, 120329, 120352, 120364, 120365, 120400, 120418, 120466, 120482, 120485, 120495, 120503, 120519, 120535, 120569, 120610, 120612, 120684, 120696, 120708, 120716, 120717, 120722, 120739, 120762, 120812, 120846, 120860, 120867, 120874, 120888, 120903, 120946, 120948, 120949, 120954, 120957, 120969, 121002, 121020, 121029, 121042, 121079, 121108, 121116, 121140, 121157, 121171, 121219, 121253, 121254, 121262, 121269, 121279, 121290, 121328, 121342, 121378, 121384, 121393, 121422, 121425, 121469, 121470, 121489, 121535, 121545, 121568, 121624, 121655, 121689, 121721, 121723, 121757, 121770, 121794, 121795, 121811, 121843, 121846, 121852, 121930, 121996, 122010, 122021, 122113, 122114, 122121, 122184, 122210, 122232, 122241, 122256, 122257, 122280, 122286, 122303, 122306, 122358, 122361, 122366, 122372, 122379, 122426, 122457, 122462, 122466, 122482, 122512, 122551, 122577, 122621, 122628, 122634, 122672, 122685, 122726, 122876, 122925, 122936, 122955, 122982, 122986, 122990, 123002, 123061, 123072, 123090, 123146, 123173, 123179, 123284, 123297, 123329, 123331, 123430, 123432, 123435, 123437, 123439, 123538, 123606, 123607, 123673, 123683, 123784, 123816, 123858, 123898, 123935, 123949, 123954, 123981, 123994, 123995, 124010, 124091, 124133, 124135, 124167, 124190, 124191, 124244, 124252, 124269, 124270, 124374, 124379, 124388, 124392, 124395, 124408, 124412, 124417, 124471, 124492, 124535, 124693, 124719, 124727, 124740, 124767, 124768, 124769, 124816, 124825, 124826, 124846, 124870, 124872, 124910, 124916, 124921, 124927, 124945, 124957, 125062, 125103, 125115, 125139, 125141, 125176, 125181, 125221, 125308, 125326, 125352, 125368, 125373, 125398, 125521, 125537, 125567, 125593, 125609, 125611, 125617, 125667, 125707, 125720, 125783, 125797, 125798, 125801, 125952, 126021, 126070, 126089, 126111, 126121, 126127, 126129, 126163, 126229, 126251, 126256, 126280, 126311, 126359, 126360, 126446, 126477, 126549, 126564, 126587, 126640, 126666, 126706, 126719, 126815, 126816, 126844, 126845, 126846, 126912, 126913, 126914, 126943, 126974, 127031, 127057, 127074, 127083, 127087, 127091, 127123, 127139, 127173, 127178, 127189, 127208, 127263, 127273, 127289, 127317, 127333, 127334, 127340, 127349, 127398, 127425, 127431, 127463, 127551, 127606, 127635, 127654, 127656, 127734, 127743, 127752, 127786, 127844, 127971, 127989, 127994, 128018, 128033, 128081, 128120, 128139, 128142, 128153, 128213, 128237, 128249, 128250, 128259, 128274, 128282, 128304, 128367, 128485, 128519, 128595, 128635, 128653, 128657, 128678, 128681, 128683, 128716, 128766, 128778, 128824, 128875, 128877, 128892, 128893, 128923, 128936, 128948, 128968, 128987, 129001, 129002, 129030, 129040, 129071, 129073, 129114, 129132, 129134, 129142, 129147, 129159, 129193, 129209, 129217, 129223, 129226, 129240, 129247, 129261, 129287, 129332, 129375, 129398, 129405, 129487, 129514, 129522, 129553, 129627, 129639, 129643, 129651, 129678, 129689, 129692, 129711, 129715, 129733, 129746, 129766, 129771, 129784, 129878, 129904, 129922, 129923, 129973, 129985, 129988, 130041, 130058, 130086, 130092, 130118, 130126, 130178, 130186, 130236, 130249, 130266, 130280, 130320, 130326, 130377, 130411, 130423, 130427, 130482, 130544, 130576, 130581, 130617, 130628, 130642, 130665, 130695, 130767, 130769, 130770, 130780, 130854, 130875, 130889, 130923, 130924, 130936, 130968, 130998, 131132, 131154, 131199, 131201, 131203, 131228, 131229, 131256, 131281, 131313, 131331, 131352, 131434, 131466, 131505, 131525, 131528, 131533, 131543, 131578, 131588, 131615, 131632, 131643, 131658, 131664, 131682, 131715, 131744, 131788, 131805, 131828, 131869, 131871, 131872, 131874, 131886, 131980, 131983, 131998, 132024, 132030, 132031, 132057, 132064, 132080, 132111, 132130, 132168, 132227, 132238, 132239, 132303, 132305, 132317, 132345, 132379, 132386, 132409, 132436, 132443, 132449, 132459, 132465, 132475, 132477, 132501, 132534, 132548, 132628, 132648, 132679, 132683, 132690, 132702, 132759, 132785, 132786, 132810, 132858, 132892, 132893, 132918, 132928, 132943, 132944, 132955, 132992, 132997, 133010, 133018, 133020, 133034, 133067, 133076, 133083, 133088, 133095, 133154, 133173, 133204, 133233, 133238, 133254, 133263, 133328, 133330, 133340, 133347, 133409, 133487, 133497, 133511, 133523, 133533, 133536, 133570, 133603, 133629, 133638, 133669, 133670, 133687, 133708, 133724, 133731, 133801, 133831, 133839, 133857, 133883, 133914, 133934, 133956, 133981, 134004, 134052, 134086, 134092, 134094, 134101, 134102, 134125, 134157, 134172, 134179, 134200, 134217, 134295, 134335, 134368, 134396, 134429, 134453, 134470, 134503, 134548, 134566, 134616, 134662, 134665, 134691, 134695, 134706, 134730, 134789, 134828, 134850, 134897, 134920, 134931, 134944, 134947, 134966, 135054, 135070, 135126, 135145, 135150, 135159, 135173, 135209, 135210, 135228, 135279, 135311, 135316, 135327, 135329, 135337, 135338, 135347, 135419, 135420, 135473, 135495, 135499, 135519, 135550, 135593, 135636, 135654, 135684, 135710, 135739, 135741, 135749, 135782, 135785, 135810, 135817, 135905, 135954, 135980, 136004, 136026, 136050, 136077, 136120, 136131, 136186, 136205, 136209, 136217, 136246, 136248, 136261, 136322, 136345, 136354, 136368, 136401, 136404, 136420, 136440, 136458, 136503, 136555, 136556, 136568, 136583, 136597, 136639, 136650, 136683, 136692, 136709, 136741, 136759, 136795, 136797, 136803, 136832, 136861, 136862, 136881, 136899, 136908, 136917, 136936, 136937, 136969, 136996, 137003, 137005, 137013, 137014, 137031, 137048, 137058, 137060, 137062, 137067, 137115, 137122, 137170, 137171, 137177, 137187, 137206, 137217, 137233, 137283, 137284, 137294, 137295, 137300, 137350, 137425, 137484, 137505, 137510, 137527, 137530, 137544, 137580, 137600, 137606, 137621, 137640, 137644, 137650, 137729, 137740, 137755, 137757, 137845, 137852, 137864, 137916, 137935, 137950, 137982, 137989, 137990, 138010, 138020, 138029, 138030, 138062, 138093, 138100, 138123, 138151, 138172, 138192, 138201, 138211, 138214, 138238, 138251, 138273, 138274, 138332, 138385, 138428, 138454, 138465, 138468, 138529, 138558, 138563, 138574, 138586, 138606, 138684, 138695, 138719, 138737, 138753, 138799, 138823, 138834, 138835, 138843, 138859, 138861, 138869, 138891, 138895, 138906, 138943, 138952, 138958, 138982, 138997, 139001, 139014, 139020, 139051, 139083, 139091, 139136, 139138, 139142, 139169, 139256, 139269, 139280, 139283, 139300, 139330, 139343, 139351, 139364, 139366, 139375, 139377, 139379, 139410, 139415, 139418, 139425, 139426, 139436, 139491, 139501, 139515, 139526, 139544, 139573, 139577, 139579, 139582, 139612, 139622, 139626, 139628, 139677, 139684, 139695, 139730, 139767, 139805, 139818, 139858, 139877, 139888, 139896, 139936, 139984, 140009, 140014, 140065, 140066, 140093, 140121, 140124, 140175, 140213, 140238, 140239, 140267, 140317, 140355, 140360, 140370, 140403, 140439, 140446, 140533, 140537, 140540, 140559, 140567, 140586, 140588, 140632, 140648, 140670, 140698, 140700, 140716, 140719, 140734, 140759, 140763, 140798, 140837, 140857, 140902, 140987, 141024, 141141, 141178, 141201, 141238, 141240, 141271, 141293, 141374, 141400, 141441, 141458, 141462, 141481, 141491, 141515, 141527, 141530, 141547, 141610, 141631, 141657, 141666, 141670, 141674, 141675, 141684, 141685, 141698, 141749, 141756, 141800, 141877, 141905, 141931, 142075, 142081, 142090, 142116, 142119, 142136, 142156, 142167, 142176, 142194, 142207, 142210, 142212, 142223, 142226, 142227, 142231, 142251, 142278, 142286, 142328, 142346, 142354, 142369, 142383, 142398, 142434, 142469, 142485, 142525, 142527, 142560, 142592, 142602, 142624, 142637, 142643, 142685, 142686, 142707, 142765, 142837, 142839, 142840, 142940, 142946, 142948, 142969, 142997, 143043, 143066, 143085, 143098, 143099, 143112, 143131, 143132, 143180, 143194, 143203, 143225, 143227, 143232, 143298, 143301, 143313, 143325, 143330, 143355, 143424, 143425, 143432, 143434, 143442, 143456, 143460, 143513, 143543, 143562, 143632, 143645, 143646, 143673, 143702, 143721, 143740, 143768, 143823, 143826, 143831, 143864, 143900, 143909, 143935, 143936, 143941, 144029, 144038, 144080, 144081, 144084, 144099, 144134, 144150, 144151, 144190, 144285, 144308, 144332, 144408, 144433, 144454, 144468, 144479, 144489, 144490, 144537, 144542, 144568, 144583, 144591, 144603, 144604, 144631, 144637, 144645, 144657, 144665, 144697, 144785, 144828, 144833, 144854, 144858, 144888, 144915, 144967, 144991, 145001, 145026, 145027, 145028, 145029, 145030, 145031, 145032, 145033, 145034, 145035, 145036, 145037, 145038, 145039, 145040, 145041, 145042, 145043, 145044, 145045, 145048, 145051, 145053, 145054, 145055, 145056, 145057, 145058, 145059, 145060, 145061, 145062, 145063, 145068, 145074, 145077, 145080, 145090, 145092, 145096, 145097, 145105, 145106, 145110, 145113, 145115, 145116, 145120, 145122, 145150, 145152, 145169, 145177, 145179, 145198, 145199, 145201, 145207, 145213, 145214, 145226, 145234, 145243, 145283, 145291, 145292, 145294, 145303, 145304, 145306, 145317, 145331, 145367, 145368, 145369, 145375, 145385, 145414, 145443, 145477, 145487, 145498, 145509, 145538, 145541, 145543, 145544, 145563, 145575, 145577, 145587, 145594, 145603, 145606, 145637, 145640, 145662, 145670, 145671, 145685, 145703, 145720, 145734, 145741, 145742, 145759, 145765, 145786, 145787, 145798, 145801, 145803, 145830, 145835, 145849, 145853, 145859, 145860, 145861, 145862, 145863, 145864, 145865, 145866, 145867, 145868, 145869, 145870, 145871, 145872, 145873, 145874, 145875, 145876, 145877, 145878, 145879, 145880, 145881, 145882, 145883, 145884, 145885, 145886, 145887, 145888, 145889, 145890, 145891, 145892, 145893, 145894, 145895, 145896, 145897, 145898, 145899, 145900, 145901, 145902, 145903, 145904, 145905, 145906, 145908, 145909, 145910, 145911, 145912, 145913, 145914, 145915, 145916, 145917, 145918, 145919, 145920, 145921, 145922, 145923, 145924, 145925, 145926, 145927, 145929, 145930, 145931, 145932, 145933, 145934, 145935, 145936, 145937, 145938, 145939, 145940, 145941, 145942, 145943, 145944, 145945, 145946, 145947, 145948, 145949, 145950, 145951, 145952, 145953, 145954, 145955, 145956, 145957, 145958, 145959, 145960, 145961, 145962, 145963, 145964, 145965, 145966, 145967, 145968, 145969, 145970, 145971, 145972, 145973, 145974, 145975, 145976, 145977, 145978, 145979, 145980, 145981, 145982, 145983, 145984, 145985, 145986, 145987, 145988, 145989, 145990, 145991, 145992, 145993, 145994, 145995, 145996, 145997, 145998, 145999, 146000, 146001, 146002, 146003, 146004, 146005, 146006, 146008, 146009, 146010, 146011, 146012, 146013, 146014, 146015, 146016, 146017, 146018, 146019, 146020, 146021, 146022, 146023, 146024, 146025, 146026, 146028, 146029, 146030, 146031, 146032, 146033, 146034, 146035, 146036, 146037, 146038, 146039, 146040, 146041, 146042, 146043, 146044, 146045, 146046, 146047, 146049, 146050, 146051, 146052, 146053, 146054, 146055, 146056, 146057, 146058, 146059, 146061, 146062, 146063, 146064, 146065, 146066, 146067, 146068, 146069, 146070, 146071, 146072, 146073, 146074, 146075, 146076, 146077, 146078, 146079, 146080, 146081, 146082, 146083, 146084, 146086, 146087, 146088, 146089, 146090, 146091, 146092, 146093, 146094, 146095, 146096, 146097, 146098, 146099, 146100, 146102, 146103, 146104, 146105, 146106, 146107, 146108, 146109, 146110, 146111, 146112, 146113, 146114, 146115, 146116, 146117, 146118, 146119, 146120, 146121, 146122, 146123, 146124, 146126, 146127, 146128, 146129, 146130, 146131, 146132, 146133, 146134, 146135, 146136, 146137, 146138, 146139, 146140, 146141, 146142, 146143, 146144, 146145, 146146, 146147, 146148, 146149, 146150, 146151, 146152, 146153, 146154, 146155, 146156, 146158, 146159, 146160, 146161, 146162, 146163, 146164, 146165, 146167, 146168, 146169, 146170, 146171, 146172, 146173, 146174, 146175, 146176, 146177, 146178, 146179, 146180, 146181, 146182, 146183, 146184, 146185, 146186, 146188, 146189, 146190, 146191, 146192, 146195, 146196, 146197, 146198, 146199, 146200, 146202, 146203, 146204, 146205, 146207, 146208, 146209, 146210, 146211, 146212, 146214, 146215, 146216, 146218, 146219, 146220, 146221, 146222, 146223, 146224, 146225, 146226, 146227, 146228, 146229, 146230, 146231, 146232, 146233, 146234, 146235, 146237, 146238, 146239, 146240, 146241, 146242, 146243, 146244, 146245, 146246, 146247, 146248, 146249, 146250, 146251, 146252, 146253, 146254, 146255, 146256, 146257, 146258, 146260, 146261, 146262, 146263, 146264, 146265, 146268, 146269, 146270, 146271, 146272, 146273, 146274, 146275, 146276, 146278, 146279, 146280, 146281, 146282, 146283, 146286, 146287, 146288, 146289, 146290, 146291, 146292, 146293, 146294, 146295, 146296, 146297, 146298, 146299, 146300, 146301, 146303, 146305, 146306, 146307, 146308, 146309, 146310, 146311, 146312, 146313, 146315, 146316, 146317, 146318, 146319, 146320, 146321, 146322, 146323, 146324, 146325, 146326, 146327, 146328, 146329, 146330, 146331, 146332, 146334, 146335, 146336, 146337, 146338, 146339, 146340, 146341, 146344, 146345, 146346, 146347, 146349, 146350, 146351, 146353, 146354, 146357, 146358, 146359, 146360, 146361, 146362, 146363, 146364, 146365, 146366, 146367, 146368, 146370, 146372, 146373, 146374, 146375, 146376, 146379, 146380, 146381, 146382, 146383, 146384, 146385, 146386, 146387, 146389, 146390, 146391, 146392, 146394, 146395, 146398, 146399, 146400, 146401, 146402, 146403, 146404, 146405, 146406, 146407, 146408, 146410, 146411, 146412, 146413, 146414, 146416, 146417, 146418, 146419, 146420, 146421, 146422, 146423, 146424, 146426, 146427, 146428, 146429, 146432, 146433, 146435, 146436, 146437, 146438, 146439, 146440, 146441, 146444, 146445, 146446, 146447, 146448, 146449, 146450, 146451, 146452, 146453, 146454, 146455, 146456, 146457, 146458, 146459, 146460, 146461, 146463, 146464, 146466, 146468, 146469, 146470, 146471, 146472, 146473, 146475, 146476, 146477, 146479, 146480, 146482, 146483, 146484, 146485, 146486, 146487, 146488, 146489, 146490, 146491, 146492, 146493, 146494, 146496, 146498, 146499, 146500, 146502, 146503, 146504, 146505, 146506, 146507, 146508, 146509, 146510, 146511, 146512, 146513, 146514, 146515, 146516, 146517, 146518, 146519, 146520, 146521, 146522, 146523, 146526, 146527, 146528, 146529, 146530, 146531, 146533, 146534, 146535, 146537, 146539, 146541, 146542, 146546, 146547, 146548, 146549, 146550, 146551, 146553, 146554, 146555, 146556, 146558, 146559, 146560, 146561, 146562, 146563, 146564, 146565, 146567, 146568, 146569, 146570, 146571, 146572, 146573, 146574, 146575, 146576, 146577, 146578, 146580, 146581, 146582, 146583, 146585, 146586, 146588, 146589, 146592, 146594, 146595, 146597, 146598, 146599, 146600, 146602, 146603, 146604, 146605, 146606, 146607, 146610, 146612, 146613, 146614, 146615, 146617, 146618, 146619, 146620, 146621, 146622, 146624, 146626, 146627, 146628, 146631, 146632, 146634, 146638, 146639, 146640, 146642, 146644, 146645, 146646, 146647, 146648, 146649, 146650, 146651, 146652, 146653, 146654, 146655, 146656, 146658, 146659, 146660, 146662, 146664, 146666, 146667, 146668, 146669, 146670, 146671, 146672, 146673, 146674, 146675, 146677, 146678, 146679, 146680, 146682, 146683, 146684, 146685, 146686, 146689, 146690, 146692, 146693, 146694, 146696, 146698, 146699, 146700, 146701, 146702, 146705, 146706, 146709, 146710, 146713, 146715, 146716, 146718, 146719, 146720, 146721, 146722, 146726, 146728, 146729, 146734, 146736, 146737, 146738, 146740, 146743, 146744, 146745, 146746, 146749, 146750, 146751, 146753, 146754, 146756, 146757, 146758, 146759, 146760, 146761, 146762, 146763, 146765, 146767, 146768, 146769, 146771, 146772, 146773, 146774, 146775, 146777, 146778, 146779, 146780, 146781, 146782, 146783, 146785, 146786, 146787, 146788, 146790, 146791, 146792, 146794, 146795, 146796, 146797, 146799, 146800, 146801, 146802, 146804, 146805, 146806, 146807, 146808, 146809, 146810, 146811, 146812, 146814, 146816, 146817, 146819, 146821, 146822, 146823, 146825, 146827, 146828, 146829, 146830, 146831, 146832, 146833, 146835, 146836, 146838, 146839, 146841, 146843, 146844, 146846, 146848, 146849, 146851, 146852, 146856, 146857, 146858, 146859, 146860, 146861, 146862, 146863, 146864, 146865, 146866, 146867, 146869, 146870, 146871, 146872, 146873, 146876, 146877, 146878, 146879, 146882, 146883, 146885, 146886, 146888, 146889, 146890, 146892, 146893, 146895, 146896, 146897, 146898, 146899, 146901, 146903, 146904, 146905, 146906, 146907, 146909, 146911, 146912, 146913, 146914, 146916, 146920, 146924, 146925, 146927, 146930, 146932, 146933, 146934, 146936, 146937, 146938, 146939, 146940, 146942, 146943, 146945, 146946, 146947, 146949, 146950, 146952, 146953, 146956, 146957, 146960, 146961, 146962, 146963, 146964, 146965, 146966, 146968, 146969, 146970, 146971, 146973, 146974, 146976, 146977, 146978, 146979, 146980, 146981, 146982, 146984, 146985, 146987, 146988, 146994, 146996, 146997, 146999, 147001, 147002, 147003, 147004, 147005, 147006, 147007, 147008, 147009, 147010, 147012, 147013, 147014, 147015, 147016, 147020, 147021, 147023, 147024, 147026, 147027, 147028, 147029, 147032, 147033, 147035, 147036, 147037, 147038, 147040, 147041, 147042, 147045, 147047, 147048, 147049, 147050, 147053, 147057, 147058, 147059, 147060, 147061, 147063, 147064, 147065, 147066, 147067, 147070, 147071, 147072, 147073, 147074, 147075, 147077, 147080, 147081, 147084, 147085, 147086, 147087, 147088, 147089, 147091, 147093, 147094, 147095, 147096, 147097, 147098, 147099, 147101, 147103, 147105, 147107, 147108, 147109, 147110, 147111, 147113, 147115, 147116, 147117, 147118, 147119, 147121, 147122, 147125, 147126, 147127, 147129, 147130, 147132, 147134, 147135, 147136, 147141, 147143, 147144, 147149, 147150, 147153, 147154, 147155, 147156, 147157, 147158, 147160, 147162, 147164, 147165, 147167, 147169, 147171, 147173, 147174, 147175, 147176, 147177, 147178, 147181, 147183, 147184, 147186, 147188, 147192, 147193, 147194, 147199, 147200, 147201, 147202, 147204, 147205, 147206, 147208, 147211, 147212, 147216, 147217, 147218, 147219, 147220, 147228, 147229, 147232, 147233, 147236, 147240, 147241, 147242, 147245, 147246, 147247, 147248, 147249, 147252, 147253, 147255, 147256, 147257, 147258, 147259, 147261, 147262, 147263, 147264, 147265, 147266, 147268, 147270, 147271, 147272, 147273, 147275, 147277, 147278, 147279, 147280, 147281, 147282, 147286, 147293, 147294, 147298, 147300, 147301, 147303, 147304, 147307, 147310, 147311, 147312, 147313, 147315, 147318, 147319, 147322, 147324, 147325, 147326, 147327, 147329, 147331, 147334, 147335, 147337, 147339, 147340, 147342, 147343, 147345, 147346, 147351, 147353, 147355, 147356, 147359, 147360, 147363, 147364, 147365, 147367, 147371, 147374, 147378, 147379, 147380, 147381, 147383, 147389, 147393, 147394, 147395, 147396, 147398, 147399, 147401, 147402, 147406, 147408, 147409, 147410, 147411, 147413, 147415, 147417, 147418, 147419, 147421, 147423, 147424, 147426, 147429, 147430, 147433, 147434, 147435, 147436, 147437, 147439, 147445, 147447, 147449, 147450, 147452, 147453, 147454, 147455, 147456, 147459, 147465, 147468, 147469, 147470, 147471, 147473, 147478, 147479, 147480, 147481, 147486, 147487, 147488, 147490, 147492, 147493, 147495, 147500, 147501, 147504, 147505, 147508, 147509, 147510, 147511, 147512, 147515, 147516, 147517, 147520, 147521, 147522, 147528, 147529, 147530, 147532, 147534, 147536, 147538, 147539, 147540, 147546, 147549, 147551, 147552, 147554, 147555, 147556, 147557, 147560, 147563, 147564, 147568, 147569, 147570, 147571, 147572, 147573, 147574, 147575, 147577, 147578, 147580, 147581, 147582, 147583, 147585, 147586, 147587, 147588, 147589, 147590, 147591, 147592, 147593, 147597, 147598, 147599, 147600, 147601, 147602, 147603, 147604, 147606, 147607, 147610, 147611, 147613, 147614, 147615, 147616, 147619, 147621, 147622, 147624, 147627, 147628, 147630, 147631, 147633, 147634, 147635, 147636, 147637, 147638, 147639, 147641, 147642, 147644, 147650, 147651, 147652, 147653, 147654, 147655, 147658, 147659, 147660, 147661, 147662, 147663, 147666, 147668, 147669, 147670, 147672, 147678, 147680, 147681, 147682, 147683, 147686, 147687, 147689, 147691, 147692, 147693, 147695, 147696, 147698, 147701, 147702, 147703, 147704, 147706, 147707, 147708, 147709, 147710, 147711, 147712, 147715, 147716, 147719, 147720, 147721, 147723, 147725, 147728, 147729, 147730, 147732, 147734, 147736, 147737, 147739, 147742, 147743, 147744, 147746, 147749, 147750, 147753, 147754, 147756, 147760, 147761, 147762, 147764, 147766, 147768, 147770, 147771, 147772, 147775, 147776, 147777, 147779, 147780, 147781, 147782, 147784, 147785, 147786, 147789, 147790, 147791, 147792, 147793, 147795, 147796, 147798, 147799, 147800, 147802, 147805, 147806, 147809, 147812, 147813, 147815, 147818, 147820, 147823, 147829, 147831, 147832, 147833, 147834, 147836, 147837, 147838, 147839, 147840, 147841, 147842, 147844, 147848, 147849, 147850, 147851, 147853, 147854, 147856, 147857, 147858, 147862, 147863, 147864, 147865, 147866, 147869, 147870, 147871, 147872, 147873, 147874, 147876, 147877, 147878, 147879, 147881, 147883, 147885, 147886, 147887, 147888, 147889, 147890, 147891, 147895, 147896, 147899, 147900, 147901, 147902, 147903, 147904, 147905, 147908, 147910, 147914, 147916, 147917, 147919, 147922, 147924, 147928, 147931, 147933, 147941, 147943, 147944, 147945, 147948, 147950, 147958, 147960, 147961, 147964, 147967, 147968, 147969, 147971, 147973, 147977, 147978, 147980, 147984, 147985, 147987, 147991, 147994, 147995, 147996, 147998, 148002, 148003, 148005, 148009, 148011, 148015, 148016, 148017, 148018, 148021, 148024, 148026, 148027, 148028, 148029, 148030, 148033, 148034, 148039, 148040, 148041, 148042, 148044, 148045, 148049, 148053, 148054, 148055, 148060, 148068, 148069, 148070, 148073, 148075, 148079, 148080, 148082, 148083, 148084, 148086, 148088, 148092, 148094, 148096, 148098, 148101, 148102, 148103, 148104, 148107, 148108, 148111, 148113, 148114, 148115, 148116, 148118, 148121, 148124, 148126, 148127, 148129, 148130, 148132, 148133, 148135, 148137, 148139, 148141, 148144, 148145, 148147, 148153, 148158, 148164, 148166, 148168, 148170, 148171, 148172, 148176, 148179, 148180, 148182, 148184, 148185, 148187, 148190, 148191, 148193, 148196, 148197, 148199, 148203, 148204, 148205, 148207, 148211, 148214, 148215, 148217, 148218, 148220, 148223, 148229, 148231, 148232, 148233, 148234, 148235, 148237, 148238, 148240, 148242, 148243, 148245, 148248, 148249, 148252, 148253, 148257, 148260, 148261, 148262, 148263, 148268, 148273, 148274, 148280, 148281, 148283, 148284, 148285, 148286, 148287, 148292, 148296, 148300, 148301, 148302, 148304, 148305, 148306, 148308, 148313, 148315, 148317, 148321, 148323, 148324, 148326, 148329, 148330, 148332, 148333, 148335, 148338, 148342, 148345, 148349, 148350, 148352, 148353, 148357, 148362, 148366, 148367, 148369, 148371, 148373, 148375, 148377, 148378, 148382, 148383, 148386, 148387, 148388, 148389, 148390, 148393, 148394, 148399, 148401, 148407, 148410, 148413, 148414, 148415, 148420, 148421, 148422, 148425, 148428, 148430, 148431, 148434, 148437, 148439, 148441, 148442, 148445, 148449, 148452, 148453, 148454, 148456, 148457, 148458, 148459, 148461, 148467, 148471, 148472, 148474, 148477, 148478, 148479, 148482, 148484, 148486, 148488, 148489, 148495, 148496, 148498, 148500, 148501, 148502, 148503, 148504, 148505, 148506, 148510, 148511, 148514, 148515, 148517, 148518, 148521, 148522, 148524, 148525, 148526, 148527, 148531, 148533, 148534, 148535, 148538, 148539, 148540, 148541, 148544, 148549, 148553, 148554, 148556, 148560, 148561, 148562, 148565, 148567, 148568, 148569, 148570, 148571, 148572, 148574, 148575, 148576, 148577, 148578, 148579, 148581, 148583, 148584, 148588, 148592, 148594, 148596, 148598, 148599, 148600, 148601, 148603, 148605, 148610, 148613, 148614, 148615, 148616, 148617, 148619, 148620, 148621, 148622, 148626, 148628, 148631, 148632, 148633, 148634, 148635, 148639, 148648, 148654, 148656, 148660, 148661, 148664, 148665, 148666, 148668, 148669, 148671, 148672, 148674, 148677, 148682, 148683, 148684, 148689, 148690, 148692, 148693, 148694, 148696, 148697, 148698, 148700, 148701, 148702, 148703, 148704, 148705, 148706, 148707, 148709, 148710, 148711, 148712, 148713, 148716, 148719, 148721, 148722, 148726, 148730, 148731, 148733, 148734, 148735, 148736, 148739, 148740, 148743, 148744, 148749, 148750, 148753, 148758, 148763, 148764, 148766, 148768, 148770, 148775, 148776, 148779, 148780, 148783, 148785, 148788, 148789, 148790, 148793, 148794, 148795, 148797, 148802, 148803, 148808, 148812, 148814, 148817, 148821, 148822, 148824, 148830, 148832, 148833, 148834, 148835, 148838, 148846, 148850, 148852, 148853, 148854, 148856, 148861, 148862, 148864, 148868, 148871, 148873, 148874, 148876, 148877, 148879, 148881, 148892, 148899, 148901, 148902, 148933, 148952, 149029, 149112, 149338, 149859, 149860, 149861, 149862, 149863, 149864, 149865, 149866, 149867, 149868, 149869, 149870, 149871, 149873, 149874, 149875, 149876, 149877, 149878, 149879, 149880, 149881, 149882, 149883, 149884, 149885, 149886, 149887, 149888, 149889, 149890, 149891, 149892, 149893, 149894, 149895, 149896, 149897, 149898, 149899, 149900, 149901, 149902, 149904, 149905, 149906, 149907, 149908, 149909, 149910, 149911, 149912, 149913, 149914, 149915, 149916, 149917, 149918, 149919, 149920, 149921, 149922, 149923, 149924, 149925, 149926, 149927, 149928, 149929, 149930, 149931, 149932, 149933, 149934, 149935, 149936, 149937, 149938, 149939, 149940, 149941, 149942, 149943, 149944, 149945, 149946, 149947, 149948, 149949, 149950, 149951, 149952, 149953, 149954, 149955, 149956, 149957, 149958, 149959, 149960, 149961, 149962, 149963, 149964, 149965, 149966, 149967, 149968, 149969, 149970, 149971, 149972, 149973, 149974, 149975, 149976, 149977, 149978, 149979, 149980, 149981, 149982, 149983, 149984, 149985, 149986, 149987, 149988, 149989, 149990, 149991, 149992, 149994, 149995, 149996, 149997, 149998, 149999, 150000, 150001, 150002, 150003, 150004, 150005, 150006, 150007, 150008, 150009, 150010, 150011, 150012, 150013, 150014, 150015, 150016, 150017, 150018, 150019, 150021, 150022, 150023, 150024, 150025, 150026, 150027, 150028, 150029, 150030, 150031, 150032, 150033, 150034, 150035, 150036, 150037, 150038, 150039, 150040, 150041, 150042, 150043, 150044, 150046, 150047, 150048, 150051, 150052, 150053, 150054, 150055, 150056, 150058, 150059, 150060, 150061, 150062, 150063, 150064, 150065, 150066, 150068, 150069, 150070, 150071, 150074, 150075, 150076, 150077, 150078, 150079, 150081, 150082, 150083, 150084, 150086, 150087, 150088, 150089, 150090, 150091, 150092, 150093, 150094, 150095, 150096, 150097, 150098, 150099, 150100, 150102, 150103, 150104, 150105, 150106, 150107, 150109, 150110, 150112, 150113, 150114, 150115, 150116, 150117, 150118, 150120, 150121, 150124, 150125, 150126, 150127, 150128, 150129, 150130, 150131, 150132, 150133, 150134, 150135, 150136, 150137, 150138, 150139, 150140, 150141, 150142, 150144, 150145, 150146, 150147, 150148, 150149, 150150, 150151, 150152, 150153, 150154, 150156, 150157, 150158, 150159, 150161, 150162, 150163, 150164, 150166, 150167, 150168, 150169, 150170, 150171, 150172, 150173, 150175, 150176, 150177, 150178, 150179, 150180, 150182, 150183, 150184, 150185, 150186, 150187, 150188, 150189, 150190, 150191, 150192, 150194, 150195, 150196, 150197, 150198, 150200, 150201, 150202, 150204, 150205, 150206, 150207, 150209, 150210, 150211, 150212, 150214, 150215, 150216, 150218, 150219, 150220, 150221, 150222, 150223, 150225, 150226, 150227, 150229, 150230, 150231, 150232, 150233, 150234, 150235, 150237, 150238, 150239, 150240, 150241, 150242, 150243, 150244, 150245, 150246, 150247, 150248, 150249, 150250, 150252, 150253, 150254, 150255, 150256, 150258, 150259, 150260, 150261, 150262, 150264, 150265, 150266, 150267, 150268, 150269, 150270, 150271, 150272, 150273, 150274, 150278, 150279, 150282, 150283, 150284, 150286, 150287, 150288, 150289, 150291, 150292, 150293, 150294, 150296, 150298, 150299, 150300, 150301, 150302, 150303, 150304, 150305, 150306, 150307, 150308, 150309, 150310, 150311, 150313, 150315, 150316, 150317, 150318, 150320, 150322, 150323, 150325, 150326, 150327, 150329, 150330, 150332, 150333, 150334, 150335, 150337, 150338, 150340, 150344, 150345, 150346, 150347, 150348, 150349, 150350, 150351, 150352, 150353, 150354, 150355, 150357, 150358, 150359, 150360, 150362, 150363, 150365, 150366, 150367, 150368, 150369, 150372, 150373, 150374, 150376, 150377, 150378, 150379, 150380, 150381, 150382, 150383, 150384, 150385, 150386, 150387, 150388, 150389, 150390, 150391, 150392, 150393, 150394, 150395, 150396, 150397, 150398, 150399, 150400, 150401, 150402, 150403, 150404, 150405, 150406, 150407, 150409, 150410, 150411, 150412, 150415, 150416, 150417, 150419, 150420, 150422, 150423, 150424, 150425, 150427, 150429, 150430, 150431, 150432, 150433, 150434, 150435, 150436, 150437, 150438, 150439, 150440, 150441, 150442, 150443, 150444, 150445, 150446, 150447, 150448, 150450, 150452, 150453, 150455, 150457, 150459, 150460, 150462, 150463, 150464, 150465, 150466, 150467, 150468, 150470, 150471, 150473, 150474, 150475, 150476, 150478, 150479, 150480, 150481, 150482, 150485, 150487, 150488, 150489, 150490, 150491, 150492, 150493, 150494, 150495, 150496, 150497, 150498, 150499, 150500, 150501, 150502, 150503, 150504, 150506, 150508, 150509, 150510, 150512, 150513, 150514, 150515, 150517, 150519, 150520, 150522, 150523, 150524, 150525, 150527, 150528, 150529, 150530, 150532, 150535, 150536, 150537, 150538, 150539, 150542, 150543, 150544, 150545, 150546, 150547, 150548, 150550, 150552, 150553, 150554, 150555, 150557, 150558, 150559, 150560, 150561, 150562, 150563, 150564, 150565, 150566, 150567, 150568, 150570, 150572, 150573, 150574, 150575, 150576, 150578, 150579, 150580, 150581, 150582, 150583, 150584, 150585, 150587, 150589, 150590, 150591, 150592, 150594, 150595, 150596, 150597, 150598, 150600, 150602, 150603, 150604, 150608, 150609, 150610, 150611, 150613, 150615, 150617, 150618, 150620, 150622, 150623, 150624, 150625, 150626, 150627, 150628, 150629, 150630, 150631, 150632, 150633, 150634, 150635, 150637, 150638, 150641, 150642, 150643, 150644, 150646, 150648, 150649, 150651, 150653, 150654, 150655, 150657, 150658, 150659, 150660, 150661, 150662, 150664, 150665, 150666, 150667, 150669, 150670, 150671, 150672, 150673, 150674, 150676, 150677, 150678, 150680, 150681, 150682, 150683, 150684, 150687, 150688, 150689, 150690, 150692, 150693, 150694, 150695, 150696, 150697, 150698, 150699, 150700, 150701, 150702, 150703, 150706, 150708, 150709, 150710, 150711, 150712, 150714, 150716, 150717, 150718, 150719, 150720, 150721, 150722, 150723, 150724, 150725, 150726, 150727, 150728, 150729, 150731, 150732, 150733, 150735, 150736, 150737, 150739, 150740, 150741, 150742, 150743, 150744, 150746, 150747, 150748, 150749, 150750, 150751, 150752, 150753, 150754, 150755, 150756, 150757, 150759, 150760, 150761, 150762, 150763, 150764, 150766, 150768, 150769, 150770, 150771, 150772, 150774, 150775, 150776, 150777, 150778, 150779, 150780, 150781, 150782, 150785, 150786, 150787, 150788, 150790, 150791, 150792, 150793, 150795, 150796, 150797, 150799, 150800, 150801, 150802, 150803, 150805, 150806, 150807, 150808, 150809, 150810, 150811, 150812, 150813, 150814, 150815, 150816, 150818, 150819, 150820, 150821, 150822, 150823, 150824, 150825, 150826, 150827, 150828, 150829, 150830, 150832, 150834, 150837, 150838, 150840, 150841, 150842, 150843, 150845, 150846, 150847, 150848, 150852, 150854, 150855, 150856, 150857, 150858, 150859, 150860, 150861, 150862, 150863, 150864, 150865, 150867, 150869, 150870, 150871, 150873, 150874, 150875, 150876, 150877, 150878, 150879, 150881, 150882, 150883, 150884, 150885, 150886, 150887, 150889, 150891, 150893, 150894, 150895, 150896, 150897, 150898, 150899, 150900, 150901, 150902, 150903, 150904, 150908, 150910, 150911, 150914, 150916, 150917, 150918, 150919, 150920, 150921, 150922, 150923, 150925, 150927, 150929, 150931, 150932, 150933, 150934, 150935, 150936, 150937, 150938, 150939, 150941, 150942, 150943, 150944, 150945, 150946, 150948, 150949, 150950, 150953, 150954, 150955, 150956, 150957, 150958, 150959, 150960, 150961, 150962, 150963, 150964, 150965, 150966, 150967, 150968, 150970, 150971, 150972, 150973, 150974, 150976, 150978, 150980, 150981, 150982, 150983, 150984, 150985, 150987, 150988, 150989, 150990, 150991, 150992, 150994, 150995, 150996, 150997, 150998, 150999, 151002, 151003, 151004, 151005, 151007, 151008, 151009, 151010, 151011, 151012, 151013, 151014, 151015, 151016, 151017, 151019, 151022, 151024, 151026, 151027, 151028, 151029, 151030, 151031, 151033, 151035, 151036, 151037, 151038, 151039, 151040, 151041, 151042, 151043, 151044, 151047, 151048, 151049, 151050, 151051, 151052, 151054, 151055, 151056, 151057, 151058, 151059, 151060, 151061, 151062, 151063, 151064, 151065, 151066, 151069, 151071, 151072, 151073, 151075, 151076, 151077, 151080, 151082, 151083, 151084, 151085, 151086, 151087, 151088, 151089, 151090, 151092, 151093, 151094, 151095, 151097, 151098, 151100, 151104, 151105, 151106, 151108, 151109, 151110, 151111, 151113, 151114, 151115, 151116, 151119, 151120, 151121, 151122, 151123, 151124, 151125, 151127, 151128, 151131, 151133, 151135, 151137, 151138, 151139, 151140, 151141, 151142, 151143, 151145, 151146, 151150, 151151, 151154, 151155, 151156, 151157, 151158, 151162, 151163, 151164, 151166, 151167, 151169, 151170, 151171, 151172, 151173, 151174, 151175, 151177, 151178, 151180, 151183, 151184, 151186, 151187, 151188, 151189, 151191, 151192, 151193, 151195, 151197, 151198, 151201, 151202, 151203, 151204, 151205, 151206, 151208, 151209, 151211, 151212, 151214, 151215, 151216, 151217, 151218, 151219, 151220, 151221, 151223, 151224, 151225, 151226, 151228, 151230, 151231, 151234, 151235, 151236, 151238, 151239, 151240, 151241, 151242, 151244, 151245, 151246, 151247, 151248, 151249, 151252, 151253, 151254, 151255, 151256, 151257, 151258, 151259, 151260, 151261, 151262, 151263, 151264, 151265, 151267, 151269, 151270, 151271, 151272, 151273, 151275, 151276, 151277, 151278, 151279, 151280, 151282, 151283, 151284, 151286, 151287, 151288, 151289, 151290, 151291, 151292, 151295, 151297, 151298, 151299, 151301, 151302, 151303, 151304, 151306, 151308, 151309, 151310, 151313, 151315, 151317, 151318, 151319, 151320, 151322, 151323, 151324, 151325, 151326, 151327, 151329, 151330, 151331, 151332, 151333, 151334, 151335, 151336, 151337, 151338, 151339, 151340, 151341, 151344, 151346, 151347, 151348, 151350, 151351, 151352, 151353, 151354, 151357, 151360, 151362, 151363, 151364, 151366, 151367, 151368, 151369, 151370, 151371, 151372, 151373, 151374, 151375, 151377, 151378, 151380, 151381, 151382, 151385, 151386, 151387, 151388, 151389, 151390, 151393, 151394, 151395, 151399, 151400, 151401, 151402, 151403, 151404, 151405, 151406, 151407, 151408, 151409, 151412, 151413, 151414, 151415, 151416, 151418, 151420, 151421, 151422, 151424, 151425, 151426, 151427, 151429, 151431, 151432, 151433, 151434, 151435, 151436, 151437, 151440, 151441, 151443, 151445, 151447, 151450, 151451, 151452, 151454, 151455, 151456, 151457, 151458, 151459, 151461, 151464, 151466, 151467, 151469, 151470, 151471, 151472, 151474, 151475, 151479, 151481, 151483, 151484, 151485, 151486, 151488, 151489, 151490, 151491, 151492, 151493, 151494, 151495, 151498, 151499, 151500, 151501, 151503, 151504, 151505, 151506, 151507, 151510, 151511, 151514, 151515, 151516, 151517, 151518, 151520, 151522, 151524, 151525, 151527, 151528, 151529, 151530, 151531, 151532, 151533, 151534, 151535, 151536, 151537, 151538, 151539, 151540, 151542, 151544, 151545, 151546, 151547, 151548, 151549, 151550, 151551, 151552, 151553, 151554, 151555, 151556, 151560, 151561, 151562, 151563, 151564, 151565, 151566, 151569, 151570, 151572, 151573, 151574, 151577, 151581, 151582, 151583, 151586, 151588, 151589, 151590, 151591, 151592, 151595, 151596, 151597, 151598, 151599, 151600, 151601, 151603, 151604, 151605, 151606, 151607, 151608, 151609, 151610, 151611, 151613, 151614, 151616, 151621, 151624, 151625, 151626, 151627, 151628, 151629, 151630, 151631, 151632, 151633, 151635, 151636, 151637, 151640, 151641, 151642, 151643, 151644, 151646, 151647, 151649, 151651, 151652, 151653, 151654, 151655, 151656, 151659, 151660, 151661, 151662, 151663, 151664, 151665, 151669, 151671, 151673, 151674, 151675, 151676, 151677, 151678, 151679, 151682, 151683, 151685, 151686, 151687, 151689, 151690, 151691, 151692, 151693, 151697, 151698, 151701, 151702, 151703, 151704, 151705, 151707, 151708, 151709, 151711, 151712, 151713, 151715, 151716, 151717, 151718, 151719, 151720, 151721, 151722, 151724, 151726, 151727, 151729, 151731, 151733, 151736, 151737, 151738, 151739, 151740, 151741, 151742, 151743, 151744, 151745, 151747, 151748, 151749, 151750, 151752, 151755, 151756, 151758, 151759, 151760, 151761, 151762, 151763, 151764, 151765, 151766, 151767, 151768, 151769, 151770, 151771, 151774, 151775, 151776, 151780, 151781, 151784, 151785, 151786, 151787, 151788, 151789, 151790, 151791, 151792, 151793, 151794, 151795, 151798, 151799, 151800, 151802, 151804, 151805, 151806, 151807, 151809, 151810, 151811, 151817, 151818, 151820, 151821, 151823, 151824, 151825, 151826, 151827, 151829, 151830, 151831, 151832, 151833, 151834, 151835, 151836, 151837, 151838, 151841, 151842, 151844, 151846, 151848, 151849, 151850, 151851, 151852, 151853, 151855, 151856, 151857, 151858, 151860, 151861, 151862, 151863, 151864, 151865, 151866, 151867, 151868, 151869, 151870, 151872, 151874, 151876, 151878, 151879, 151880, 151881, 151883, 151884, 151886, 151887, 151888, 151889, 151892, 151893, 151894, 151897, 151901, 151906, 151909, 151910, 151911, 151913, 151916, 151917, 151918, 151919, 151920, 151922, 151924, 151927, 151930, 151932, 151933, 151934, 151935, 151937, 151939, 151940, 151942, 151943, 151944, 151945, 151946, 151947, 151950, 151952, 151954, 151955, 151957, 151959, 151961, 151962, 151965, 151966, 151967, 151968, 151970, 151971, 151972, 151974, 151977, 151982, 151983, 151984, 151985, 151986, 151987, 151990, 151992, 151993, 151994, 151998, 151999, 152000, 152001, 152003, 152004, 152007, 152011, 152012, 152013, 152015, 152017, 152018, 152019, 152020, 152021, 152024, 152025, 152026, 152027, 152028, 152029, 152030, 152031, 152032, 152034, 152035, 152036, 152038, 152039, 152041, 152042, 152043, 152044, 152045, 152046, 152047, 152048, 152049, 152050, 152051, 152052, 152053, 152054, 152057, 152058, 152059, 152060, 152061, 152062, 152067, 152068, 152069, 152070, 152071, 152072, 152073, 152074, 152077, 152078, 152079, 152080, 152082, 152083, 152084, 152085, 152086, 152087, 152088, 152089, 152090, 152091, 152092, 152093, 152094, 152095, 152096, 152098, 152103, 152105, 152106, 152107, 152109, 152110, 152111, 152112, 152115, 152116, 152118, 152119, 152120, 152121, 152122, 152124, 152125, 152127, 152131, 152132, 152133, 152134, 152135, 152136, 152137, 152138, 152139, 152140, 152142, 152143, 152144, 152145, 152146, 152147, 152148, 152150, 152151, 152152, 152153, 152157, 152158, 152159, 152160, 152161, 152162, 152163, 152164, 152165, 152166, 152167, 152170, 152171, 152172, 152174, 152175, 152177, 152179, 152180, 152182, 152183, 152186, 152187, 152188, 152191, 152193, 152196, 152197, 152198, 152199, 152202, 152203, 152206, 152210, 152211, 152213, 152214, 152215, 152216, 152217, 152220, 152221, 152223, 152225, 152226, 152227, 152228, 152229, 152230, 152232, 152233, 152235, 152236, 152237, 152238, 152243, 152244, 152246, 152248, 152249, 152250, 152252, 152254, 152255, 152258, 152259, 152261, 152263, 152264, 152265, 152266, 152268, 152269, 152271, 152272, 152273, 152274, 152275, 152276, 152277, 152281, 152282, 152283, 152284, 152285, 152286, 152287, 152288, 152289, 152290, 152291, 152292, 152293, 152294, 152297, 152300, 152301, 152302, 152303, 152304, 152307, 152308, 152310, 152311, 152312, 152313, 152314, 152316, 152317, 152318, 152321, 152322, 152324, 152328, 152330, 152331, 152333, 152334, 152335, 152336, 152337, 152338, 152339, 152340, 152341, 152343, 152344, 152345, 152346, 152347, 152349, 152352, 152353, 152354, 152355, 152356, 152357, 152362, 152364, 152367, 152369, 152371, 152373, 152374, 152376, 152377, 152378, 152379, 152380, 152381, 152383, 152385, 152386, 152387, 152388, 152391, 152392, 152393, 152394, 152396, 152397, 152398, 152401, 152404, 152405, 152406, 152407, 152408, 152409, 152411, 152412, 152413, 152414, 152416, 152417, 152418, 152419, 152425, 152426, 152428, 152429, 152430, 152432, 152433, 152436, 152439, 152442, 152443, 152444, 152445, 152446, 152447, 152449, 152450, 152452, 152453, 152455, 152456, 152457, 152459, 152460, 152461, 152463, 152464, 152465, 152467, 152468, 152469, 152471, 152473, 152475, 152477, 152480, 152481, 152482, 152484, 152486, 152487, 152488, 152489, 152491, 152492, 152496, 152497, 152498, 152501, 152504, 152505, 152506, 152507, 152508, 152509, 152510, 152511, 152514, 152516, 152518, 152519, 152520, 152521, 152524, 152527, 152528, 152529, 152530, 152531, 152532, 152535, 152539, 152540, 152541, 152543, 152548, 152550, 152552, 152553, 152554, 152555, 152556, 152558, 152564, 152565, 152567, 152568, 152570, 152573, 152575, 152576, 152582, 152583, 152587, 152588, 152589, 152590, 152591, 152592, 152593, 152599, 152600, 152601, 152602, 152607, 152609, 152610, 152611, 152613, 152615, 152617, 152618, 152621, 152625, 152626, 152627, 152628, 152629, 152630, 152633, 152634, 152635, 152636, 152640, 152641, 152642, 152643, 152644, 152645, 152646, 152651, 152652, 152655, 152656, 152659, 152661, 152662, 152663, 152664, 152665, 152666, 152667, 152668, 152669, 152670, 152671, 152672, 152673, 152676, 152677, 152678, 152679, 152682, 152683, 152686, 152687, 152689, 152690, 152691, 152692, 152693, 152694, 152696, 152697, 152698, 152699, 152701, 152702, 152703, 152704, 152705, 152706, 152708, 152710, 152711, 152712, 152713, 152715, 152719, 152720, 152721, 152722, 152725, 152727, 152728, 152729, 152730, 152732, 152734, 152736, 152738, 152739, 152741, 152742, 152743, 152744, 152745, 152746, 152748, 152750, 152751, 152752, 152753, 152754, 152755, 152757, 152758, 152762, 152763, 152765, 152767, 152770, 152771, 152773, 152774, 152777, 152778, 152782, 152783, 152787, 152788, 152789, 152790, 152791, 152792, 152793, 152794, 152795, 152800, 152802, 152803, 152804, 152808, 152809, 152811, 152812, 152813, 152815, 152816, 152818, 152821, 152822, 152823, 152825, 152826, 152827, 152831, 152832, 152833, 152834, 152835, 152836, 152837, 152838, 152841, 152842, 152844, 152845, 152849, 152850, 152851, 152853, 152854, 152855, 152856, 152858, 152860, 152862, 152863, 152864, 152866, 152867, 152868, 152869, 152870, 152871, 152872, 152874, 152875, 152877, 152881, 152882, 152887, 152888, 152889, 152893, 152894, 152897, 152898, 152900, 152904, 152905, 152906, 152907, 152908, 152909, 152912, 152913, 152914, 152916, 152918, 152919, 152921, 152922, 152925, 152926, 152930, 152931, 152932, 152935, 152939, 152940, 152941, 152942, 152943, 152945, 152946, 152947, 152948, 152949, 152951, 152953, 152955, 152956, 152959, 152961, 152962, 152963, 152964, 152965, 152966, 152967, 152968, 152971, 152972, 152975, 152976, 152978, 152979, 152980, 152983, 152985, 152989, 152990, 152991, 152992, 152993, 152995, 152996, 152997, 153001, 153002, 153003, 153005, 153006, 153008, 153011, 153012, 153013, 153014, 153015, 153018, 153020, 153021, 153023, 153025, 153030, 153032, 153033, 153035, 153036, 153039, 153041, 153042, 153043, 153046, 153048, 153049, 153051, 153052, 153054, 153055, 153056, 153057, 153060, 153061, 153062, 153063, 153064, 153065, 153066, 153068, 153069, 153072, 153073, 153074, 153075, 153077, 153078, 153081, 153082, 153083, 153085, 153088, 153092, 153093, 153094, 153096, 153097, 153098, 153099, 153101, 153102, 153103, 153105, 153106, 153107, 153108, 153110, 153111, 153113, 153121, 153122, 153123, 153125, 153126, 153128, 153130, 153132, 153133, 153134, 153135, 153140, 153143, 153145, 153150, 153151, 153152, 153154, 153155, 153159, 153160, 153163, 153169, 153170, 153172, 153173, 153174, 153175, 153176, 153177, 153178, 153180, 153182, 153183, 153186, 153187, 153189, 153190, 153191, 153192, 153194, 153195, 153199, 153200, 153201, 153206, 153210, 153212, 153215, 153216, 153218, 153220, 153221, 153222, 153223, 153224, 153225, 153230, 153232, 153233, 153235, 153236, 153238, 153241, 153242, 153243, 153244, 153245, 153247, 153249, 153250, 153251, 153253, 153257, 153258, 153262, 153263, 153266, 153267, 153268, 153269, 153270, 153271, 153276, 153277, 153278, 153279, 153281, 153282, 153284, 153287, 153288, 153289, 153290, 153291, 153297, 153300, 153302, 153303, 153304, 153305, 153306, 153308, 153309, 153310, 153312, 153313, 153314, 153316, 153317, 153318, 153319, 153320, 153322, 153328, 153329, 153334, 153336, 153337, 153339, 153341, 153343, 153345, 153346, 153348, 153349, 153352, 153356, 153357, 153359, 153361, 153362, 153364, 153367, 153371, 153373, 153374, 153375, 153376, 153378, 153379, 153380, 153381, 153383, 153384, 153387, 153388, 153391, 153393, 153394, 153397, 153398, 153399, 153400, 153403, 153405, 153406, 153408, 153409, 153411, 153412, 153413, 153414, 153417, 153420, 153422, 153423, 153424, 153425, 153426, 153427, 153428, 153429, 153431, 153432, 153434, 153435, 153436, 153437, 153440, 153442, 153443, 153444, 153445, 153446, 153449, 153450, 153451, 153453, 153454, 153457, 153458, 153462, 153464, 153470, 153475, 153477, 153479, 153480, 153481, 153483, 153486, 153487, 153488, 153490, 153493, 153494, 153495, 153496, 153498, 153499, 153500, 153501, 153502, 153506, 153507, 153513, 153514, 153515, 153516, 153518, 153521, 153522, 153525, 153527, 153528, 153529, 153533, 153534, 153535, 153536, 153537, 153544, 153545, 153546, 153547, 153549, 153551, 153553, 153555, 153556, 153557, 153558, 153559, 153560, 153562, 153563, 153565, 153566, 153567, 153571, 153572, 153575, 153579, 153580, 153581, 153582, 153584, 153585, 153587, 153590, 153592, 153594, 153595, 153596, 153597, 153599, 153602, 153603, 153605, 153606, 153607, 153608, 153609, 153611, 153612, 153614, 153615, 153618, 153622, 153623, 153624, 153626, 153627, 153628, 153631, 153633, 153634, 153635, 153636, 153637, 153641, 153642, 153643, 153644, 153646, 153647, 153648, 153650, 153651, 153652, 153654, 153655, 153656, 153658, 153660, 153662, 153663, 153665, 153666, 153667, 153670, 153672, 153673, 153677, 153678, 153681, 153685, 153686, 153688, 153689, 153690, 153691, 153694, 153695, 153697, 153700, 153701, 153704, 153705, 153706, 153707, 153708, 153709, 153710, 153713, 153716, 153717, 153718, 153721, 153725, 153726, 153727, 153728, 153729, 153730, 153731, 153733, 153735, 153736, 153739, 153741, 153742, 153744, 153745, 153746, 153747, 153748, 153750, 153751, 153753, 153755, 153758, 153765, 153766, 153767, 153771, 153772, 153777, 153780, 153783, 153784, 153786, 153788, 153791, 153792, 153793, 153794, 153796, 153797, 153799, 153800, 153801, 153802, 153803, 153804, 153806, 153810, 153812, 153813, 153815, 153816, 153819, 153820, 153821, 153822, 153823, 153825, 153827, 153830, 153831, 153833, 153834, 153835, 153836, 153839, 153840, 153841, 153842, 153843, 153845, 153846, 153847, 153850, 153852, 153853, 153855, 153856, 153857, 153858, 153859, 153860, 153861, 153862, 153863, 153864, 153868, 153869, 153873, 153874, 153877, 153878, 153879, 153880, 153881, 153884, 153886, 153887, 153889, 153890, 153891, 153892, 153893, 153898, 153899, 153900, 153902, 153905, 153906, 153908, 153912, 153913, 153914, 153916, 153917, 153918, 153919, 153920, 153922, 153923, 153925, 153928, 153931, 153932, 153933, 153934, 153935, 153937, 153938, 153939, 153942, 153944, 153946, 153947, 153950, 153951, 153953, 153955, 153956, 153958, 153959, 153960, 153961, 153962, 153966, 153968, 153969, 153971, 153972, 153975, 153977, 153980, 153981, 153983, 153985, 153987, 153989, 153991, 153995, 153996, 153998, 154001, 154002, 154004, 154006, 154007, 154010, 154011, 154013, 154014, 154015, 154018, 154019, 154020, 154022, 154023, 154025, 154027, 154028, 154031, 154034, 154036, 154038, 154040, 154043, 154044, 154045, 154047, 154048, 154049, 154050, 154054, 154056, 154057, 154059, 154060, 154064, 154066, 154067, 154070, 154071, 154072, 154073, 154074, 154075, 154076, 154077, 154078, 154080, 154081, 154082, 154083, 154085, 154090, 154091, 154092, 154093, 154097, 154098, 154102, 154104, 154105, 154106, 154107, 154110, 154111, 154112, 154113, 154114, 154115, 154116, 154117, 154118, 154121, 154122, 154124, 154125, 154126, 154127, 154128, 154129, 154131, 154132, 154133, 154134, 154135, 154136, 154141, 154142, 154147, 154149, 154152, 154153, 154154, 154156, 154157, 154158, 154160, 154162, 154163, 154164, 154165, 154168, 154171, 154174, 154175, 154182, 154183, 154185, 154188, 154189, 154193, 154195, 154196, 154199, 154201, 154203, 154204, 154206, 154207, 154209, 154211, 154212, 154213, 154214, 154217, 154218, 154219, 154220, 154223, 154227, 154228, 154231, 154234, 154235, 154238, 154239, 154240, 154241, 154242, 154243, 154244, 154245, 154246, 154247, 154248, 154250, 154251, 154256, 154259, 154264, 154265, 154267, 154269, 154270, 154271, 154272, 154273, 154275, 154276, 154277, 154281, 154282, 154283, 154284, 154289, 154291, 154292, 154295, 154297, 154300, 154302, 154303, 154305, 154306, 154309, 154310, 154311, 154312, 154314, 154315, 154316, 154318, 154319, 154320, 154322, 154323, 154324, 154325, 154326, 154329, 154332, 154336, 154339, 154341, 154342, 154343, 154344, 154345, 154346, 154347, 154348, 154351, 154352, 154356, 154358, 154359, 154360, 154361, 154366, 154370, 154379, 154382, 154383, 154384, 154385, 154388, 154389, 154390, 154391, 154393, 154395, 154396, 154400, 154403, 154404, 154405, 154407, 154408, 154409, 154412, 154413, 154414, 154415, 154420, 154421, 154423, 154425, 154426, 154427, 154429, 154430, 154431, 154432, 154433, 154435, 154436, 154437, 154438, 154441, 154442, 154445, 154449, 154450, 154451, 154452, 154455, 154458, 154460, 154465, 154466, 154467, 154469, 154470, 154473, 154476, 154477, 154478, 154479, 154480, 154481, 154482, 154483, 154486, 154487, 154488, 154489, 154490, 154491, 154493, 154495, 154496, 154497, 154498, 154499, 154503, 154505, 154506, 154507, 154508, 154511, 154512, 154513, 154515, 154516, 154517, 154520, 154522, 154523, 154526, 154527, 154530, 154532, 154536, 154538, 154541, 154542, 154546, 154549, 154551, 154552, 154553, 154554, 154556, 154561, 154565, 154568, 154570, 154572, 154573, 154574, 154575, 154577, 154580, 154585, 154586, 154591, 154592, 154593, 154594, 154595, 154600, 154603, 154605, 154608, 154609, 154610, 154611, 154613, 154614, 154619, 154620, 154621, 154622, 154623, 154624, 154625, 154626, 154627, 154630, 154631, 154633, 154634, 154637, 154638, 154639, 154642, 154643, 154647, 154649, 154650, 154651, 154653, 154654, 154656, 154657, 154660, 154661, 154662, 154664, 154668, 154671, 154675, 154677, 154679, 154681, 154684, 154686, 154687, 154688, 154689, 154691, 154693, 154694, 154695, 154697, 154699, 154700, 154701, 154702, 154704, 154706, 154707, 154709, 154710, 154711, 154714, 154715, 154721, 154723, 154724, 154728, 154729, 154732, 154735, 154736, 154737, 154742, 154745, 154747, 154748, 154749, 154750, 154751, 154753, 154754, 154755, 154757, 154760, 154761, 154762, 154763, 154765, 154766, 154767, 154768, 154769, 154770, 154771, 154773, 154776, 154778, 154787, 154788, 154790, 154793, 154801, 154803, 154805, 154806, 154807, 154810, 154811, 154812, 154815, 154816, 154817, 154818, 154824, 154826, 154828, 154829, 154830, 154831, 154833, 154834, 154835, 154837, 154838, 154839, 154842, 154843, 154844, 154845, 154850, 154853, 154854, 154855, 154856, 154857, 154859, 154861, 154864, 154870, 154871, 154872, 154877, 154878, 154879, 154881, 154885, 154886, 154887, 154889, 154890, 154898, 154899, 154901, 154902, 154904, 154906, 154907, 154910, 154911, 154912, 154914, 154916, 154917, 154918, 154919, 154920, 154921, 154926, 154927, 154930, 154935, 154941, 154942, 154943, 154948, 154950, 154955, 154956, 154957, 154958, 154959, 154962, 154965, 154968, 154969, 154970, 154972, 154973, 154976, 154978, 154981, 154983, 154984, 154985, 154986, 154987, 154989, 154994, 154995, 154999, 155003, 155005, 155006, 155007, 155008, 155009, 155013, 155014, 155015, 155019, 155021, 155022, 155023, 155026, 155028, 155032, 155033, 155035, 155037, 155040, 155041, 155045, 155047, 155049, 155051, 155052, 155055, 155057, 155058, 155060, 155063, 155066, 155067, 155068, 155069, 155071, 155072, 155073, 155075, 155076, 155077, 155078, 155082, 155083, 155086, 155087, 155091, 155093, 155095, 155096, 155100, 155104, 155108, 155110, 155111, 155112, 155113, 155114, 155117, 155119, 155122, 155125, 155126, 155130, 155131, 155134, 155138, 155139, 155140, 155141, 155144, 155147, 155148, 155149, 155151, 155152, 155154, 155156, 155158, 155159, 155160, 155161, 155162, 155163, 155164, 155165, 155167, 155169, 155173, 155175, 155177, 155180, 155181, 155182, 155184, 155185, 155188, 155189, 155190, 155191, 155192, 155193, 155194, 155195, 155196, 155197, 155198, 155199, 155200, 155202, 155204, 155205, 155207, 155210, 155211, 155213, 155214, 155215, 155217, 155218, 155219, 155222, 155224, 155225, 155226, 155230, 155231, 155237, 155241, 155242, 155244, 155248, 155249, 155252, 155253, 155256, 155258, 155262, 155264, 155266, 155267, 155269, 155271, 155274, 155282, 155284, 155289, 155291, 155294, 155296, 155302, 155303, 155304, 155307, 155309, 155310, 155312, 155316, 155317, 155318, 155320, 155323, 155324, 155326, 155327, 155328, 155329, 155333, 155335, 155336, 155337, 155338, 155339, 155341, 155347, 155348, 155350, 155351, 155354, 155355, 155357, 155358, 155360, 155361, 155367, 155369, 155372, 155374, 155379, 155380, 155381, 155382, 155383, 155385, 155389, 155392, 155393, 155397, 155398, 155401, 155404, 155405, 155406, 155407, 155410, 155411, 155414, 155415, 155417, 155420, 155424, 155426, 155428, 155430, 155431, 155434, 155435, 155436, 155438, 155440, 155442, 155443, 155445, 155448, 155449, 155450, 155451, 155452, 155453, 155455, 155456, 155458, 155459, 155462, 155463, 155468, 155470, 155471, 155472, 155474, 155477, 155478, 155482, 155483, 155484, 155485, 155489, 155490, 155492, 155494, 155497, 155498, 155499, 155501, 155503, 155507, 155509, 155510, 155511, 155512, 155513, 155515, 155516, 155531, 155533, 155534, 155535, 155538, 155539, 155543, 155545, 155547, 155548, 155549, 155550, 155552, 155555, 155557, 155558, 155559, 155563, 155564, 155566, 155569, 155571, 155572, 155573, 155575, 155576, 155582, 155584, 155586, 155587, 155588, 155589, 155591, 155593, 155594, 155595, 155599, 155601, 155602, 155604, 155608, 155610, 155612, 155613, 155615, 155617, 155621, 155623, 155625, 155626, 155627, 155633, 155639, 155640, 155641, 155647, 155648, 155650, 155653, 155654, 155655, 155656, 155658, 155659, 155661, 155665, 155668, 155669, 155670, 155671, 155672, 155673, 155674, 155675, 155682, 155685, 155687, 155688, 155692, 155694, 155699, 155700, 155705, 155707, 155711, 155715, 155716, 155720, 155731, 155734, 155735, 155736, 155737, 155741, 155743, 155744, 155745, 155747, 155749, 155750, 155754, 155761, 155762, 155767, 155768, 155770, 155771, 155773, 155774, 155775, 155780, 155781, 155782, 155783, 155784, 155786, 155787, 155788, 155790, 155791, 155798, 155799, 155801, 155803, 155804, 155805, 155806, 155808, 155813, 155814, 155818, 155820, 155824, 155825, 155826, 155827, 155833, 155835, 155838, 155843, 155845, 155846, 155847, 155848, 155849, 155850, 155851, 155854, 155856, 155859, 155861, 155862, 155863, 155864, 155867, 155871, 155872, 155873, 155875, 155878, 155879, 155884, 155885, 155886, 155890, 155893, 155894, 155895, 155896, 155899, 155900, 155904, 155907, 155910, 155911, 155915, 155916, 155919, 155920, 155922, 155925, 155926, 155928, 155930, 155931, 155934, 155937, 155939, 155943, 155949, 155950, 155952, 155953, 155954, 155955, 155958, 155960, 155961, 155964, 155965, 155967, 155971, 155972, 155974, 155975, 155976, 155978, 155982, 155984, 155985, 155988, 155995, 156000, 156003, 156005, 156006, 156007, 156009, 156011, 156013, 156014, 156016, 156017, 156021, 156023, 156027, 156030, 156031, 156033, 156035, 156041, 156046, 156047, 156050, 156051, 156052, 156053, 156055, 156057, 156063, 156064, 156076, 156077, 156078, 156079, 156080, 156082, 156085, 156089, 156090, 156094, 156095, 156096, 156098, 156104, 156105, 156109, 156110, 156112, 156113, 156116, 156117, 156118, 156119, 156121, 156124, 156125, 156126, 156127, 156128, 156132, 156133, 156136, 156138, 156147, 156150, 156151, 156154, 156155, 156156, 156157, 156159, 156163, 156168, 156169, 156170, 156172, 156173, 156174, 156175, 156178, 156180, 156182, 156183, 156186, 156187, 156195, 156197, 156199, 156201, 156203, 156204, 156207, 156210, 156211, 156212, 156213, 156216, 156219, 156220, 156221, 156223, 156224, 156227, 156228, 156232, 156234, 156235, 156236, 156238, 156239, 156241, 156244, 156246, 156249, 156255, 156257, 156258, 156259, 156262, 156263, 156264, 156265, 156266, 156267, 156268, 156269, 156275, 156277, 156278, 156280, 156285, 156286, 156287, 156289, 156291, 156292, 156294, 156295, 156296, 156299, 156300, 156301, 156303, 156307, 156308, 156310, 156312, 156315, 156316, 156319, 156322, 156323, 156325, 156327, 156331, 156333, 156340, 156342, 156344, 156349, 156350, 156355, 156358, 156359, 156360, 156362, 156363, 156364, 156365, 156366, 156367, 156368, 156369, 156372, 156374, 156375, 156377, 156378, 156379, 156385, 156390, 156392, 156395, 156399, 156402, 156405, 156408, 156409, 156410, 156411, 156414, 156418, 156421, 156423, 156424, 156426, 156429, 156430, 156431, 156437, 156438, 156439, 156440, 156441, 156444, 156446, 156447, 156448, 156449, 156453, 156454, 156458, 156464, 156465, 156466, 156469, 156470, 156471, 156476, 156481, 156483, 156488, 156490, 156491, 156493, 156495, 156496, 156500, 156502, 156503, 156507, 156510, 156516, 156517, 156518, 156519, 156521, 156524, 156526, 156530, 156531, 156534, 156535, 156536, 156537, 156538, 156541, 156544, 156545, 156551, 156552, 156554, 156556, 156557, 156559, 156563, 156566, 156567, 156570, 156571, 156572, 156576, 156577, 156580, 156581, 156582, 156584, 156586, 156587, 156590, 156591, 156592, 156593, 156600, 156607, 156612, 156614, 156619, 156620, 156622, 156624, 156627, 156632, 156635, 156637, 156639, 156642, 156644, 156647, 156648, 156650, 156651, 156653, 156654, 156655, 156658, 156659, 156663, 156666, 156667, 156669, 156670, 156672, 156673, 156674, 156677, 156679, 156681, 156682, 156685, 156686, 156687, 156690, 156691, 156693, 156694, 156696, 156701, 156702, 156704, 156706, 156707, 156708, 156718, 156720, 156723, 156724, 156727, 156730, 156732, 156733, 156736, 156740, 156743, 156744, 156747, 156751, 156752, 156757, 156760, 156761, 156762, 156764, 156775, 156777, 156778, 156780, 156781, 156787, 156791, 156793, 156795, 156796, 156797, 156798, 156803, 156804, 156806, 156808, 156812, 156814, 156815, 156822, 156828, 156830, 156832, 156834, 156835, 156836, 156839, 156841, 156845, 156847, 156848, 156850, 156852, 156853, 156860, 156862, 156864, 156865, 156870, 156871, 156872, 156877, 156880, 156881, 156883, 156885, 156887, 156888, 156889, 156890, 156892, 156897, 156898, 156900, 156903, 156911, 156919, 156920, 156922, 156924, 156926, 156929, 156934, 156936, 156938, 156940, 156947, 156948, 156950, 156951, 156953, 156954, 156957, 156958, 156959, 156964, 156966, 156968, 156970, 156971, 156972, 156983, 156984, 156992, 156994, 156996, 156997, 156998, 157000, 157002, 157004, 157009, 157010, 157011, 157012, 157013, 157014, 157016, 157020, 157021, 157025, 157030, 157032, 157034, 157035, 157039, 157040, 157041, 157044, 157047, 157050, 157051, 157053, 157054, 157060, 157061, 157063, 157064, 157067, 157071, 157074, 157075, 157076, 157077, 157078, 157081, 157084, 157089, 157092, 157093, 157094, 157095, 157096, 157099, 157104, 157105, 157106, 157108, 157109, 157112, 157113, 157114, 157115, 157119, 157121, 157124, 157125, 157126, 157132, 157133, 157135, 157141, 157143, 157150, 157151, 157153, 157154, 157155, 157160, 157161, 157162, 157164, 157165, 157166, 157170, 157174, 157175, 157176, 157177, 157180, 157181, 157186, 157190, 157192, 157196, 157200, 157201, 157207, 157208, 157210, 157213, 157215, 157221, 157222, 157223, 157226, 157229, 157233, 157234, 157235, 157242, 157245, 157247, 157249, 157254, 157256, 157257, 157258, 157259, 157261, 157265, 157267, 157276, 157282, 157288, 157290, 157294, 157295, 157296, 157299, 157301, 157307, 157308, 157311, 157314, 157320, 157324, 157325, 157328, 157329, 157330, 157333, 157335, 157338, 157344, 157347, 157348, 157350, 157351, 157353, 157354, 157356, 157358, 157360, 157364, 157368, 157370, 157374, 157375, 157377, 157382, 157385, 157388, 157389, 157392, 157393, 157394, 157396, 157401, 157413, 157414, 157416, 157421, 157423, 157424, 157429, 157433, 157434, 157436, 157437, 157439, 157442, 157443, 157444, 157450, 157452, 157454, 157455, 157456, 157460, 157464, 157470, 157472, 157473, 157474, 157475, 157476, 157477, 157480, 157486, 157489, 157494, 157498, 157500, 157503, 157507, 157514, 157516, 157517, 157518, 157520, 157521, 157525, 157526, 157527, 157528, 157530, 157533, 157535, 157536, 157538, 157543, 157545, 157547, 157550, 157551, 157552, 157553, 157557, 157558, 157560, 157561, 157562, 157567, 157570, 157571, 157572, 157573, 157574, 157579, 157581, 157583, 157584, 157589, 157591, 157592, 157597, 157600, 157604, 157609, 157611, 157613, 157614, 157616, 157619, 157620, 157621, 157626, 157628, 157631, 157633, 157634, 157635, 157638, 157641, 157642, 157643, 157644, 157645, 157646, 157647, 157652, 157654, 157658, 157659, 157661, 157663, 157666, 157675, 157679, 157680, 157682, 157687, 157690, 157694, 157699, 157702, 157707, 157709, 157711, 157712, 157713, 157714, 157715, 157716, 157717, 157718, 157720, 157724, 157730, 157731, 157734, 157735, 157737, 157740, 157742, 157744, 157746, 157750, 157754, 157763, 157764, 157768, 157773, 157779, 157782, 157783, 157786, 157790, 157791, 157794, 157796, 157797, 157801, 157803, 157809, 157810, 157811, 157817, 157819, 157820, 157822, 157823, 157825, 157831, 157833, 157836, 157839, 157840, 157846, 157848, 157850, 157851, 157856, 157857, 157859, 157861, 157864, 157865, 157866, 157869, 157872, 157878, 157882, 157883, 157884, 157885, 157887, 157892, 157900, 157904, 157906, 157911, 157914, 157916, 157917, 157924, 157931, 157934, 157938, 157939, 157940, 157943, 157947, 157953, 157957, 157963, 157970, 157971, 157972, 157973, 157975, 157976, 157977, 157979, 157981, 157984, 157987, 157988, 157991, 157992, 157994, 157995, 158000, 158002, 158003, 158004, 158006, 158010, 158011, 158013, 158015, 158016, 158018, 158019, 158020, 158022, 158023, 158025, 158026, 158027, 158029, 158030, 158031, 158033, 158039, 158040, 158041, 158042, 158050, 158051, 158052, 158053, 158054, 158058, 158059, 158065, 158066, 158068, 158070, 158074, 158078, 158079, 158081, 158082, 158084, 158086, 158089, 158093, 158095, 158099, 158101, 158102, 158103, 158104, 158105, 158108, 158109, 158114, 158116, 158117, 158123, 158127, 158131, 158132, 158133, 158134, 158141, 158142, 158147, 158148, 158152, 158158, 158163, 158164, 158165, 158167, 158171, 158172, 158173, 158176, 158181, 158183, 158185, 158188, 158191, 158192, 158193, 158195, 158197, 158200, 158205, 158212, 158215, 158217, 158221, 158222, 158226, 158227, 158228, 158230, 158235, 158241, 158242, 158243, 158246, 158247, 158248, 158252, 158255, 158257, 158260, 158261, 158268, 158275, 158279, 158282, 158283, 158285, 158286, 158288, 158296, 158307, 158308, 158310, 158311, 158312, 158314, 158320, 158321, 158324, 158327, 158329, 158330, 158331, 158336, 158340, 158341, 158342, 158345, 158346, 158347, 158348, 158354, 158360, 158361, 158362, 158366, 158367, 158370, 158371, 158375, 158380, 158381, 158391, 158393, 158394, 158401, 158403, 158406, 158407, 158408, 158409, 158412, 158414, 158419, 158423, 158431, 158439, 158442, 158451, 158455, 158457, 158462, 158463, 158466, 158467, 158469, 158471, 158472, 158473, 158475, 158478, 158482, 158486, 158487, 158488, 158490, 158491, 158493, 158497, 158502, 158503, 158511, 158515, 158519, 158522, 158529, 158530, 158531, 158535, 158536, 158537, 158540, 158541, 158547, 158548, 158549, 158554, 158555, 158557, 158560, 158564, 158565, 158566, 158567, 158568, 158571, 158572, 158573, 158575, 158577, 158588, 158589, 158596, 158601, 158605, 158606, 158608, 158611, 158612, 158615, 158617, 158618, 158624, 158626, 158628, 158631, 158632, 158636, 158642, 158645, 158646, 158649, 158651, 158657, 158661, 158664, 158669, 158670, 158671, 158676, 158677, 158679, 158680, 158681, 158684, 158688, 158691, 158692, 158694, 158701, 158702, 158706, 158707, 158719, 158722, 158723, 158725, 158728, 158729, 158730, 158733, 158735, 158738, 158739, 158743, 158748, 158750, 158755, 158757, 158758, 158761, 158765, 158767, 158774, 158779, 158783, 158785, 158786, 158788, 158792, 158796, 158804, 158805, 158807, 158810, 158814, 158818, 158823, 158827, 158830, 158832, 158835, 158836, 158837, 158839, 158840, 158841, 158842, 158852, 158854, 158856, 158860, 158861, 158865, 158872, 158876, 158879, 158880, 158884, 158887, 158891, 158893, 158901, 158902, 158904, 158906, 158912, 158913, 158916, 158919, 158920, 158921, 158925, 158928, 158929, 158941, 158943, 158945, 158953, 158954, 158956, 158960, 158961, 158963, 158965, 158967, 158970, 158974, 158975, 158976, 158977, 158982, 158987, 158988, 158991, 158996, 158997, 158999, 159010, 159012, 159014, 159015, 159017, 159018, 159022, 159023, 159026, 159029, 159036, 159039, 159046, 159049, 159052, 159055, 159056, 159057, 159059, 159066, 159071, 159072, 159073, 159077, 159084, 159094, 159097, 159099, 159100, 159103, 159104, 159105, 159106, 159107, 159109, 159111, 159112, 159113, 159116, 159117, 159122, 159124, 159128, 159133, 159134, 159135, 159136, 159137, 159139, 159140, 159141, 159144, 159147, 159152, 159153, 159157, 159158, 159161, 159162, 159164, 159165, 159167, 159168, 159170, 159171, 159172, 159178, 159182, 159185, 159197, 159198, 159201, 159203, 159204, 159206, 159208, 159209, 159210, 159218, 159220, 159223, 159225, 159230, 159232, 159233, 159234, 159241, 159246, 159249, 159250, 159252, 159254, 159257, 159259, 159260, 159261, 159262, 159265, 159266, 159269, 159270, 159272, 159273, 159280, 159283, 159286, 159295, 159297, 159299, 159302, 159303, 159306, 159309, 159312, 159315, 159319, 159322, 159326, 159328, 159330, 159336, 159342, 159344, 159347, 159349, 159357, 159358, 159360, 159364, 159367, 159369, 159370, 159371, 159373, 159375, 159378, 159381, 159382, 159383, 159394, 159400, 159406, 159409, 159413, 159416, 159422, 159428, 159429, 159431, 159434, 159439, 159446, 159450, 159451, 159452, 159453, 159455, 159456, 159459, 159461, 159462, 159463, 159464, 159469, 159471, 159472, 159473, 159475, 159476, 159479, 159489, 159490, 159492, 159493, 159501, 159502, 159512, 159513, 159515, 159519, 159520, 159521, 159524, 159527, 159529, 159530, 159542, 159550, 159552, 159557, 159560, 159563, 159564, 159572, 159573, 159574, 159576, 159578, 159580, 159588, 159595, 159597, 159600, 159606, 159607, 159611, 159613, 159614, 159615, 159616, 159618, 159622, 159629, 159630, 159633, 159639, 159643, 159647, 159648, 159650, 159655, 159659, 159660, 159665, 159675, 159679, 159683, 159687, 159689, 159690, 159694, 159699, 159701, 159702, 159703, 159706, 159710, 159711, 159712, 159714, 159718, 159719, 159720, 159721, 159727, 159729, 159731, 159734, 159737, 159739, 159741, 159743, 159745, 159746, 159747, 159748, 159749, 159753, 159754, 159755, 159756, 159757, 159760, 159766, 159772, 159775, 159776, 159778, 159783, 159792, 159793, 159800, 159801, 159802, 159809, 159811, 159818, 159819, 159821, 159822, 159825, 159829, 159835, 159837, 159838, 159839, 159843, 159845, 159846, 159851, 159855, 159857, 159858, 159868, 159872, 159877, 159889, 159893, 159894, 159895, 159896, 159901, 159902, 159908, 159911, 159913, 159914, 159917, 159922, 159923, 159925, 159926, 159927, 159930, 159932, 159933, 159938, 159942, 159944, 159945, 159946, 159950, 159952, 159953, 159954, 159955, 159966, 159967, 159970, 159972, 159975, 159977, 159978, 159979, 159980, 159983, 159988, 159991, 159994, 159995, 159996, 159997, 160003, 160006, 160008, 160010, 160013, 160014, 160015, 160016, 160022, 160033, 160034, 160036, 160039, 160044, 160045, 160048, 160050, 160056, 160060, 160061, 160064, 160073, 160085, 160090, 160092, 160094, 160097, 160103, 160108, 160109, 160113, 160115, 160116, 160117, 160124, 160127, 160129, 160133, 160137, 160139, 160141, 160143, 160154, 160157, 160160, 160161, 160162, 160166, 160167, 160172, 160174, 160180, 160181, 160188, 160200, 160201, 160202, 160204, 160206, 160207, 160215, 160218, 160219, 160220, 160221, 160222, 160227, 160230, 160235, 160240, 160242, 160243, 160246, 160265, 160269, 160274, 160278, 160285, 160291, 160297, 160302, 160305, 160306, 160316, 160317, 160323, 160324, 160327, 160328, 160329, 160333, 160339, 160340, 160342, 160343, 160345, 160351, 160353, 160355, 160358, 160360, 160371, 160376, 160380, 160384, 160385, 160386, 160393, 160398, 160405, 160410, 160412, 160413, 160415, 160418, 160420, 160427, 160429, 160432, 160433, 160439, 160442, 160444, 160453, 160455, 160465, 160469, 160475, 160477, 160487, 160489, 160492, 160493, 160502, 160505, 160507, 160523, 160526, 160531, 160537, 160541, 160542, 160544, 160545, 160550, 160554, 160556, 160562, 160563, 160565, 160568, 160574, 160578, 160580, 160581, 160589, 160592, 160598, 160602, 160604, 160607, 160608, 160609, 160611, 160613, 160616, 160621, 160628, 160630, 160637, 160638, 160647, 160650, 160653, 160666, 160671, 160678, 160687, 160695, 160701, 160706, 160710, 160711, 160712, 160714, 160717, 160730, 160732, 160737, 160743, 160744, 160753, 160756, 160757, 160761, 160763, 160765, 160769, 160771, 160773, 160780, 160781, 160789, 160798, 160801, 160804, 160807, 160812, 160814, 160816, 160818, 160819, 160821, 160824, 160825, 160826, 160829, 160831, 160832, 160836, 160837, 160841, 160844, 160849, 160850, 160852, 160861, 160864, 160868, 160870, 160872, 160873, 160874, 160879, 160883, 160886, 160888, 160889, 160892, 160893, 160899, 160900, 160902, 160904, 160912, 160925, 160926, 160927, 160930, 160934, 160936, 160937, 160938, 160944, 160947, 160948, 160953, 160960, 160964, 160979, 160982, 160987, 160988, 160995, 160997, 160998, 161002, 161003, 161004, 161005, 161010, 161018, 161025, 161026, 161030, 161035, 161036, 161040, 161041, 161043, 161045, 161047, 161053, 161054, 161055, 161057, 161062, 161065, 161066, 161069, 161071, 161072, 161073, 161080, 161084, 161086, 161093, 161094, 161095, 161112, 161114, 161117, 161118, 161123, 161131, 161138, 161140, 161144, 161146, 161147, 161149, 161158, 161159, 161164, 161165, 161167, 161173, 161175, 161179, 161183, 161186, 161189, 161191, 161201, 161203, 161205, 161206, 161210, 161212, 161218, 161227, 161228, 161230, 161232, 161236, 161238, 161242, 161243, 161246, 161249, 161251, 161252, 161253, 161255, 161257, 161259, 161264, 161265, 161267, 161269, 161272, 161274, 161283, 161284, 161287, 161288, 161291, 161295, 161302, 161309, 161310, 161314, 161315, 161316, 161320, 161327, 161329, 161332, 161338, 161343, 161345, 161349, 161351, 161354, 161357, 161359, 161361, 161365, 161366, 161367, 161369, 161370, 161371, 161372, 161376, 161377, 161380, 161384, 161385, 161389, 161391, 161394, 161395, 161398, 161402, 161407, 161408, 161413, 161414, 161416, 161417, 161419, 161422, 161426, 161427, 161429, 161437, 161443, 161445, 161451, 161457, 161458, 161459, 161460, 161472, 161476, 161487, 161491, 161493, 161497, 161501, 161503, 161505, 161509, 161510, 161512, 161513, 161518, 161520, 161527, 161542, 161543, 161545, 161546, 161548, 161554, 161561, 161563, 161564, 161570, 161573, 161574, 161575, 161579, 161584, 161586, 161598, 161602, 161605, 161609, 161616, 161618, 161625, 161632, 161636, 161640, 161641, 161643, 161644, 161646, 161648, 161655, 161663, 161664, 161665, 161669, 161670, 161671, 161677, 161679, 161682, 161684, 161685, 161692, 161697, 161699, 161703, 161708, 161712, 161716, 161718, 161720, 161721, 161724, 161725, 161726, 161729, 161730, 161738, 161748, 161749, 161750, 161752, 161763, 161764, 161767, 161768, 161779, 161783, 161787, 161789, 161791, 161792, 161794, 161796, 161797, 161798, 161803, 161806, 161807, 161813, 161814, 161819, 161822, 161825, 161827, 161829, 161830, 161833, 161835, 161838, 161845, 161848, 161854, 161856, 161860, 161864, 161868, 161871, 161879, 161882, 161885, 161890, 161898, 161900, 161907, 161913, 161916, 161919, 161922, 161923, 161939, 161940, 161943, 161945, 161946, 161948, 161951, 161952, 161956, 161959, 161969, 161973, 161978, 161980, 161985, 161991, 162009, 162017, 162021, 162023, 162033, 162048, 162051, 162058, 162062, 162065, 162066, 162078, 162084, 162086, 162092, 162094, 162095, 162100, 162108, 162110, 162111, 162127, 162129, 162130, 162132, 162134, 162135, 162137, 162140, 162141, 162144, 162145, 162149, 162151, 162153, 162154, 162158, 162159, 162163, 162164, 162170, 162172, 162174, 162178, 162179, 162185, 162186, 162192, 162193, 162194, 162195, 162200, 162205, 162209, 162211, 162215, 162225, 162226, 162227, 162231, 162241, 162247, 162249, 162252, 162262, 162263, 162270, 162271, 162274, 162278, 162280, 162283, 162285, 162302, 162312, 162313, 162318, 162319, 162321, 162322, 162325, 162329, 162330, 162331, 162334, 162338, 162339, 162344, 162345, 162352, 162355, 162364, 162365, 162366, 162371, 162377, 162379, 162380, 162385, 162395, 162399, 162404, 162405, 162411, 162413, 162418, 162421, 162428, 162429, 162433, 162434, 162437, 162447, 162458, 162467, 162469, 162475, 162480, 162484, 162496, 162497, 162502, 162508, 162516, 162521, 162524, 162526, 162545, 162553, 162559, 162561, 162566, 162574, 162576, 162587, 162591, 162593, 162603, 162610, 162612, 162613, 162621, 162624, 162625, 162631, 162633, 162635, 162639, 162643, 162651, 162654, 162656, 162658, 162672, 162681, 162684, 162687, 162689, 162690, 162693, 162694, 162706, 162712, 162713, 162718, 162719, 162723, 162729, 162731, 162734, 162736, 162738, 162746, 162749, 162753, 162755, 162757, 162760, 162764, 162766, 162767, 162772, 162774, 162776, 162779, 162781, 162782, 162786, 162790, 162795, 162796, 162797, 162798, 162801, 162809, 162815, 162817, 162820, 162821, 162828, 162830, 162834, 162835, 162837, 162843, 162845, 162847, 162849, 162851, 162854, 162855, 162856, 162861, 162863, 162869, 162870, 162871, 162872, 162880, 162882, 162887, 162895, 162896, 162899, 162900, 162904, 162905, 162911, 162912, 162913, 162917, 162926, 162937, 162944, 162947, 162951, 162956, 162961, 162962, 162970, 162980, 162981, 162988, 162996, 163005, 163007, 163008, 163009, 163017, 163019, 163025, 163033, 163039, 163041, 163048, 163050, 163057, 163062, 163066, 163067, 163068, 163081, 163084, 163088, 163092, 163094, 163113, 163114, 163121, 163126, 163128, 163131, 163139, 163142, 163143, 163144, 163146, 163148, 163155, 163157, 163164, 163165, 163178, 163180, 163181, 163182, 163184, 163189, 163190, 163192, 163195, 163198, 163199, 163205, 163214, 163221, 163222, 163224, 163225, 163227, 163232, 163234, 163237, 163240, 163241, 163249, 163253, 163254, 163262, 163263, 163273, 163275, 163276, 163293, 163294, 163297, 163298, 163299, 163301, 163305, 163316, 163322, 163323, 163325, 163329, 163335, 163338, 163340, 163342, 163357, 163358, 163360, 163361, 163363, 163365, 163369, 163371, 163377, 163378, 163379, 163380, 163386, 163393, 163394, 163399, 163407, 163408, 163409, 163419, 163427, 163437, 163443, 163445, 163446, 163447, 163448, 163455, 163457, 163460, 163466, 163467, 163469, 163471, 163475, 163479, 163485, 163489, 163493, 163495, 163496, 163502, 163503, 163506, 163507, 163515, 163520, 163525, 163529, 163531, 163533, 163535, 163536, 163537, 163538, 163542, 163543, 163545, 163551, 163556, 163559, 163567, 163568, 163570, 163575, 163577, 163579, 163584, 163585, 163591, 163594, 163601, 163604, 163606, 163610, 163616, 163619, 163620, 163628, 163632, 163634, 163643, 163645, 163648, 163652, 163653, 163657, 163659, 163660, 163662, 163663, 163665, 163668, 163670, 163673, 163674, 163676, 163677, 163680, 163684, 163688, 163692, 163696, 163697, 163698, 163699, 163706, 163707, 163709, 163714, 163715, 163722, 163726, 163740, 163741, 163743, 163750, 163753, 163754, 163755, 163757, 163762, 163769, 163776, 163785, 163787, 163788, 163791, 163792, 163806, 163809, 163820, 163824, 163827, 163828, 163839, 163841, 163845, 163847, 163852, 163854, 163856, 163859, 163863, 163866, 163867, 163872, 163873, 163877, 163879, 163881, 163882, 163886, 163891, 163896, 163897, 163898, 163904, 163906, 163908, 163909, 163918, 163921, 163925, 163930, 163935, 163937, 163939, 163946, 163961, 163964, 163965, 163978, 163979, 163982, 163983, 163987, 163988, 163989, 163993, 163998, 164002, 164003, 164006, 164010, 164011, 164023, 164024, 164025, 164030, 164032, 164033, 164038, 164039, 164053, 164065, 164069, 164072, 164077, 164078, 164080, 164084, 164085, 164088, 164092, 164098, 164101, 164109, 164110, 164117, 164122, 164128, 164143, 164149, 164154, 164160, 164164, 164166, 164174, 164176, 164178, 164179, 164183, 164193, 164200, 164202, 164208, 164209, 164212, 164215, 164216, 164217, 164225, 164226, 164227, 164229, 164240, 164243, 164244, 164254, 164267, 164275, 164277, 164281, 164295, 164310, 164317, 164320, 164321, 164324, 164327, 164333, 164334, 164335, 164337, 164338, 164340, 164344, 164345, 164348, 164354, 164356, 164359, 164364, 164375, 164380, 164393, 164394, 164399, 164406, 164407, 164408, 164430, 164435, 164439, 164440, 164452, 164458, 164465, 164476, 164480, 164485, 164488, 164492, 164512, 164515, 164516, 164517, 164519, 164521, 164526, 164528, 164531, 164535, 164536, 164541, 164542, 164550, 164553, 164554, 164558, 164560, 164563, 164566, 164568, 164582, 164586, 164617, 164619, 164621, 164626, 164627, 164628, 164629, 164632, 164637, 164642, 164647, 164655, 164662, 164665, 164668, 164677, 164678, 164680, 164685, 164693, 164695, 164708, 164709, 164712, 164715, 164725, 164726, 164729, 164731, 164739, 164744, 164748, 164755, 164762, 164763, 164765, 164770, 164772, 164781, 164787, 164792, 164795, 164797, 164798, 164800, 164804, 164806, 164809, 164811, 164818, 164820, 164831, 164836, 164839, 164845, 164846, 164854, 164860, 164867, 164875, 164877, 164881, 164884, 164885, 164895, 164899, 164909, 164912, 164919, 164924, 164928, 164929, 164930, 164937, 164939, 164951, 164953, 164957, 164962, 164964, 164966, 164967, 164969, 164978, 164980, 164981, 164982, 164985, 164999, 165000, 165008, 165009, 165012, 165016, 165021, 165027, 165030, 165031, 165037, 165039, 165042, 165048, 165052, 165059, 165065, 165066, 165069, 165071, 165080, 165086, 165088, 165095, 165100, 165107, 165118, 165125, 165129, 165135, 165141, 165143, 165149, 165153, 165155, 165157, 165158, 165159, 165163, 165164, 165166, 165168, 165169, 165174, 165176, 165179, 165185, 165190, 165196, 165210, 165211, 165214, 165219, 165220, 165225, 165229, 165233, 165234, 165235, 165237, 165240, 165243, 165245, 165249, 165252, 165258, 165260, 165264, 165271, 165274, 165275, 165283, 165298, 165300, 165302, 165309, 165310, 165317, 165326, 165331, 165332, 165334, 165338, 165341, 165344, 165347, 165348, 165349, 165351, 165356, 165358, 165359, 165365, 165367, 165388, 165393, 165395, 165396, 165403, 165404, 165407, 165417, 165431, 165434, 165436, 165440, 165449, 165459, 165460, 165461, 165464, 165477, 165478, 165483, 165484, 165485, 165486, 165489, 165490, 165492, 165493, 165495, 165496, 165497, 165502, 165503, 165507, 165514, 165521, 165522, 165524, 165536, 165551, 165566, 165576, 165580, 165600, 165601, 165602, 165608, 165621, 165625, 165627, 165632, 165638, 165641, 165643, 165659, 165661, 165665, 165673, 165676, 165683, 165691, 165702, 165703, 165706, 165711, 165713, 165714, 165722, 165723, 165740, 165742, 165766, 165768, 165772, 165774, 165779, 165801, 165804, 165815, 165816, 165824, 165826, 165827, 165829, 165831, 165833, 165839, 165841, 165847, 165859, 165861, 165863, 165867, 165872, 165874, 165876, 165882, 165883, 165887, 165891, 165893, 165897, 165898, 165909, 165912, 165915, 165919, 165923, 165925, 165929, 165932, 165934, 165936, 165939, 165946, 165950, 165951, 165957, 165962, 165964, 165967, 165979, 165991, 165998, 166006, 166008, 166011, 166019, 166020, 166026, 166030, 166031, 166032, 166036, 166046, 166048, 166053, 166062, 166082, 166084, 166086, 166088, 166097, 166101, 166105, 166115, 166119, 166131, 166132, 166139, 166141, 166144, 166147, 166154, 166160, 166169, 166171, 166182, 166183, 166189, 166192, 166195, 166199, 166201, 166205, 166209, 166210, 166215, 166217, 166220, 166223, 166225, 166228, 166231, 166242, 166243, 166253, 166265, 166268, 166284, 166300, 166302, 166305, 166306, 166309, 166315, 166318, 166319, 166320, 166321, 166327, 166328, 166333, 166334, 166357, 166361, 166364, 166370, 166372, 166377, 166384, 166387, 166388, 166390, 166391, 166392, 166397, 166399, 166405, 166406, 166417, 166420, 166426, 166433, 166435, 166437, 166438, 166439, 166450, 166453, 166461, 166467, 166469, 166478, 166479, 166483, 166490, 166493, 166498, 166499, 166507, 166509, 166520, 166521, 166527, 166529, 166537, 166540, 166543, 166552, 166557, 166559, 166565, 166570, 166571, 166574, 166575, 166578, 166586, 166608, 166620, 166622, 166624, 166626, 166627, 166642, 166643, 166645, 166649, 166653, 166658, 166666, 166667, 166669, 166671, 166674, 166675, 166685, 166693, 166695, 166697, 166703, 166704, 166709, 166719, 166722, 166728, 166733, 166734, 166738, 166739, 166752, 166762, 166768, 166775, 166777, 166785, 166787, 166788, 166789, 166790, 166795, 166804, 166831, 166832, 166835, 166840, 166842, 166855, 166863, 166871, 166873, 166876, 166886, 166890, 166896, 166898, 166904, 166910, 166914, 166915, 166917, 166930, 166939, 166944, 166946, 166951, 166952, 166959, 166961, 166962, 166965, 166980, 166984, 166985, 167008, 167010, 167012, 167015, 167019, 167020, 167024, 167029, 167034, 167037, 167041, 167042, 167049, 167053, 167062, 167064, 167066, 167073, 167077, 167090, 167107, 167112, 167114, 167117, 167133, 167139, 167143, 167146, 167152, 167160, 167161, 167165, 167166, 167170, 167172, 167175, 167177, 167182, 167198, 167200, 167207, 167210, 167214, 167227, 167229, 167230, 167231, 167233, 167240, 167247, 167255, 167258, 167261, 167265, 167269, 167270, 167280, 167281, 167288, 167290, 167291, 167297, 167298, 167302, 167305, 167307, 167311, 167313, 167317, 167326, 167333, 167335, 167341, 167350, 167360, 167363, 167366, 167368, 167375, 167378, 167380, 167381, 167389, 167391, 167392, 167399, 167400, 167409, 167411, 167420, 167422, 167424, 167431, 167442, 167443, 167447, 167454, 167455, 167459, 167474, 167479, 167480, 167491, 167492, 167496, 167498, 167499, 167508, 167518, 167520, 167521, 167527, 167529, 167533, 167536, 167543, 167550, 167552, 167554, 167558, 167560, 167561, 167569, 167572, 167574, 167577, 167585, 167599, 167602, 167606, 167608, 167609, 167611, 167617, 167618, 167620, 167623, 167628, 167630, 167647, 167649, 167652, 167669, 167676, 167684, 167688, 167690, 167694, 167699, 167700, 167703, 167705, 167706, 167708, 167710, 167729, 167734, 167739, 167742, 167744, 167746, 167747, 167751, 167759, 167769, 167771, 167772, 167786, 167789, 167791, 167800, 167804, 167810, 167811, 167819, 167825, 167834, 167840, 167843, 167845, 167848, 167851, 167852, 167859, 167862, 167864, 167865, 167869, 167876, 167877, 167885, 167888, 167889, 167891, 167893, 167899, 167911, 167921, 167928, 167932, 167935, 167936, 167938, 167941, 167944, 167960, 167966, 167974, 167986, 167987, 167990, 168005, 168008, 168009, 168013, 168016, 168018, 168021, 168044, 168046, 168047, 168052, 168072, 168076, 168081, 168085, 168094, 168098, 168105, 168112, 168115, 168119, 168121, 168129, 168139, 168140, 168143, 168144, 168146, 168155, 168166, 168168, 168172, 168177, 168178, 168193, 168196, 168214, 168224, 168229, 168231, 168237, 168238, 168241, 168242, 168243, 168247, 168249, 168250, 168257, 168263, 168264, 168267, 168268, 168274, 168282, 168284, 168290, 168294, 168303, 168304, 168310, 168311, 168324, 168329, 168331, 168332, 168340, 168341, 168348, 168350, 168355, 168356, 168357, 168359, 168365, 168366, 168368, 168369, 168370, 168380, 168381, 168385, 168388, 168394, 168402, 168411, 168417, 168425, 168428, 168432, 168433, 168434, 168439, 168443, 168451, 168459, 168463, 168474, 168480, 168487, 168490, 168496, 168497, 168500, 168503, 168515, 168518, 168525, 168529, 168539, 168542, 168545, 168548, 168549, 168550, 168554, 168555, 168558, 168563, 168567, 168577, 168595, 168596, 168597, 168598, 168601, 168604, 168613, 168618, 168620, 168625, 168628, 168636, 168643, 168648, 168651, 168653, 168656, 168657, 168666, 168668, 168675, 168679, 168680, 168681, 168690, 168695, 168702, 168703, 168706, 168709, 168712, 168717, 168722, 168725, 168731, 168732, 168738, 168741, 168744, 168750, 168754, 168755, 168756, 168763, 168766, 168768, 168772, 168778, 168779, 168788, 168798, 168802, 168806, 168807, 168808, 168809, 168814, 168823, 168824, 168829, 168833, 168843, 168852, 168855, 168858, 168862, 168868, 168878, 168880, 168894, 168899, 168914, 168915, 168920, 168921, 168922, 168928, 168942, 168956, 168957, 168964, 168973, 168983, 168985, 168987, 168996, 169014, 169016, 169017, 169021, 169037, 169038, 169042, 169049, 169068, 169082, 169092, 169104, 169114, 169116, 169117, 169118, 169119, 169121, 169125, 169132, 169134, 169135, 169136, 169143, 169145, 169146, 169147, 169149, 169150, 169151, 169160, 169162, 169165, 169167, 169178, 169179, 169180, 169181, 169182, 169190, 169194, 169196, 169202, 169203, 169204, 169206, 169208, 169213, 169215, 169217, 169221, 169227, 169229, 169230, 169238, 169243, 169245, 169247, 169263, 169264, 169266, 169269, 169275, 169278, 169284, 169288, 169292, 169293, 169311, 169313, 169314, 169319, 169331, 169339, 169340, 169341, 169362, 169364, 169371, 169380, 169382, 169384, 169388, 169390, 169400, 169401, 169410, 169411, 169414, 169415, 169418, 169433, 169435, 169441, 169444, 169448, 169450, 169453, 169455, 169457, 169458, 169461, 169471, 169483, 169484, 169488, 169493, 169494, 169496, 169500, 169501, 169503, 169507, 169509, 169511, 169514, 169518, 169520, 169521, 169522, 169524, 169538, 169539, 169540, 169548, 169568, 169579, 169582, 169584, 169590, 169591, 169595, 169602, 169604, 169607, 169611, 169626, 169628, 169629, 169631, 169632, 169639, 169644, 169645, 169648, 169653, 169670, 169672, 169705, 169706, 169711, 169712, 169713, 169720, 169722, 169732, 169752, 169758, 169763, 169765, 169768, 169775, 169777, 169778, 169783, 169784, 169792, 169793, 169794, 169798, 169799, 169809, 169812, 169813, 169825, 169836, 169838, 169840, 169848, 169851, 169857, 169858, 169860, 169869, 169880, 169883, 169898, 169900, 169902, 169906, 169914, 169917, 169937, 169947, 169956, 169967, 169975, 169976, 169981, 169987, 169993, 170008, 170010, 170013, 170016, 170023, 170032, 170033, 170034, 170036, 170043, 170068, 170080, 170084, 170099, 170110, 170118, 170123, 170129, 170130, 170131, 170137, 170139, 170140, 170141, 170142, 170143, 170146, 170151, 170152, 170164, 170172, 170174, 170178, 170192, 170194, 170195, 170200, 170203, 170205, 170222, 170228, 170232, 170234, 170238, 170239, 170247, 170248, 170256, 170266, 170286, 170288, 170289, 170298, 170299, 170303, 170308, 170309, 170313, 170315, 170320, 170322, 170324, 170325, 170329, 170333, 170334, 170337, 170339, 170342, 170347, 170354, 170356, 170358, 170368, 170374, 170376, 170385, 170390, 170392, 170395, 170410, 170418, 170419, 170425, 170429, 170436, 170449, 170455, 170471, 170474, 170477, 170488, 170497, 170498, 170512, 170524, 170532, 170537, 170551, 170554, 170559, 170567, 170569, 170576, 170587, 170590, 170593, 170597, 170599, 170610, 170612, 170613, 170618, 170619, 170628, 170635, 170651, 170658, 170667, 170671, 170675, 170683, 170698, 170699, 170700, 170709, 170714, 170721, 170729, 170730, 170747, 170753, 170762, 170764, 170774, 170775, 170780, 170781, 170782, 170787, 170789, 170793, 170798, 170802, 170803, 170823, 170825, 170837, 170845, 170846, 170856, 170860, 170861, 170867, 170870, 170873, 170879, 170881, 170882, 170883, 170885, 170893, 170896, 170900, 170908, 170915, 170919, 170923, 170937, 170940, 170942, 170944, 170946, 170953, 170956, 170964, 170990, 170992, 170993, 170995, 170996, 170999, 171010, 171013, 171019, 171022, 171023, 171032, 171037, 171040, 171051, 171056, 171061, 171064, 171069, 171071, 171073, 171074, 171076, 171079, 171086, 171089, 171098, 171116, 171119, 171129, 171130, 171131, 171138, 171140, 171141, 171145, 171159, 171168, 171170, 171174, 171175, 171182, 171186, 171199, 171201, 171203, 171209, 171212, 171214, 171216, 171220, 171236, 171237, 171242, 171247, 171255, 171268, 171277, 171278, 171279, 171290, 171292, 171294, 171300, 171302, 171304, 171314, 171335, 171339, 171343, 171345, 171352, 171355, 171356, 171385, 171394, 171395, 171397, 171400, 171405, 171408, 171413, 171420, 171421, 171427, 171430, 171436, 171439, 171441, 171455, 171464, 171469, 171474, 171475, 171477, 171480, 171503, 171504, 171507, 171512, 171520, 171521, 171531, 171541, 171545, 171547, 171552, 171556, 171561, 171562, 171568, 171578, 171581, 171595, 171597, 171607, 171611, 171612, 171613, 171620, 171624, 171632, 171641, 171642, 171647, 171649, 171650, 171656, 171657, 171663, 171679, 171680, 171681, 171683, 171684, 171689, 171692, 171699, 171700, 171701, 171705, 171729, 171755, 171758, 171759, 171765, 171766, 171772, 171773, 171774, 171775, 171777, 171789, 171799, 171806, 171811, 171814, 171827, 171837, 171839, 171846, 171850, 171884, 171892, 171894, 171899, 171900, 171908, 171911, 171920, 171928, 171943, 171948, 171949, 171954, 171955, 171960, 171963, 171966, 171973, 171974, 171981, 171985, 171986, 171990, 171999, 172002, 172004, 172010, 172012, 172013, 172020, 172027, 172029, 172036, 172044, 172048, 172055, 172060, 172064, 172079, 172080, 172088, 172096, 172108, 172109, 172116, 172117, 172126, 172150, 172155, 172160, 172162, 172166, 172167, 172173, 172175, 172185, 172187, 172189, 172194, 172200, 172202, 172203, 172209, 172214, 172217, 172219, 172221, 172222, 172223, 172224, 172226, 172233, 172241, 172250, 172251, 172252, 172261, 172262, 172269, 172278, 172280, 172283, 172284, 172290, 172298, 172302, 172303, 172304, 172307, 172309, 172311, 172320, 172330, 172332, 172334, 172337, 172339, 172352, 172353, 172362, 172366, 172381, 172397, 172401, 172404, 172406, 172411, 172416, 172418, 172421, 172433, 172434, 172435, 172446, 172449, 172453, 172469, 172519, 172521, 172530, 172533, 172537, 172547, 172555, 172562, 172570, 172575, 172577, 172579, 172588, 172589, 172591, 172594, 172596, 172597, 172598, 172600, 172602, 172604, 172605, 172613, 172615, 172616, 172630, 172633, 172634, 172636, 172639, 172642, 172648, 172649, 172651, 172669, 172676, 172680, 172681, 172682, 172684, 172688, 172698, 172701, 172704, 172706, 172709, 172711, 172715, 172717, 172723, 172725, 172726, 172727, 172731, 172745, 172746, 172751, 172753, 172759, 172772, 172782, 172783, 172785, 172786, 172792, 172798, 172800, 172805, 172806, 172810, 172813, 172817, 172821, 172827, 172833, 172843, 172850, 172858, 172859, 172871, 172874, 172883, 172895, 172905, 172914, 172917, 172923, 172924, 172926, 172927, 172934, 172943, 172962, 172963, 172972, 172978, 172981, 172997, 173000, 173001, 173002, 173018, 173029, 173030, 173032, 173055, 173068, 173071, 173072, 173073, 173076, 173079, 173082, 173090, 173091, 173092, 173108, 173110, 173111, 173121, 173123, 173136, 173137, 173141, 173142, 173149, 173152, 173155, 173171, 173173, 173177, 173178, 173185, 173201, 173209, 173213, 173217, 173224, 173233, 173235, 173242, 173244, 173250, 173251, 173255, 173264, 173273, 173281, 173282, 173296, 173305, 173306, 173307, 173310, 173312, 173320, 173321, 173326, 173331, 173334, 173339, 173340, 173341, 173357, 173361, 173363, 173370, 173371, 173387, 173388, 173390, 173395, 173401, 173403, 173406, 173416, 173420, 173425, 173431, 173450, 173453, 173455, 173474, 173482, 173486, 173487, 173489, 173490, 173496, 173501, 173505, 173512, 173513, 173522, 173554, 173561, 173562, 173563, 173565, 173569, 173577, 173579, 173606, 173610, 173613, 173616, 173632, 173635, 173642, 173648, 173656, 173659, 173663, 173670, 173672, 173684, 173686, 173690, 173692, 173699, 173706, 173708, 173715, 173720, 173727, 173728, 173736, 173738, 173739, 173740, 173742, 173743, 173749, 173752, 173762, 173766, 173767, 173779, 173782, 173788, 173802, 173803, 173816, 173821, 173822, 173826, 173828, 173829, 173830, 173847, 173850, 173857, 173859, 173873, 173876, 173879, 173890, 173891, 173894, 173895, 173896, 173897, 173907, 173908, 173909, 173915, 173917, 173920, 173928, 173930, 173951, 173961, 173969, 173974, 173979, 173981, 173982, 173990, 173992, 174003, 174005, 174007, 174013, 174028, 174040, 174041, 174049, 174055, 174058, 174059, 174064, 174067, 174068, 174081, 174082, 174089, 174091, 174093, 174096, 174100, 174103, 174104, 174113, 174115, 174123, 174127, 174132, 174139, 174140, 174142, 174143, 174146, 174152, 174156, 174161, 174165, 174167, 174178, 174181, 174186, 174187, 174191, 174197, 174201, 174211, 174218, 174227, 174231, 174247, 174254, 174255, 174257, 174258, 174260, 174263, 174264, 174269, 174281, 174287, 174288, 174290, 174303, 174310, 174311, 174313, 174323, 174332, 174339, 174348, 174351, 174354, 174356, 174358, 174359, 174364, 174365, 174380, 174384, 174385, 174386, 174388, 174389, 174390, 174391, 174397, 174398, 174410, 174470, 174474, 174475, 174479, 174485, 174490, 174492, 174502, 174506, 174509, 174517, 174541, 174545, 174549, 174553, 174555, 174557, 174562, 174564, 174566, 174577, 174584, 174586, 174598, 174600, 174611, 174617, 174621, 174626, 174630, 174633, 174635, 174651, 174661, 174665, 174667, 174669, 174673, 174676, 174680, 174693, 174696, 174699, 174703, 174706, 174716, 174717, 174718, 174721, 174729, 174732, 174751, 174756, 174757, 174758, 174765, 174772, 174775, 174779, 174781, 174785, 174786, 174787, 174810, 174838, 174839, 174851, 174858, 174860, 174869, 174870, 174871, 174878, 174881, 174884, 174888, 174893, 174899, 174914, 174921, 174931, 174941, 174952, 174955, 174961, 174966, 174968, 174969, 174988, 174991, 175003, 175006, 175008, 175010, 175011, 175017, 175019, 175037, 175041, 175049, 175050, 175051, 175057, 175058, 175063, 175076, 175078, 175090, 175096, 175101, 175104, 175106, 175112, 175113, 175114, 175124, 175126, 175143, 175154, 175159, 175161, 175167, 175173, 175190, 175194, 175201, 175208, 175220, 175228, 175233, 175249, 175253, 175261, 175268, 175269, 175271, 175283, 175288, 175293, 175328, 175331, 175337, 175340, 175341, 175356, 175371, 175374, 175383, 175386, 175394, 175395, 175397, 175399, 175407, 175415, 175419, 175429, 175442, 175444, 175447, 175457, 175461, 175469, 175473, 175474, 175479, 175482, 175492, 175494, 175497, 175502, 175511, 175516, 175520, 175523, 175539, 175541, 175543, 175544, 175551, 175552, 175556, 175559, 175560, 175564, 175569, 175572, 175582, 175583, 175585, 175592, 175594, 175600, 175608, 175610, 175611, 175619, 175622, 175631, 175641, 175642, 175644, 175648, 175650, 175673, 175675, 175678, 175679, 175691, 175710, 175712, 175714, 175715, 175723, 175726, 175732, 175733, 175735, 175749, 175755, 175761, 175773, 175775, 175777, 175783, 175786, 175789, 175796, 175798, 175807, 175809, 175823, 175839, 175849, 175854, 175860, 175878, 175879, 175883, 175888, 175889, 175890, 175895, 175900, 175901, 175914, 175924, 175934, 175949, 175956, 175963, 175964, 175965, 175983, 175984, 175997, 176003, 176006, 176014, 176038, 176039, 176046, 176056, 176060, 176065, 176070, 176096, 176102, 176105, 176108, 176109, 176113, 176116, 176138, 176144, 176149, 176150, 176152, 176162, 176182, 176186, 176187, 176189, 176198, 176202, 176233, 176235, 176254, 176257, 176258, 176261, 176262, 176265, 176272, 176274, 176300, 176328, 176330, 176332, 176343, 176346, 176354, 176358, 176365, 176371, 176372, 176384, 176385, 176391, 176401, 176420, 176425, 176430, 176445, 176456, 176463, 176466, 176468, 176470, 176474, 176479, 176486, 176491, 176492, 176495, 176498, 176502, 176506, 176512, 176516, 176522, 176524, 176531, 176545, 176557, 176558, 176559, 176565, 176567, 176577, 176587, 176588, 176591, 176592, 176593, 176603, 176614, 176615, 176618, 176622, 176643, 176650, 176655, 176662, 176663, 176671, 176680, 176687, 176694, 176700, 176701, 176715, 176727, 176741, 176746, 176751, 176752, 176753, 176754, 176755, 176762, 176767, 176770, 176783, 176784, 176785, 176786, 176806, 176809, 176815, 176822, 176823, 176824, 176828, 176839, 176840, 176841, 176843, 176851, 176852, 176854, 176876, 176877, 176885, 176889, 176891, 176893, 176897, 176902, 176907, 176910, 176911, 176916, 176921, 176923, 176925, 176931, 176935, 176942, 176943, 176962, 176963, 176970, 176981, 176982, 176986, 176988, 176992, 176997, 177008, 177011, 177019, 177026, 177031, 177032, 177036, 177039, 177046, 177052, 177054, 177066, 177067, 177069, 177083, 177090, 177095, 177097, 177105, 177110, 177113, 177122, 177132, 177144, 177148, 177155, 177156, 177157, 177158, 177195, 177196, 177198, 177199, 177218, 177229, 177250, 177251, 177256, 177258, 177259, 177261, 177263, 177264, 177284, 177287, 177290, 177291, 177292, 177293, 177295, 177311, 177315, 177328, 177334, 177346, 177355, 177358, 177364, 177366, 177367, 177370, 177376, 177379, 177380, 177381, 177396, 177403, 177404, 177409, 177416, 177422, 177437, 177438, 177444, 177450, 177475, 177479, 177480, 177490, 177495, 177499, 177505, 177514, 177515, 177522, 177545, 177560, 177561, 177564, 177570, 177571, 177572, 177575, 177580, 177608, 177616, 177628, 177635, 177642, 177649, 177652, 177653, 177656, 177658, 177661, 177671, 177711, 177716, 177718, 177724, 177725, 177726, 177727, 177738, 177740, 177742, 177747, 177751, 177756, 177761, 177764, 177776, 177783, 177787, 177791, 177795, 177796, 177797, 177807, 177809, 177814, 177832, 177836, 177840, 177857, 177861, 177866, 177867, 177869, 177872, 177877, 177881, 177886, 177887, 177888, 177902, 177904, 177915, 177933, 177935, 177937, 177942, 177947, 177948, 177949, 177952, 177959, 177960, 177966, 177986, 177989, 177994, 178009, 178014, 178024, 178025, 178026, 178029, 178031, 178032, 178040, 178055, 178064, 178071, 178073, 178081, 178089, 178091, 178095, 178102, 178105, 178107, 178108, 178115, 178125, 178129, 178136, 178138, 178141, 178145, 178154, 178169, 178178, 178181, 178185, 178186, 178203, 178215, 178219, 178222, 178229, 178234, 178241, 178250, 178258, 178274, 178275, 178278, 178288, 178299, 178305, 178310, 178313, 178314, 178330, 178332, 178333, 178351, 178356, 178363, 178367, 178370, 178381, 178390, 178399, 178407, 178409, 178416, 178428, 178440, 178447, 178475, 178477, 178479, 178480, 178481, 178484, 178487, 178490, 178500, 178502, 178503, 178505, 178521, 178537, 178542, 178559, 178567, 178571, 178573, 178578, 178579, 178581, 178582, 178591, 178592, 178594, 178595, 178598, 178604, 178611, 178619, 178624, 178631, 178634, 178648, 178650, 178658, 178691, 178702, 178708, 178712, 178757, 178761, 178773, 178778, 178779, 178792, 178800, 178804, 178807, 178814, 178815, 178828, 178832, 178849, 178854, 178858, 178866, 178871, 178874, 178890, 178893, 178895, 178906, 178912, 178927, 178973, 178985, 178986, 178993, 178996, 179004, 179013, 179014, 179018, 179026, 179027, 179032, 179038, 179040, 179052, 179054, 179072, 179084, 179099, 179102, 179112, 179119, 179125, 179131, 179133, 179134, 179142, 179148, 179156, 179161, 179163, 179166, 179173, 179180, 179182, 179185, 179193, 179194, 179196, 179204, 179208, 179209, 179212, 179224, 179225, 179231, 179232, 179235, 179239, 179241, 179248, 179249, 179251, 179254, 179255, 179256, 179260, 179263, 179266, 179277, 179279, 179297, 179298, 179302, 179311, 179313, 179317, 179318, 179331, 179348, 179358, 179360, 179363, 179378, 179389, 179391, 179392, 179404, 179413, 179428, 179430, 179433, 179434, 179436, 179439, 179449, 179465, 179471, 179480, 179481, 179489, 179491, 179495, 179499, 179502, 179503, 179505, 179510, 179526, 179527, 179544, 179548, 179551, 179557, 179559, 179571, 179575, 179582, 179589, 179590, 179593, 179611, 179616, 179626, 179627, 179628, 179635, 179636, 179640, 179647, 179657, 179661, 179662, 179682, 179689, 179698, 179705, 179710, 179721, 179723, 179724, 179728, 179737, 179741, 179752, 179757, 179760, 179765, 179775, 179776, 179782, 179788, 179789, 179791, 179795, 179798, 179812, 179816, 179824, 179828, 179835, 179836, 179838, 179845, 179852, 179854, 179860, 179874, 179877, 179883, 179890, 179906, 179917, 179921, 179931, 179941, 179943, 179949, 179951, 179973, 179975, 179976, 179979, 179983, 179985, 179993, 179994, 179998, 180011, 180012, 180019, 180020, 180036, 180039, 180040, 180055, 180058, 180070, 180074, 180078, 180096, 180112, 180121, 180126, 180127, 180128, 180132, 180133, 180141, 180161, 180162, 180172, 180174, 180188, 180193, 180197, 180233, 180241, 180271, 180272, 180285, 180286, 180288, 180293, 180311, 180319, 180320, 180341, 180350, 180351, 180352, 180367, 180371, 180388, 180391, 180401, 180410, 180414, 180429, 180433, 180435, 180436, 180456, 180461, 180463, 180464, 180469, 180476, 180478, 180480, 180485, 180508, 180510, 180511, 180516, 180518, 180528, 180536, 180537, 180546, 180548, 180550, 180552, 180557, 180566, 180578, 180581, 180590, 180592, 180594, 180613, 180616, 180622, 180623, 180629, 180636, 180647, 180651, 180657, 180659, 180664, 180675, 180680, 180681, 180684, 180702, 180706, 180709, 180716, 180722, 180723, 180725, 180726, 180739, 180747, 180763, 180764, 180793, 180808, 180810, 180848, 180849, 180855, 180858, 180864, 180879, 180881, 180882, 180884, 180890, 180896, 180911, 180916, 180927, 180935, 180939, 180941, 180942, 180951, 180952, 180953, 180956, 180972, 180988, 180993, 180996, 181002, 181014, 181020, 181026, 181028, 181049, 181052, 181070, 181078, 181080, 181089, 181093, 181097, 181099, 181105, 181114, 181118, 181120, 181121, 181124, 181130, 181133, 181144, 181149, 181163, 181169, 181173, 181183, 181225, 181226, 181269, 181280, 181281, 181291, 181315, 181317, 181319, 181322, 181323, 181326, 181330, 181339, 181341, 181342, 181343, 181344, 181352, 181356, 181358, 181364, 181377, 181389, 181397, 181400, 181401, 181403, 181404, 181425, 181445, 181447, 181449, 181456, 181478, 181480, 181507, 181511, 181514, 181535, 181539, 181542, 181557, 181579, 181582, 181583, 181614, 181616, 181620, 181622, 181623, 181624, 181632, 181637, 181651, 181655, 181659, 181664, 181671, 181677, 181687, 181692, 181698, 181701, 181708, 181715, 181722, 181726, 181743, 181754, 181757, 181759, 181763, 181766, 181771, 181774, 181775, 181782, 181785, 181789, 181795, 181796, 181801, 181808, 181810, 181820, 181822, 181834, 181835, 181852, 181860, 181878, 181886, 181887, 181891, 181892, 181895, 181919, 181927, 181932, 181938, 181940, 181948, 181953, 181963, 181968, 181969, 181970, 181976, 181977, 181988, 181996, 182011, 182029, 182032, 182035, 182037, 182041, 182044, 182045, 182048, 182051, 182052, 182065, 182074, 182078, 182114, 182135, 182136, 182137, 182156, 182157, 182162, 182174, 182175, 182178, 182186, 182189, 182192, 182200, 182202, 182203, 182212, 182223, 182224, 182229, 182232, 182241, 182250, 182251, 182268, 182270, 182272, 182273, 182277, 182287, 182298, 182314, 182326, 182328, 182331, 182340, 182343, 182345, 182349, 182364, 182367, 182370, 182385, 182386, 182388, 182394, 182396, 182401, 182406, 182408, 182411, 182414, 182417, 182441, 182455, 182460, 182463, 182466, 182470, 182480, 182494, 182496, 182510, 182512, 182533, 182546, 182550, 182552, 182556, 182563, 182564, 182570, 182579, 182596, 182598, 182602, 182604, 182606, 182610, 182611, 182627, 182638, 182652, 182653, 182673, 182675, 182689, 182690, 182733, 182742, 182749, 182752, 182755, 182758, 182759, 182766, 182768, 182769, 182772, 182779, 182784, 182786, 182809, 182811, 182825, 182848, 182851, 182853, 182864, 182868, 182879, 182888, 182890, 182899, 182907, 182911, 182916, 182920, 182926, 182934, 182944, 182949, 182958, 182969, 182975, 182982, 182988, 182998, 183000, 183006, 183025, 183048, 183055, 183060, 183066, 183067, 183074, 183089, 183095, 183106, 183108, 183124, 183125, 183126, 183139, 183148, 183150, 183172, 183200, 183228, 183229, 183230, 183231, 183252, 183254, 183257, 183260, 183262, 183263, 183270, 183276, 183277, 183278, 183280, 183301, 183302, 183316, 183322, 183327, 183337, 183344, 183366, 183374, 183375, 183376, 183394, 183417, 183427, 183428, 183430, 183442, 183443, 183447, 183450, 183457, 183459, 183468, 183471, 183472, 183485, 183494, 183501, 183503, 183511, 183513, 183515, 183522, 183525, 183544, 183549, 183550, 183554, 183557, 183565, 183570, 183575, 183578, 183583, 183590, 183594, 183608, 183635, 183640, 183666, 183673, 183674, 183696, 183704, 183719, 183720, 183726, 183738, 183740, 183747, 183758, 183763, 183782, 183790, 183800, 183806, 183810, 183814, 183822, 183836, 183848, 183850, 183852, 183857, 183860, 183861, 183871, 183872, 183878, 183885, 183900, 183907, 183909, 183911, 183913, 183919, 183927, 183936, 183937, 183943, 183948, 183965, 183969, 183972, 183984, 183994, 184008, 184009, 184012, 184016, 184017, 184031, 184033, 184044, 184046, 184049, 184058, 184065, 184070, 184073, 184074, 184081, 184086, 184087, 184093, 184098, 184103, 184104, 184116, 184117, 184127, 184139, 184142, 184161, 184179, 184180, 184192, 184200, 184220, 184228, 184234, 184246, 184250, 184251, 184263, 184267, 184276, 184294, 184303, 184317, 184321, 184327, 184329, 184343, 184345, 184356, 184365, 184368, 184371, 184380, 184384, 184387, 184401, 184403, 184417, 184428, 184430, 184437, 184440, 184444, 184457, 184470, 184471, 184476, 184489, 184504, 184512, 184513, 184519, 184521, 184534, 184535, 184537, 184538, 184541, 184546, 184550, 184564, 184569, 184591, 184600, 184603, 184611, 184622, 184631, 184641, 184650, 184659, 184671, 184674, 184693, 184700, 184701, 184714, 184728, 184729, 184730, 184741, 184748, 184753, 184756, 184770, 184786, 184797, 184803, 184804, 184824, 184827, 184829, 184841, 184847, 184851, 184852, 184853, 184854, 184856, 184866, 184869, 184880, 184895, 184898, 184902, 184909, 184918, 184923, 184924, 184932, 184941, 184944, 184955, 184960, 184963, 184972, 184981, 184985, 184992, 184994, 185001, 185010, 185020, 185038, 185044, 185057, 185060, 185062, 185069, 185073, 185075, 185081, 185087, 185088, 185089, 185095, 185105, 185115, 185118, 185123, 185136, 185149, 185167, 185173, 185192, 185196, 185211, 185215, 185216, 185221, 185223, 185224, 185225, 185243, 185246, 185261, 185263, 185269, 185273, 185276, 185279, 185283, 185287, 185294, 185297, 185300, 185305, 185306, 185309, 185335, 185342, 185348, 185358, 185362, 185366, 185370, 185382, 185386, 185390, 185392, 185401, 185403, 185408, 185412, 185418, 185421, 185429, 185444, 185459, 185484, 185494, 185505, 185508, 185516, 185519, 185523, 185535, 185537, 185539, 185549, 185578, 185580, 185595, 185596, 185599, 185616, 185619, 185627, 185634, 185635, 185641, 185668, 185670, 185671, 185696, 185706, 185715, 185718, 185723, 185724, 185728, 185749, 185770, 185774, 185778, 185781, 185787, 185793, 185794, 185797, 185798, 185800, 185805, 185820, 185835, 185845, 185853, 185855, 185865, 185868, 185872, 185881, 185904, 185905, 185912, 185914, 185945, 185962, 185963, 185977, 185978, 185979, 185994, 185995, 185998, 185999, 186001, 186016, 186018, 186020, 186022, 186024, 186025, 186028, 186030, 186037, 186038, 186039, 186050, 186055, 186069, 186095, 186097, 186104, 186105, 186125, 186138, 186139, 186140, 186143, 186150, 186155, 186159, 186168, 186188, 186206, 186209, 186215, 186230, 186231, 186247, 186259, 186276, 186285, 186289, 186302, 186303, 186316, 186327, 186338, 186340, 186348, 186351, 186355, 186369, 186375, 186380, 186383, 186384, 186394, 186403, 186418, 186419, 186420, 186421, 186428, 186434, 186436, 186441, 186465, 186466, 186487, 186489, 186495, 186505, 186516, 186519, 186533, 186539, 186549, 186555, 186558, 186565, 186572, 186574, 186576, 186609, 186614, 186624, 186626, 186645, 186646, 186652, 186654, 186659, 186671, 186672, 186677, 186682, 186684, 186695, 186697, 186701, 186710, 186763, 186780, 186789, 186800, 186803, 186812, 186828, 186829, 186838, 186842, 186848, 186849, 186871, 186890, 186896, 186912, 186933, 186938, 186954, 186957, 186961, 186967, 186969, 186970, 186984, 186988, 186992, 187000, 187008, 187021, 187031, 187039, 187057, 187063, 187075, 187083, 187090, 187092, 187095, 187102, 187114, 187116, 187121, 187142, 187149, 187157, 187160, 187161, 187171, 187177, 187178, 187184, 187191, 187195, 187197, 187199, 187200, 187209, 187214, 187215, 187224, 187225, 187227, 187231, 187238, 187268, 187281, 187301, 187311, 187326, 187340, 187342, 187361, 187363, 187369, 187375, 187385, 187386, 187389, 187399, 187417, 187421, 187428, 187433, 187437, 187445, 187449, 187452, 187453, 187461, 187471, 187472, 187473, 187475, 187477, 187484, 187495, 187497, 187509, 187530, 187532, 187539, 187552, 187554, 187564, 187575, 187591, 187592, 187600, 187603, 187608, 187629, 187630, 187631, 187636, 187647, 187648, 187667, 187669, 187672, 187679, 187688, 187689, 187691, 187700, 187706, 187708, 187709, 187736, 187737, 187739, 187747, 187760, 187761, 187765, 187777, 187784, 187785, 187786, 187791, 187819, 187835, 187855, 187860, 187863, 187871, 187886, 187892, 187903, 187928, 187931, 187937, 187940, 187947, 187961, 187966, 187968, 187979, 187981, 187988, 187989, 187998, 188000, 188005, 188013, 188030, 188031, 188032, 188034, 188037, 188053, 188055, 188062, 188072, 188075, 188089, 188098, 188103, 188111, 188118, 188130, 188133, 188137, 188149, 188151, 188155, 188156, 188162, 188163, 188173, 188175, 188176, 188178, 188193, 188199, 188202, 188205, 188215, 188219, 188224, 188228, 188229, 188231, 188253, 188256, 188257, 188269, 188270, 188272, 188297, 188302, 188306, 188325, 188340, 188347, 188354, 188360, 188364, 188367, 188369, 188375, 188385, 188386, 188389, 188394, 188396, 188410, 188412, 188418, 188431, 188434, 188453, 188456, 188460, 188461, 188463, 188465, 188479, 188480, 188485, 188486, 188489, 188495, 188516, 188517, 188553, 188561, 188568, 188578, 188586, 188602, 188606, 188607, 188614, 188615, 188624, 188627, 188632, 188646, 188648, 188650, 188651, 188655, 188663, 188666, 188675, 188704, 188709, 188721, 188726, 188741, 188743, 188758, 188763, 188776, 188791, 188822, 188829, 188834, 188838, 188846, 188852, 188863, 188865, 188872, 188882, 188888, 188894, 188895, 188913, 188920, 188945, 188947, 188949, 188959, 188966, 188970, 188977, 188978, 188987, 188992, 189014, 189016, 189017, 189026, 189029, 189032, 189036, 189040, 189051, 189058, 189070, 189073, 189081, 189091, 189097, 189105, 189113, 189129, 189131, 189132, 189137, 189139, 189153, 189164, 189166, 189174, 189175, 189186, 189187, 189190, 189192, 189204, 189206, 189228, 189230, 189232, 189236, 189241, 189242, 189246, 189249, 189270, 189277, 189281, 189300, 189313, 189322, 189332, 189341, 189345, 189366, 189369, 189371, 189375, 189377, 189381, 189388, 189402, 189408, 189409, 189415, 189416, 189435, 189436, 189449, 189459, 189466, 189470, 189477, 189479, 189480, 189487, 189501, 189516, 189518, 189526, 189528, 189543, 189559, 189566, 189567, 189568, 189574, 189579, 189591, 189593, 189602, 189615, 189617, 189624, 189631, 189643, 189644, 189652, 189659, 189662, 189682, 189692, 189697, 189702, 189705, 189709, 189712, 189715, 189723, 189740, 189743, 189744, 189747, 189748, 189771, 189775, 189796, 189801, 189816, 189824, 189839, 189846, 189847, 189848, 189860, 189874, 189877, 189878, 189881, 189894, 189900, 189909, 189910, 189941, 189942, 189943, 189951, 189952, 189963, 189978, 189985, 189987, 190000, 190021, 190028, 190031, 190032, 190035, 190037, 190040, 190054, 190055, 190076, 190080, 190084, 190085, 190088, 190107, 190114, 190115, 190143, 190148, 190157, 190174, 190182, 190186, 190187, 190195, 190199, 190210, 190211, 190230, 190233, 190242, 190246, 190249, 190250, 190257, 190262, 190264, 190265, 190267, 190269, 190276, 190285, 190293, 190325, 190329, 190352, 190380, 190383, 190392, 190393, 190394, 190395, 190408, 190410, 190411, 190415, 190417, 190423, 190473, 190482, 190484, 190490, 190502, 190521, 190525, 190534, 190537, 190539, 190541, 190557, 190558, 190564, 190568, 190586, 190598, 190618, 190620, 190624, 190628, 190645, 190647, 190648, 190657, 190658, 190673, 190674, 190685, 190687, 190699, 190702, 190730, 190733, 190739, 190757, 190763, 190778, 190793, 190802, 190809, 190810, 190814, 190815, 190827, 190831, 190842, 190843, 190862, 190864, 190866, 190867, 190868, 190874, 190876, 190880, 190885, 190897, 190906, 190911, 190929, 190931, 190934, 190935, 190937, 190942, 190956, 190957, 190973, 190980, 190984, 190992, 190995, 191007, 191022, 191029, 191032, 191043, 191053, 191055, 191062, 191066, 191080, 191081, 191118, 191122, 191128, 191136, 191140, 191150, 191152, 191155, 191156, 191172, 191173, 191183, 191188, 191189, 191197, 191199, 191206, 191213, 191215, 191236, 191243, 191246, 191267, 191273, 191293, 191312, 191320, 191321, 191324, 191331, 191342, 191349, 191353, 191354, 191358, 191360, 191366, 191368, 191371, 191391, 191393, 191394, 191402, 191415, 191416, 191424, 191427, 191430, 191449, 191451, 191457, 191465, 191477, 191487, 191502, 191512, 191513, 191520, 191544, 191554, 191561, 191574, 191582, 191595, 191598, 191609, 191615, 191625, 191633, 191650, 191657, 191665, 191671, 191672, 191674, 191676, 191690, 191708, 191718, 191726, 191727, 191736, 191744, 191759, 191761, 191762, 191764, 191770, 191776, 191781, 191786, 191792, 191797, 191798, 191800, 191811, 191832, 191833, 191834, 191852, 191853, 191855, 191856, 191860, 191862, 191873, 191875, 191908, 191910, 191929, 191950, 191952, 191977, 191986, 191995, 192003, 192015, 192024, 192026, 192029, 192030, 192072, 192073, 192078, 192081, 192089, 192107, 192112, 192113, 192115, 192125, 192143, 192148, 192162, 192183, 192193, 192210, 192211, 192215, 192220, 192234, 192237, 192241, 192253, 192257, 192258, 192259, 192262, 192272, 192275, 192279, 192288, 192291, 192304, 192316, 192320, 192321, 192324, 192328, 192329, 192330, 192338, 192350, 192351, 192357, 192362, 192367, 192397, 192399, 192400, 192402, 192441, 192448, 192456, 192464, 192466, 192474, 192476, 192477, 192478, 192499, 192542, 192556, 192564, 192575, 192579, 192583, 192584, 192588, 192589, 192602, 192606, 192621, 192623, 192641, 192650, 192660, 192670, 192692, 192697, 192705, 192709, 192715, 192732, 192736, 192749, 192764, 192773, 192774, 192775, 192789, 192806, 192810, 192811, 192812, 192815, 192824, 192827, 192836, 192845, 192849, 192852, 192858, 192860, 192863, 192865, 192870, 192897, 192902, 192912, 192913, 192919, 192929, 192930, 192932, 192948, 192950, 192965, 192978, 192980, 192987, 193004, 193006, 193016, 193017, 193026, 193037, 193040, 193057, 193058, 193059, 193062, 193067, 193076, 193083, 193090, 193092, 193123, 193131, 193145, 193156, 193194, 193196, 193203, 193205, 193215, 193224, 193245, 193250, 193255, 193256, 193265, 193276, 193282, 193287, 193298, 193301, 193309, 193315, 193326, 193328, 193338, 193342, 193353, 193365, 193367, 193369, 193377, 193379, 193380, 193388, 193399, 193417, 193423, 193433, 193443, 193449, 193458, 193461, 193467, 193480, 193483, 193485, 193486, 193497, 193509, 193527, 193542, 193547, 193548, 193549, 193551, 193556, 193562, 193568, 193578, 193581, 193594, 193616, 193621, 193626, 193627, 193631, 193647, 193654, 193655, 193672, 193674, 193676, 193677, 193706, 193712, 193723, 193727, 193738, 193742, 193743, 193747, 193753, 193754, 193756, 193761, 193774, 193779, 193784, 193798, 193804, 193828, 193837, 193839, 193844, 193851, 193869, 193875, 193876, 193883, 193885, 193893, 193894, 193899, 193912, 193913, 193925, 193932, 193953, 193966, 193985, 193996, 194007, 194030, 194036, 194037, 194041, 194048, 194063, 194067, 194074, 194087, 194099, 194104, 194113, 194121, 194131, 194132, 194134, 194140, 194148, 194165, 194166, 194174, 194230, 194232, 194240, 194243, 194252, 194253, 194281, 194299, 194310, 194311, 194313, 194314, 194316, 194320, 194335, 194346, 194368, 194381, 194383, 194387, 194390, 194404, 194417, 194425, 194427, 194438, 194444, 194459, 194460, 194464, 194476, 194483, 194491, 194502, 194510, 194530, 194544, 194547, 194556, 194558, 194562, 194566, 194576, 194585, 194586, 194593, 194595, 194598, 194608, 194626, 194634, 194635, 194639, 194644, 194668, 194676, 194690, 194693, 194709, 194725, 194736, 194752, 194757, 194766, 194768, 194770, 194773, 194784, 194789, 194799, 194802, 194804, 194811, 194818, 194830, 194837, 194841, 194842, 194849, 194856, 194858, 194861, 194863, 194865, 194876, 194884, 194885, 194891, 194900, 194901, 194906, 194928, 194934, 194938, 194942, 194958, 194964, 194967, 194974, 194984, 195006, 195009, 195010, 195012, 195023, 195039, 195041, 195042, 195043, 195054, 195056, 195077, 195087, 195091, 195100, 195103, 195107, 195113, 195120, 195142, 195143, 195150, 195167, 195170, 195181, 195182, 195187, 195195, 195203, 195215, 195221, 195223, 195226, 195236, 195239, 195255, 195262, 195271, 195275, 195280, 195283, 195284, 195296, 195310, 195315, 195320, 195336, 195350, 195352, 195353, 195398, 195433, 195436, 195451, 195452, 195472, 195473, 195481, 195482, 195484, 195507, 195508, 195509, 195523, 195530, 195534, 195539, 195543, 195564, 195572, 195579, 195581, 195597, 195601, 195615, 195617, 195624, 195625, 195632, 195633, 195646, 195647, 195651, 195657, 195658, 195660, 195666, 195686, 195709, 195711, 195714, 195749, 195763, 195766, 195768, 195784, 195787, 195791, 195839, 195849, 195854, 195855, 195859, 195863, 195870, 195915, 195919, 195933, 195939, 195943, 195954, 195958, 195972, 195989, 195994, 196009, 196034, 196042, 196067, 196072, 196093, 196128, 196142, 196146, 196149, 196157, 196162, 196165, 196169, 196185, 196211, 196229, 196234, 196235, 196248, 196262, 196291, 196330, 196337, 196345, 196349, 196358, 196362, 196387, 196388, 196393, 196402, 196420, 196422, 196431, 196438, 196449, 196479, 196488, 196489, 196490, 196494, 196495, 196496, 196497, 196498, 196501, 196511, 196517, 196522, 196530, 196532, 196544, 196548, 196554, 196559, 196565, 196566, 196580, 196596, 196599, 196603, 196616, 196619, 196632, 196633, 196644, 196646, 196657, 196660, 196669, 196676, 196677, 196679, 196686, 196698, 196708, 196713, 196717, 196722, 196743, 196760, 196763, 196772, 196782, 196792, 196797, 196807, 196819, 196825, 196829, 196831, 196834, 196839, 196843, 196851, 196864, 196868, 196876, 196878, 196902, 196906, 196919, 196934, 196938, 196952, 196956, 196962, 196965, 196973, 196974, 196975, 196976, 196977, 196978, 196979, 196980, 196981, 196982, 196983, 196984, 196985, 196986, 196987, 196988, 196989, 196990, 196991, 196992, 196993, 196994, 196995, 196996, 196997, 196998, 196999, 197000, 197001, 197002, 197003, 197004, 197005, 197006, 197007, 197008, 197009, 197010, 197011, 197012, 197013, 197014, 197015, 197016, 197017, 197018, 197019, 197020, 197021, 197022, 197023, 197027, 197030, 197032, 197033, 197034, 197035, 197036, 197037, 197038, 197039, 197040, 197042, 197043, 197044, 197045, 197046, 197047, 197048, 197054, 197069, 197135, 197163, 197170, 197236, 197286, 197307, 197320, 197416, 197544, 197626, 197719, 197721, 197889, 198094, 198254, 198255, 198256, 198257, 198258, 198259, 198260, 198261, 198262, 198264, 198265, 198266, 198267, 198268, 198269, 198270, 198271, 198272, 198273, 198274, 198275, 198276, 198277, 198278, 198279, 198280, 198281, 198283, 198284, 198285, 198286, 198287, 198289, 198290, 198291, 198292, 198293, 198294, 198295, 198296, 198297, 198298, 198299, 198301, 198302, 198303, 198304, 198305, 198306, 198307, 198308, 198309, 198310, 198311, 198312, 198316, 198317, 198318, 198319, 198320, 198322, 198323, 198324, 198325, 198326, 198327, 198328, 198329, 198330, 198331, 198332, 198333, 198334, 198336, 198337, 198339, 198340, 198341, 198342, 198343, 198344, 198346, 198347, 198348, 198349, 198350, 198351, 198352, 198354, 198355, 198356, 198357, 198358, 198360, 198362, 198363, 198364, 198366, 198367, 198369, 198370, 198371, 198372, 198373, 198375, 198377, 198378, 198379, 198380, 198381, 198382, 198383, 198384, 198385, 198387, 198389, 198390, 198391, 198392, 198394, 198397, 198398, 198401, 198402, 198403, 198404, 198406, 198407, 198409, 198412, 198414, 198416, 198417, 198418, 198419, 198420, 198421, 198422, 198423, 198424, 198425, 198426, 198428, 198429, 198430, 198431, 198432, 198436, 198437, 198438, 198439, 198440, 198442, 198443, 198444, 198445, 198446, 198447, 198448, 198449, 198450, 198451, 198452, 198453, 198455, 198456, 198457, 198458, 198459, 198460, 198461, 198462, 198466, 198468, 198469, 198470, 198471, 198472, 198473, 198474, 198475, 198476, 198477, 198480, 198483, 198484, 198486, 198487, 198488, 198489, 198490, 198491, 198492, 198494, 198496, 198497, 198498, 198499, 198500, 198501, 198502, 198503, 198504, 198506, 198507, 198508, 198510, 198511, 198512, 198514, 198515, 198517, 198518, 198519, 198520, 198521, 198522, 198523, 198524, 198525, 198526, 198527, 198529, 198530, 198531, 198532, 198533, 198534, 198535, 198536, 198537, 198539, 198541, 198542, 198543, 198544, 198545, 198547, 198550, 198551, 198552, 198556, 198557, 198558, 198560, 198561, 198563, 198568, 198569, 198570, 198573, 198574, 198575, 198576, 198577, 198578, 198580, 198582, 198583, 198584, 198585, 198589, 198590, 198591, 198592, 198593, 198594, 198595, 198596, 198599, 198600, 198601, 198602, 198604, 198607, 198609, 198610, 198612, 198613, 198614, 198616, 198618, 198619, 198620, 198627, 198628, 198630, 198632, 198633, 198634, 198636, 198640, 198641, 198642, 198644, 198646, 198647, 198648, 198649, 198651, 198652, 198653, 198654, 198655, 198656, 198657, 198659, 198661, 198663, 198664, 198665, 198666, 198667, 198670, 198671, 198673, 198674, 198676, 198677, 198678, 198681, 198682, 198683, 198684, 198686, 198687, 198688, 198689, 198690, 198691, 198693, 198694, 198695, 198696, 198697, 198698, 198700, 198702, 198703, 198705, 198706, 198707, 198711, 198712, 198713, 198716, 198719, 198720, 198721, 198724, 198725, 198730, 198731, 198732, 198733, 198735, 198739, 198742, 198743, 198744, 198745, 198746, 198747, 198749, 198754, 198757, 198758, 198759, 198762, 198763, 198764, 198766, 198767, 198770, 198774, 198776, 198777, 198779, 198780, 198782, 198786, 198788, 198791, 198793, 198794, 198795, 198796, 198797, 198799, 198801, 198802, 198805, 198807, 198810, 198812, 198814, 198815, 198820, 198828, 198829, 198830, 198832, 198838, 198840, 198841, 198843, 198846, 198847, 198848, 198850, 198853, 198854, 198857, 198858, 198860, 198861, 198862, 198863, 198864, 198865, 198867, 198869, 198870, 198871, 198874, 198876, 198877, 198881, 198883, 198885, 198886, 198888, 198889, 198890, 198894, 198898, 198902, 198903, 198904, 198905, 198906, 198909, 198911, 198912, 198913, 198917, 198919, 198921, 198922, 198923, 198925, 198929, 198931, 198932, 198936, 198940, 198942, 198943, 198948, 198949, 198951, 198952, 198953, 198955, 198956, 198958, 198960, 198962, 198963, 198964, 198965, 198969, 198972, 198976, 198978, 198984, 198987, 198990, 198991, 198993, 198999, 199000, 199001, 199003, 199004, 199006, 199009, 199012, 199013, 199014, 199015, 199016, 199017, 199019, 199021, 199022, 199024, 199025, 199026, 199031, 199032, 199033, 199035, 199037, 199040, 199045, 199048, 199053, 199056, 199058, 199059, 199061, 199063, 199065, 199067, 199070, 199074, 199075, 199078, 199082, 199085, 199088, 199091, 199097, 199100, 199102, 199103, 199105, 199106, 199108, 199117, 199118, 199121, 199122, 199126, 199128, 199130, 199131, 199133, 199134, 199136, 199137, 199138, 199140, 199141, 199143, 199144, 199148, 199150, 199158, 199159, 199161, 199163, 199164, 199165, 199167, 199168, 199169, 199172, 199175, 199177, 199178, 199181, 199182, 199184, 199186, 199193, 199194, 199195, 199199, 199200, 199201, 199202, 199204, 199205, 199207, 199209, 199210, 199214, 199215, 199217, 199219, 199220, 199221, 199222, 199224, 199229, 199233, 199234, 199235, 199237, 199241, 199242, 199243, 199247, 199248, 199250, 199252, 199254, 199255, 199258, 199259, 199267, 199268, 199269, 199282, 199285, 199286, 199287, 199289, 199290, 199294, 199295, 199297, 199298, 199299, 199300, 199301, 199302, 199306, 199307, 199308, 199311, 199312, 199314, 199315, 199322, 199326, 199328, 199329, 199334, 199340, 199342, 199343, 199344, 199345, 199346, 199347, 199349, 199352, 199355, 199357, 199369, 199372, 199375, 199377, 199380, 199382, 199383, 199389, 199390, 199392, 199394, 199395, 199399, 199401, 199404, 199406, 199407, 199408, 199409, 199411, 199412, 199413, 199418, 199422, 199432, 199433, 199439, 199442, 199445, 199448, 199453, 199456, 199457, 199460, 199464, 199470, 199471, 199476, 199484, 199486, 199489, 199491, 199495, 199497, 199499, 199506, 199507, 199513, 199514, 199516, 199517, 199518, 199523, 199527, 199531, 199534, 199535, 199537, 199544, 199561, 199564, 199565, 199567, 199570, 199571, 199572, 199573, 199575, 199576, 199579, 199580, 199588, 199591, 199595, 199597, 199600, 199604, 199608, 199614, 199625, 199628, 199635, 199638, 199644, 199646, 199648, 199653, 199655, 199657, 199659, 199662, 199665, 199666, 199667, 199668, 199669, 199676, 199677, 199681, 199684, 199686, 199690, 199692, 199693, 199695, 199706, 199710, 199711, 199716, 199720, 199727, 199728, 199729, 199740, 199744, 199746, 199750, 199753, 199755, 199757, 199764, 199766, 199768, 199769, 199772, 199774, 199780, 199781, 199782, 199783, 199791, 199793, 199798, 199800, 199803, 199812, 199820, 199822, 199826, 199828, 199829, 199832, 199840, 199842, 199849, 199850, 199852, 199854, 199855, 199858, 199867, 199871, 199872, 199883, 199887, 199888, 199891, 199893, 199895, 199898, 199899, 199901, 199906, 199908, 199909, 199910, 199917, 199921, 199923, 199928, 199933, 199940, 199942, 199950, 199952, 199961, 199964, 199970, 199971, 199972, 199973, 199978, 199979, 199980, 199981, 199982, 199983, 199984, 199985, 199986, 199987, 199988, 199989, 199990, 199991, 199992, 199993, 199994, 199995, 199996, 199997, 199998, 199999, 200000, 200001, 200002, 200003, 200004, 200005, 200006, 200007, 200008, 200009, 200010, 200011, 200012, 200013, 200014, 200015, 200016, 200017, 200018, 200019, 200020, 200021, 200022, 200023, 200024, 200025, 200026, 200027, 200028, 200029, 200030, 200031, 200032, 200033, 200034, 200035, 200036, 200037, 200038, 200039, 200040, 200041, 200042, 200043, 200044, 200045, 200046, 200047, 200048, 200049, 200050, 200051, 200052, 200053, 200054, 200055, 200056, 200057]
\ No newline at end of file
diff --git a/recipe/stack/dflash2/sglang_inkling_dflash2.py b/recipe/stack/dflash2/sglang_inkling_dflash2.py
new file mode 100644
index 0000000000000000000000000000000000000000..176ea328c1eda21415ddd55bbb4566ac62461d38
--- /dev/null
+++ b/recipe/stack/dflash2/sglang_inkling_dflash2.py
@@ -0,0 +1,143 @@
+"""Minimal Inkling DFlash2 integration for the pinned official Inkling image.
+
+No target math, sampling, or checkpoint weights are changed.
+"""
+from pathlib import Path
+import hashlib, json
+
+def apply():
+    import sglang
+    root=Path(sglang.__file__).resolve().parent
+    changes=[]
+    pending={}
+    originals={}
+    def read(rel):
+        if rel not in pending:
+            originals[rel]=pending[rel]=(root/rel).read_text()
+        return pending[rel]
+    def edit(rel, old, new):
+        s=read(rel)
+        if new in s:return
+        assert s.count(old)==1,(rel,s.count(old),old[:100])
+        pending[rel]=s.replace(old,new)
+    def undo(rel, old, new):
+        s=read(rel)
+        if new in s:
+            assert s.count(new)==1,(rel,new[:100])
+            pending[rel]=s.replace(new,old)
+    # Upgrade the earlier patch without retaining draft-owned target metadata.
+    undo('srt/speculative/dflash_utils.py',
+         '    is_mla: bool = False\n',
+         '    is_mla: bool = False\n    capture_final_norm: bool = False\n')
+    undo('srt/speculative/dflash_utils.py',
+         '            if val < 0 or val >= target_num_layers:',
+         '            if val < 0 or val > target_num_layers or (val == target_num_layers and not self.capture_final_norm):')
+    undo('srt/speculative/dflash_utils.py',
+         '        final_logit_softcapping=final_logit_softcapping,',
+         '        final_logit_softcapping=final_logit_softcapping,\n'
+         '        capture_final_norm=bool(dflash_cfg.get("capture_final_norm", False)),')
+    alias = ('    def set_dflash_layers_to_capture(self, layer_ids: list[int]) -> None:\n'
+             '        # Both drafts use native post-residual visit features and final norm.\n'
+             '        self.set_dspark_layers_to_capture(layer_ids)\n\n')
+    original = '    def set_dspark_layers_to_capture(self, layer_ids: list[int]) -> None:'
+    undo('srt/models/inkling2.py', original, alias + original)
+    edit('srt/models/inkling2.py', original,
+         alias + '    def get_dflash_valid_vocab_size(self) -> int:\n'
+         '        return int(self.text_config.vocab_size)\n\n' + original)
+    edit('srt/configs/inkling2.py',
+         '    @property\n    def num_layer_visits(self) -> int:',
+         '    def resolve_dflash_capture_layers(self, layer_ids):\n'
+         '        # Inkling features end with the post-final-norm state.\n'
+         '        ids = list(layer_ids) if layer_ids is not None else []\n'
+         '        if (not ids or ids != sorted(set(ids)) or ids[0] < 0\n'
+         '                or ids[-1] != self.num_layer_visits):\n'
+         '            raise ValueError("Inkling draft capture ids must be sorted, unique, "\n'
+         '                             "and end at the final-norm layer visit")\n'
+         '        return ids\n\n'
+         '    @property\n    def num_layer_visits(self) -> int:')
+    edit('srt/model_executor/model_runner_components/spec_aux_hidden_state.py',
+         '        target_layer_ids = dflash_draft_config.resolve_target_layer_ids(\n'
+         '            target_num_layers=int(target_num_layers),\n'
+         '            draft_num_layers=int(draft_num_layers),\n'
+         '        )',
+         '        capture_resolver = getattr(model_config.hf_text_config,\n'
+         '                                   "resolve_dflash_capture_layers", None)\n'
+         '        if callable(capture_resolver):\n'
+         '            target_layer_ids = capture_resolver(dflash_draft_config.target_layer_ids)\n'
+         '        else:\n'
+         '            target_layer_ids = dflash_draft_config.resolve_target_layer_ids(\n'
+         '                target_num_layers=int(target_num_layers),\n'
+         '                draft_num_layers=int(draft_num_layers),\n'
+         '            )')
+    edit('srt/models/dflash.py',
+         '        target_layer_ids = draft_config.resolve_target_layer_ids(\n'
+         '            target_num_layers=target_num_layers, draft_num_layers=num_layers\n'
+         '        )',
+         '        # Explicit feature ids are validated against the actual target\n'
+         '        # by its capture adapter; here only the projection width is needed.\n'
+         '        target_layer_ids = draft_config.target_layer_ids\n'
+         '        if target_layer_ids is None:\n'
+         '            target_layer_ids = draft_config.resolve_target_layer_ids(\n'
+         '                target_num_layers=target_num_layers, draft_num_layers=num_layers\n'
+         '            )')
+    edit('srt/speculative/dflash_worker_v2.py',
+         '        self.selector = self.draft_model.candidate_selector\n',
+         '        self.selector = self.draft_model.candidate_selector\n'
+         '        vocab_resolver = getattr(target_worker.model_runner.model,\n'
+         '                                 "get_dflash_valid_vocab_size", None)\n'
+         '        if self.selector is not None and callable(vocab_resolver):\n'
+         '            self.draft_model.valid_vocab_size = vocab_resolver()\n')
+    undo('srt/models/dflash.py',
+         '        self.valid_vocab_size = None',
+         '        self.valid_vocab_size = config.dflash_config.get("valid_vocab_size")')
+    # The trained selector applies softcap after adding the correction. The
+    # image predates that config field; preserve its default for other drafts.
+    edit('srt/models/dflash.py',
+         '        # The draft has no head of its own; the worker points this at the target\'s',
+         '        self.selector_softcap_mode = config.dflash_config.get("selector_softcap_mode", "before_correction")\n'
+         '        if self.selector_softcap_mode not in ("before_correction", "after_correction"):\n'
+         '            raise ValueError(self.selector_softcap_mode)\n'
+         '        self.candidate_selector.post_softcap = (draft_config.final_logit_softcapping\n'
+         '            if self.selector_softcap_mode == "after_correction" else None)\n'
+         '        self.valid_vocab_size = None\n'
+         '        # The draft has no head of its own; the worker points this at the target\'s')
+    edit('srt/models/dflash.py',
+         '        if softcap is not None:\n            logits.div_(softcap).tanh_().mul_(softcap)',
+         '        if softcap is not None and self.selector_softcap_mode == "before_correction":\n            logits.div_(softcap).tanh_().mul_(softcap)')
+    edit('srt/models/dflash.py',
+         '        return _score_edges(\n            predecessor_table=self.predecessor_codebook,',
+         '        scores = _score_edges(\n            predecessor_table=self.predecessor_codebook,')
+    edit('srt/models/dflash.py',
+         '            top_k=self.top_k,\n        )\n\n    def sample_path(',
+         '            top_k=self.top_k,\n        )\n'
+         '        cap = getattr(self, "post_softcap", None)\n'
+         '        return cap * torch.tanh(scores / cap) if cap else scores\n\n'
+         '    def sample_path(')
+    # Limit the draft candidate projection to the same real vocabulary used by
+    # the target logits processor and training (201024 is padded storage only).
+    edit('srt/models/dflash.py',
+         '    with_partition: bool = False,\n    merged_unary_transform:',
+         '    with_partition: bool = False,\n    valid_vocab_size: Optional[int] = None,\n    merged_unary_transform:')
+    edit('srt/models/dflash.py',
+         '    logits = _project_candidate_logits(\n        hidden, lm_head, num_org=num_org, use_quant_head=use_quant_head\n    )',
+         '    if valid_vocab_size is not None:\n'
+         '        if not tp:\n'
+         '            raise ValueError("This Inkling benchmark integration is validated for TP1")\n'
+         '        num_org = min(num_org, int(valid_vocab_size))\n'
+         '    logits = _project_candidate_logits(\n        hidden, lm_head, num_org=num_org, use_quant_head=use_quant_head\n    )')
+    edit('srt/models/dflash.py',
+         '            hidden, self.lm_head, self.candidate_selector.top_k\n        )\n        return ids, self._transform_unary_logits(vals)',
+         '            hidden, self.lm_head, self.candidate_selector.top_k,\n'
+         '            valid_vocab_size=self.valid_vocab_size\n        )\n        return ids, self._transform_unary_logits(vals)')
+    for rel,s in pending.items():
+        compile(s, str(root/rel), 'exec')
+    for rel,s in pending.items():
+        before=originals[rel]
+        if before != s:
+            (root/rel).write_text(s)
+            changes.append({'file':rel,'before_sha256':hashlib.sha256(before.encode()).hexdigest(),
+                            'after_sha256':hashlib.sha256(s.encode()).hexdigest()})
+    return changes
+
+if __name__=='__main__':
+    print(json.dumps(apply(),indent=2))
diff --git a/recipe/test/clean-checkout.sh b/recipe/test/clean-checkout.sh
new file mode 100644
index 0000000000000000000000000000000000000000..e40ab7309a0c4f51d83e0527f79956d11104dee1
--- /dev/null
+++ b/recipe/test/clean-checkout.sh
@@ -0,0 +1,61 @@
+#!/usr/bin/env bash
+# clean-checkout.sh REPO_DIR MODEL_DIR: boots this release the way a user does and checks it, then removes its container.
+#
+#   bash recipe/test/clean-checkout.sh ~/models/Inkling-2-Mini-DFlash2-t5a-DGX-Spark ~/models/Inkling-2-Mini
+#
+# Steps: (1) every file of REPO_DIR matches its SHA256SUMS; (2) recipe/serve.sh starts the server with its own container name,
+# port and a fresh kernel cache (so nothing from an earlier boot is reused), checking the base weights on the way; (3) the
+# smoke test (recipe/test/smoke.py: chat, reasoning, a tool call, a 32K-token prompt; an image on the long profile);
+# (4) the container is removed whatever happened. Exit status 0 = PASS.
+# Settings: PROFILE (agentic), NAME (inkling2-cleancheck), PORT (8115), MEM (the profile's), KEEP_CACHE=1 keeps the fresh cache,
+# DRY_RUN=1 = steps 1-2 with a docker stand-in that records the docker command lines instead of running them (no GPU, no
+# container; for checking a checkout on any machine). The test never binds beyond 127.0.0.1.
+set -uo pipefail
+REPO=$(cd "${1:?REPO_DIR}" && pwd); MODEL_DIR=$(cd "${2:?MODEL_DIR}" && pwd)
+export PROFILE=${PROFILE:-agentic} NAME=${NAME:-inkling2-cleancheck} PORT=${PORT:-8115} BIND=127.0.0.1 MODEL_DIR
+LOG=${LOG:-$PWD/clean-checkout-$(date +%Y%m%d-%H%M%S).log}
+ph() { echo "[clean-checkout $(date '+%H:%M:%S %Z')] $*" | tee -a "$LOG"; }
+cleanup() {
+  [ "${DRY_RUN:-0}" = 1 ] || { docker logs "$NAME" > "${LOG%.log}.server.log" 2>&1 || true; docker rm -f "$NAME" > /dev/null 2>&1 || true; }
+  case "${SHIM:-}" in /*/inkling2-shim.*) rm -f "$SHIM/docker"; rmdir "$SHIM";; esac
+  if [ "${KEEP_CACHE:-0}" != 1 ] && [ -n "${CACHE:-}" ] && [ -d "$CACHE" ]; then
+    rm -rf "$CACHE" 2>/dev/null || {   # the container wrote root-owned files: remove them through the pinned image (no pull)
+      IMG=$(grep -o 'IMAGE=[^ ]*' "$REPO/recipe/profiles/$PROFILE.row" | head -1 | cut -d= -f2-)
+      docker run --rm --pull=never --network none --entrypoint find -v "$CACHE":/c "$IMG" /c -mindepth 1 -delete > /dev/null 2>&1
+      rmdir "$CACHE" 2>/dev/null || ph "note: could not remove $CACHE (root-owned kernel cache); remove it by hand"; }
+  fi
+}
+if [ "${DRY_RUN:-0}" = 1 ]; then
+  SHIM=$(mktemp -d "${TMPDIR:-/tmp}/inkling2-shim.XXXXXX"); export DOCKER_SHIM_LOG=${DOCKER_SHIM_LOG:-$PWD/docker-argv.log}; : > "$DOCKER_SHIM_LOG"
+  cat > "$SHIM/docker" <<'EOF'
+#!/usr/bin/env bash
+# docker stand-in for DRY_RUN: records argv (NUL-separated args, each call ended by RS + newline) and pretends success
+printf '%s\0' "$@" >> "$DOCKER_SHIM_LOG"; printf '\036\n' >> "$DOCKER_SHIM_LOG"
+case "${1:-}" in run) echo 0000dryrun;; ps) ;; esac
+exit 0
+EOF
+  chmod +x "$SHIM/docker"; export PATH=$SHIM:$PATH WAIT=0
+  ph "DRY RUN: docker calls recorded in $DOCKER_SHIM_LOG"
+else
+  docker ps -a --format '{{.Names}}' | grep -qx "$NAME" && { ph "ABORT: a container named $NAME exists"; exit 1; }
+  ss -tlnH "( sport = :$PORT )" 2>/dev/null | grep -q . && { ph "ABORT: port $PORT in use"; exit 1; }
+fi
+# only now (after the name / port guards) is the container ours to remove on exit
+CACHE=$(mktemp -d "${TMPDIR:-/tmp}/inkling2-cleancheck-cache.XXXXXX"); export CACHE_DIR=$CACHE
+trap cleanup EXIT
+
+ph "1/4 checksums of $REPO"
+( cd "$REPO" && sha256sum --quiet -c SHA256SUMS ) >> "$LOG" 2>&1 || { ph "FAIL: checkout differs from SHA256SUMS"; exit 1; }
+ph "    $(wc -l < "$REPO/SHA256SUMS") files OK"
+ph "2/4 boot: PROFILE=$PROFILE NAME=$NAME PORT=$PORT fresh CACHE_DIR=$CACHE"
+t0=$(date +%s)
+bash "$REPO/recipe/serve.sh" >> "$LOG" 2>&1 || { ph "FAIL: serve.sh exited non-zero (log $LOG)"; exit 1; }
+ph "    boot returned after $(( $(date +%s) - t0 )) s"
+if [ "${DRY_RUN:-0}" = 1 ]; then ph "DRY RUN PASS (no boot, no smoke)"; exit 0; fi
+ph "3/4 smoke"
+python3 -I "$REPO/recipe/test/smoke.py" --port "$PORT" --profile "$PROFILE" 2>&1 | tee -a "$LOG"; rc=${PIPESTATUS[0]}
+ph "4/4 server log lines that must not appear"
+BAD='Traceback|CUDA error|out of memory|OutOfMemory|illegal memory|REFUSED|do not match'
+n=$(docker logs "$NAME" 2>&1 | grep -cE "$BAD" || true); ph "    $n"
+[ "$rc" = 0 ] && [ "$n" = 0 ] && { ph "PASS"; exit 0; }
+ph "FAIL (smoke rc $rc, bad log lines $n)"; exit 1
diff --git a/recipe/test/smoke.py b/recipe/test/smoke.py
new file mode 100644
index 0000000000000000000000000000000000000000..2474d75c413604cae4ed79963075547674f830b3
--- /dev/null
+++ b/recipe/test/smoke.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+"""smoke.py --port 8000 [--profile agentic|long] [--api-key KEY]: functional checks of a running server (standard library only).
+
+1. /v1/models lists inkling-2-mini.
+2. A greedy chat answer is non-empty and finishes.
+3. (information) which field the reasoning arrived in.
+4. A tool call comes back as tool_calls with valid JSON arguments.
+5. A ~32K-token prompt (synthetic, generated here; reasoning_effort none) is answered: the long-prompt prefill and decode paths run.
+6. (--profile long) an image input is described (a generated 64x64 PNG, solid red; reasoning_effort none).
+Exit 0 iff all pass. Prints one line per check.
+"""
+import argparse, base64, json, struct, sys, time, urllib.request, zlib
+
+ap = argparse.ArgumentParser()
+ap.add_argument('--port', type=int, default=8000); ap.add_argument('--host', default='127.0.0.1')
+ap.add_argument('--profile', default='agentic'); ap.add_argument('--api-key', default='')
+a = ap.parse_args()
+BASE = f'http://{a.host}:{a.port}/v1'
+H = {'Content-Type': 'application/json', **({'Authorization': f'Bearer {a.api_key}'} if a.api_key else {})}
+
+def call(path, body=None, timeout=900):
+    req = urllib.request.Request(BASE + path, data=json.dumps(body).encode() if body else None, headers=H)
+    with urllib.request.urlopen(req, timeout=timeout) as r:
+        return json.load(r)
+
+def chat(messages, **kw):
+    t = time.time()
+    d = call('/chat/completions', {'model': 'inkling-2-mini', 'messages': messages, 'temperature': 0, **kw})
+    return d, time.time() - t
+
+def png_red(n=64):
+    raw = b''.join(b'\x00' + b'\xff\x00\x00' * n for _ in range(n))
+    chunk = lambda t, d: struct.pack('>I', len(d)) + t + d + struct.pack('>I', zlib.crc32(t + d) & 0xffffffff)
+    return b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', n, n, 8, 2, 0, 0, 0)) + chunk(b'IDAT', zlib.compress(raw)) + chunk(b'IEND', b'')
+
+ok = True
+def check(name, cond, info=''):
+    global ok
+    ok &= bool(cond); print(f"{'PASS' if cond else 'FAIL'}  {name}  {info}", flush=True)
+
+try:
+    ids = [m['id'] for m in call('/models')['data']]
+    check('models', 'inkling-2-mini' in ids, str(ids))
+    d, dt = chat([{'role': 'user', 'content': 'Write a Python function that returns the n-th Fibonacci number.'}], max_tokens=600)
+    m = d['choices'][0]['message']
+    check('chat', (m.get('content') or m.get('reasoning_content') or '').strip() != '',
+          f"finish={d['choices'][0]['finish_reason']} tokens={d['usage']['completion_tokens']} {dt:.1f}s")
+    print(f"INFO  reasoning field: {'reasoning_content' if m.get('reasoning_content') else 'reasoning' if m.get('reasoning') else 'none in this answer'}", flush=True)
+    tools = [{'type': 'function', 'function': {'name': 'read_file', 'description': 'Read a file from the workspace',
+              'parameters': {'type': 'object', 'properties': {'path': {'type': 'string'}}, 'required': ['path']}}}]
+    d, dt = chat([{'role': 'user', 'content': 'Open src/main.py and tell me what it does.'}], tools=tools, max_tokens=4096)
+    tc = d['choices'][0]['message'].get('tool_calls') or []
+    args = json.loads(tc[0]['function']['arguments']) if tc else {}
+    check('tool call', bool(tc) and tc[0]['function']['name'] == 'read_file' and 'path' in args, f'{args} {dt:.1f}s')
+    lines = '\n'.join(f'def f{i}(x):\n    return x * {i} + {i % 7}' for i in range(1700))
+    d, dt = chat([{'role': 'user', 'content': lines + '\n\nWhich function multiplies by 1234? Answer with its name only.'}], max_tokens=1024,
+                 chat_template_kwargs={'reasoning_effort': 'none'})
+    pt = d['usage']['prompt_tokens']; out = (d['choices'][0]['message'].get('content') or '')
+    check('long prompt', pt > 25000 and 'f1234' in out, f'prompt_tokens={pt} answer={out.strip()[:40]!r} {dt:.1f}s')
+    if a.profile == 'long':
+        img = 'data:image/png;base64,' + base64.b64encode(png_red()).decode()
+        d, dt = chat([{'role': 'user', 'content': [{'type': 'image_url', 'image_url': {'url': img}},
+                       {'type': 'text', 'text': 'What colour is this image? One word.'}]}], max_tokens=1024,
+                 chat_template_kwargs={'reasoning_effort': 'none'})
+        out = (d['choices'][0]['message'].get('content') or '').lower()
+        check('image', 'red' in out, f'{out.strip()[:40]!r} {dt:.1f}s')
+except Exception as e:  # any transport / server error is a failure
+    check('request', False, repr(e)[:300])
+sys.exit(0 if ok else 1)