fix: generate CK FMHA kernels for gfx1250 - #4797
Open
tomjen12 wants to merge 2 commits into
Open
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates CK FMHA kernel generation command lines so that runtime codegen includes an explicit --targets <gfx> flag, aiming to generate kernels for gfx1250 instead of producing an empty set and failing dispatch.
Changes:
- Append a CK target-arch flag to CK
generate.pyinvocations for dense MHA fwd and bwd codegen. - Append the same CK target-arch flag to varlen MHA bwd codegen.
- Import and reuse a shared
_ck_targets_flag()helper for these command-line updates.
Suppressed comments (2)
aiter/ops/mha.py:1144
- Same as in fwd: relying on _ck_targets_flag() (which uses get_gfx() rather than rocminfo-detected get_gfx_runtime()) can still produce a kernel set for a non-running arch when GPU_ARCHS is set, undermining the goal of enabling gfx1250 runtime dispatch. Updating the helper to use get_gfx_runtime() would make the --targets selection robust.
blob_gen_cmd = [
f"{CK_DIR}/example/ck_tile/01_fmha/generate.py -d bwd "
"--receipt 300 --filter {} --output_dir {{}}{}".format(
filter, _ck_targets_flag()
),
aiter/ops/mha.py:1404
- Same concern here: if _ck_targets_flag() resolves the arch via get_gfx() (GPU_ARCHS/build-time) instead of get_gfx_runtime(), varlen bwd codegen may still target the wrong ISA on multi-arch setups. Using get_gfx_runtime() for the --targets flag would better align with runtime kernel generation/dispatch for gfx1250.
blob_gen_cmd = [
f"{CK_DIR}/example/ck_tile/01_fmha/generate.py -d bwd "
"--receipt 400 --filter {} --output_dir {{}}{}".format(
filter, _ck_targets_flag()
),
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
112
to
+116
| blob_gen_cmd = [ | ||
| f"{CK_DIR}/example/ck_tile/01_fmha/generate.py -d fwd " | ||
| "--receipt 100 --filter {} --output_dir {{}}".format(filter), | ||
| "--receipt 100 --filter {} --output_dir {{}}{}".format( | ||
| filter, _ck_targets_flag() | ||
| ), |
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
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.
Summary
Manual validation