[MI450][Kernel] add Deepseek MHA bf16 kernel verified on MI450#393
Open
jli-melchior wants to merge 3 commits intomainfrom
Open
[MI450][Kernel] add Deepseek MHA bf16 kernel verified on MI450#393jli-melchior wants to merge 3 commits intomainfrom
jli-melchior wants to merge 3 commits intomainfrom
Conversation
…de style Refactor machine-generated MHA kernel (1850→1633 lines) to align with standard gfx1250 kernel conventions: - Consolidate 20+ inline imports to top-level with consistent aliases - Replace hand-rolled _SCFForCtx/_scf_yield_/_to_index with built-in range(init=...) + yield syntax - Replace 128-line hand-unrolled extract+add with _tree_reduce calls - Remove redundant _idx2crd wrapper (fx.idx2crd handles scalar ir.Value) - Clean up duplicate imports in _shuffle_* helpers - Reorganize constants with descriptive names Verified: test passes with identical max_err=0.000468
Replace low-level arith.* function calls with ArithValue method syntax: - arith.bitcast(T.xxx, val) → val.bitcast(T.xxx) (32 sites) - arith.truncf(T.xxx, val) → val.truncf(T.xxx) (4 sites) - arith.extsi(T.xxx, val) → val.extsi(T.xxx) (2 sites) - arith.select(cond, a, b) → cond.select(a, b) (3 sites) - arith.index_cast(T.xxx, val) → val.index_cast(T.xxx) (10 sites) Retained explicit arith.index_cast in helper functions where values may be raw ir.Value from MLIR dialect ops (not ArithValue). Verified: test passes with identical max_err=0.000468
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.
Deepseek MHA bf16 kernel verified on MI450
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist