Skip to content

Commit

Permalink
[MFMA] Refactor dot pipeline to reduce code duplication (#400)
Browse files Browse the repository at this point in the history
This PR:
- simplifies data types generated by `shared->mfma dot op` layout conversions. Do not pack data types in int32 or int64
- reduce code duplication between fast/normal path
- reduce code duplication between operand A and operand B

Co-authored-by: Shucai Xiao <[email protected]>
Co-authored-by: Lixun Zhang <[email protected]>
  • Loading branch information
3 people authored Dec 13, 2023
1 parent 605a90c commit f2afd65
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 308 deletions.
3 changes: 1 addition & 2 deletions include/triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.td
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,7 @@ section 9.7.13.4.1 for more details.
int bitwidth) const;
#ifdef USE_ROCM
SmallVector<int64_t> getMFMAElemsPerInstr() const;
SmallVector<int64_t> getMFMARep(ArrayRef<int64_t> operandShape,
Type elemType) const;
SmallVector<int64_t> getMFMARep(ArrayRef<int64_t> operandShape) const;
#endif
}];
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Conversion/TritonGPUToLLVM/ConvertLayoutOpToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ struct ConvertLayoutOpConversion
return success();
}

// shared -> mma_operand
// shared -> mma_operand/mfma_operand
LogicalResult
lowerSharedToDotOperand(triton::gpu::ConvertLayoutOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const {
Expand Down Expand Up @@ -1060,7 +1060,7 @@ struct ConvertLayoutOpConversion
}

#ifdef USE_ROCM
// shared -> dot_operand if the result layout is mma
// shared -> dot_operand if the result layout is mfma
Value lowerSharedToDotOperandMFMA(
triton::gpu::ConvertLayoutOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter, const MfmaEncodingAttr &mfmaLayout,
Expand Down
Loading

0 comments on commit f2afd65

Please sign in to comment.