Skip to content

Commit

Permalink
[NFC] Slight cleanup in HAL compiler passes. (#10223)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd authored Aug 26, 2022
1 parent 8a48e10 commit 62d2be5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "iree/compiler/Dialect/HAL/IR/HALDialect.h"
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
#include "iree/compiler/Dialect/HAL/IR/HALTypes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"

Expand All @@ -17,7 +16,7 @@ namespace IREE {
namespace HAL {
namespace {

// A pass converting the IREE flow dialect into the IREE HAL dialect.
// Repeats dispatches a specified number of times.
class BenchmarkBatchDispatchesPass
: public PassWrapper<BenchmarkBatchDispatchesPass,
OperationPass<func::FuncOp>> {
Expand All @@ -28,8 +27,7 @@ class BenchmarkBatchDispatchesPass
: repeatCount_(repeatCount) {}

void getDependentDialects(DialectRegistry& registry) const override {
registry.insert<HALDialect, func::FuncDialect,
mlir::arith::ArithmeticDialect>();
registry.insert<func::FuncDialect, IREE::HAL::HALDialect>();
}

StringRef getArgument() const override {
Expand All @@ -41,10 +39,7 @@ class BenchmarkBatchDispatchesPass
}

void runOnOperation() override {
func::FuncOp f = getOperation();
SmallVector<HAL::CommandBufferDispatchOp> ops;
f.walk([&](HAL::CommandBufferDispatchOp op) { ops.push_back(op); });

auto ops = getOperation().getOps<IREE::HAL::CommandBufferDispatchOp>();
for (auto op : ops) {
OpBuilder builder(op);
for (unsigned i = 1; i < repeatCount_; ++i) {
Expand Down
7 changes: 0 additions & 7 deletions compiler/src/iree/compiler/Dialect/HAL/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,12 @@ createSerializeTargetExecutablesPass(StringRef target, int debugLevel = 2,
// Resource initialization, caching, and optimization
//===----------------------------------------------------------------------===//

// Performs packing and materializes runtime packing code when required.
std::unique_ptr<OperationPass<func::FuncOp>> createPackAllocationsPass();

// Finds all resource lookups (such as hal.executable.lookup), materializes
// their cache storage and initialization, and rewrites the lookups to
// references.
std::unique_ptr<OperationPass<mlir::ModuleOp>>
createMaterializeResourceCachesPass(TargetOptions targetOptions);

// Eliminates redundant 'load's of variables within functions with no 'store'.
// TODO(#1124): replace with memory side effects once supported upstream.
std::unique_ptr<OperationPass<func::FuncOp>> createCSEVariableLoadsPass();

// Elides stateful command buffer ops that set redundant state.
std::unique_ptr<OperationPass<void>> createElideRedundantCommandsPass();

Expand Down

0 comments on commit 62d2be5

Please sign in to comment.