Move to more recent LLVM commit ID (#64)
* Move to more recent LLVM commit ID * Update LLVM cache version from V9 to V10 * Update to latest LLVM commit id from master, roll back conditions in util scripts * Update circlci LLVM cache tag to ensure ci updates builds with latest LLVM commit id * Update README.md to have matching LLVM commit id * Update doc/Dialtects/onnx.md
This commit is contained in:
parent
b422116f12
commit
b65e77305c
|
@ -18,7 +18,7 @@ jobs:
|
|||
git submodule update --init --recursive
|
||||
# Use cached mlir installation if possible.
|
||||
- restore_cache:
|
||||
key: V9-LLVM-PROJECT-{{ arch }}
|
||||
key: V10-1-LLVM-PROJECT-{{ arch }}
|
||||
- run:
|
||||
name: Install MLIR
|
||||
command: |
|
||||
|
@ -29,7 +29,7 @@ jobs:
|
|||
source onnx-mlir/utils/install-mlir.sh
|
||||
fi
|
||||
- save_cache:
|
||||
key: V9-LLVM-PROJECT-{{ arch }}
|
||||
key: V10-1-LLVM-PROJECT-{{ arch }}
|
||||
paths:
|
||||
- llvm-project
|
||||
- run:
|
||||
|
|
28
MLIR.cmake
28
MLIR.cmake
|
@ -54,9 +54,11 @@ function(find_mlir_lib lib)
|
|||
NO_DEFAULT_PATH)
|
||||
endfunction(find_mlir_lib)
|
||||
|
||||
find_mlir_lib(MLIRAffineOps)
|
||||
find_mlir_lib(MLIRAffine)
|
||||
find_mlir_lib(MLIRAffineToStandard)
|
||||
find_mlir_lib(MLIRAnalysis)
|
||||
find_mlir_lib(MLIRCallInterfaces)
|
||||
find_mlir_lib(MLIRControlFlowInterfaces)
|
||||
find_mlir_lib(MLIRDialect)
|
||||
find_mlir_lib(MLIREDSC)
|
||||
find_mlir_lib(MLIRExecutionEngine)
|
||||
|
@ -65,21 +67,25 @@ find_mlir_lib(MLIRLLVMIR)
|
|||
find_mlir_lib(MLIRLoopAnalysis)
|
||||
find_mlir_lib(MLIRLoopToStandard)
|
||||
find_mlir_lib(MLIRLoopOps)
|
||||
find_mlir_lib(MLIRLoopLikeInterface)
|
||||
find_mlir_lib(MLIRLLVMIRTransforms)
|
||||
find_mlir_lib(MLIRMlirOptMain)
|
||||
find_mlir_lib(MLIRParser)
|
||||
find_mlir_lib(MLIRPass)
|
||||
find_mlir_lib(MLIRStandardOps)
|
||||
find_mlir_lib(MLIRStandardToLLVM)
|
||||
find_mlir_lib(MLIRSideEffects)
|
||||
find_mlir_lib(MLIRTargetLLVMIR)
|
||||
find_mlir_lib(MLIRTransforms)
|
||||
find_mlir_lib(MLIRTransformUtils)
|
||||
find_mlir_lib(MLIRSupport)
|
||||
find_mlir_lib(MLIRMlirOptMain)
|
||||
find_mlir_lib(MLIROpenMP)
|
||||
find_mlir_lib(MLIROptLib)
|
||||
find_mlir_lib(MLIRTargetLLVMIRModuleTranslation)
|
||||
find_mlir_lib(MLIRTargetLLVMIR)
|
||||
find_mlir_lib(MLIRTransformUtils)
|
||||
find_mlir_lib(MLIRTranslation)
|
||||
find_mlir_lib(MLIRVectorOps)
|
||||
find_mlir_lib(MLIRVector)
|
||||
|
||||
find_mlir_lib(LLVMCore)
|
||||
find_mlir_lib(LLVMSupport)
|
||||
|
@ -87,6 +93,7 @@ find_mlir_lib(LLVMAsmParser)
|
|||
find_mlir_lib(LLVMBinaryFormat)
|
||||
find_mlir_lib(LLVMRemarks)
|
||||
find_mlir_lib(LLVMIRReader)
|
||||
find_mlir_lib(LLVMMLIRTableGen)
|
||||
find_mlir_lib(LLVMTransformUtils)
|
||||
find_mlir_lib(LLVMBitstreamReader)
|
||||
find_mlir_lib(LLVMAnalysis)
|
||||
|
@ -97,6 +104,7 @@ find_mlir_lib(LLVMMCParser)
|
|||
find_mlir_lib(LLVMObject)
|
||||
find_mlir_lib(LLVMProfileData)
|
||||
find_mlir_lib(LLVMDemangle)
|
||||
find_mlir_lib(LLVMFrontendOpenMP)
|
||||
|
||||
|
||||
set(MLIRLibsOnce
|
||||
|
@ -107,30 +115,38 @@ set(MLIRLibsOnce
|
|||
${LLVMBitstreamReader}
|
||||
${LLVMBitWriter}
|
||||
${LLVMCore}
|
||||
${LLVMFrontendOpenMP}
|
||||
${LLVMIRReader}
|
||||
${LLVMMC}
|
||||
${LLVMMCParser}
|
||||
${LLVMMLIRTableGen}
|
||||
${LLVMObject}
|
||||
${LLVMRemarks}
|
||||
${LLVMSupport}
|
||||
${LLVMTransformUtils}
|
||||
${LLVMProfileData}
|
||||
${LLVMDemangle}
|
||||
${MLIRAffineOps}
|
||||
${MLIRAffine}
|
||||
${MLIRAffineToStandard}
|
||||
${MLIRAnalysis}
|
||||
${MLIRCallInterfaces}
|
||||
${MLIRControlFlowInterfaces}
|
||||
${MLIRDialect}
|
||||
${MLIREDSC}
|
||||
${MLIRExecutionEngine}
|
||||
${MLIRIR}
|
||||
${MLIRLLVMIR}
|
||||
${MLIRLLVMIRTransforms}
|
||||
${MLIRLoopToStandard}
|
||||
${MLIRLoopOps}
|
||||
${MLIRLoopAnalysis}
|
||||
${MLIRLoopLikeInterface}
|
||||
${MLIROpenMP}
|
||||
${MLIRMlirOptMain}
|
||||
${MLIROptLib}
|
||||
${MLIRParser}
|
||||
${MLIRPass}
|
||||
${MLIRSideEffects}
|
||||
${MLIRStandardOps}
|
||||
${MLIRStandardToLLVM}
|
||||
${MLIRSupport}
|
||||
|
@ -147,13 +163,13 @@ set(MLIRLibs
|
|||
|
||||
set(MLIRWholeArchiveLibs
|
||||
MLIRAffineToStandard
|
||||
MLIRAffineOps
|
||||
MLIRAffine
|
||||
MLIRLLVMIR
|
||||
MLIRStandardOps
|
||||
MLIRStandardToLLVM
|
||||
MLIRTransforms
|
||||
MLIRLoopToStandard
|
||||
MLIRVectorOps
|
||||
MLIRVector
|
||||
MLIRLoopOps)
|
||||
|
||||
function(whole_archive_link target lib_dir)
|
||||
|
|
|
@ -19,7 +19,7 @@ Firstly, install MLIR (as a part of LLVM-Project):
|
|||
``` bash
|
||||
git clone https://github.com/llvm/llvm-project.git
|
||||
# Check out a specific branch that is known to work with ONNX MLIR.
|
||||
cd llvm-project && git checkout 076475713c236081a3247a53e9dbab9043c3eac2 && cd ..
|
||||
cd llvm-project && git checkout 07e462526d0cbae40b320e1a4307ce11e197fb0a && cd ..
|
||||
mkdir llvm-project/build
|
||||
cd llvm-project/build
|
||||
cmake -G Ninja ../llvm \
|
||||
|
|
3747
doc/Dialects/onnx.md
3747
doc/Dialects/onnx.md
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,7 @@
|
|||
#include <tuple>
|
||||
|
||||
#include "mlir/Analysis/Verifier.h"
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/IR/Attributes.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/IR/Function.h"
|
||||
|
|
|
@ -21,7 +21,7 @@ class ONNXEntryPointLowering : public OpRewritePattern<ONNXEntryPointOp> {
|
|||
public:
|
||||
using OpRewritePattern<ONNXEntryPointOp>::OpRewritePattern;
|
||||
|
||||
PatternMatchResult matchAndRewrite(ONNXEntryPointOp op,
|
||||
LogicalResult matchAndRewrite(ONNXEntryPointOp op,
|
||||
PatternRewriter &rewriter) const override {
|
||||
rewriter.replaceOpWithNewOp<KrnlEntryPointOp>(
|
||||
op,
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
op.getAttrOfType<IntegerAttr>(ONNXEntryPointOp::getNumInputsAttrName()),
|
||||
op.getAttrOfType<IntegerAttr>(
|
||||
ONNXEntryPointOp::getNumOutputsAttrName()));
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -56,7 +56,7 @@ void FrontendToKrnlLoweringPass::runOnModule() {
|
|||
// We define the specific operations, or dialects, that are legal targets for
|
||||
// this lowering.
|
||||
target
|
||||
.addLegalDialect<KrnlOpsDialect, AffineOpsDialect, StandardOpsDialect>();
|
||||
.addLegalDialect<KrnlOpsDialect, AffineDialect, StandardOpsDialect>();
|
||||
|
||||
// TODO: enable this once more ops are supported.
|
||||
// We also define the ONNX dialect as Illegal so that the conversion will fail
|
||||
|
|
|
@ -495,7 +495,7 @@ template <typename ElementwiseUnaryOp>
|
|||
struct ONNXElementwiseUnaryOpLowering : public ConversionPattern {
|
||||
ONNXElementwiseUnaryOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(ElementwiseUnaryOp::getOperationName(), 1, ctx) {}
|
||||
PatternMatchResult
|
||||
LogicalResult
|
||||
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
// TODO: Check that the types are valid.
|
||||
|
@ -553,7 +553,7 @@ struct ONNXElementwiseUnaryOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -563,7 +563,7 @@ template <typename ElementwiseVariadicOp>
|
|||
struct ONNXElementwiseVariadicOpLowering : public ConversionPattern {
|
||||
ONNXElementwiseVariadicOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(ElementwiseVariadicOp::getOperationName(), 1, ctx) {}
|
||||
PatternMatchResult
|
||||
LogicalResult
|
||||
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
// TODO: Check that the types are valid.
|
||||
|
@ -633,7 +633,7 @@ struct ONNXElementwiseVariadicOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ONNXGemmOpLowering : public ConversionPattern {
|
|||
ONNXGemmOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(GemmOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult
|
||||
LogicalResult
|
||||
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
auto loc = op->getLoc();
|
||||
|
@ -210,7 +210,7 @@ struct ONNXGemmOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct ONNXMatMulOpLowering : public ConversionPattern {
|
|||
ONNXMatMulOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXMatMulOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult
|
||||
LogicalResult
|
||||
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
auto loc = op->getLoc();
|
||||
|
@ -330,7 +330,7 @@ struct ONNXMatMulOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ struct ONNXReductionOpLowering : public ConversionPattern {
|
|||
ONNXReductionOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(ONNXReductionOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult
|
||||
LogicalResult
|
||||
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
/*
|
||||
|
@ -271,7 +271,7 @@ struct ONNXReductionOpLowering : public ConversionPattern {
|
|||
rewriter.create<StoreOp>(loc, accumulated, alloc, outLoopIVs);
|
||||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace mlir;
|
|||
struct ONNXSoftmaxOpLowering : public ConversionPattern {
|
||||
ONNXSoftmaxOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXSoftmaxOp::getOperationName(), 1, ctx) {}
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
// softmax(x) = let max_x = max(x) in
|
||||
// let exp_x = exp(x - max_x) in
|
||||
|
@ -196,7 +196,7 @@ struct ONNXSoftmaxOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct ONNXConvOpLowering : public ConversionPattern {
|
|||
ONNXConvOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXConvOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
auto loc = op->getLoc();
|
||||
ONNXConvOpOperandAdaptor operandAdaptor(operands);
|
||||
|
@ -250,7 +250,7 @@ struct ONNXConvOpLowering : public ConversionPattern {
|
|||
}
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ONNXBatchNormalizationTestModeOpLowering : public ConversionPattern {
|
|||
: ConversionPattern(
|
||||
mlir::ONNXBatchNormalizationTestModeOp::getOperationName(), 1,
|
||||
ctx) {}
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
// batchnorm{epsilon}(x, scale, bias, mean, variance) =
|
||||
// scale * (x - mean) / sqrt(variance + epsilon) + bias
|
||||
|
@ -133,7 +133,7 @@ struct ONNXBatchNormalizationTestModeOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ struct ONNXMaxPoolSingleOutOpLowering : public ConversionPattern {
|
|||
: ConversionPattern(
|
||||
mlir::ONNXMaxPoolSingleOutOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
ONNXMaxPoolSingleOutOpOperandAdaptor operandAdaptor(operands);
|
||||
auto loc = op->getLoc();
|
||||
|
@ -315,7 +315,7 @@ struct ONNXMaxPoolSingleOutOpLowering : public ConversionPattern {
|
|||
}
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include "mlir/Dialect/AffineOps/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
|
|
|
@ -47,7 +47,7 @@ struct ONNXConstantOpLowering : public ConversionPattern {
|
|||
ONNXConstantOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXConstantOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
auto loc = op->getLoc();
|
||||
auto constantOp = llvm::dyn_cast<ONNXConstantOp>(op);
|
||||
|
@ -90,7 +90,7 @@ struct ONNXConstantOpLowering : public ConversionPattern {
|
|||
// Replace this operation with the generated alloc.
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ struct ONNXIdentityOpLowering : public ConversionPattern {
|
|||
ONNXIdentityOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXIdentityOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
ONNXIdentityOpOperandAdaptor operandAdaptor(operands);
|
||||
rewriter.replaceOp(op, operandAdaptor.input());
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ONNXPadConstantValuePadOpLowering : public ConversionPattern {
|
|||
: ConversionPattern(
|
||||
mlir::ONNXPadConstantValuePadOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
auto tensorType = (*op->result_type_begin());
|
||||
ONNXPadConstantValuePadOpOperandAdaptor operandAdaptor(operands);
|
||||
|
@ -98,7 +98,7 @@ struct ONNXPadConstantValuePadOpLowering : public ConversionPattern {
|
|||
// Replace the original op with the generated code.
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct ONNXReshapeOpLowering : public ConversionPattern {
|
|||
ONNXReshapeOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXReshapeOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
ONNXReshapeOpOperandAdaptor operandAdaptor(operands);
|
||||
auto loc = op->getLoc();
|
||||
|
@ -139,7 +139,7 @@ struct ONNXReshapeOpLowering : public ConversionPattern {
|
|||
rewriter.create<KrnlMemcpyOp>(loc, alloc, data, tensorSize);
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct ONNXTransposeOpLowering : public ConversionPattern {
|
|||
ONNXTransposeOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXTransposeOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
ONNXTransposeOpOperandAdaptor operandAdaptor(operands);
|
||||
auto loc = op->getLoc();
|
||||
|
@ -93,7 +93,7 @@ struct ONNXTransposeOpLowering : public ConversionPattern {
|
|||
|
||||
rewriter.replaceOp(op, alloc);
|
||||
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct ONNXUnsqueezeOpLowering : public ConversionPattern {
|
|||
ONNXUnsqueezeOpLowering(MLIRContext *ctx)
|
||||
: ConversionPattern(mlir::ONNXUnsqueezeOp::getOperationName(), 1, ctx) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const final {
|
||||
ONNXUnsqueezeOpOperandAdaptor operandAdaptor(operands);
|
||||
auto loc = op->getLoc();
|
||||
|
@ -77,7 +77,7 @@ struct ONNXUnsqueezeOpLowering : public ConversionPattern {
|
|||
}
|
||||
rewriter.create<KrnlMemcpyOp>(loc, alloc, data, tensorSize);
|
||||
rewriter.replaceOp(op, alloc);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/AffineOps/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
|
||||
#include "KrnlOps.hpp"
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <iostream>
|
||||
#include <queue>
|
||||
|
||||
#include "mlir/Dialect/AffineOps/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/IR/Block.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/IR/Function.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/IR/Dialect.h"
|
||||
#include "mlir/IR/OpDefinition.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// This file is automatically generated via script.
|
||||
// Details can be found in doc/readonnxdefs.md .
|
||||
//********************************************************
|
||||
include "mlir/Interfaces/SideEffects.td"
|
||||
|
||||
def ONNXAbsOp:ONNX_Op<"Abs",
|
||||
[NoSideEffect, DeclareOpInterfaceMethods<ShapeInferenceOpInterface>]> {
|
||||
|
|
|
@ -45,7 +45,7 @@ void EmitLLVMBitCode(const mlir::OwningModuleRef &module) {
|
|||
}
|
||||
|
||||
void registerDialects() {
|
||||
mlir::registerDialect<mlir::AffineOpsDialect>();
|
||||
mlir::registerDialect<mlir::AffineDialect>();
|
||||
mlir::registerDialect<mlir::LLVM::LLVMDialect>();
|
||||
mlir::registerDialect<mlir::loop::LoopOpsDialect>();
|
||||
mlir::registerDialect<mlir::StandardOpsDialect>();
|
||||
|
|
|
@ -48,8 +48,13 @@ static llvm::cl::opt<bool> verify_passes(
|
|||
llvm::cl::desc("Run the verifier after each transformation pass"),
|
||||
llvm::cl::init(true));
|
||||
|
||||
static llvm::cl::opt<bool> allowUnregisteredDialects(
|
||||
"allow-unregistered-dialect",
|
||||
llvm::cl::desc("Allow operation with no registered dialects"),
|
||||
llvm::cl::init(false));
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mlir::registerDialect<mlir::AffineOpsDialect>();
|
||||
mlir::registerDialect<mlir::AffineDialect>();
|
||||
mlir::registerDialect<mlir::LLVM::LLVMDialect>();
|
||||
mlir::registerDialect<mlir::loop::LoopOpsDialect>();
|
||||
mlir::registerDialect<mlir::StandardOpsDialect>();
|
||||
|
@ -74,5 +79,5 @@ int main(int argc, char **argv) {
|
|||
|
||||
return failed(mlir::MlirOptMain(output->os(), std::move(file), passPipeline,
|
||||
split_input_file, verify_diagnostics,
|
||||
verify_passes));
|
||||
verify_passes, allowUnregisteredDialects));
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/AffineOps/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace {
|
|||
struct KrnlIterateOpLowering : public OpRewritePattern<KrnlIterateOp> {
|
||||
using OpRewritePattern<KrnlIterateOp>::OpRewritePattern;
|
||||
|
||||
PatternMatchResult matchAndRewrite(KrnlIterateOp iterateOp,
|
||||
LogicalResult matchAndRewrite(KrnlIterateOp iterateOp,
|
||||
PatternRewriter &rewriter) const override {
|
||||
auto boundMapAttrs =
|
||||
iterateOp.getAttrOfType<ArrayAttr>(KrnlIterateOp::getBoundsAttrName())
|
||||
|
@ -81,7 +81,7 @@ struct KrnlIterateOpLowering : public OpRewritePattern<KrnlIterateOp> {
|
|||
innermostForOp.region().end());
|
||||
|
||||
rewriter.eraseOp(iterateOp);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -93,10 +93,10 @@ class KrnlTerminatorLowering : public OpRewritePattern<KrnlTerminatorOp> {
|
|||
public:
|
||||
using OpRewritePattern<KrnlTerminatorOp>::OpRewritePattern;
|
||||
|
||||
PatternMatchResult matchAndRewrite(KrnlTerminatorOp op,
|
||||
LogicalResult matchAndRewrite(KrnlTerminatorOp op,
|
||||
PatternRewriter &rewriter) const override {
|
||||
rewriter.replaceOpWithNewOp<AffineTerminatorOp>(op);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -108,10 +108,10 @@ class KrnlDefineLoopsLowering : public OpRewritePattern<KrnlDefineLoopsOp> {
|
|||
public:
|
||||
using OpRewritePattern<KrnlDefineLoopsOp>::OpRewritePattern;
|
||||
|
||||
PatternMatchResult matchAndRewrite(KrnlDefineLoopsOp op,
|
||||
LogicalResult matchAndRewrite(KrnlDefineLoopsOp op,
|
||||
PatternRewriter &rewriter) const override {
|
||||
rewriter.eraseOp(op);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -123,10 +123,10 @@ class KrnlOptimizeLoopsLowering : public OpRewritePattern<KrnlOptimizeLoopsOp> {
|
|||
public:
|
||||
using OpRewritePattern<KrnlOptimizeLoopsOp>::OpRewritePattern;
|
||||
|
||||
PatternMatchResult matchAndRewrite(KrnlOptimizeLoopsOp op,
|
||||
LogicalResult matchAndRewrite(KrnlOptimizeLoopsOp op,
|
||||
PatternRewriter &rewriter) const override {
|
||||
rewriter.eraseOp(op);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -149,7 +149,7 @@ void KrnlToAffineLoweringPass::runOnFunction() {
|
|||
|
||||
ConversionTarget target(getContext());
|
||||
|
||||
target.addLegalDialect<AffineOpsDialect, StandardOpsDialect>();
|
||||
target.addLegalDialect<AffineDialect, StandardOpsDialect>();
|
||||
// We expect IR to be free of Krnl Dialect Ops.
|
||||
target.addIllegalDialect<KrnlOpsDialect>();
|
||||
target.addLegalOp<KrnlMemcpyOp>();
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h"
|
||||
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
|
||||
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
|
||||
#include "mlir/Dialect/AffineOps/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
||||
#include "mlir/Dialect/LoopOps/LoopOps.h"
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "llvm/ADT/Sequence.h"
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
explicit KrnlMemcpyOpLowering(MLIRContext *context)
|
||||
: ConversionPattern(KrnlMemcpyOp::getOperationName(), 1, context) {}
|
||||
|
||||
PatternMatchResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
|
||||
ConversionPatternRewriter &rewriter) const override {
|
||||
auto *context = op->getContext();
|
||||
KrnlMemcpyOpOperandAdaptor operandAdaptor(operands);
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
int64Size, isVolatile}));
|
||||
|
||||
rewriter.eraseOp(op);
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
PatternMatchResult matchAndRewrite(
|
||||
LogicalResult matchAndRewrite(
|
||||
KrnlEntryPointOp op, PatternRewriter &rewriter) const override {
|
||||
|
||||
auto *llvmDialect =
|
||||
|
@ -301,7 +301,7 @@ public:
|
|||
// Return wrapped output.
|
||||
rewriter.create<LLVM::ReturnOp>(
|
||||
loc, SmallVector<Value, 1>({wrappedOutput}));
|
||||
return matchSuccess();
|
||||
return success();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/StandardOps/Ops.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/IR/PatternMatch.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
git clone https://github.com/llvm/llvm-project.git
|
||||
# Check out a specific branch that is known to work with ONNX MLIR.
|
||||
cd llvm-project && git checkout 076475713c236081a3247a53e9dbab9043c3eac2 && cd ..
|
||||
cd llvm-project && git checkout 07e462526d0cbae40b320e1a4307ce11e197fb0a && cd ..
|
||||
mkdir llvm-project/build
|
||||
cd llvm-project/build
|
||||
cmake -G Ninja ../llvm \
|
||||
|
|
Loading…
Reference in New Issue