summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/GPU/Transforms
diff options
context:
space:
mode:
authorTres Popp <tpopp@google.com>2019-12-05 03:56:18 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-05 03:56:46 -0800
commitb8cd0c148644957ac48bc7a82b7c69e83a11a721 (patch)
tree9c251859fd01562907ac50d67ef203240728ddf3 /mlir/lib/Dialect/GPU/Transforms
parentb60799b71bb4e1e33f701b6c86dac6dc680a853e (diff)
downloadbcm5719-llvm-b8cd0c148644957ac48bc7a82b7c69e83a11a721.tar.gz
bcm5719-llvm-b8cd0c148644957ac48bc7a82b7c69e83a11a721.zip
Move ModuleManager functionality into mlir::SymbolTable.
Note for broken code, the following transformations occurred: ModuleManager::insert(Block::iterator, Operation*) - > SymbolTable::insert(Operation*, Block::iterator) ModuleManager::lookupSymbol -> SymbolTable::lookup ModuleManager::getModule() -> SymbolTable::getOp() ModuleManager::getContext() -> SymbolTable::getOp()->getContext() ModuleManager::* -> SymbolTable::* PiperOrigin-RevId: 283944635
Diffstat (limited to 'mlir/lib/Dialect/GPU/Transforms')
-rw-r--r--mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 235a74ba1c3..81d585219a1 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -24,6 +24,7 @@
#include "mlir/Dialect/StandardOps/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
+#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/Pass.h"
using namespace mlir;
@@ -155,7 +156,7 @@ namespace {
class GpuKernelOutliningPass : public ModulePass<GpuKernelOutliningPass> {
public:
void runOnModule() override {
- ModuleManager moduleManager(getModule());
+ SymbolTable symbolTable(getModule());
bool modified = false;
for (auto func : getModule().getOps<FuncOp>()) {
// Insert just after the function.
@@ -166,8 +167,8 @@ public:
// Create nested module and insert outlinedFunc. The module will
// originally get the same name as the function, but may be renamed on
// insertion into the parent module.
- auto kernelModule = createKernelModule(outlinedFunc, moduleManager);
- moduleManager.insert(insertPt, kernelModule);
+ auto kernelModule = createKernelModule(outlinedFunc, symbolTable);
+ symbolTable.insert(kernelModule, insertPt);
// Potentially changes signature, pulling in constants.
convertToLaunchFuncOp(op, outlinedFunc);
@@ -185,16 +186,15 @@ public:
private:
// Returns a module containing kernelFunc and all callees (recursive).
ModuleOp createKernelModule(FuncOp kernelFunc,
- const ModuleManager &parentModuleManager) {
+ const SymbolTable &parentSymbolTable) {
auto context = getModule().getContext();
Builder builder(context);
auto kernelModule =
ModuleOp::create(builder.getUnknownLoc(), kernelFunc.getName());
kernelModule.setAttr(gpu::GPUDialect::getKernelModuleAttrName(),
builder.getUnitAttr());
- ModuleManager moduleManager(kernelModule);
-
- moduleManager.insert(kernelFunc);
+ SymbolTable symbolTable(kernelModule);
+ symbolTable.insert(kernelFunc);
llvm::SmallVector<Operation *, 8> symbolDefWorklist = {kernelFunc};
while (!symbolDefWorklist.empty()) {
@@ -203,13 +203,13 @@ private:
for (SymbolTable::SymbolUse symbolUse : *symbolUses) {
StringRef symbolName =
symbolUse.getSymbolRef().cast<FlatSymbolRefAttr>().getValue();
- if (moduleManager.lookupSymbol(symbolName))
+ if (symbolTable.lookup(symbolName))
continue;
Operation *symbolDefClone =
- parentModuleManager.lookupSymbol(symbolName)->clone();
+ parentSymbolTable.lookup(symbolName)->clone();
symbolDefWorklist.push_back(symbolDefClone);
- moduleManager.insert(symbolDefClone);
+ symbolTable.insert(symbolDefClone);
}
}
}
OpenPOWER on IntegriCloud