-
Notifications
You must be signed in to change notification settings - Fork 145
redirect asm_moe_tkw1 call to fused_moe in order to force kernel tuning #1366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
antsaukk
wants to merge
26
commits into
ROCm:main
Choose a base branch
from
antsaukk:asm_moe_tkw1_refactoring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valarLip
reviewed
Nov 13, 2025
valarLip
reviewed
Nov 18, 2025
…if condition to select run_1stage=True
valarLip
previously approved these changes
Nov 19, 2025
Collaborator
valarLip
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks your contribution, LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This change introduces merge of kernel selection API
asm_moe_tkw1fromfused_moe_bf16_asm.pyintofused_moe.py. The change is required in order to unlock kernel selection logic fortkw1case from predefined tuned_fmoe.csv config, which brings performance improvement for low concurrency cases in top tier customer model.Technical Details
In order to unlock kernel selection functionality from tuned_fmoe.csv config for
asm_moe_tkw1, the function call toasm_moe_tkw1is forwarded intofused_moe. The selection logic ofasm_moe_tkw1has been left unchanged but is extracted into a new functionfused_moe_stage1_tkw1underfused_moe.pymodule. The functions' interfaces have been modified accordingly to accommodate new arguments.Test Plan
The functionality has been tested with
aiter/op_teststo verify that selection logic works as intended. In addition to that, tests within the model were conducted to confirm end-to-end correctness.Test Result
Above mentioned tests confirm that correctness is preserved.
Submission Checklist
At least those test cases should be verified:
AITER_LOG_MORE=1 python ./op_tests/test_moe_tkw1.py -m 1 -dim 5120 -hdim 1024 -e 128 -d bf16, uses 1 stage fmoe; selects 32x64 kernelAITER_LOG_MORE=1 python ./op_tests/test_moe_tkw1.py -m 17 -dim 5120 -hdim 1024 -e 128 -d bf16, uses 1 stage fmoe; selects 32x128 kernelAITER_LOG_MORE=1 python ./op_tests/test_moe_tkw1.py -m 300 -dim 5120 -hdim 1024 -e 128 -d bf16, uses 1 stage fmoe; selects 32x128 kernelAITER_LOG_MORE=1 python ./op_tests/test_moe_2stage.py -d bf16 -dim 5120,1024 -t 1 -q 2 -a silu -e 128 -k 1uses 2 stage moe, with 32x512 asm kernel and ck_moe_stage2 selectedAITER_LOG_MORE=1 python ./op_tests/test_moe_2stage.py -d bf16 -dim 5120,1024 -t 17 -q 2 -a silu -e 128 -k 1uses 2 stage moe, with 32x512 asm kernel and ck_moe_stage2 selectedAdditional notes
Please note that files
hsa/gfx950/fmoe/gelu/fmoe_bf16_pertokenFp8_g1u1_gelu_tkw1.csv, hsa/gfx950/fmoe/silu/fmoe_bf16_pertokenFp8_g1u1_silu_tkw1.csv,
hsa/gfx950/fmoe/silu/fmoe_bf16_pertokenInt8_g1u1_tkw1_silu_32x64.co,
hsa/gfx950/fmoe/gelu/fmoe_bf16_pertokenInt8_g1u1_tkw1_gelu_32x64.co,
aiter/configs/tuned_fmoe.csv
are not meant to be merged in this PR. However, they are required here in order to verify correctness functionality. Upon approvement, they will be removed and merger in separate PR.