Skip to content

[MoE][Qwen3.8] Replace gfx942 prefill inverse routing with Opus aux sort - #7

Merged
sammysun0711 merged 3 commits into
qwen38-flash-next-devfrom
fix/moe-opus-aux-sorted-sum
Oct 28, 2026
Merged

sammysun0711 merged 3 commits into
qwen38-flash-next-devfrom
fix/moe-opus-aux-sorted-sum

Conversation

@apinge

@apinge apinge commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Revert the zero-row workaround from #6 and reuse Opus auxiliary reverse-route maps for gfx942 MoE prefill. Initialize omitted routes to -1 and skip their contributions during reduction to prevent uninitialized-index reads.

This PR introduces the modification from ROCm#4526 to let the new prefill path obtain the reverse-route map from Opus while allowing multi-phase sorting.

This PR also introduces the modification from ROCm#6467 to initialize the reverse-route table to -1 before sorting.

tong.qiu2@amd.com and others added 3 commits October 27, 2026 01:45
This reverts commit e9a4447.
…to `invert_sorted_ids`

(cherry picked from commit 4641dd7)
The cherry-picked gfx942 prefill change needs AUX_SORT_OPUS and initialized
reverse maps on this branch. Request Opus explicitly while retaining the
caller's sorting policy and the legacy boolean aux behavior. Backport the
multi-phase aux outputs from fe4814c and
reverse-map initialization/validation from dcb7c7f.
Remove inversion from this branch's AOT precompile entry point.

Adapt the cherry-picked tests to existing kernel paths, four-field config
suffixes, and compile-time CU specialization. Add deterministic reverse-map,
all-skipped-route, BF16/FP8 zero-weight padding, and graph replay regressions.
Retain FlyDSL 0.3.2 and the existing kernel compilation wrappers.

Validation on MI308X/gfx942: 23 targeted pytest cases; 32 sorted reductions;
4 random/padding whole-MoE checks; task-table and compact-MoE smoke checks;
BF16/FP8 AOT precompile; Black, Ruff, and git diff --check.
@apinge
apinge marked this pull request as ready for review October 28, 2026 01:30
@apinge
apinge requested a review from luocheng25 October 28, 2026 01:35

@luocheng25 luocheng25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@apinge
apinge requested a review from sammysun0711 October 28, 2026 05:07
Comment thread csrc/include/moe_sorting_opus.h Resolved

@sammysun0711 sammysun0711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sammysun0711
sammysun0711 merged commit 05420f1 into qwen38-flash-next-dev Oct 28, 2026
1 check failed
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.

3 participants