Skip to content

Commit 17f2915

Browse files
authored
[Encoding] Remove padFactor in set encoding pass (#20532)
Since we no longer need round_dims_to attribute we can remove the pad-factor attribute. The encoding specialization handles the allocation.
1 parent 7f12007 commit 17f2915

File tree

4 files changed

+6
-31
lines changed

4 files changed

+6
-31
lines changed

compiler/src/iree/compiler/DispatchCreation/Passes.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ static llvm::cl::opt<bool> clEnableFusePaddingIntoLinalgProducerOps(
4141
llvm::cl::desc("Enable fusing tensor.pad ops into Linalg consumer ops."),
4242
llvm::cl::init(false));
4343

44-
static llvm::cl::opt<int> clPadFactor(
45-
"iree-dispatch-creation-pad-factor",
46-
llvm::cl::desc("Provides padding size hints that will be attached to "
47-
"encodings. This only affects the experimental data tiling "
48-
"path in DispatchCreation with "
49-
"iree-dispatch-creation-experimental-data-tiling."),
50-
llvm::cl::init(32));
51-
5244
static llvm::cl::opt<bool> clEnablePadHandling(
5345
"iree-flow-enable-pad-handling",
5446
llvm::cl::desc("Enable native handling of tensor.pad operations."),
@@ -252,9 +244,7 @@ addDispatchRegionCreationPasses(OpPassManager &passManager,
252244
// Set encodings on all eligible ops. All ops should be in compiler
253245
// formed dispatch regions, so encodings will be placed inside of the
254246
// dispatch regions with the data-tiled op.
255-
.addPass([] {
256-
return createSetEncodingPass(SetEncodingPassOptions{clPadFactor});
257-
})
247+
.addPass(createSetEncodingPass)
258248
// SetEncodingOps should not be in the same dispatch as the data-tiled
259249
// op, so hoist them out of their current dispatch regions. Also, bubble
260250
// SetEncodingOps through special operations like bit-extending ops and

compiler/src/iree/compiler/DispatchCreation/Passes.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,6 @@ def SetEncodingPass :
306306
"IREE::Flow::FlowDialect",
307307
"IREE::Encoding::IREEEncodingDialect",
308308
];
309-
let options = [
310-
Option<"padFactor", "pad-factor", "int64_t", /*default=*/"32",
311-
"provides padding size hints that will be attached to encodings.">,
312-
];
313309
}
314310

315311
def ConvertEncodingToFlowPass :

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ class SetContractionOpEncoding final
163163
: public OpInterfaceRewritePattern<linalg::LinalgOp> {
164164
public:
165165
using OpInterfaceRewritePattern::OpInterfaceRewritePattern;
166-
explicit SetContractionOpEncoding(MLIRContext *ctx, int64_t factor)
167-
: OpInterfaceRewritePattern<linalg::LinalgOp>(ctx), padFactor(factor) {}
166+
explicit SetContractionOpEncoding(MLIRContext *ctx)
167+
: OpInterfaceRewritePattern<linalg::LinalgOp>(ctx) {}
168168

169169
LogicalResult matchAndRewrite(linalg::LinalgOp linalgOp,
170170
PatternRewriter &rewriter) const override {
@@ -248,9 +248,6 @@ class SetContractionOpEncoding final
248248
rewriter.replaceOp(linalgOp, result);
249249
return success();
250250
}
251-
252-
private:
253-
int64_t padFactor = 32;
254251
};
255252

256253
/// Pattern to fold a `linalg.fill` -> `iree_encoding.set_encoding`
@@ -284,7 +281,7 @@ struct SetEncodingPass final : impl::SetEncodingPassBase<SetEncodingPass> {
284281
void runOnOperation() override {
285282
MLIRContext *context = &getContext();
286283
RewritePatternSet patterns(context);
287-
patterns.add<SetContractionOpEncoding>(context, padFactor);
284+
patterns.add<SetContractionOpEncoding>(context);
288285
linalg::FillOp::getCanonicalizationPatterns(patterns, context);
289286
patterns.add<FoldFillWithSetEncoding>(context);
290287
memref::populateResolveRankedShapedTypeResultDimsPatterns(patterns);

compiler/src/iree/compiler/GlobalOptimization/Passes.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ static llvm::cl::opt<DemotionOption> clDemoteContractionInputsToBF16Strategy(
6161
clEnumValN(DemotionOption::None, "none", "Demote no contraction ops.")),
6262
llvm::cl::init(DemotionOption::None));
6363

64-
static llvm::cl::opt<int> clPadFactor(
65-
"iree-global-opt-pad-factor",
66-
llvm::cl::desc("provides padding size hints that will be attached to "
67-
"encodings."),
68-
llvm::cl::init(32));
69-
7064
static llvm::cl::opt<bool> clWarnOnUninitializedValues(
7165
"iree-global-opt-enable-warn-on-uninitialized-values",
7266
llvm::cl::desc("Warn on some classes of uses of uninitialized values."),
@@ -181,10 +175,8 @@ void buildGlobalOptimizationPassPipeline(
181175

182176
// Enable data tiling after they are in a canonical form.
183177
if (transformOptions.options.dataTiling) {
184-
FunctionLikeNest(mainPassManager).addPass([&]() {
185-
return DispatchCreation::createSetEncodingPass(
186-
DispatchCreation::SetEncodingPassOptions{clPadFactor});
187-
});
178+
FunctionLikeNest(mainPassManager)
179+
.addPass(DispatchCreation::createSetEncodingPass);
188180
// TODO(hanchung): Make data-tiling passes be FunctionOpInterface pass, so
189181
// we can use `FunctionLikNest` here.
190182
if (clEnableEarlyMaterialization) {

0 commit comments

Comments
 (0)