Skip to content

Commit 4bf30c4

Browse files
committed
Remove Intel code
1 parent b1c3c72 commit 4bf30c4

File tree

2 files changed

+50
-40
lines changed

2 files changed

+50
-40
lines changed

lib/Dialect/TritonGPU/IR/Dialect.cpp

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
#include "mlir/IR/DialectImplementation.h"
77
#include "mlir/IR/OpImplementation.h"
8-
9-
#include "intel/include/Dialect/TritonIntelGPU/IR/Dialect.h"
10-
118
#include "mlir/Support/LLVM.h"
129
#include "triton/Analysis/Utility.h"
1310
#include "triton/Dialect/Triton/IR/Utility.h"
@@ -325,11 +322,11 @@ SmallVector<unsigned> getOrder(Attribute layout) {
325322
// with Intel layouts.
326323
// More details:
327324
// https://github.com/intel/intel-xpu-backend-for-triton/pull/2517
328-
if (dyn_cast<intel::DpasEncodingAttr>(dotLayout.getParent())) {
329-
SmallVector<unsigned> order(rank);
330-
std::iota(order.rbegin(), order.rend(), 0);
331-
return order;
332-
}
325+
// if (dyn_cast<intel::DpasEncodingAttr>(dotLayout.getParent())) {
326+
// SmallVector<unsigned> order(rank);
327+
// std::iota(order.rbegin(), order.rend(), 0);
328+
// return order;
329+
// }
333330
return getOrderForDotOperand(dotLayout.getOpIdx(), rank, /*kMajor*/ true);
334331
}
335332
if (auto sliceLayout = dyn_cast<SliceEncodingAttr>(layout)) {
@@ -1129,10 +1126,11 @@ unsigned DotOperandEncodingAttr::getTotalElemsPerThread(ArrayRef<int64_t> shape,
11291126
return amdWmmaParent.getTotalElemsPerThreadForOperand(
11301127
shape, eltTy, getKWidth(), getOpIdx());
11311128
}
1132-
if (auto dpasParent = mlir::dyn_cast<intel::DpasEncodingAttr>(mmaParent)) {
1133-
return dpasParent.getTotalElemsPerThreadForOperand(
1134-
shape, eltTy, getKWidth(), getOpIdx());
1135-
}
1129+
// if (auto dpasParent =
1130+
// mlir::dyn_cast<intel::DpasEncodingAttr>(mmaParent)) {
1131+
// return dpasParent.getTotalElemsPerThreadForOperand(
1132+
// shape, eltTy, getKWidth(), getOpIdx());
1133+
// }
11361134
}
11371135
if (auto blockedLayout = mlir::dyn_cast<BlockedEncodingAttr>(getParent())) {
11381136
auto shapePerCTA = getShapePerCTA(*this, shape);
@@ -1197,17 +1195,19 @@ SmallVector<unsigned> DotOperandEncodingAttr::getWarpOrder() const {
11971195
return {};
11981196
}
11991197
SmallVector<unsigned> DotOperandEncodingAttr::getThreadOrder() const {
1200-
// FIXME: delete if branch for `DpasEncodingAttr` and provide more
1201-
// general solution to make `getOrderForDotOperand` function compatible
1202-
// with Intel layouts.
1203-
// More details:
1204-
// https://github.com/intel/intel-xpu-backend-for-triton/pull/2517
1205-
if (mlir::dyn_cast<intel::DpasEncodingAttr>(getParent())) {
1206-
return ::getOrder(*this);
1207-
} else {
1208-
return getOrderForDotOperand(getOpIdx(), getWarpsPerCTA().size(),
1209-
/*kMajor*/ true);
1210-
}
1198+
// // FIXME: delete if branch for `DpasEncodingAttr` and provide more
1199+
// // general solution to make `getOrderForDotOperand` function compatible
1200+
// // with Intel layouts.
1201+
// // More details:
1202+
// // https://github.com/intel/intel-xpu-backend-for-triton/pull/2517
1203+
// if (mlir::dyn_cast<intel::DpasEncodingAttr>(getParent())) {
1204+
// return ::getOrder(*this);
1205+
// } else {
1206+
// return getOrderForDotOperand(getOpIdx(), getWarpsPerCTA().size(),
1207+
// /*kMajor*/ true);
1208+
// }
1209+
return getOrderForDotOperand(getOpIdx(), getWarpsPerCTA().size(),
1210+
/*kMajor*/ true);
12111211
}
12121212

12131213
LogicalResult DotOperandEncodingAttr::verify(
@@ -1250,19 +1250,16 @@ LogicalResult DotOperandEncodingAttr::verify(
12501250
return success();
12511251
}
12521252

1253-
if (auto parentAttr = mlir::dyn_cast<intel::DpasEncodingAttr>(parent)) {
1254-
if (kWidth != parentAttr.getOpsPerChannel())
1255-
return emitError() << "ttg.dot_op kWidth parameter must match the "
1256-
"parent's opsPerChannel";
1257-
return success();
1258-
}
1259-
1260-
if (auto parentAttr = mlir::dyn_cast<intel::WarpEncodingAttr>(parent)) {
1261-
if (kWidth != 0)
1262-
return emitError() << "ttg.dot_op kWidth parameter is not supported "
1263-
"when the parent is a warp layout";
1253+
if (auto parentAttr = mlir::dyn_cast<MmaEncodingTrait>(parent)) {
12641254
return success();
12651255
}
1256+
//
1257+
// if (auto parentAttr = mlir::dyn_cast<intel::WarpEncodingAttr>(parent)) {
1258+
// if (kWidth != 0)
1259+
// return emitError() << "ttg.dot_op kWidth parameter is not supported "
1260+
// "when the parent is a warp layout";
1261+
// return success();
1262+
// }
12661263

12671264
if (auto parentAttr = mlir::dyn_cast<BlockedEncodingAttr>(parent)) {
12681265
if (kWidth != 0)
@@ -2527,9 +2524,6 @@ class TritonGPUOpAsmInterface : public OpAsmDialectInterface {
25272524
} else if (auto linearAttr = mlir::dyn_cast<LinearEncodingAttr>(attr)) {
25282525
os << "linear";
25292526
return AliasResult::FinalAlias;
2530-
} else if (auto warpAttr = mlir::dyn_cast<intel::WarpEncodingAttr>(attr)) {
2531-
os << "warp";
2532-
return AliasResult::FinalAlias;
25332527
} /* else if (auto sliceAttr = dyn_cast<SliceEncodingAttr>(attr)) {
25342528
os << "slice";
25352529
return AliasResult::FinalAlias;
@@ -3248,8 +3242,7 @@ struct CanonicalizeConvertFromConvert
32483242
auto srcType = op.getSrc().getType();
32493243
auto dstType = op.getType();
32503244
if (mlir::isa<DotOperandEncodingAttr>(dstType.getEncoding()) &&
3251-
(mlir::isa<NvidiaMmaEncodingAttr>(srcType.getEncoding()) ||
3252-
mlir::isa<intel::DpasEncodingAttr>(srcType.getEncoding())))
3245+
mlir::isa<NvidiaMmaEncodingAttr>(srcType.getEncoding()))
32533246
return failure();
32543247

32553248
// for hopper MMAv3

third_party/intel/include/Dialect/TritonIntelGPU/IR/TritonIntelGPUAttrDefs.td

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ along the row (resp. col) dimension.
125125
//===----------------------------------------------------------------------===//
126126

127127
def WarpEncodingAttr : TritonGPU_Attr<"WarpEncoding", "intel_warp_encoding",
128-
[], TritonIntelGPU_Dialect> {
128+
[MmaEncodingTrait], TritonIntelGPU_Dialect> {
129129
let mnemonic = "warp";
130130

131131
let description = [{
@@ -144,6 +144,23 @@ def WarpEncodingAttr : TritonGPU_Attr<"WarpEncoding", "intel_warp_encoding",
144144
let extraClassDeclaration = [{
145145
unsigned getTotalElemsPerThread(ArrayRef<int64_t> shape, Type eltTy) const;
146146
SmallVector<unsigned> getElemsPerThread(ArrayRef<int64_t> shape, Type eltTy) const;
147+
148+
SmallVector<unsigned> getRepOrderForOperand(int opIdx) const {
149+
llvm::report_fatal_error("NYI. WarpEncodingAttr::getRepOrder");
150+
};
151+
152+
bool supportReduction() const {
153+
llvm::report_fatal_error("NYI. WarpEncodingAttr::supportReduction");
154+
};
155+
156+
SmallVector<unsigned> getSizePerThreadForOperand(int kWidth,unsigned opIdx) const {
157+
llvm::report_fatal_error("NYI. WarpEncodingAttr::getSizePerThreadForOperand");
158+
};
159+
160+
SmallVector<unsigned> getElemsPerThreadForOperands(ArrayRef<int64_t> shape, Type eltTy, unsigned opIdx) const {
161+
llvm::report_fatal_error("NYI. WarpEncodingAttr::getElemsPerThreadForOperands");
162+
};
163+
147164
}];
148165

149166
let hasCustomAssemblyFormat = 1;

0 commit comments

Comments
 (0)