-
Notifications
You must be signed in to change notification settings - Fork 44
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
Support for tritongpu.upcast_mxfp
operation
#2700
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Tiotto, Ettore <[email protected]>
Signed-off-by: Tiotto, Ettore <[email protected]>
Note: Merging upstream to |
// standalone values and returns them as a pair for (high 4 bits, low 4 bits). | ||
std::pair<Value, Value> convertMxfp4x2ToBf16x2(RewriterBase &rewriter, | ||
Location loc, Value v); | ||
// Convert each value, which is an int8 containing 2 packed mxfp4 values, |
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.
Note: This is identical to upstream code as of commit 1cf7b1b
|
||
return {v0, v1}; | ||
} | ||
SmallVector<Value> convertMxfp4x2ToBf16x2(RewriterBase &rewriter, Location loc, |
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.
Note: This is identical to upstream code as of commit 1cf7b1b
@@ -19,17 +19,6 @@ using namespace mlir::triton::gpu; | |||
|
|||
namespace { | |||
|
|||
Value mxfpScaleBf16(RewriterBase &rewriter, Location loc, Value v, |
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.
Note: This is identical to upstream code as of commit 1cf7b1b
@@ -30,47 +30,6 @@ class UpcastMXFPOpPattern : public ConvertOpToLLVMPattern<UpcastMXFPOp> { | |||
: ConvertOpToLLVMPattern<UpcastMXFPOp>(typeConverter, benefit), | |||
targetInfo(targetInfo) {} | |||
|
|||
llvm::SmallVector<Value> unpackFP4Elements(Location loc, |
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.
Removed in 1cf7b1b
Merging in #2707. |
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.
As this is just copying, LGTM. As in previous cases we found relying on logical bitwise operations for this kind of operations was slower, does it make sense to have a ticket to change the code in the future?
lib/Dialect/TritonGPU/IR/Ops.cpp
Outdated
auto parentEncoding = oldEncoding.getParent(); | ||
|
||
// Note: For Intel the dot operands layout's kWidth parameter must | ||
// match the parent's dpas layout opsPerChannel. Given that the kWidth |
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.
opsPerChannel
is defined by the HW DPAS instruction.
I think we should align the opsPerChannel
to the result scalar type of the UpcastMXFPOp
instead of double the size.
fp16/bf16 -> opsPerChannel=2
Otherwise there might be ambiguous in the lowering of UpcastMXFPOp
.
if (fpType == ScaleDotElemType::E2M1) | ||
xVals = LLVM::convertMxfp4x2ToBf16x2(rewriter, loc, xVals); | ||
|
||
// Each thread owns elements of 4 mxfp vectors so we need 4 scales |
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.
The better we need to make sure the layout are expected of the DotOp
with the DPAS
as parent and the layout conversion from the source operand to the dest operand are supported as well.
Add initial support for the new tritongpu
upcast_mxfp
operation.