Skip to content

Commit 0b6af4e

Browse files
authored
[Stream] Remove unused variables (i.e., dead code) and clean up tests. (#19964)
- Remove unused variables. - Remove extra module op from lit tests. - Switch all the tests to use iree_encoding.unspecialized_encoding except the sizeof tests. The sizeof tests capture the actual layouts from backend attributes. The other tests do not really care what attributes are used. - Move GPU sizeof tests to where CPU sizeof tests locate. Signed-off-by: hanhanW <[email protected]>
1 parent e5a5881 commit 0b6af4e

File tree

2 files changed

+294
-316
lines changed

2 files changed

+294
-316
lines changed

compiler/src/iree/compiler/Dialect/Stream/Transforms/SpecializeEncodings.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ updateBindingEncodings(FunctionOpInterface funcOp,
150150
/// this case, we have to duplicate the executable with updated encoding, and
151151
/// modify the dispatch to launch proper executable based on resolved encoding
152152
/// layouts.
153-
static LogicalResult duplicateExecutablesPerLayoutVariant(
154-
ModuleOp moduleOp, SymbolTable symbolTable, FunctionOpInterface funcOp,
155-
IREE::Stream::ResolveLayoutAttrFn resolveLayoutAttr) {
153+
static LogicalResult
154+
duplicateExecutablesPerLayoutVariant(ModuleOp moduleOp, SymbolTable symbolTable,
155+
FunctionOpInterface funcOp) {
156156
MLIRContext *ctx = moduleOp.getContext();
157157
IRRewriter rewriter(ctx);
158158

@@ -563,18 +563,13 @@ struct SpecializeEncodingsPass
563563
return signalPassFailure();
564564
}
565565

566-
SymbolTable symbolTable(moduleOp);
567-
llvm::MapVector<StringRef, IREE::Stream::ExecutableOp> executableOps;
568-
for (auto executableOp : moduleOp.getOps<IREE::Stream::ExecutableOp>()) {
569-
executableOps[executableOp.getName()] = executableOp;
570-
}
571-
572566
IREE::Stream::AffinityAnalysis affinityAnalysis(moduleOp);
573567
if (failed(affinityAnalysis.run())) {
574568
moduleOp.emitError("failed on running affinity analysis");
575569
return signalPassFailure();
576570
}
577571

572+
SymbolTable symbolTable(moduleOp);
578573
IREE::Stream::ResolveLayoutAttrFn resolveLayoutAttr =
579574
usedDialects[0]->makeLayoutAttrResolver(moduleOp);
580575
for (auto funcOp : moduleOp.getOps<FunctionOpInterface>()) {
@@ -584,8 +579,8 @@ struct SpecializeEncodingsPass
584579
"failed on adding layouts to Stream::TensorPhaseOp with encodings");
585580
return signalPassFailure();
586581
}
587-
if (failed(duplicateExecutablesPerLayoutVariant(
588-
moduleOp, symbolTable, funcOp, resolveLayoutAttr))) {
582+
if (failed(duplicateExecutablesPerLayoutVariant(moduleOp, symbolTable,
583+
funcOp))) {
589584
funcOp.emitError("failed on executable duplication");
590585
return signalPassFailure();
591586
}

0 commit comments

Comments
 (0)