Skip to content

Commit

Permalink
NFC: Cleanup ConcretizeTileAmongstWorkgroupsPass. (#5297)
Browse files Browse the repository at this point in the history
The refactoring silos everything required for removing unit-trip loop
counts under a flag with future changes trying to use the affine min
canonicalization without removing the loop itself. Goal is to verify
performance overhead that keeping the unit loop around adds.

Lot of the complication in this pass was introduced to get the types
of the outputs and inputs in this pass and propogating that
information to the launch configuration computation. Instead use of
the ViewOpInterface allows the operation itself to get the types of
the untiled operands using a simple traversal. Cleans up the pass
quite a bit.

Also cleanup some of the command line options handling in
configuration computation, i.e. override the default configuration
picked using the tiles sizes/workgroup sizes specified on command
line.

Fixes #5311
  • Loading branch information
MaheshRavishankar authored Apr 5, 2021
1 parent f96726a commit f2f0041
Show file tree
Hide file tree
Showing 12 changed files with 433 additions and 476 deletions.
7 changes: 7 additions & 0 deletions iree/compiler/Conversion/CodegenUtils/FunctionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,12 @@ IREE::HAL::ExecutableEntryPointOp getEntryPoint(FuncOp funcOp) {
return nullptr;
}

Value getViewSource(Value view) {
while (auto viewOp = view.getDefiningOp<ViewLikeOpInterface>()) {
view = viewOp.getViewSource();
}
return view;
}

} // namespace iree_compiler
} // namespace mlir
4 changes: 4 additions & 0 deletions iree/compiler/Conversion/CodegenUtils/FunctionUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ unsigned getNumOuterParallelLoops(linalg::LinalgOp op);
/// Returns the entry point op for the `funcOp`. Returns `nullptr` on failure.
IREE::HAL::ExecutableEntryPointOp getEntryPoint(FuncOp funcOp);

/// Gets the source type of ops that implement ViewOpInterface recursively. Can
/// be used to get the untiled operands from a tiled operation.
Value getViewSource(Value view);

} // namespace iree_compiler
} // namespace mlir

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ void MaterializeCPULaunchConfigurationPass::runOnOperation() {
SmallVector<linalg::LinalgOp, 4> linalgOps;
SmallVector<Operation *, 4> tiledLoops;
if (failed(getLinalgOps(funcOp, linalgOps, tiledLoops))) {
return signalPassFailure();
// Nothing to do here. Continue.
continue;
}
linalg::Aliases aliases;
linalg::LinalgDependenceGraph dependenceGraph(aliases, linalgOps);
Optional<LaunchConfig> launchConfigOpt =
initCPULaunchConfig(context, dependenceGraph, linalgOps);
if (!launchConfigOpt) {
return;
// Nothing to do here. Continue.
continue;
}
LaunchConfig &launchConfig = *launchConfigOpt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define IREE_COMPILER_CONVERSION_LINALGTOSPIRV_CODEGENOPTIONUTILS_H_

#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"

namespace mlir {
namespace iree_compiler {
Expand Down
Loading

0 comments on commit f2f0041

Please sign in to comment.