Repository navigation
[Core] Bound Flash-Next TP4 memory and fix GGUF MMQ expert bounds - #1210
yangzhuxinyzx merged 34 commits into
Conversation
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Add opt-in E4M3 target hot storage with native and protected-reader support, preserving FP16 attention operands and the default cache policy. Qualify 32K mean verifier bounds, ordinary decode, quality and near-256K capacity on TP4 V100 16GB. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
…-20261014-065933 Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
…-20261014-065933 Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com> Assisted-by: Codex
Combine the qualified prefill and decode dependencies in an owned local deployment with MTP4, prefix caching, tools, encoded target hot KV and independent draft capacity. Record the model revision, direct mirror download contract and focused GPU qualification. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Record measured prefill and pure decode, near-256K task completion, prefix hit counters and public API validation. Retain the measured prefix admission limitation and transparent proxy routing correction. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Expose the existing host-indexer cache setting in the launcher while preserving its default. Record destination-native GPU checks, memory qualification, near-256K task completion, matched prefill, prefix reuse and public authentication/stream evidence. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
…l chunks _short_conv_dilated_prefill_batched pads every prefill in a step to the longest one, so the packed history and the convolution output are [num_prefills, hidden, state + max_len]. With long chunked prefills next to short prompts this is several times the step itself, a shape the profiling run never takes. At max_num_seqs=8, a step with 4 x 100K chunked prefills plus new chats (hidden 10240) made F.conv1d ask for 480 MiB with 414 MiB free, and the engine died. When a step has more than one prefill and the padded buffer exceeds half of the unpadded step, process the channels in chunks sized to keep each padded buffer within that half (a multiple of 64 channels, at least 64). The convolution is depthwise, so every channel's arithmetic, the state write-back and the output are unchanged; the tests compare the bits with the padded oracle and with the single-pass path. Also give test_qwen4_exp_v2_model_state_uses_committed_ngram_context the admission state that prepare_inputs reads since #988; on main the test fails with an AttributeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Bound long single-prefill PLE temporaries using the existing channel chunks. Record matched host/device indexer evidence and validate state equality and device headroom. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Use the existing 32-row workspace for row-independent tiled prefill. Retain both reference and native capacity in either initialization order, and verify tiled output and changed-input CUDA graph replay bitwise. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Release consumed HC and QSA score temporaries. Keep serial layer prefetch fenced on the existing stream, with typed one/two-slot policy and 256K boundary tests. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Port the peer TP4 QSA row partition and bounded PLE prefill convolution, retaining tile lifetime repairs, explicit admission and ordinary decode paths. Record destination operator gates and the complete 15.217 ms verifier window. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Reuse the qualified peer HC stages with separate MoE partial dependencies and padded row ownership. Restrict deployment admission to unreduced GGUF and retain existing decode/capture fallbacks. Record passed CPU gates and the remaining destination acceptance work. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
|
The SM70 PLE prefill fast path in Why: in Mamba align mode and state_indices_tensor_p.is_contiguous()
and has_initial_states_p.is_contiguous()So a pure-prefill step with ≥2 prefills ( We hit this on 4×V100-SXM2-32GB, TP4, Flash-Next NVFP4 + MTP4, with no chunk bound in the fallback. A long cold prompt plus a second cold prompt in the same step produced an 8160 + 32 token step. The padded fallback allocated Fix we run in production: drop the two contiguity checks from the admission, and pass contiguous copies to the kernel (a handful of int32/bool values per step): state_indices_tensor_p[:num_prefills].contiguous(),
has_initial_states_p[:num_prefills].contiguous(),The kernel itself is unchanged; our copy is byte-identical to the one in this branch. Regression test:
With this change and the #1209 channel chunks plus the score-tile
Happy to open a small PR with the fix and the test if that helps. (Investigation and write-up AI-assisted; reviewed and tested by me.) |
Add an explicit startup resource policy after all kernel and graph warmup. Preserve active buffers and private capture pools, and retain configuration/consumer and changed-input GPU replay checks. Record the ordinary long-context verifier curve and remaining deployment gates. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Distribute long score rows across existing exact local selectors and merge their canonical candidate union without changing FP32 scores or tie ordering. Keep typed opt-in admission and original fallbacks; record exact GPU replay/guard checks and pending model gates. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Expose a typed queue budget without changing runtime placement, weights or computation hashes. Preserve the default and qualify bounded ordered loading; record host-pressure failures and pending model acceptance. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Keep requested device headroom beyond measured non-Torch use while retaining active tensors and captured pools. Default off, preserve tighter process caps, and explicitly reject impossible retained budgets; destination model qualification remains pending. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Communicate every HC prefill partial in FP32 and preserve the established process GEMM policy so MTP packed decode remains admitted. Qualify existing true-reduction state/graph cases without relaxing the failed FP16 drift limit; full-model resource and verifier gates remain pending. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Keep the complete query count explicit for packed result decoding and remove the full hidden gather and duplicate shard before PLE. Preserve the full convolution transaction and existing fallback. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Keep complete causal history and state commits while bounding TP4 output storage. Preserve original unpartitioned operations and qualified fallbacks. Exercise actual metadata dispatch and padding through graph replay. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
…ests pass) Uncommitted work taken over from the Codex session: shard rows before the pre-FC norms and gather only the small FC weight shards. The mtp.py call site is in the next commit together with the memory changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
…profile - GGUF affine BLAS scratch is sized by the projections actually admitted (12.5 MiB) instead of the largest calibrated shape of any model (170 MiB). - The speculator reads the target's persistent MTP hidden buffer in place instead of copying it into a second 8192 x 10240 buffer (160 MiB). - The MTP layer borrows the target's serially reused QSA top-k workspace (64 MiB) and identical RoPE tables (32 MiB). - MTP Q8 MoE prefill chunk 2048 -> 1024 tokens (its temporaries sit at the measured prefill peak). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Pass the actual expert count through the existing MMQ family instead of rejecting IDs above 255. Keep expert pointer arithmetic wide enough for larger banks. Cover expert-count boundaries, upper-half routing and changed-input graph replay against dequantized references. Assisted-by: GPT-6 (Codex) Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Reuse the target MTP buffer as the HC gather destination while preserving padded tails and qualified fallbacks. Qualify shared workspace ownership and FP16 draft staging at page-rounded 256K boundaries, retain the measured 2048-token Q8 prefill throughput, and version the full acceleration profile with a 512 MiB allocator reserve. Assisted-by: GPT-6 (Codex) Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Record the one-boot 52-request ordinary run, cold-prefix prefill, long-context quality, exact capacity and sampled per-device margins. Keep loading-cache pressure and the unmeasured verifier target explicit; profiling was deferred at the user request to restore the public API. Assisted-by: GPT-6 (Codex) Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Purpose
Flash-Next TP4 on 4×V100 16 GB retained duplicate workspaces and full HC/PLE temporaries, leaving too little space for long prefill. Bound ownership and lifetimes while preserving 80% GPU / 20% host experts, 512 MiB allocator reserve, host main KV with GPU compressed index history, 256K total context, prefix caching, tools/thinking and FULL MTP4.
Reuse the existing QSA, HC, PLE and GGUF families. Qualified HC prefill keeps rows local, including MTP FC and PLE convolution outputs; the target's final HC gather writes its persistent MTP buffer directly and preserves capacity tails. Share identical RoPE, serial QSA top-k and target/draft hidden storage; size BLAS scratch by admitted projections. Preserve decode policy and qualified fallbacks. The versioned launcher enables the profile, including one page-rounded shared stage that covers FP16 draft history through 262144 tokens.
The module memory/speed comparison also exposed a correctness bug: generic GGUF MMQ skipped experts above 255 although the MTP has512. Pass the weight tensor's actual expert count through the existing kernels, widen expert byte-offset multiplication, and retain the public op ABI and quantization.
Test Plan and Results
-76 focused memory/ownership tests passed. TP4 target and MTP FC/HC adapters passed six query shapes4096/4097/7344/7345/8192/16384, padding, complete outputs/state and changed-input CUDA graph replay under the original paired0.001 numerical bound. Synthetic4096-row MTP adapter peak delta500.18→180.01MiB; this is not whole-model HBM evidence.
_C_stable_libtorchrebuilt from the owned source on CUDA12.8/Torch2.10.0+cu128/SM70. Installed standard library SHA256699d904f5d058d6f401930d9ab076160dfea69af66838349ffeb817fda488a44; other11 normal artifacts unchanged from6ca4143c747898ddc3f09895439a9c0359e1973e. All12 dependency audits use only standard CUDA/Torch/system libraries, with no private DSO/preload.-18 additional expert-bound, full Q8 MoE and staging-budget cases passed: Q8 E128/256/257/512, Q4_0 E257/512, upper-half expert IDs and changed-input/routes graph replay against dequantized FP32 references; full MTP Q8 crosses the64/65-token dispatch boundary. The original benchmark's uninitialized/nonfinite failure is retained.
host_kv_forward, mapped host backing, page816,513 queries: the old byte budget admits only130560 tokens. At130561 tokens, old fallback≈203ms versus enlarged staging≈31ms; at262144 tokens,≈225ms versus≈59ms. Maximum paired row L2<0.000345 and absolute error7.63e-6, within predeclared0.001/0.002 limits. One shared stage budget525504 costs another130.60MiB; hot KV/state blocks/expert fraction remain unchanged.Remaining Qualification
The one-boot ordinary Worker acceptance passed:52 sequential requests (13 each at actual32774/65604/131124/261044 input tokens), three long-context retrieval/arithmetic/natural-EOS checks through260977 input tokens, and exact262139 input+5 output=262144 total capacity. No OOM, hang or automatic restart. Cold-prefix32000-word trials had actual34606–34688 input tokens: TTFT6.525–6.576s, median6.5537s and5284.2tok/s. External200ms driver samples showed minimum778MiB free on every GPU after readiness. Startup driver free briefly reached18MiB, including allocator reservations; the post-ready gate does not establish an all-startup physical floor. No profiler or memory observer ran during this ordinary acceptance.
The user requested immediate public API access, so the newly started short profiler was cancelled during loading and ordinary serving was restored. The public tunnel passed authenticated model discovery,401 rejection, arithmetic SSE (first reasoning/text1.59s) and tool-call checks; one initial tool transport disconnect was retained and its separate retry passed. This is a public smoke, not a stability or verifier-performance claim. Exact target-GPU-start→latest-TP4-state-commit costs across32/64/128/256K remain pending. No all-context16ms claim is made; HTTP round estimates and old partial traces are excluded.
Raw reports, failed paths and diagnostic snapshots:
/home/test/flashnext-256k/codex-abliterated-20261014/decode-parity-20261015/and/home/test/flashnext-256k/claude-memdiag/; implementation/range/fallback notes inbenchmarks/flashnext_prefill/HANDOFF.md.