Skip to content

[Misc][ROCm][Kernel] Drop W4A16 prefill force hooks and the unregistered alias - #104

Merged
BlivionIaG merged 1 commit into
rdna_extrasfrom
cursor/w4a16-prefill-host-cleanup-39f8
Oct 16, 2026
Merged

BlivionIaG merged 1 commit into
rdna_extrasfrom
cursor/w4a16-prefill-host-cleanup-39f8

Conversation

@BlivionIaG

Copy link
Copy Markdown

Purpose

Subtraction-only cleanup of the W4A16 prefill host path on rdna_extras. This is a redo of the substance of #48. #48 stays on rdna_extra/v0.28.0 and is not retargeted. Default config and split-K selection are the same when the removed env vars are unset.

AI assistance was used (Cursor Grok 4.7). A human should review every changed line and run the gfx1030 build and tests below before this leaves draft.

Why this is not a duplicate

Open PRs were searched for q_gemm_rdna2_prefill, FORCE_CONFIG, prefill_direct, and hc_prefill. The only PR that deletes these hooks is #48, and its base is rdna_extra/v0.28.0. Nothing else open on rdna_extras edits this host path. This PR also drops the unregistered gptq_gemm_rdna2_prefill_direct alias, the undocumented HC prefill tile/split overrides, the false Triton sentences in q_gemm_rdna2.cu, and the force-var row in docs/rdna2/tuning.md. #48 deleted VLLM_RDNA2_PREFILL_DEBUG; this PR keeps it.

What was deleted

  • csrc/rocm/q_gemm_rdna2_prefill.cu: both banners above select_config. Inner branch comments stay. select_config branches are unchanged.
  • VLLM_RDNA2_PREFILL_FORCE_CONFIG early return inside select_config.
  • maybe_force_split_k and VLLM_RDNA2_PREFILL_FORCE_SPLIT_K. launch_dispatch calls compute_split_k<Config*> directly.
  • VLLM_RDNA2_PREFILL_DEBUG is unchanged.
  • Unregistered gptq_gemm_rdna2_prefill_direct (not in ops.h or torch_bindings.cpp), its wrapper and fake in vllm/_custom_ops.py, and the fixture line in benchmarks/kernels/w4a16_compile_dispatch/test_probe_cpu.py. That line was not counted: the probe regex ends the op name on a word boundary, and the assertion still expects three gptq_gemm_rdna2_prefill calls.
  • csrc/rocm/hc_prefill_rdna2.cu: VLLM_RDNA_HC_PREFILL_TILE / _SPLIT and the env_int helper that only served them. Tile selection is M <= 64 ? 0 : (M <= 384 ? 1 : 2). Split count is (target_blocks + mn / 2) / mn, then clamped to [1, 16].
  • csrc/rocm/q_gemm_rdna2.cu: the three sentences that said prefill falls through to Triton. Prefill is gptq_gemm_rdna2_prefill.
  • docs/rdna2/tuning.md: the one table row that documented both VLLM_RDNA2_PREFILL_FORCE_CONFIG and _FORCE_SPLIT_K. They were not two rows. That row is not in perf(rdna2): QSA/GDN HIP prefill paths vs Triton/FLA + TunableOp decode/MTP grid (implements #64) #99's hunk (which adds VLLM_RDNA_ALL_HIP and VLLM_RDNA_MROPE_BLOCK after the QSA row) and not in feat(rdna2): opt-in W8A8 int8 sdot4 dense and MoE kernels for gfx1030 #93's hunk (which inserts the W8A8 row after VLLM_RDNA2_W4A8_SDOT4).

ops.h, torch_bindings.cpp, and CMakeLists.txt are not edited, so this does not touch the #57 / #93 / #99 hunks in those files.

vllm/_custom_ops.py: #57 edits moe_skinny_int4_decode (around the old line 3072). This deletion is the unregistered prefill alias (old lines 922-950). The hunks do not overlap. The alias removal is included anyway.

tools/rdna2_028/probe_force_split.py still sets VLLM_RDNA2_PREFILL_FORCE_SPLIT_K. #87 deletes the tools/rdna2_028 probes, so this PR does not edit that file. bench_results/2026-09-29_w4a16-regression-audit/SUMMARY.md names the var in a past writeup and is left as history.

Unset env path (unchanged)

select_config used to cache atoi(VLLM_RDNA2_PREFILL_FORCE_CONFIG) (default -1) and return it when >= 0. Unset, that return never fired. The remaining branches, in order, are the same:

  • size_m > 256: size_n >= 4096 returns ConfigA, otherwise ConfigC
  • size_m < 4 && size_n > 4096 returns ConfigA
  • 4 <= size_m <= 8 && size_n >= 2048 && size_k >= 1024 returns ConfigC
  • size_m == 12 && 2560 <= size_n <= 8192 && size_k >= 512 returns ConfigC
  • size_m == 32 && 5120 <= size_n <= 6144 && size_k >= 1536 returns ConfigC
  • otherwise ConfigV1

launch_dispatch was maybe_force_split_k(compute_split_k<Config>(...)). That helper returned the computed split unless VLLM_RDNA2_PREFILL_FORCE_SPLIT_K was a positive integer (unset default -1). Each arm now passes compute_split_k straight through. compute_split_k itself, including the VLLM_RDNA2_PREFILL_DEBUG print, is untouched.

HC tile was forced >= 0 ? forced : (M-based). env_int returned -1 when unset, so the M-based value was already the result. HC split was forced > 0 ? forced : (target_blocks + mn / 2) / mn. Unset, forced was -1, so the formula was already the result. The [1, 16] clamp is unchanged.

A host replica of those predicates (envs unset) matched on 720 (M, N, K) shapes, 37 computed split values, 4096 HC M values, and 48 HC split pairs. Setting the vars used to change the result; that is what this removal does.

Test Plan

No ROCm toolchain in this environment (hipcc is absent, no /opt/rocm). On gfx1030, before merge:

# Build with PYTORCH_ROCM_ARCH=gfx1030, then:
.venv/bin/python -m pytest \
  tests/kernels/quantization/test_rdna2_w4a16.py \
  tests/kernels/quantization/test_rdna2_w4a16_awq.py \
  tests/kernels/quantization/test_rdna2_w4a16_selection.py -v

Host checks run here: rg for the removed names, python3 -m py_compile on the two Python files, and the unset-env replica above.

Test Result

  • rg over csrc/, vllm/, benchmarks/, docs/, tests/, tools/: the only remaining reader is tools/rdna2_028/probe_force_split.py (left for cleanup(tools): delete finished tools/rdna2_028 campaign drivers #87). VLLM_RDNA2_PREFILL_DEBUG is still read in compute_split_k.
  • python3 -m py_compile on vllm/_custom_ops.py and benchmarks/kernels/w4a16_compile_dispatch/test_probe_cpu.py: pass. pytest for that file was not run: this environment has no .venv and no regex.
  • Brace/paren/bracket balance on the three .cu files: even. No line in those files exceeds 88 columns.
  • gfx1030 build and tests/kernels/quantization/test_rdna2_w4a16*.py: not run (no hipcc, no GPU). No model eval: the unset dispatch path is the same code, and no serving run was done.

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model. (dropped the force-var row in docs/rdna2/tuning.md)

BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing

Open in Web Open in Cursor 

Delete the finished FORCE_CONFIG and FORCE_SPLIT_K getenv hooks and the
two contradictory banners above select_config. launch_dispatch calls
compute_split_k directly. VLLM_RDNA2_PREFILL_DEBUG stays.

Delete the unregistered gptq_gemm_rdna2_prefill_direct alias, its Python
wrapper and fake, and the probe fixture line that named it. Delete the
undocumented HC prefill tile and split overrides; the M-based tile and
the block-count split stay.

Correct the decode-kernel comments that said prefill falls through to
Triton. Prefill is gptq_gemm_rdna2_prefill.

Co-authored-by: Cursor Grok 4.7
Signed-off-by: BlivionIaG <15323295+BlivionIaG@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/w4a16-prefill-host-cleanup-39f8 branch from 8829469 to ddb69e6 Compare October 16, 2026 15:28
@BlivionIaG
BlivionIaG marked this pull request as ready for review October 16, 2026 15:29
@BlivionIaG
BlivionIaG merged commit a26ad2c into rdna_extras Oct 16, 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