Skip to content

[ROCm][RDNA2] Add TP2 AWQ MoE expert offloading with graph replay - #146

Merged
BlivionIaG merged 1 commit into
rdna_extrasfrom
codex/rdna2-awq-moe-offloading
Oct 28, 2026
Merged

BlivionIaG merged 1 commit into
rdna_extrasfrom
codex/rdna2-awq-moe-offloading

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Oct 28, 2026 •

Copy link
Copy Markdown

Flash-Next's expert weights do not fit the tested TP2 deployment when fully resident. This adds immutable pinned-RAM expert banks, bounded GPU slots with decayed LFU/LRU replacement, protected demand leases, consumer-fenced transfers, and overflow passes.

MonoKernel execution is split into captured prefix, expert-pass, and finish stages around host cache planning. Segmented FULL_AND_PIECEWISE graphs, MTP2, prefix caching, and the existing native CPU KV tier are supported. Padding rows do not enter residency statistics.

Dense W4A16 split-K atomics and unordered QSA block selection caused repeat variation. The offload launcher enables guarded Q32 dense accumulation; RDNA QSA canonicalizes selected block order. The existing dense resident default is preserved.

Validation

Target: two Radeon PRO V620 on par1-cs25 (HIP 6–7), TP2/EP2, FP16, MTP2, 96 expert slots per layer, 16 GiB native CPU KV tier. Model: wtdcode/Qwen3.8-Flash-Next-AWQ-W4A16, compressed-tensors symmetric INT4, group 128.

  • 153 local CPU tests and all commit hooks pass; focused GPU suites cover dense repeatability/guards, MoE, TP2 all-reduce, graph/churn/padding, and byte-exact hybrid KV transfers.
  • Cold prefill, GPU prefix reuse/repeat, and CPU KV reload yield identical 32-token outputs and token logprobs: maximum difference 0.0.
  • Normal-EOS concurrency passes 44 comparisons with zero hard failures.
  • Nine 16k/1024 performance requests complete at c=1/c=8 with zero request failures/preemptions; aggregate output including prefill is 19.77/26.72 tok/s.
  • 32,256/256 c=1 completes at 30.08 decode tok/s and TTFT 33.70 s. A separate coherent 32,256-token normal-EOS prompt retrieves its marker correctly.

Limits and review scope

Forced-length random outputs have whitespace/repetition warnings and are performance evidence only. Long cells span two named isolated runs; KV parity uses an approximately 4k prompt separately from 32k generation/retrieval. No controlled resident-versus-offload speedup or global optimum is claimed.

Q32 has a measured cost: isolated qkvz prefill at M4096 rises from 8.84 to 14.17 ms, with a 224 MiB accumulator. Predictive prefetch, adaptive expert/KV rebudgeting, and arbitrary active-context paging are not implemented. Native KV offload covers eligible prefix/hybrid state.

Draft for review: the commit includes diagnostics, benchmark receipts, and native formatting changes alongside implementation. Details and evidence: docs/rdna2/moe-offloading-target.md and bench_results/2026-10-28-moe-offload/qualification-summary.json.

Related: #37 (earlier draft), #40.

Keep symmetric W4A16 experts in pinned RAM with bounded GPU slots, decayed LFU/LRU replacement, and consumer-fenced transfers. Support TP2 MonoKernel execution, segmented graph replay, MTP2, and the native CPU KV tier.

Add opt-in deterministic dense reduction and canonical QSA ordering for reproducible restore validation. Exclude graph padding from cache demand, and add focused tests, launchers, CI coverage, and 16k/32k validation receipts.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: BlivionIaG <kev29lt@gmail.com>
@BlivionIaG
BlivionIaG marked this pull request as ready for review October 28, 2026 12:27
@BlivionIaG
BlivionIaG merged commit 68ec88e into rdna_extras Oct 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant