mirror of https://github.com/llvm/torch-mlir
Bump llvm-project to c8c07b76b2cf2ada8e7ec132f7f57b97d76743cf.
* Several NFC changes to signatures/includes.pull/99/head
parent
30adf9e6b0
commit
a3f4db9fe8
|
@ -1 +1 @@
|
|||
Subproject commit 68486f9c3a509cdb23451a488f16c530919bab70
|
||||
Subproject commit c8c07b76b2cf2ada8e7ec132f7f57b97d76743cf
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "../PassDetail.h"
|
||||
#include "mlir/Dialect/Traits.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
|
||||
using namespace mlir;
|
||||
using namespace mlir::NPCOMP;
|
||||
|
@ -23,11 +23,14 @@ class ConvertBasicpyToStd
|
|||
public:
|
||||
void runOnOperation() {
|
||||
FuncOp func = getOperation();
|
||||
MLIRContext *context = &getContext();
|
||||
(void)applyPatternsAndFoldGreedily(func, getPatterns());
|
||||
}
|
||||
|
||||
FrozenRewritePatternList getPatterns() {
|
||||
auto *context = &getContext();
|
||||
OwningRewritePatternList patterns;
|
||||
populateBasicpyToStdPrimitiveOpPatterns(context, patterns);
|
||||
(void)applyPatternsAndFoldGreedily(func, patterns);
|
||||
return std::move(patterns);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "npcomp/Conversion/NumpyToTCF/Passes.h"
|
||||
|
||||
#include "../PassDetail.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
#include "npcomp/Dialect/Numpy/IR/NumpyOps.h"
|
||||
#include "npcomp/Dialect/TCF/IR/TCFDialect.h"
|
||||
#include "npcomp/Dialect/TCF/IR/TCFOps.h"
|
||||
|
@ -55,7 +55,7 @@ class ConvertNumpyToTCF : public ConvertNumpyToTCFBase<ConvertNumpyToTCF> {
|
|||
OwningRewritePatternList patterns;
|
||||
patterns.insert<ConvertBinaryBuiltinUfuncCallOp<tcf::AddOp>>(context,
|
||||
"numpy.add");
|
||||
(void)applyPatternsAndFoldGreedily(func, patterns);
|
||||
(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Dialect/Traits.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
#include "npcomp/Dialect/TCF/IR/TCFOps.h"
|
||||
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
|
||||
#include "npcomp/Dialect/TCP/IR/TCPOps.h"
|
||||
|
@ -164,8 +165,11 @@ public:
|
|||
|
||||
void runOnOperation() override {
|
||||
ModuleOp module = getOperation();
|
||||
MLIRContext *context = &getContext();
|
||||
(void)applyPatternsAndFoldGreedily(module, getPatterns());
|
||||
}
|
||||
|
||||
FrozenRewritePatternList getPatterns() {
|
||||
MLIRContext *context = &getContext();
|
||||
OwningRewritePatternList patterns;
|
||||
patterns.insert<ConvertUnaryElementwise<tcf::ExpOp>,
|
||||
ConvertUnaryElementwise<tcf::TanhOp>>(context);
|
||||
|
@ -173,7 +177,7 @@ public:
|
|||
ConvertBinaryElementwise<tcf::MaxOp>,
|
||||
ConvertBinaryElementwise<tcf::MulOp>>(context);
|
||||
patterns.insert<ConvertMatmul>(context);
|
||||
(void)applyPatternsAndFoldGreedily(module, patterns);
|
||||
return std::move(patterns);
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "mlir/Parser.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
|
||||
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
|
||||
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
|
||||
|
@ -898,7 +899,8 @@ struct ATenLoweringPass : public ATenLoweringBase<ATenLoweringPass> {
|
|||
return typeConverter.isSignatureLegal(op.getType());
|
||||
});
|
||||
|
||||
if (failed(applyPartialConversion(module, target, acapPatterns))) {
|
||||
if (failed(
|
||||
applyPartialConversion(module, target, std::move(acapPatterns)))) {
|
||||
emitError(UnknownLoc::get(context), "error lowering ATen\n");
|
||||
signalPassFailure();
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "PassDetail.h"
|
||||
|
||||
#include "mlir/IR/PatternMatch.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
#include "npcomp/Dialect/ATen/IR/ATenDialect.h"
|
||||
#include "npcomp/Dialect/ATen/Transforms/Passes.h"
|
||||
#include "npcomp/Dialect/Numpy/IR/NumpyDialect.h"
|
||||
|
@ -366,9 +367,9 @@ class ATenRecognizeKernelsPass
|
|||
|
||||
OwningRewritePatternList patterns;
|
||||
patterns.insert<RecognizeOpPattern>(&context, transformer);
|
||||
if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(), patterns))) {
|
||||
if (failed(
|
||||
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
|
||||
signalPassFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ using namespace mlir::NPCOMP::refback;
|
|||
namespace {
|
||||
struct RefbackInlinerInterface : public DialectInlinerInterface {
|
||||
using DialectInlinerInterface::DialectInlinerInterface;
|
||||
bool isLegalToInline(Region *dest, Region *src,
|
||||
bool isLegalToInline(Region *dest, Region *src, bool shouldBeCloned,
|
||||
BlockAndValueMapping &valueMapping) const final {
|
||||
return true;
|
||||
}
|
||||
bool isLegalToInline(Operation *, Region *,
|
||||
bool isLegalToInline(Operation *, Region *, bool shouldBeCloned,
|
||||
BlockAndValueMapping &) const final {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ using namespace mlir::NPCOMP::tcp;
|
|||
namespace {
|
||||
struct TCPInlinerInterface : public DialectInlinerInterface {
|
||||
using DialectInlinerInterface::DialectInlinerInterface;
|
||||
bool isLegalToInline(Region *dest, Region *src,
|
||||
bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned,
|
||||
BlockAndValueMapping &valueMapping) const final {
|
||||
return true;
|
||||
}
|
||||
bool isLegalToInline(Operation *, Region *,
|
||||
bool isLegalToInline(Operation *, Region *, bool wouldBeCloned,
|
||||
BlockAndValueMapping &) const final {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mlir/IR/Module.h"
|
||||
#include "mlir/Transforms/Bufferize.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
#include "npcomp/Dialect/Refback/IR/RefbackDialect.h"
|
||||
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
|
||||
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
|
||||
|
@ -277,12 +278,10 @@ class TCPBufferizePass : public TCPBufferizeBase<TCPBufferizePass> {
|
|||
|
||||
patterns.insert<LowerBroadcastToToLoopsPattern>(typeConverter, context);
|
||||
target.addIllegalOp<tcp::BroadcastToOp>();
|
||||
patterns.insert<BufferizeElementwiseOp<tcp::AddOp>,
|
||||
BufferizeElementwiseOp<tcp::MaxOp>,
|
||||
BufferizeElementwiseOp<tcp::MulOp>,
|
||||
BufferizeElementwiseOp<tcp::ExpOp>,
|
||||
BufferizeElementwiseOp<tcp::TanhOp>>(typeConverter,
|
||||
context);
|
||||
patterns.insert<
|
||||
BufferizeElementwiseOp<tcp::AddOp>, BufferizeElementwiseOp<tcp::MaxOp>,
|
||||
BufferizeElementwiseOp<tcp::MulOp>, BufferizeElementwiseOp<tcp::ExpOp>,
|
||||
BufferizeElementwiseOp<tcp::TanhOp>>(typeConverter, context);
|
||||
target.addIllegalOp<tcp::AddOp, tcp::MaxOp, tcp::MulOp>();
|
||||
patterns.insert<BufferizeMatmulOp>(typeConverter, context);
|
||||
target.addIllegalOp<tcp::MatmulOp>();
|
||||
|
@ -292,7 +291,7 @@ class TCPBufferizePass : public TCPBufferizeBase<TCPBufferizePass> {
|
|||
target.addLegalDialect<scf::SCFDialect>();
|
||||
target.addLegalOp<shape::GetExtentOp>();
|
||||
|
||||
if (failed(applyPartialConversion(func, target, patterns)))
|
||||
if (failed(applyPartialConversion(func, target, std::move(patterns))))
|
||||
return signalPassFailure();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,7 +37,8 @@ llvm::Expected<std::unique_ptr<JITModule>>
|
|||
JITModule::fromCompiledModule(mlir::ModuleOp module,
|
||||
llvm::ArrayRef<llvm::StringRef> sharedLibs) {
|
||||
auto expectedEngine = ExecutionEngine::create(
|
||||
module, [](llvm::Module *) { return Error::success(); },
|
||||
module, /*llvmModuleBuilder=*/nullptr,
|
||||
/*transformer=*/[](llvm::Module *) { return Error::success(); },
|
||||
/*jitCodeGenOptLevel=*/llvm::None, llvm::to_vector<6>(sharedLibs));
|
||||
if (!expectedEngine)
|
||||
return expectedEngine.takeError();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
||||
#include "mlir/Dialect/StandardOps/Transforms/Passes.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
|
||||
#include "npcomp/Dialect/Refbackrt/IR/RefbackrtDialect.h"
|
||||
#include "npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h"
|
||||
|
@ -712,7 +713,7 @@ class LowerToLLVM : public LowerToLLVMBase<LowerToLLVM> {
|
|||
// lots of these patterns.
|
||||
populateExpandTanhPattern(patterns, context);
|
||||
|
||||
if (failed(applyFullConversion(module, target, patterns))) {
|
||||
if (failed(applyFullConversion(module, target, std::move(patterns)))) {
|
||||
return signalPassFailure();
|
||||
}
|
||||
// Rewrite llvm.mlir.addressof ops that reference the original exported
|
||||
|
|
|
@ -225,7 +225,7 @@ static LogicalResult doDialectConversion(ModuleOp module) {
|
|||
patterns.insert<LowerAssertOp>(context);
|
||||
target.addIllegalOp<AssertOp>();
|
||||
|
||||
return applyPartialConversion(module, target, patterns);
|
||||
return applyPartialConversion(module, target, std::move(patterns));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Pass/PassRegistry.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
#include "mlir/Transforms/Passes.h"
|
||||
#include "npcomp/Conversion/TCFToTCP/TCFToTCP.h"
|
||||
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
|
||||
|
@ -113,7 +114,7 @@ class LowerAllocMemRefOps
|
|||
target.addLegalOp<shape::GetExtentOp>();
|
||||
target.addLegalOp<AllocOp>();
|
||||
target.addLegalOp<ConstantOp>();
|
||||
if (failed(applyPartialConversion(func, target, patterns))) {
|
||||
if (failed(applyPartialConversion(func, target, std::move(patterns)))) {
|
||||
return signalPassFailure();
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +168,7 @@ struct RestrictedCanonicalizer
|
|||
op->getCanonicalizationPatterns(patterns, context);
|
||||
|
||||
Operation *op = getOperation();
|
||||
applyPatternsAndFoldGreedily(op->getRegions(), patterns);
|
||||
applyPatternsAndFoldGreedily(op->getRegions(), std::move(patterns));
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
|
|
@ -112,7 +112,7 @@ class LowerStructuralToMemref
|
|||
patterns.insert<LowerTensorLoadOp>(typeConverter, context);
|
||||
target.addIllegalOp<TensorToMemrefOp>();
|
||||
|
||||
if (failed(applyFullConversion(func, target, patterns)))
|
||||
if (failed(applyFullConversion(func, target, std::move(patterns))))
|
||||
return signalPassFailure();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue