[Fix] eliminate llvm unsupported type (Float8/4) before llvm conversion#415
Merged
[Fix] eliminate llvm unsupported type (Float8/4) before llvm conversion#415
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Fly’s register-to-SSA promotion and Fly→ROCDL lowering to proactively eliminate LLVM-unsupported small-float element types (e.g., fp8/fp4) by projecting them to same-bitwidth integer types before LLVM dialect conversion.
Changes:
- Introduces
projectToLLVMCompatibleElemTyand extendsRegMem2SSAType(..., llvmCompatibleType=true)to project small floats to same-width integers. - Updates regmem promotion + atom-call SSA conversion paths to use LLVM-compatible SSA element types (with bitcasts as needed).
- Extends Fly→ROCDL type conversion and adds/updates MLIR tests covering fp8 SSA MMA lowering.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mlir/Transforms/promote_regmem_to_ssa.mlir | Updates FileCheck expectations to reflect fp8→i8 vector bitcasts during regmem-to-SSA promotion. |
| tests/mlir/Conversion/mma_atom.mlir | Adds a conversion test ensuring fp8 SSA MMA uses vector<8xi8> and lowers via llvm.bitcast to i64 for MFMA. |
| lib/Dialect/FlyROCDL/GFX1250/MmaAtom.cpp | Bitcasts SSA inputs to expected ROCDL operand/accumulator types before WMMA emission. |
| lib/Dialect/FlyROCDL/CDNA4/CopyAtom.cpp | Requests LLVM-compatible SSA types for register memrefs in copy atom lowering. |
| lib/Dialect/FlyROCDL/CDNA3/MmaAtom.cpp | Bitcasts SSA inputs to expected MFMA operand/accumulator types; removes unused includes. |
| lib/Dialect/FlyROCDL/CDNA3/CopyAtom.cpp | Requests LLVM-compatible SSA types for register memrefs; fixes switch completeness in getFieldIndex. |
| lib/Dialect/Fly/Utils/PointerUtils.cpp | Implements projectToLLVMCompatibleElemTy and adds llvmCompatibleType control to RegMem2SSAType. |
| lib/Dialect/Fly/Transforms/PromoteRegMemToVectorSSA.cpp | Promotes regmem SSA vectors using LLVM-compatible element types and inserts element-type bitcasts. |
| lib/Dialect/Fly/Transforms/ConvertAtomCallToSSAForm.cpp | Loads/stores promoted regmem using LLVM-compatible SSA types for atom-call SSA conversion. |
| lib/Dialect/Fly/IR/FlyUniversalOps.cpp | Uses LLVM-compatible SSA types for universal atomic copy lowering. |
| lib/Conversion/FlyToROCDL/FlyToROCDL.cpp | Projects small-float element types for alloca/GEP and adds type-converter rules for small-float→int (including vectors). |
| include/flydsl/Dialect/Fly/Utils/PointerUtils.h | Declares new projection helper and extends RegMem2SSAType API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
98eb704 to
f0f1a81
Compare
coderfeli
approved these changes
Apr 20, 2026
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.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist