Skip to content

Commit 8588cfd

Browse files
committed
Revert the place of cl option
1 parent 647af24 commit 8588cfd

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

compiler/src/iree/compiler/Codegen/Common/EncodingUtils.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ static RankedTensorType transposeIfNarrowNResult(RankedTensorType tensorType) {
8484
}
8585
auto newEncoding = IREE::Encoding::EncodingAttr::get(
8686
context, operandIndex, encoding.getOpType().getValue(),
87-
encoding.getElementTypesArray(), maps, newBcastMap, newRoundDimsTo,
88-
encoding.getLayouts());
87+
encoding.getElementTypesArray(), maps, newBcastMap, newRoundDimsTo);
8988
return RankedTensorType::get(newShape, elemType, newEncoding);
9089
}
9190

compiler/src/iree/compiler/DispatchCreation/SetEncoding.cpp

+3-26
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h"
1313
#include "iree/compiler/Dialect/Encoding/IR/EncodingDialect.h"
1414
#include "iree/compiler/Dialect/Encoding/IR/EncodingOps.h"
15-
#include "iree/compiler/Dialect/Encoding/IR/EncodingTypes.h"
1615
#include "iree/compiler/Dialect/Flow/IR/FlowDialect.h"
1716
#include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
1817
#include "iree/compiler/Dialect/Flow/Transforms/RegionOpUtils.h"
@@ -26,13 +25,6 @@
2625
#include "mlir/Support/LLVM.h"
2726
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
2827

29-
llvm::cl::opt<bool> clEnableI1Support(
30-
"iree-experimental-packed-i1-storage",
31-
llvm::cl::desc(
32-
"Experimental feature: use packed storage for i1 tensors. This feature "
33-
"can be dropped once the frontend can emit packed i1 tensors."),
34-
llvm::cl::init(false));
35-
3628
#define DEBUG_TYPE "iree-dispatch-creation-set-encoding"
3729

3830
namespace mlir::iree_compiler::DispatchCreation {
@@ -46,13 +38,6 @@ using IREE::Encoding::PackedStorageAttr;
4638
// Utility functions
4739
//===---------------------------------------------------------------------===//
4840

49-
static std::optional<Attribute> getI1PackedStorageAttr(MLIRContext *context) {
50-
if (clEnableI1Support) {
51-
return PackedStorageAttr::get(context);
52-
}
53-
return {};
54-
}
55-
5641
Value setEncoding(OpBuilder &builder, Location loc, Value source,
5742
EncodingAttr encodingAttr) {
5843
auto sourceType = cast<RankedTensorType>(source.getType());
@@ -232,17 +217,9 @@ class setContractionOpEncoding
232217
if (narrowDim.isN()) {
233218
roundDimsTo[1] = llvm::PowerOf2Ceil(narrowDim.size);
234219
}
235-
// This is a temporary solution that we can use
236-
// `--iree-experimental-packed-i1-storage` to enable packed storage for i1
237-
// tensors without specifying attributes.
238-
auto optI1PackedStorageAttr =
239-
getI1PackedStorageAttr(rewriter.getContext());
240-
auto layouts = optI1PackedStorageAttr
241-
? ArrayRef<Attribute>(*optI1PackedStorageAttr)
242-
: ArrayRef<Attribute>{};
243-
auto encoding = EncodingAttr::get(
244-
linalgOp.getContext(), operandIndex, opType, elemTypes, maps,
245-
/*bcastMap=*/std::nullopt, roundDimsTo, layouts);
220+
auto encoding = EncodingAttr::get(linalgOp.getContext(), operandIndex,
221+
opType, elemTypes, maps,
222+
/*bcastMap=*/std::nullopt, roundDimsTo);
246223
return setEncoding(rewriter, loc, src, encoding);
247224
};
248225
Value encodedLhs = setEncodingWrapper(lhs, IREE::Encoding::MATMUL_LHS);

compiler/src/iree/compiler/Utils/ElementPackingUtils.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
#include "mlir/Dialect/Arith/IR/Arith.h"
1616
#include "mlir/IR/BuiltinTypes.h"
1717

18+
llvm::cl::opt<bool> clEnableI1Support(
19+
"iree-experimental-packed-i1-storage",
20+
llvm::cl::desc(
21+
"Experimental feature: use packed storage for i1 tensors. This feature "
22+
"can be dropped once the frontend can emit packed i1 tensors."),
23+
llvm::cl::init(false));
24+
1825
namespace mlir::iree_compiler {
1926

2027
bool needToPackSubByteElementBitWidth(unsigned bitWidth,
@@ -114,9 +121,7 @@ Value calculateStorageElementOffsetInBytes(Location loc,
114121
Type alignedElementType =
115122
legalizeStorageElementType(originalType.getElementType());
116123
unsigned elementBits = IREE::Util::getTypeBitWidth(alignedElementType);
117-
118-
auto encoding = IREE::Encoding::getEncodingAttr(originalType);
119-
bool isI1PackedStorage = encoding && encoding.i1PackedStorage();
124+
bool isI1PackedStorage = IREE::Encoding::hasPackedStorageAttr(originalType);
120125

121126
// Sub-byte packing requires putting multiple elements in the same byte.
122127
if (needToPackSubByteElementBitWidth(elementBits, isI1PackedStorage)) {

0 commit comments

Comments
 (0)