Skip to content

[MXFP] Fix fp4 fp4 scaled_dot does not use dpas issue #4920

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions third_party/intel/include/Analysis/DPAS.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class DPASAnalysis {
FP32_FP32_FP4_BF16,
FP32_FP32_FP4_FP16,
FP32_FP32_FP4_FP8,
FP32_FP32_FP4_FP4,
NOT_APPLICABLE
};

Expand Down
4 changes: 2 additions & 2 deletions third_party/intel/lib/Analysis/DPAS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,12 @@ DPASAnalysis::getDPASType(OpTy op) {
if (dElemTy.isF32()) {
if (aElemTy.isBF16() && isa<Float8E4M3FNType, Float8E5M2Type>(bElemTy))
return DPASEngineType::FP32_FP32_BF16_FP8;
// 2 E2M1 are packed into 1 int8
if (aElemTy.isBF16() && bElemTy.isInteger(8))
return DPASEngineType::FP32_FP32_BF16_FP4;
if (isa<Float8E4M3FNType, Float8E5M2Type>(aElemTy) && bElemTy.isBF16())
return DPASEngineType::FP32_FP32_FP8_BF16;
if (aElemTy.isF16() && isa<Float8E4M3FNType, Float8E5M2Type>(bElemTy))
return DPASEngineType::FP32_FP32_FP16_FP8;
// 2 E2M1 are packed into 1 int8
if (aElemTy.isF16() && bElemTy.isInteger(8))
return DPASEngineType::FP32_FP32_FP16_FP4;
if (isa<Float8E4M3FNType, Float8E5M2Type>(aElemTy) && bElemTy.isF16())
Expand All @@ -182,6 +180,8 @@ DPASAnalysis::getDPASType(OpTy op) {
if (aElemTy.isInteger(8) &&
isa<Float8E4M3FNType, Float8E5M2Type>(bElemTy))
return DPASEngineType::FP32_FP32_FP4_FP8;
if (aElemTy.isInteger(8) && bElemTy.isInteger(8))
return DPASEngineType::FP32_FP32_FP4_FP4;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ class DecomposeScaledBlocked : public OpRewritePattern<DotScaledOp> {
scaledA = cvtDotOperand(scaledA, 0);
auto scaledB = scaleArg(rewriter, scaledDotOp, 1, computeType);
scaledB = cvtDotOperand(scaledB, 1);
auto newDot = rewriter.create<DotOp>(scaledDotOp.getLoc(), scaledA, scaledB,
scaledDotOp.getC());
auto newDot =
rewriter.create<DotOp>(scaledDotOp.getLoc(), scaledA, scaledB,
scaledDotOp.getC(), InputPrecision::TF32, 0);

rewriter.replaceOpWithNewOp<ConvertLayoutOp>(scaledDotOp,
scaledDotOp.getType(), newDot);
Expand Down
Loading