From 9c5ca2cf03ed179deb702db1b58e4bc014f6558f Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Wed, 14 Oct 2026 16:20:48 +0200 Subject: [PATCH] feat(verify): window GPU smokes, review fixes, seal plan for window assets - QSA KV binding admits the serving index image size; kv addresses refuse until the resolver is reset - GR shared-memory attributes only emitted for sm_70+ - docs/cuda-seal-plan-additions-window.json merges the new sources, bound pins and fast-math risk list - ignored GPU smokes for asset load and shared opt-in Co-Authored-By: Claude Sonnet 5.5 --- PORT-GAPS-MODE17.md | 2 +- crates/cuda-driver/src/original_verify.rs | 1 + .../src/original_verify_window_gpu.rs | 37 ++++ .../src/original_verify_window_gr.rs | 7 +- .../src/original_verify_window_ops.rs | 28 ++- .../src/original_verify_window_qsa.rs | 17 +- crates/cuda-driver/src/qsa_mapped_journal.rs | 3 + docs/cuda-seal-plan-additions-window.json | 195 ++++++++++++++++++ docs/seal-parts/moe.json | 39 ---- docs/seal-parts/qsa.json | 15 -- 10 files changed, 282 insertions(+), 62 deletions(-) create mode 100644 crates/cuda-driver/src/original_verify_window_gpu.rs create mode 100644 docs/cuda-seal-plan-additions-window.json delete mode 100644 docs/seal-parts/moe.json delete mode 100644 docs/seal-parts/qsa.json diff --git a/PORT-GAPS-MODE17.md b/PORT-GAPS-MODE17.md index d1f15aa1..709cd50a 100644 --- a/PORT-GAPS-MODE17.md +++ b/PORT-GAPS-MODE17.md @@ -10,7 +10,7 @@ This is a bounded core-path ledger, not a whole-project completion certificate. | Original source / function | Current Rust boundary | Required completion | | --- | --- | --- | | `src/core/mtp.cpp:143` `MtpDrafter::load`; `:380` `bind`; `:677` `kv_restore`; `include/strata/core/mtp.hpp` `idle/device/tensor_*` | SOURCE-COMPLETE, NOT GPU-RUN (2026-10-14, branch `claude/port-mtp-loader`). `original_mtp_rt.rs` reads dense.txt/dense.bin/experts.bin/draft_vocab.bin; `original_mtp_bank.rs` places them (Original order, nine-name check last); `original_mtp_loader.rs` plans geometry/session/KV/coupled and admits the retained ring; `original_mtp_draft_head.rs` gathers the subset head; `original_mtp_actor_loaded.rs` adopts the genuine drafter and links `idle/device/kv_restore/set_*/draft*/coupled`. Runtime: `RetainedOriginalMtpWeights::from_rt_bank`, `OriginalMtpFullOwner::assemble_rt`, `OriginalPromptExecutor::select_rt_mtp` and the actor-driven `draft_committed_mtp`/`draft_first_committed_mtp`. | Remaining is GPU-only evidence: run the ignored `original_mtp_bank_gpu` tests (`LELEKA_MTP_RT_BANK_GPU=yes`), a real-pack load, and compare drafts with the Original. Nothing above `select_rt_mtp` (serving backend, `OriginalSpecController`) calls it yet: rows 2-3. Not repeated: Original `cudaMemset(cring_, 0xff)`; the Original single-allocation `dense_` (each indexed tensor is its own allocation, same total bytes); `tensor_f32/bf16/q8` host accessors (roles are the retained `Rc` bank). | -| `src/core/verify.cpp:405` `record_window`, `:925` `capture`, `:988` `capture_commit`, `:1054` `run` | `original_verify.rs:235` defines `OriginalVerifyGraphResources`; `original_verify_schedule.rs` owns real streams/graphs/doorbells and accepts a caller recording closure. No concrete implementation of that combined verifier resource trait was found in `crates/`. | Implement retained whole 48-layer native window resources, actual projection/GR/GDN/QSA/MoE/head command recording, cache-slot/source lifetime and CPU pool/PCIe plan callbacks. Record all T graphs and real commit graph before `run`; existing scheduler alone is not the window producer. | +| `src/core/verify.cpp:405` `record_window`, `:925` `capture`, `:988` `capture_commit`, `:1054` `run` | `original_verify.rs:235` defines `OriginalVerifyGraphResources`; `original_verify_schedule.rs` owns real streams/graphs/doorbells and accepts a caller recording closure. No concrete implementation of that combined verifier resource trait was found in `crates/`. | `OriginalVerifyWindowOps` now has capture-time producers for every former `UNBOUND_PRODUCERS` entry (pure planners over SHA-pinned sealed PTX: projections/head, GR, GDN, QSA, MoE; unit-tested against verify.cpp order). Still open: seal `original_verify_window_moe_experts.ptx` and `original_verify_window_qsa_gate.ptx` (`docs/cuda-seal-plan-additions-window.json`; the window fails closed with those names until then), GPU smokes/golden comparisons per kernel and for a whole window, the fast-math re-seal question listed in that JSON, and the runtime-side wiring (weights, QSA/PLE journals, CPU pool callbacks, graph registration before `run`). | | `mtp.cpp` `draft/draft_first` and `verify.cpp` `run/commit/wait_commit`, used together by mode17 generation | `qwen_forward/original_spec_draft.rs` defines `OriginalDraftEngine` / `OriginalFirstDraftEngine`; `original_spec_controller.rs:20` defines `OriginalSpecEngine`. No concrete impl or production `OriginalSpecController::new` call was found. The real driver `OriginalMtpDrafter` and verifier receipt bridge already exist. | Bind the genuine verifier receipts, all-T residual catch-up, actual MTP ring/full seed, accepted-prefix replay/publication, adaptive work and BOTH checkpoint restoration to these traits; then select that controller in the actual serving owner. Preserve sampled history/counter and async commit event dependencies. | | `include/strata/core/verify.hpp` `set_stage/set_next`; `src/core/verify.cpp:191,1054,1382,1412`; `core/on_device.hpp` | `OriginalVerifier` loops all 48 layers, has no next-stage owner or stage handoff fields. Context identity exists, but the unselected MTP actor cannot infer an actual current CUDA device ordinal. | Port stage bounds, mapped portable R+pending-bo+inject handoff, next-user CPU dispatch and last-stage head/sampling/final_R/commit forwarding. This is an absent multi-GPU mode17 leaf, not a single-device quality defect. | | `verify.cpp:137,158,899,1323,1422` public release/diag/profile/logprob/logit APIs | Internal Rust bounded wait release, commit event and completed-row bridge are present. No equivalent public diagnostic/watchdog registry, profile report, window_logprobs or copy_logits API was found in the inspected Original Rust modules. | Expose the actual live verifier release/diagnostic owner; port literal GPU-stage stamps and completed logit/logprob readout (including LOGPOS_TOPK). Keep capture-only graphs inadmissible for readout. Do not call the existing internal release absent. | diff --git a/crates/cuda-driver/src/original_verify.rs b/crates/cuda-driver/src/original_verify.rs index 19ba14ca..f8cece58 100644 --- a/crates/cuda-driver/src/original_verify.rs +++ b/crates/cuda-driver/src/original_verify.rs @@ -15,6 +15,7 @@ #[path="original_verify_window_qsa.rs"] pub(crate) mod qsa; #[path="original_verify_window_moe.rs"] pub(crate) mod moe; #[path="original_verify_window_planner.rs"] pub(crate) mod planner; +#[cfg(test)] #[path="original_verify_window_gpu.rs"] mod window_gpu; pub use layout::{OriginalVerifyGeometry,OriginalVerifyLayout,OriginalVerifySpan}; pub use diag::{OriginalVerifyDiag,original_verify_diagnostics,original_verify_live_count,original_verify_release_live,write_original_verify_diagnostics}; pub use profile::{OriginalVerifyProfile,PROFILE_STAMPS_PER_LAYER,profile_stamp_slot,profile_stamp_words}; diff --git a/crates/cuda-driver/src/original_verify_window_gpu.rs b/crates/cuda-driver/src/original_verify_window_gpu.rs new file mode 100644 index 00000000..80841cfb --- /dev/null +++ b/crates/cuda-driver/src/original_verify_window_gpu.rs @@ -0,0 +1,37 @@ +//! Root-only device proofs for the window producers' sealed kernel assets. They need a CUDA device +//! and run only with the enabling variable; on every other host they are compile-checked, never +//! executed. They certify that the pinned PTX loads on the card and exports every entry the +//! planners name, NOT numerics (the per-kernel golden comparisons against the Original are listed in +//! the work report). +use super::*; +use crate::Driver; + +const ENABLE: &str = "LELEKA_VERIFY_WINDOW_GPU"; + +#[test] +#[ignore = "Root-only: needs a CUDA device"] +fn sealed_window_assets_load_on_the_device_and_export_every_named_entry() { + assert_eq!(std::env::var(ENABLE).ok().as_deref(), Some("yes")); + let driver = Driver::load().expect("driver"); + let device = driver.device(0).expect("device"); + let context = device.create_context(1 << 30).expect("context"); + let bank = context.original_verify_bank(kernels::test_geometry()).expect("bank"); + let all = window_ops::all_window_assets(); + // Every sealed module is loaded (cuModuleLoadData + cuModuleGetFunction per named entry); the first + // placeholder is then reported by name. + let result = bank.physical.ensure_window_assets(&all); + let sealed = all.iter().filter(|a| a.sealed().is_ok()).map(|a| a.key()).collect::>(); + let loaded = bank.physical.window.borrow().iter().map(|(name, _, _)| *name).collect::>(); + assert_eq!(loaded, sealed); + match window_ops::unsealed_window_assets().first() { + Some(_) => assert!(matches!(result, Err(Error::InvalidDriverValue(m)) if m.contains("unsealed"))), + None => result.expect("all assets sealed"), + } + // the card's fused-GR decisions are readable (compute capability 12.x for the sm_120 PTX, a shared opt-in) + assert!(bank.physical.window_device_attribute(75).expect("cc major") >= 7); + assert!(bank.physical.window_device_attribute(97).expect("opt-in shared") >= 48 * 1024); + // loading again is a no-op and a second call with a subset is satisfied by the loaded modules + let _ = bank.physical.ensure_window_assets(&all); + assert_eq!(bank.physical.window.borrow().len(), loaded.len()); + bank.close().expect("close"); +} diff --git a/crates/cuda-driver/src/original_verify_window_gr.rs b/crates/cuda-driver/src/original_verify_window_gr.rs index 94404386..053685f9 100644 --- a/crates/cuda-driver/src/original_verify_window_gr.rs +++ b/crates/cuda-driver/src/original_verify_window_gr.rs @@ -211,8 +211,10 @@ impl GrConfig { chunk_plain: clamp(usable / (tile * 4)), chunk_staged: clamp(usable / (2 * STAGED_TILE * 4)), usable_shared: usable, - attr_down: (optin > 0).then_some(want), - attr_staged: (optin > 0).then_some(want_staged), + // below sm_70 the attribute cannot raise the limit (and a card that rejects it is ignored + // by the Original), so no attribute is emitted there + attr_down: (cc_major >= 7 && optin > 0).then_some(want), + attr_staged: (cc_major >= 7 && optin > 0).then_some(want_staged), } } @@ -967,6 +969,7 @@ mod tests { let c60 = GrConfig::from_device(GrVariant::Plain, true, 6, 0, 65_536, 49_152); assert_eq!(c60.usable_shared, 49_152); assert_eq!(c60.chunk_plain, 4); + assert_eq!((c60.attr_down, c60.attr_staged), (None, None)); // a card that cannot hold one token still reports a chunk of 1 (the launch is then refused) let tiny = GrConfig::from_device(GrVariant::Plain, true, 6, 1, 0, 4096); assert_eq!((tiny.chunk_plain, tiny.chunk_staged), (1, 1)); diff --git a/crates/cuda-driver/src/original_verify_window_ops.rs b/crates/cuda-driver/src/original_verify_window_ops.rs index 0465a7b0..e8ba27f8 100644 --- a/crates/cuda-driver/src/original_verify_window_ops.rs +++ b/crates/cuda-driver/src/original_verify_window_ops.rs @@ -39,7 +39,7 @@ use crate::{OriginalNativeEmbedRows, OriginalNativeHeadGraphResources}; pub const UNBOUND_PRODUCERS: &[&str] = &[]; /// Every kernel asset a window can launch from (all families), regardless of what is attached. -fn all_window_assets() -> Vec<&'static AssetSpec> { +pub(super) fn all_window_assets() -> Vec<&'static AssetSpec> { let mut all = Vec::new(); all.extend(proj::mmvq_assets()); for family in [gr::assets(), qsa::assets(), moe::assets()] { @@ -586,6 +586,32 @@ impl<'a, 'ctx> OriginalVerifier<'ctx, OriginalVerifyWindowResources<'a, 'ctx>> { mod tests { use super::*; + #[test] + fn exactly_the_new_sources_are_unsealed_until_root_seals_them() { + // The two NEW sources (grouped native experts, fast-math QSA gate) are placeholders; every other asset is a + // pinned, sealed PTX. A window cannot be recorded while any asset it uses is unsealed. + let mut unsealed = unsealed_window_assets(); + unsealed.sort_unstable(); + assert_eq!(unsealed, ["original_verify_window_moe_experts.ptx", "original_verify_window_qsa_gate.ptx"]); + } + + #[test] + fn every_window_asset_is_listed_once_and_names_a_distinct_module() { + let all = all_window_assets(); + let mut keys: Vec<&str> = all.iter().map(|a| a.key()).collect(); + let count = keys.len(); + keys.sort_unstable(); + keys.dedup(); + // specs of one PTX file share a key (entries are unioned by the loader); no key hides two different files + assert!(keys.len() <= count); + for key in &keys { + let mut pins = all.iter().filter(|a| a.key() == *key).map(|a| (a.sha, a.ptx.len())); + let first = pins.next().unwrap(); + assert!(pins.all(|p| p == first), "{key}: specs of one module disagree on the file"); + } + assert!(UNBOUND_PRODUCERS.is_empty()); + } + #[test] fn expert_layout_requires_whole_16_byte_blobs_within_the_staging_bound() { assert!(OriginalVerifyExpertLayout::new([1 << 20; WINDOW_LAYERS], 4 << 20).is_ok()); diff --git a/crates/cuda-driver/src/original_verify_window_qsa.rs b/crates/cuda-driver/src/original_verify_window_qsa.rs index 69a398c6..1ad81888 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa.rs +++ b/crates/cuda-driver/src/original_verify_window_qsa.rs @@ -296,9 +296,12 @@ impl OriginalVerifyQsaKvBinding { if seen.windows(2).any(|w| w[0] == w[1]) { return Err(Error::OutputAliasesInput); } - let max_blocks = max_blocks(g); - if self.pooled_bytes < max_blocks * g.index_dim * 4 || self.dead_bytes != g.index_dim * 4 { - return Err(Error::ShapeMismatch { expected: max_blocks * g.index_dim * 4, actual: self.pooled_bytes }); + // The serving index image holds one pooled key row per completed block plus the partial one + // (`pooled_rows() = max_cells / index_block + 1`); the scratch arrays use two more rows + // (`max_blocks`) but they live in the arena, not in the index image. + let pooled_need = (g.max_cells / g.index_block + 1) * g.index_dim * 4; + if self.pooled_bytes < pooled_need || self.dead_bytes != g.index_dim * 4 { + return Err(Error::ShapeMismatch { expected: pooled_need, actual: self.pooled_bytes }); } Ok(()) } @@ -852,7 +855,7 @@ mod tests { // the body is the Original `gate`: second half of each [head][2][head_dim] row assert!(source.contains("q_full[head * 2 * head_dim + head_dim + channel]")); assert!(source.contains("1.0f / (1.0f + expf(-raw))")); - assert!(include_str!("../../../docs/seal-parts/qsa.json").contains("--use_fast_math")); + assert!(include_str!("../../../docs/cuda-seal-plan-additions-window.json").contains("--use_fast_math")); } #[test] @@ -1056,6 +1059,12 @@ mod tests { let mut short = layer(); short.kv.pooled_bytes = 512; assert!(w.kv_append(0, &short, rows(0, 1)).is_err()); + // the serving image is exactly (max_cells / index_block + 1) rows: it must be admitted + let mut serving = layer(); + serving.kv.pooled_bytes = (4096 / 4 + 1) * 512; + assert!(w.kv_append(0, &serving, rows(0, 1)).is_ok()); + serving.kv.pooled_bytes -= 1; + assert!(w.kv_append(0, &serving, rows(0, 1)).is_err()); let mut unaligned = layer(); unaligned.kv.table += 4; assert!(w.kv_append(0, &unaligned, rows(0, 1)).is_err()); diff --git a/crates/cuda-driver/src/qsa_mapped_journal.rs b/crates/cuda-driver/src/qsa_mapped_journal.rs index bf0d9366..4fb1fd2f 100644 --- a/crates/cuda-driver/src/qsa_mapped_journal.rs +++ b/crates/cuda-driver/src/qsa_mapped_journal.rs @@ -147,6 +147,9 @@ impl<'ctx> OriginalQsaMappedJournal<'ctx>{ /// Read only: no coverage, epoch or resolver state changes. pub(crate) fn window_kv_addresses(&self)->Result<([u64;4],u64,[u64;4],[u64;7])>{ self.validate_context(self.owner.context)?; + // The captured window launches the resolver against these slots: it must have been reset (zeroed + // page table / slot stamps) by an owner call first, exactly like the prompt paths do lazily. + if !self.resolver_ready{return Err(Error::InvalidDriverValue("Original verifier producer unavailable: qsa_resolve: the streamed KV resolver was not initialised (reset) before the window capture"))} let table=self.owner.pools.table()?; let resolver=self.owner.resolver.as_ref().ok_or(Error::ContextPoisoned)?.window_addresses(table)?; Ok((self.owner.pools.addresses()?,table,self.owner.host_addresses()?,resolver)) diff --git a/docs/cuda-seal-plan-additions-window.json b/docs/cuda-seal-plan-additions-window.json new file mode 100644 index 00000000..9fe8c747 --- /dev/null +++ b/docs/cuda-seal-plan-additions-window.json @@ -0,0 +1,195 @@ +{ + "schema": 1, + "purpose": "Assets Root must seal for the literal Verifier window recorder (OriginalVerifyWindowOps). Everything not listed under new_sources is an already sealed asset that the window producers merely bind (SHA-256 pinned in the AssetSpec constants of crates/cuda-driver/src/original_verify_window_*.rs).", + "toolkit": "deploy/cuda-toolkit.lock.json (CUDA 13.0.88), built through scripts/build-original-verify-ptx.sh", + "new_sources": [ + { + "source": "crates/cuda-driver/src/original_verify_window_moe_experts.cu", + "ptx": "crates/cuda-driver/src/original_verify_window_moe_experts.ptx", + "nvcc": [ + "--ptx", + "-std=c++17", + "-O3", + "-arch=sm_120", + "--fmad=true", + "--ftz=false", + "-Iengine/strata/include", + "-Iengine/strata/third_party/ggml", + "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-cuda", + "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-include", + "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-src" + ], + "exports": [ + "window_moe_gu_16", + "window_moe_gu_17", + "window_moe_gu_18", + "window_moe_gu_21", + "window_moe_gu_22", + "window_moe_gu_23", + "window_moe_gu_29", + "window_moe_gu_42", + "window_moe_gu_12", + "window_moe_gu_13", + "window_moe_gu_8", + "window_moe_down_20", + "window_moe_down_23", + "window_moe_down_42", + "window_moe_down_7", + "window_moe_down_8" + ], + "derived_from": "engine/strata/src/kernels/cuda/iq_kernels.cu (native_gu_kernel, native_gu_multi_kernel, native_down_kernel, native_down_multi_kernel via native_expert_grouped / launch_gu / launch_down; textually includes crates/cuda-driver/src/mtp_original_full_head_iq.cu, the sealed copy of iq_kernels.cu; engine/strata/CMakeLists.txt gives iq_kernels.cu no per-source COMPILE_OPTIONS)", + "notes": "NEW source: no sealed PTX instantiates the grouped gate/up and down templates for the target's formats. The rest of native_expert_grouped (swiglu_entries_kernel, quantize_q8_1_kernel) is sealed in mtp_original_full_head_iq.ptx under mangled names. The PTX will also carry the unused head_* / dequant entries of the included file. Update EXPERTS.sha in original_verify_window_moe.rs after sealing; the build script's required-exports check should list the exports above.", + "install": "Compile, append exactly ONE terminal NUL byte (like the other sealed MTP assets), write over the placeholder .ptx, then replace the all-zero `sha` of the matching AssetSpec by sha256 of the bytes BEFORE the NUL." + }, + { + "source": "crates/cuda-driver/src/original_verify_window_qsa_gate.cu", + "ptx": "crates/cuda-driver/src/original_verify_window_qsa_gate.ptx", + "nvcc": [ + "--ptx", + "-std=c++17", + "-O3", + "-arch=sm_120", + "--fmad=true", + "--use_fast_math", + "-Iengine/strata/include", + "-Iengine/strata/third_party/ggml", + "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-cuda", + "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-include", + "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-src" + ], + "exports": [ + "verify_window_qsa_gate" + ], + "derived_from": "engine/strata/src/kernels/cuda/native_qsa.cu (kernel `gate`; CMakeLists.txt compiles native_qsa.cu with --use_fast_math)", + "nvcc_note": "--use_fast_math (as engine/strata/CMakeLists.txt compiles native_qsa.cu) implies --ftz=true --prec-div=false --prec-sqrt=false --fmad=true; --ftz=false is deliberately NOT passed.", + "install": "Compile, append exactly ONE terminal NUL byte (like the other sealed MTP assets), write over the placeholder .ptx, then replace the all-zero `sha` of the matching AssetSpec by sha256 of the bytes BEFORE the NUL." + } + ], + "sealed_assets_bound": [ + { + "ptx": "crates/cuda-driver/src/mtp_original_full_attention.ptx", + "sha256": "3fb235ca405d24c3b8d0ec46611d9d640103b71a65859923194f02f06b482f6c" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_bf16.ptx", + "sha256": "a16dfcfc9a49ccab25d8030293d5826f8f75e2868fae1b6c4cef706b6dfc3d08" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_combine.ptx", + "sha256": "2253fe2d641350f4445a0a69c4a0fc22b85c2fffca7cbd536ffe5d2912f81fb7" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_element.ptx", + "sha256": "8fdfdf8ef616698c12301f7df4716fc022bf34b419099e4c972729920bd5f4a7" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_fused_gr.ptx", + "sha256": "ac5400a7972b3f242648c2de71ef4f178466d38b1392a83a9591b3b24e92c59b" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_gr_norm.ptx", + "sha256": "ba95d7c5b27cc9d4c1cfbc6b3bcd000e5ba29b124c661c090515c86d8237e05c" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_gr_post.ptx", + "sha256": "e884c4a3a20695c798d48b156657ff24b9322c1568430f5144cfdaeed14ef25a" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_head_iq.ptx", + "sha256": "3c5f13d5747f78a04be4155f0824b91f7e4b10ca3796add24912228fab5a4520" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_head_native.ptx", + "sha256": "da5ca63be66149554d18b03ae6a3ea295f7b2c97afbd6491445ee1ae0a29e242" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_router.ptx", + "sha256": "c5b933b5010683a92ada414d312156bbde87c6c59bb1f883713a0682a15920e4" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_router_legacy.ptx", + "sha256": "a58412249757cc351eb8332e807e79f1b3da5865574d0fb7179ef558df70af24" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_s2.ptx", + "sha256": "fbb917d590ea80338a7bdf07b2ca6d458fa72763ba279e576bcc1eec8836fd55" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_full_shared.ptx", + "sha256": "b36f432692e43f7948a2538c22cab55ef67c625b8d4461c67ca2a27519b9e0f0" + }, + { + "ptx": "crates/cuda-driver/src/mtp_original_kv.ptx", + "sha256": "e0c1ff10d3d4bcf8fd3369713079b232e62cdb2c3a345faec49d1e66763f911f" + }, + { + "ptx": "crates/cuda-driver/src/ple_native_batch.ptx", + "sha256": "1a382cbe867bc193c6af5292c2cbcfbd8e2f57cd1950c90de4f30000367410b3" + }, + { + "ptx": "crates/cuda-driver/src/qsa_decode_postops.ptx", + "sha256": "000a824e087c569bfa4cbad8dc919f845cba2a86348bbff1e7fcd206dc28b3a9" + }, + { + "ptx": "crates/cuda-driver/src/qsa_prompt_postops.ptx", + "sha256": "261233f1975941a86d0ffa7b9a2e26250163ddea682874bc85aaad8d9b20c1a0" + }, + { + "ptx": "crates/cuda-driver/src/qsa_prompt_resolver.ptx", + "sha256": "ab672a54a7b9131d85b248cf56b409342634f9280b9b18482850fba3b66b1100" + }, + { + "ptx": "crates/cuda-driver/src/qsa_prompt_select.ptx", + "sha256": "1e35514744216229b0cffb4f45d2f13f25cb95f377a30c1c012543dbf53a1c2d" + } + ], + "numerics_risk_fast_math": { + "engine_fast_math_sources_cmake": [ + "native_mmvq", + "native_bf16", + "native_gr_norm", + "native_moe", + "native_gdn", + "native_gr_postops", + "native_router", + "native_gdn_preprocess", + "native_qsa", + "native_rope", + "native_ple_postops", + "native_flash_attn", + "native_qsa_indexer", + "native_qsa_score" + ], + "note": "engine/strata/CMakeLists.txt compiles these Original sources with --use_fast_math. The sealed Rust copies below were built with the precise flags of scripts/build-original-verify-ptx.sh (--fmad=true --ftz=false). Some copies reproduce the fast-math operations with explicit intrinsics in the .cu (e.g. mtp_original_full_shared.cu: __fdividef/__expf); the others are a numerics risk for bit-exact parity with the Original window until a per-kernel golden comparison on the GPU (or a re-seal with --use_fast_math) proves otherwise.", + "candidate_resealed_assets": [ + { + "ptx": "mtp_original_full_head_native.ptx", + "derived_from": "native_mmvq / head_dispatch (quantize_q8_1 + MMVQ)" + }, + { + "ptx": "mtp_original_full_bf16.ptx", + "derived_from": "native_bf16" + }, + { + "ptx": "mtp_original_full_router.ptx / mtp_original_full_router_legacy.ptx", + "derived_from": "native_router" + }, + { + "ptx": "mtp_original_full_gr_norm.ptx / mtp_original_full_gr_post.ptx / mtp_original_full_fused_gr.ptx", + "derived_from": "native_gr_norm / native_gr_postops" + }, + { + "ptx": "mtp_original_full_combine.ptx", + "derived_from": "native_moe" + }, + { + "ptx": "mtp_original_full_attention.ptx / qsa_decode_postops.ptx / qsa_prompt_postops.ptx / qsa_prompt_select.ptx", + "derived_from": "native_flash_attn / native_qsa / native_qsa_indexer / native_qsa_score" + }, + { + "ptx": "ple_native_batch.ptx", + "derived_from": "native_ple_postops" + } + ] + } +} diff --git a/docs/seal-parts/moe.json b/docs/seal-parts/moe.json deleted file mode 100644 index e80a5ef3..00000000 --- a/docs/seal-parts/moe.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "source": "crates/cuda-driver/src/original_verify_window_moe_experts.cu", - "ptx": "crates/cuda-driver/src/original_verify_window_moe_experts.ptx", - "nvcc": [ - "--ptx", - "-std=c++17", - "-O3", - "-arch=sm_120", - "--fmad=true", - "--ftz=false", - "-Iengine/strata/include", - "-Iengine/strata/third_party/ggml", - "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-cuda", - "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-include", - "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-src" - ], - "exports": [ - "window_moe_gu_16", - "window_moe_gu_17", - "window_moe_gu_18", - "window_moe_gu_21", - "window_moe_gu_22", - "window_moe_gu_23", - "window_moe_gu_29", - "window_moe_gu_42", - "window_moe_gu_12", - "window_moe_gu_13", - "window_moe_gu_8", - "window_moe_down_20", - "window_moe_down_23", - "window_moe_down_42", - "window_moe_down_7", - "window_moe_down_8" - ], - "derived_from": "engine/strata/src/kernels/cuda/iq_kernels.cu (native_gu_kernel, native_gu_multi_kernel, native_down_kernel, native_down_multi_kernel via native_expert_grouped / launch_gu / launch_down; textually includes crates/cuda-driver/src/mtp_original_full_head_iq.cu, the sealed copy of iq_kernels.cu; engine/strata/CMakeLists.txt gives iq_kernels.cu no per-source COMPILE_OPTIONS)", - "notes": "NEW source: no sealed PTX instantiates the grouped gate/up and down templates for the target's formats. The rest of native_expert_grouped (swiglu_entries_kernel, quantize_q8_1_kernel) is sealed in mtp_original_full_head_iq.ptx under mangled names. The PTX will also carry the unused head_* / dequant entries of the included file. Update EXPERTS.sha in original_verify_window_moe.rs after sealing; the build script's required-exports check should list the exports above." - } -] diff --git a/docs/seal-parts/qsa.json b/docs/seal-parts/qsa.json deleted file mode 100644 index 04a7733c..00000000 --- a/docs/seal-parts/qsa.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "source": "crates/cuda-driver/src/original_verify_window_qsa_gate.cu", - "ptx": "crates/cuda-driver/src/original_verify_window_qsa_gate.ptx", - "nvcc": [ - "--ptx", "-std=c++17", "-O3", "-arch=sm_120", "--fmad=true", "--ftz=false", "--use_fast_math", - "-Iengine/strata/include", "-Iengine/strata/third_party/ggml", - "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-cuda", - "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-include", - "-Icrates/cuda-driver/src/third_party/llamacpp/ggml-src" - ], - "exports": ["verify_window_qsa_gate"], - "derived_from": "engine/strata/src/kernels/cuda/native_qsa.cu (kernel `gate`; CMakeLists.txt compiles native_qsa.cu with --use_fast_math)" - } -]