add bazel support
This commit is contained in:
parent
1b2fae016f
commit
a0f2513706
|
@ -0,0 +1,18 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "include",
|
||||
srcs = [],
|
||||
hdrs = [
|
||||
"OnnxMlirRuntime.h",
|
||||
"onnx-mlir/Runtime/OMTensor.h",
|
||||
"onnx-mlir/Runtime/OMTensorList.h",
|
||||
"onnx-mlir/Runtime/OnnxDataType.h",
|
||||
"onnx-mlir/Runtime/OnnxDataTypeMetaData.inc",
|
||||
],
|
||||
strip_include_prefix = "//include",
|
||||
# visibility = ["//visibility:public"],
|
||||
deps = [],
|
||||
)
|
78
src/BUILD
78
src/BUILD
|
@ -1,35 +1,53 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "MainUtils",
|
||||
srcs = ["MainUtils.hpp","MainUtils.cpp"],
|
||||
copts = [],
|
||||
deps = [
|
||||
"@onnx",
|
||||
"//Builder:OMBuilder",
|
||||
OMKrnlOps
|
||||
OMONNXOps
|
||||
OMKrnlToAffine
|
||||
OMKrnlToLLVM
|
||||
OMONNXToKrnl
|
||||
OMONNXRewrite
|
||||
OMShapeInference
|
||||
OMShapeInferenceOpInterface
|
||||
OMAttributePromotion
|
||||
OMPromotableConstOperandsOpInterface
|
||||
OMResultTypeInferenceOpInterface
|
||||
OMElideConstants
|
||||
OMElideKrnlGlobalConstants
|
||||
OMPackKrnlGlobalConstants
|
||||
OMEnableMemoryPool
|
||||
OMBundleMemoryPools
|
||||
OMDisconnectKrnlDimFromAlloc
|
||||
OMLowerKrnlShape
|
||||
],
|
||||
genrule(
|
||||
name = "ExternalUtil",
|
||||
srcs = [
|
||||
"ExternalUtil.hpp.in",
|
||||
],
|
||||
outs = [
|
||||
"ExternalUtil.hpp",
|
||||
],
|
||||
cmd = "cp $(location :ExternalUtil.hpp.in) $(location :ExternalUtil.hpp)",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "MainUtils",
|
||||
srcs = ["MainUtils.cpp"],
|
||||
hdrs = [
|
||||
"MainUtils.hpp",
|
||||
":ExternalUtil",
|
||||
],
|
||||
deps = [
|
||||
"//src/Builder:OMBuilder",
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "onnx-mlir",
|
||||
srcs = ["main.cpp"],
|
||||
copts = [],
|
||||
deps = [":MainUtils"],
|
||||
name = "onnx-mlir",
|
||||
srcs = ["main.cpp"],
|
||||
copts = [],
|
||||
deps = [
|
||||
":MainUtils",
|
||||
"//src/Conversion/KrnlToAffine:OMKrnlToAffine",
|
||||
"//src/Conversion/KrnlToLLVM:OMKrnlToLLVM",
|
||||
"//src/Conversion/ONNXToKrnl:OMONNXToKrnl",
|
||||
"//src/Transform:OMBundleMemoryPools",
|
||||
"//src/Transform:OMDisconnectKrnlDimFromAlloc",
|
||||
"//src/Transform:OMElideKrnlGlobalConstants",
|
||||
"//src/Transform:OMEnableMemoryPool",
|
||||
"//src/Transform:OMLowerKrnlShape",
|
||||
"//src/Transform:OMPackKrnlGlobalConstants",
|
||||
"//src/Transform/ONNX:OMAttributePromotion",
|
||||
"//src/Transform/ONNX:OMElideConstants",
|
||||
"//src/Transform/ONNX:OMONNXRewrite",
|
||||
"//src/Transform/ONNX:OMShapeInference",
|
||||
],
|
||||
)
|
|
@ -1,11 +1,24 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMBuilder",
|
||||
srcs = [
|
||||
"FrontendDialectHelper.cpp",
|
||||
"FrontendDialectHelper.hpp",
|
||||
"FrontendDialectTransformer.cpp",
|
||||
"FrontendDialectTransformer.hpp",
|
||||
],
|
||||
hdrs = ["header files"],
|
||||
deps = ["header files"],
|
||||
hdrs = [
|
||||
"FrontendDialectHelper.hpp",
|
||||
"FrontendDialectTransformer.hpp",
|
||||
"OpBuildTable.inc",
|
||||
],
|
||||
deps = [
|
||||
"@llvm-project//llvm:Support",
|
||||
"@onnx",
|
||||
"@llvm-project//mlir:IR",
|
||||
"@llvm-project//mlir:StandardOps",
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
|
||||
],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMKrnlToAffine",
|
||||
srcs = [
|
||||
"KrnlToAffine.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
],
|
||||
deps = [
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"//src/Pass:Passes",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,23 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMKrnlToLLVM",
|
||||
srcs = [
|
||||
"KrnlToLLVM.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"KrnlToLLVM.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//src/Conversion/ONNXToKrnl:OMONNXToKrnl",
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//llvm:FrontendOpenMP",
|
||||
"@llvm-project//mlir:OpenMPToLLVM",
|
||||
"@llvm-project//mlir:Shape",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,46 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMONNXToKrnl",
|
||||
srcs = [
|
||||
"ConvertONNXToKrnl.cpp",
|
||||
"Math/Elementwise.cpp",
|
||||
"Math/Gemm.cpp",
|
||||
"Math/MatMul.cpp",
|
||||
"Math/Reduction.cpp",
|
||||
"Math/Softmax.cpp",
|
||||
"NN/Conv.cpp",
|
||||
"NN/Normalization.cpp",
|
||||
"NN/Pooling.cpp",
|
||||
"ONNXToKrnlCommon.cpp",
|
||||
"ONNXToKrnlCommon.hpp",
|
||||
"RNN/LSTM.cpp",
|
||||
"RNN/RNNBase.cpp",
|
||||
"RNN/RNNBase.hpp",
|
||||
"Tensor/Concat.cpp",
|
||||
"Tensor/Constant.cpp",
|
||||
"Tensor/ConstantOfShape.cpp",
|
||||
"Tensor/Gather.cpp",
|
||||
"Tensor/Identity.cpp",
|
||||
"Tensor/Pad.cpp",
|
||||
"Tensor/PadConstantValuePad.cpp",
|
||||
"Tensor/Reshape.cpp",
|
||||
"Tensor/Size.cpp",
|
||||
"Tensor/Split.cpp",
|
||||
"Tensor/Squeeze.cpp",
|
||||
"Tensor/Tile.cpp",
|
||||
"Tensor/Transpose.cpp",
|
||||
"Tensor/Unsqueeze.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
],
|
||||
deps = [
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//mlir:ConversionPasses",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
|
@ -1,3 +1,7 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
load("@llvm-project//mlir:tblgen.bzl", "gentbl")
|
||||
|
||||
gentbl(
|
||||
|
|
|
@ -31,11 +31,9 @@ cc_library(
|
|||
]),
|
||||
deps = [
|
||||
":OMONNXOpsIncGen",
|
||||
|
||||
"@//src/Interface:OMPromotableConstOperandsOpInterface",
|
||||
"@//src/Interface:OMShapeInferenceOpInterface",
|
||||
"@//src/Interface:OMResultTypeInferenceOpInterface",
|
||||
|
||||
"//src/Interface:OMPromotableConstOperandsOpInterface",
|
||||
"//src/Interface:OMShapeInferenceOpInterface",
|
||||
"//src/Interface:OMResultTypeInferenceOpInterface",
|
||||
"@onnx",
|
||||
# "@onnx//:onnx_proto_genproto",
|
||||
# "@llvm-project//mlir:Affine",
|
||||
|
@ -57,3 +55,22 @@ cc_library(
|
|||
# "@llvm-project//mlir:TableGen",
|
||||
],
|
||||
)
|
||||
|
||||
# "@llvm-project//llvm:core",
|
||||
# "@llvm-project//llvm:dtu_asm_parser",
|
||||
# "@llvm-project//llvm:dtu_code_gen",
|
||||
# "@llvm-project//llvm:dtu_desc",
|
||||
# "@llvm-project//llvm:orc_jit",
|
||||
# "@llvm-project//llvm:passes",
|
||||
# "@llvm-project//llvm:x86_asm_parser",
|
||||
# "@llvm-project//llvm:x86_code_gen",
|
||||
# "@llvm-project//mlir:AffineOps",
|
||||
# "@llvm-project//mlir:Dialect",
|
||||
# "@llvm-project//mlir:ExecutionEngine",
|
||||
# "@llvm-project//mlir:LLVMDialect",
|
||||
# "@llvm-project//mlir:LoopOps",
|
||||
# "@llvm-project//mlir:MlirOptLib",
|
||||
# "@llvm-project//mlir:Parser",
|
||||
# "@llvm-project//mlir:StandardOps",
|
||||
# "@llvm-project//mlir:Support",
|
||||
# "@llvm-project//mlir:VectorOps",
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "Passes",
|
||||
srcs = [],
|
||||
hdrs = ["Passes.hpp"],
|
||||
deps = [],
|
||||
)
|
|
@ -0,0 +1,73 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cruntime",
|
||||
srcs = [
|
||||
"OMTensor.c",
|
||||
"OMTensor.inc",
|
||||
"OMTensorList.c",
|
||||
"OMTensorList.inc",
|
||||
"OnnxDataType.cpp",
|
||||
],
|
||||
hdrs = [],
|
||||
deps = [
|
||||
"//include",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMTensorUtils",
|
||||
srcs = [
|
||||
"OMTensor.cpp",
|
||||
"OMTensor.inc",
|
||||
"OMTensorList.cpp",
|
||||
"OMTensorList.inc",
|
||||
"OnnxDataType.cpp",
|
||||
],
|
||||
hdrs = ["OMTensorHelper.h"],
|
||||
deps = [
|
||||
"//include",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "ExecutionSession",
|
||||
srcs = [
|
||||
"ExecutionSession.cpp",
|
||||
],
|
||||
hdrs = ["ExecutionSession.hpp"],
|
||||
deps = [
|
||||
"//include",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "PyRuntime.so",
|
||||
srcs = [
|
||||
"PyExecutionSession.cpp",
|
||||
"PyExecutionSession.hpp",
|
||||
],
|
||||
copts = ["-I/usr/include/python3.6"],
|
||||
linkshared = True,
|
||||
deps = [
|
||||
":ExecutionSession",
|
||||
":OMTensorUtils",
|
||||
"@onnx",
|
||||
"@pybind11",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "EmbeddedDataLoader",
|
||||
srcs = [
|
||||
"GetEmbeddedConstPool.cpp",
|
||||
],
|
||||
hdrs = ["GetEmbeddedConstPool.h"],
|
||||
deps = [
|
||||
"//include",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "binary-decoder",
|
||||
srcs = ["BinaryDecoder.cpp"],
|
||||
copts = [],
|
||||
deps = [
|
||||
"@llvm-project//llvm:Core",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "onnx-mlir-opt",
|
||||
srcs = ["ONNXMLIROpt.cpp"],
|
||||
copts = [],
|
||||
deps = [
|
||||
"@llvm-project//llvm:Core",
|
||||
"@llvm-project//mlir:IR",
|
||||
"@llvm-project//mlir:mlir-opt",
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,60 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMElideKrnlGlobalConstants",
|
||||
srcs = ["ElideKrnlGlobalConstants.cpp"],
|
||||
hdrs = ["ElideKrnlGlobalConstants.hpp"],
|
||||
deps = [
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"//src/Pass:Passes",
|
||||
# "@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMPackKrnlGlobalConstants",
|
||||
srcs = ["PackKrnlGlobalConstants.cpp"],
|
||||
deps = [
|
||||
"//src/Dialect/Krnl:OMKrnlOps",
|
||||
"//src/Pass:Passes",
|
||||
":OMElideKrnlGlobalConstants",
|
||||
# "@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMEnableMemoryPool",
|
||||
srcs = ["EnableMemoryPool.cpp"],
|
||||
deps = [
|
||||
"//src/Conversion/ONNXToKrnl:OMONNXToKrnl",
|
||||
# "@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMBundleMemoryPools",
|
||||
srcs = ["BundleMemoryPools.cpp"],
|
||||
deps = [
|
||||
"//src/Conversion/ONNXToKrnl:OMONNXToKrnl",
|
||||
# "@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMDisconnectKrnlDimFromAlloc",
|
||||
srcs = ["DisconnectKrnlDimFromAlloc.cpp"],
|
||||
deps = [
|
||||
"//src/Conversion/ONNXToKrnl:OMONNXToKrnl",
|
||||
# "@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMLowerKrnlShape",
|
||||
srcs = ["LowerKrnlShape.cpp"],
|
||||
deps = [
|
||||
"//src/Conversion/ONNXToKrnl:OMONNXToKrnl",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,116 @@
|
|||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMAttributePromotion",
|
||||
srcs = ["AttributePromotion.cpp"],
|
||||
copts = [],
|
||||
deps = [
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//mlir:StandardOps",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMElideConstants",
|
||||
srcs = ["ElideConstants.cpp"],
|
||||
copts = [],
|
||||
deps = [
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//mlir:StandardOps",
|
||||
"@onnx",
|
||||
],
|
||||
)
|
||||
|
||||
load("@llvm-project//mlir:tblgen.bzl", "gentbl")
|
||||
|
||||
gentbl(
|
||||
name = "OMONNXRewriteIncGen",
|
||||
tbl_outs = [
|
||||
("-gen-rewriters", "ONNXRewrite.inc"),
|
||||
],
|
||||
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
||||
td_file = "Rewrite.td",
|
||||
td_includes = ["."],
|
||||
td_srcs = [
|
||||
"@llvm-project//mlir:TdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl(
|
||||
name = "OMONNXCombineIncGen",
|
||||
tbl_outs = [
|
||||
("-gen-rewriters", "ONNXCombine.inc"),
|
||||
],
|
||||
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
||||
td_file = "Combine.td",
|
||||
td_includes = ["."],
|
||||
td_srcs = [
|
||||
"@llvm-project//mlir:TdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl(
|
||||
name = "OMONNXDecomposeIncGen",
|
||||
tbl_outs = [
|
||||
("-gen-rewriters", "ONNXDecompose.inc"),
|
||||
],
|
||||
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
||||
td_file = "Decompose.td",
|
||||
td_includes = ["."],
|
||||
td_srcs = [
|
||||
"@llvm-project//mlir:TdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl(
|
||||
name = "OMONNXConstPropIncGen",
|
||||
tbl_outs = [
|
||||
("-gen-rewriters", "ONNXConstProp.inc"),
|
||||
],
|
||||
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
||||
td_file = "ConstProp.td",
|
||||
td_includes = ["."],
|
||||
td_srcs = [
|
||||
"@llvm-project//mlir:TdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMONNXRewrite",
|
||||
srcs = [
|
||||
"Combine.cpp",
|
||||
"ConstProp.cpp",
|
||||
"Decompose.cpp",
|
||||
"Rewrite.cpp",
|
||||
],
|
||||
copts = [],
|
||||
deps = [
|
||||
":OMONNXCombineIncGen",
|
||||
":OMONNXConstPropIncGen",
|
||||
":OMONNXDecomposeIncGen",
|
||||
":OMONNXRewriteIncGen",
|
||||
"//src/Dialect/ONNX:OMONNXOps",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//mlir:StandardOps",
|
||||
"@onnx",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "OMShapeInference",
|
||||
srcs = [
|
||||
"ShapeInferencePass.cpp",
|
||||
],
|
||||
copts = [],
|
||||
deps = [
|
||||
"//src/Interface:OMShapeInferenceOpInterface",
|
||||
"//src/Pass:Passes",
|
||||
"@llvm-project//mlir:StandardOps",
|
||||
],
|
||||
)
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 1d01fc100bb5bef5f5eaf92520b2e52f64ee1d6e
|
|
@ -0,0 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_library(
|
||||
name = "pybind11",
|
||||
hdrs = glob(["include/**/*."]),
|
||||
includes = ["include"],
|
||||
)
|
||||
|
Loading…
Reference in New Issue