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