Skip to content

[FlyDSL] [gfx1250] Radix top-k: 512-thread blocks for long decode rows, index-sort output for streaming rows - #7662

Merged
yadaish merged 1 commit into
ROCm:mainfrom
yhl-amd:hyi/radix-topk-512-thread-long-rows
Nov 11, 2026
Merged

yadaish merged 1 commit into
ROCm:mainfrom
yhl-amd:hyi/radix-topk-512-thread-long-rows

Conversation

@yhl-amd

@yhl-amd yhl-amd commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Scheduling changes for the FlyDSL one-block radix top-k on gfx1250 decode. The selection and its output (ascending columns, ties to the lower column) are unchanged.

Motivation

On gfx1250 a 1024-thread block occupies a whole CU, so with more than 256 long decode rows the one-block kernel runs in several rounds and its time steps up with ceil(rows / 256). Separately, stable streaming rows between the cached capacity and the index-sort crossover take the ordered re-scan output, which is slower there than gathering the row and index-sorting it.

Changes

  • topk_per_row.py: gfx1250 decode with long rows (wider than the cached capacity) and more than 256 rows uses 512-thread blocks, two resident per CU. Up to 256 rows, short rows and prefill keep their current block sizes.
  • radix_topk_one_block.py (gfx1250 only):
    • a 512-thread block gets half of the one-block LDS budget, so two fit per CU, and may use the stable index sort (previously 1024 threads only);
    • streaming rows always take the index-sort output (crossover 0); cached rows never reach that path;
    • the long-row first-level histogram uses two copies instead of one.
  • gfx950 / gfx942 values and paths are unchanged. No new environment variables or allocations.

Validation

  • Outputs bit-identical to the previous kernel on gfx1250: decode buckets of several row counts with graph padding rows and short contexts mixed in, padding past each row filled with large values so an out-of-range read would be selected; results also match a numpy reference (key descending, column ascending, top k then ascending).
  • DeepSeek-V4.1-Flash on gfx1250 (indexer top-k for the sparse attention layers) served end to end with this change; GSM8K in line with the baseline.
  • black and ruff clean on the changed files; modules import cleanly.

🤖 Generated with Claude Code

…rt for streaming rows

On gfx1250 a 1024-thread block occupies a whole CU, so long decode rows
past 256 rows ran in several rounds. Such rows (width above the cached
capacity, more than 256 rows, decode) now take 512-thread blocks with half
the LDS budget, two resident per CU; the stable index sort is allowed for
them. gfx1250 streaming rows always take the index-sort output instead of
the ordered re-scan, and its long-row first-level histogram uses two copies.

Only scheduling choices change: the selection and its ascending-column
output order are the same, and other arches and prefill are untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yhl-amd
yhl-amd requested a review from a team November 9, 2026 15:07
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7662 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@github-actions github-actions Bot added the FlyDSL label Nov 9, 2026
@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision e3b11be6c89d · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What is the most important boundary or failure mode introduced by this change, and what evidence covers it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@yadaish
yadaish merged commit f283124 into ROCm:main Nov 11, 2026
minmengdie added a commit that referenced this pull request Nov 12, 2026
…erge-1111

# Conflicts:
#	aiter/ops/flydsl/kernels/topk/radix_topk_one_block.py

Both sides added independent code: main's 512-thread half-LDS block and
index-sort-for-all-streaming-rows (#7662), and this branch's bounded path.
The bounded path stays gated to 1024-thread blocks, so the 512-thread blocks
#7662 now builds for long decode rows take the streaming path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants