diff --git a/external/llvm-project b/external/llvm-project index 774f1d3ff..444822d77 160000 --- a/external/llvm-project +++ b/external/llvm-project @@ -1 +1 @@ -Subproject commit 774f1d3ffd458d6cb82d5039758ef1cf6370957f +Subproject commit 444822d77a7fea28aa49edf24533c987efa1b2ee diff --git a/frontends/pytorch/csrc/builder/acap_dispatch.cpp b/frontends/pytorch/csrc/builder/acap_dispatch.cpp index c5cbaadd6..718466881 100644 --- a/frontends/pytorch/csrc/builder/acap_dispatch.cpp +++ b/frontends/pytorch/csrc/builder/acap_dispatch.cpp @@ -9,8 +9,8 @@ #include "debug.h" #include "mlir_utils.h" -#include "mlir-c/StandardAttributes.h" -#include "mlir-c/StandardTypes.h" +#include "mlir-c/BuiltinAttributes.h" +#include "mlir-c/BuiltinTypes.h" #include "npcomp-c/Types.h" #include "npcomp/Python/PybindUtils.h" diff --git a/frontends/pytorch/csrc/builder/func_builder.cpp b/frontends/pytorch/csrc/builder/func_builder.cpp index 888a67721..1254a1b16 100644 --- a/frontends/pytorch/csrc/builder/func_builder.cpp +++ b/frontends/pytorch/csrc/builder/func_builder.cpp @@ -7,9 +7,9 @@ #include "func_builder.h" +#include "mlir-c/BuiltinAttributes.h" +#include "mlir-c/BuiltinTypes.h" #include "mlir-c/Diagnostics.h" -#include "mlir-c/StandardAttributes.h" -#include "mlir-c/StandardTypes.h" #include "npcomp-c/Types.h" using namespace torch_mlir; @@ -32,7 +32,8 @@ KernelCallBuilder::KernelCallBuilder(MlirContext context, MlirLocation loc, (void)this->context; // Preserve for future. MlirNamedAttribute kernelNameAttr = mlirNamedAttributeGet( toMlirStringRef("kernelName"), - mlirStringAttrGet(context, kernelName.size(), kernelName.data())); + mlirStringAttrGet( + context, mlirStringRefCreate(kernelName.data(), kernelName.size()))); mlirOperationStateAddAttributes(state, 1, &kernelNameAttr); addSchemaAttrs(); } @@ -59,7 +60,8 @@ void KernelCallBuilder::addSchemaAttrs() { llvm::SmallVector args; for (auto &arg : schema.arguments()) { const std::string &typeStr = arg.type()->str(); - args.push_back(mlirStringAttrGet(context, typeStr.size(), typeStr.data())); + args.push_back(mlirStringAttrGet( + context, mlirStringRefCreate(typeStr.data(), typeStr.size()))); } attrs.push_back(mlirNamedAttributeGet( toMlirStringRef("sigArgTypes"), @@ -69,8 +71,8 @@ void KernelCallBuilder::addSchemaAttrs() { llvm::SmallVector returns; for (auto &ret : schema.returns()) { const std::string &typeStr = ret.type()->str(); - returns.push_back( - mlirStringAttrGet(context, typeStr.size(), typeStr.data())); + returns.push_back(mlirStringAttrGet( + context, mlirStringRefCreate(typeStr.data(), typeStr.size()))); } attrs.push_back(mlirNamedAttributeGet( toMlirStringRef("sigRetTypes"), @@ -215,7 +217,8 @@ FuncBuilder::createFunction(FuncBuilder::Inserter &inserter, /*numResults=*/0, /*results=*/nullptr)))); funcAttrs.push_back(mlirNamedAttributeGet( toMlirStringRef("sym_name"), - mlirStringAttrGet(context, name.size(), name.data()))); + mlirStringAttrGet(context, + mlirStringRefCreate(name.data(), name.size())))); MlirOperationState state = mlirOperationStateGet(toMlirStringRef("func"), location); diff --git a/frontends/pytorch/csrc/builder/graph_importer.cpp b/frontends/pytorch/csrc/builder/graph_importer.cpp index 6ff7abdb9..590096c73 100644 --- a/frontends/pytorch/csrc/builder/graph_importer.cpp +++ b/frontends/pytorch/csrc/builder/graph_importer.cpp @@ -9,9 +9,9 @@ #include "mlir_utils.h" +#include "mlir-c/BuiltinAttributes.h" +#include "mlir-c/BuiltinTypes.h" #include "mlir-c/Diagnostics.h" -#include "mlir-c/StandardAttributes.h" -#include "mlir-c/StandardTypes.h" namespace py = pybind11; using namespace torch_mlir; diff --git a/frontends/pytorch/csrc/builder/module_builder.cpp b/frontends/pytorch/csrc/builder/module_builder.cpp index d941c844a..3e1b37424 100644 --- a/frontends/pytorch/csrc/builder/module_builder.cpp +++ b/frontends/pytorch/csrc/builder/module_builder.cpp @@ -10,9 +10,9 @@ #include "graph_importer.h" #include "mlir-c/Bindings/Python/Interop.h" +#include "mlir-c/BuiltinAttributes.h" +#include "mlir-c/BuiltinTypes.h" #include "mlir-c/Registration.h" -#include "mlir-c/StandardAttributes.h" -#include "mlir-c/StandardTypes.h" #include "npcomp-c/Registration.h" namespace py = pybind11; diff --git a/frontends/pytorch/csrc/init_python_bindings.cpp b/frontends/pytorch/csrc/init_python_bindings.cpp index a8ac7b74b..83098577e 100644 --- a/frontends/pytorch/csrc/init_python_bindings.cpp +++ b/frontends/pytorch/csrc/init_python_bindings.cpp @@ -17,8 +17,8 @@ #include "llvm/Support/raw_ostream.h" #include "mlir/Conversion/SCFToStandard/SCFToStandard.h" +#include "mlir/IR/BuiltinOps.h" #include "mlir/IR/MLIRContext.h" -#include "mlir/IR/Module.h" #include "mlir/IR/Verifier.h" #include "mlir/Parser.h" #include "mlir/Pass/Pass.h" diff --git a/include/npcomp/Dialect/ATen/IR/ATenDialect.h b/include/npcomp/Dialect/ATen/IR/ATenDialect.h index f7cd03027..45e5cbbc9 100644 --- a/include/npcomp/Dialect/ATen/IR/ATenDialect.h +++ b/include/npcomp/Dialect/ATen/IR/ATenDialect.h @@ -10,11 +10,11 @@ #define NPCOMP_DIALECT_ATEN_IR_DIALECT_H #include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "mlir/IR/Function.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/IR/TypeSupport.h" #include "mlir/IR/Types.h" #include "mlir/Interfaces/SideEffectInterfaces.h" diff --git a/include/npcomp/Dialect/ATen/IR/ATenOpStatisticsUtils.h b/include/npcomp/Dialect/ATen/IR/ATenOpStatisticsUtils.h index dbc7afe11..40d8e3daf 100644 --- a/include/npcomp/Dialect/ATen/IR/ATenOpStatisticsUtils.h +++ b/include/npcomp/Dialect/ATen/IR/ATenOpStatisticsUtils.h @@ -11,7 +11,7 @@ #include "npcomp/Dialect/ATen/IR/ATenDialect.h" -#include "mlir/IR/StandardTypes.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Types.h" #include "llvm/Support/Debug.h" diff --git a/include/npcomp/Dialect/ATen/Transforms/LivenessReport.h b/include/npcomp/Dialect/ATen/Transforms/LivenessReport.h index ac9f9d5d7..c311685f2 100644 --- a/include/npcomp/Dialect/ATen/Transforms/LivenessReport.h +++ b/include/npcomp/Dialect/ATen/Transforms/LivenessReport.h @@ -11,7 +11,7 @@ #include -#include "mlir/IR/Module.h" +#include "mlir/IR/BuiltinOps.h" #include "llvm/ADT/DenseMap.h" namespace mlir { diff --git a/include/npcomp/Dialect/Basicpy/IR/BasicpyOps.h b/include/npcomp/Dialect/Basicpy/IR/BasicpyOps.h index fb0ce1a69..4bfaf90cd 100644 --- a/include/npcomp/Dialect/Basicpy/IR/BasicpyOps.h +++ b/include/npcomp/Dialect/Basicpy/IR/BasicpyOps.h @@ -11,11 +11,11 @@ #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/FunctionSupport.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/IR/SymbolTable.h" #include "mlir/Interfaces/CallInterfaces.h" #include "mlir/Interfaces/ControlFlowInterfaces.h" diff --git a/include/npcomp/Dialect/Numpy/IR/NumpyDialect.h b/include/npcomp/Dialect/Numpy/IR/NumpyDialect.h index c6c0a9e94..43352f6ac 100644 --- a/include/npcomp/Dialect/Numpy/IR/NumpyDialect.h +++ b/include/npcomp/Dialect/Numpy/IR/NumpyDialect.h @@ -9,8 +9,8 @@ #ifndef NPCOMP_DIALECT_NUMPY_IR_NUMPY_DIALECT_H #define NPCOMP_DIALECT_NUMPY_IR_NUMPY_DIALECT_H +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "mlir/IR/StandardTypes.h" #include "npcomp/Typing/Analysis/CPA/Interfaces.h" namespace mlir { diff --git a/include/npcomp/Dialect/Numpy/IR/NumpyOps.h b/include/npcomp/Dialect/Numpy/IR/NumpyOps.h index bc7ede189..3700274c5 100644 --- a/include/npcomp/Dialect/Numpy/IR/NumpyOps.h +++ b/include/npcomp/Dialect/Numpy/IR/NumpyOps.h @@ -10,10 +10,10 @@ #define NPCOMP_DIALECT_NUMPY_IR_NUMPY_OPS_H #include "mlir/IR/Attributes.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/FunctionSupport.h" #include "mlir/IR/OpDefinition.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/IR/SymbolTable.h" #include "mlir/Interfaces/SideEffectInterfaces.h" #include "npcomp/Typing/Analysis/CPA/Interfaces.h" diff --git a/include/npcomp/Dialect/Refback/IR/RefbackOps.h b/include/npcomp/Dialect/Refback/IR/RefbackOps.h index fcd481955..a52cd5580 100644 --- a/include/npcomp/Dialect/Refback/IR/RefbackOps.h +++ b/include/npcomp/Dialect/Refback/IR/RefbackOps.h @@ -10,9 +10,9 @@ #define NPCOMP_DIALECT_REFBACK_IR_REFBACKOPS_H #include "mlir/Dialect/Shape/IR/Shape.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/IR/SymbolTable.h" #include "mlir/Interfaces/SideEffectInterfaces.h" diff --git a/include/npcomp/Dialect/Refback/IR/RefbackOps.td b/include/npcomp/Dialect/Refback/IR/RefbackOps.td index c3353d949..914d1c272 100644 --- a/include/npcomp/Dialect/Refback/IR/RefbackOps.td +++ b/include/npcomp/Dialect/Refback/IR/RefbackOps.td @@ -30,7 +30,7 @@ def Refback_AllocMemRefOp : Refback_Op<"alloc_memref", []> { Allocates a memref of the given shape. This op is a convenience for creating a bunch of - extract_element ops + std.alloc. + tensor.extract ops + std.alloc. }]; let arguments = (ins Shape_ExtentTensorType:$shape); let results = (outs AnyMemRef:$memref); diff --git a/include/npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h b/include/npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h index 39b805df6..819c53f41 100644 --- a/include/npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h +++ b/include/npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h @@ -9,9 +9,9 @@ #ifndef NPCOMP_DIALECT_REFBACKRT_IR_REFBACKRTOPS_H #define NPCOMP_DIALECT_REFBACKRT_IR_REFBACKRTOPS_H +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/IR/SymbolTable.h" #define GET_OP_CLASSES diff --git a/include/npcomp/Dialect/TCF/IR/TCFOps.h b/include/npcomp/Dialect/TCF/IR/TCFOps.h index dc1175241..ceaf5a792 100644 --- a/include/npcomp/Dialect/TCF/IR/TCFOps.h +++ b/include/npcomp/Dialect/TCF/IR/TCFOps.h @@ -9,9 +9,9 @@ #ifndef NPCOMP_DIALECT_TCF_IR_TCFOPS_H #define NPCOMP_DIALECT_TCF_IR_TCFOPS_H +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #define GET_OP_CLASSES #include "npcomp/Dialect/TCF/IR/TCFOps.h.inc" diff --git a/include/npcomp/Dialect/TCP/IR/TCPOps.h b/include/npcomp/Dialect/TCP/IR/TCPOps.h index 555b2ad0d..acbba64fb 100644 --- a/include/npcomp/Dialect/TCP/IR/TCPOps.h +++ b/include/npcomp/Dialect/TCP/IR/TCPOps.h @@ -10,9 +10,9 @@ #define NPCOMP_DIALECT_TCP_IR_TCPOPS_H #include "mlir/Dialect/Shape/IR/Shape.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/IR/SymbolTable.h" #include "mlir/Interfaces/SideEffectInterfaces.h" diff --git a/include/npcomp/Dialect/Torch/IR/TorchOps.h b/include/npcomp/Dialect/Torch/IR/TorchOps.h index a59dd1242..e109d7458 100644 --- a/include/npcomp/Dialect/Torch/IR/TorchOps.h +++ b/include/npcomp/Dialect/Torch/IR/TorchOps.h @@ -9,9 +9,9 @@ #ifndef NPCOMP_DIALECT_TORCH_IR_TORCHOPS_H #define NPCOMP_DIALECT_TORCH_IR_TORCHOPS_H +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" -#include "mlir/IR/StandardTypes.h" #include "npcomp/Dialect/Torch/IR/OpInterfaces.h" #define GET_OP_CLASSES diff --git a/include/npcomp/Python/MlirIr.h b/include/npcomp/Python/MlirIr.h index 85c68e7e8..7f07bb43e 100644 --- a/include/npcomp/Python/MlirIr.h +++ b/include/npcomp/Python/MlirIr.h @@ -13,9 +13,9 @@ #include "mlir/IR/Block.h" #include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Identifier.h" #include "mlir/IR/MLIRContext.h" -#include "mlir/IR/Module.h" #include "mlir/IR/Operation.h" #include "mlir/IR/Region.h" #include "mlir/IR/SymbolTable.h" diff --git a/include/npcomp/RefBackend/JITHelpers/JITModule.h b/include/npcomp/RefBackend/JITHelpers/JITModule.h index 3a2511190..1476a7d9a 100644 --- a/include/npcomp/RefBackend/JITHelpers/JITModule.h +++ b/include/npcomp/RefBackend/JITHelpers/JITModule.h @@ -10,7 +10,7 @@ #define NPCOMP_JITRUNTIME_JITMODULE_H #include "mlir/ExecutionEngine/ExecutionEngine.h" -#include "mlir/IR/Module.h" +#include "mlir/IR/BuiltinOps.h" #include "npcomp/RefBackend/Runtime/UserAPI.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" diff --git a/include/npcomp/RefBackend/Passes.td b/include/npcomp/RefBackend/Passes.td index 0b1bdc17f..b65c56a15 100644 --- a/include/npcomp/RefBackend/Passes.td +++ b/include/npcomp/RefBackend/Passes.td @@ -29,6 +29,7 @@ def LowerToRefbackrtABI : Pass<"lower-to-refbackrt-abi", "ModuleOp"> { def LowerAllocMemRefOps : Pass<"lower-alloc-memref-ops", "FuncOp"> { let summary = "Lower AllocMemRefOp's"; let constructor = "mlir::NPCOMP::createLowerAllocMemRefOpsPass()"; + let dependentDialects = ["tensor::TensorDialect"]; } def LowerToLLVM : Pass<"refback-lower-to-llvm", "ModuleOp"> { diff --git a/include/npcomp/Typing/Support/CPAIrHelpers.h b/include/npcomp/Typing/Support/CPAIrHelpers.h index 0df8c4026..6dd2ac509 100644 --- a/include/npcomp/Typing/Support/CPAIrHelpers.h +++ b/include/npcomp/Typing/Support/CPAIrHelpers.h @@ -9,7 +9,7 @@ #ifndef NPCOMP_TYPING_SUPPORT_CPA_IR_HELPERS_H #define NPCOMP_TYPING_SUPPORT_CPA_IR_HELPERS_H -#include "mlir/IR/StandardTypes.h" +#include "mlir/IR/BuiltinTypes.h" #include "npcomp/Typing/Analysis/CPA/Types.h" namespace mlir { diff --git a/lib/CAPI/Types.cpp b/lib/CAPI/Types.cpp index 357b44f94..12aa3a46b 100644 --- a/lib/CAPI/Types.cpp +++ b/lib/CAPI/Types.cpp @@ -9,7 +9,7 @@ #include "npcomp-c/Types.h" #include "mlir/CAPI/IR.h" -#include "mlir/IR/StandardTypes.h" +#include "mlir/IR/BuiltinTypes.h" #include "npcomp/Dialect/Basicpy/IR/BasicpyDialect.h" #include "npcomp/Dialect/Numpy/IR/NumpyDialect.h" diff --git a/lib/Dialect/ATen/IR/ATenDialectOpStats.cpp b/lib/Dialect/ATen/IR/ATenDialectOpStats.cpp index db56a3a81..5c881a97a 100644 --- a/lib/Dialect/ATen/IR/ATenDialectOpStats.cpp +++ b/lib/Dialect/ATen/IR/ATenDialectOpStats.cpp @@ -11,7 +11,7 @@ #include "llvm/Support/Debug.h" -#include "mlir/IR/StandardTypes.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Types.h" #include diff --git a/lib/Dialect/ATen/Transforms/ATenLoweringPass.cpp b/lib/Dialect/ATen/Transforms/ATenLoweringPass.cpp index d176c968d..b831166b4 100644 --- a/lib/Dialect/ATen/Transforms/ATenLoweringPass.cpp +++ b/lib/Dialect/ATen/Transforms/ATenLoweringPass.cpp @@ -23,8 +23,8 @@ #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/EDSC/Builders.h" #include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/OperationSupport.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/Parser.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" diff --git a/lib/Dialect/ATen/Transforms/LivenessReport.cpp b/lib/Dialect/ATen/Transforms/LivenessReport.cpp index 6dcca6960..f90219a63 100644 --- a/lib/Dialect/ATen/Transforms/LivenessReport.cpp +++ b/lib/Dialect/ATen/Transforms/LivenessReport.cpp @@ -14,7 +14,7 @@ #include "mlir/Analysis/Liveness.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Builders.h" -#include "mlir/IR/Module.h" +#include "mlir/IR/BuiltinOps.h" #include "llvm/Support/Debug.h" #include "llvm/Support/JSON.h" diff --git a/lib/Dialect/Basicpy/IR/BasicpyOps.cpp b/lib/Dialect/Basicpy/IR/BasicpyOps.cpp index 7d741f37d..b451f60cc 100644 --- a/lib/Dialect/Basicpy/IR/BasicpyOps.cpp +++ b/lib/Dialect/Basicpy/IR/BasicpyOps.cpp @@ -8,7 +8,7 @@ #include "npcomp/Dialect/Basicpy/IR/BasicpyOps.h" #include "mlir/IR/Builders.h" -#include "mlir/IR/Function.h" +#include "mlir/IR/BuiltinOps.h" #include "mlir/IR/FunctionImplementation.h" #include "mlir/IR/OpImplementation.h" #include "mlir/IR/PatternMatch.h" diff --git a/lib/Dialect/Numpy/Transforms/PublicFunctionToTensor.cpp b/lib/Dialect/Numpy/Transforms/PublicFunctionToTensor.cpp index d9358def7..ce897f613 100644 --- a/lib/Dialect/Numpy/Transforms/PublicFunctionToTensor.cpp +++ b/lib/Dialect/Numpy/Transforms/PublicFunctionToTensor.cpp @@ -10,7 +10,7 @@ #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Builders.h" -#include "mlir/IR/Module.h" +#include "mlir/IR/BuiltinOps.h" #include "npcomp/Dialect/Numpy/IR/NumpyDialect.h" #include "npcomp/Dialect/Numpy/IR/NumpyOps.h" #include "npcomp/Dialect/Numpy/Transforms/Passes.h" diff --git a/lib/Dialect/Refbackrt/IR/RefbackrtOps.cpp b/lib/Dialect/Refbackrt/IR/RefbackrtOps.cpp index 1b8f2bee8..f9d209ffe 100644 --- a/lib/Dialect/Refbackrt/IR/RefbackrtOps.cpp +++ b/lib/Dialect/Refbackrt/IR/RefbackrtOps.cpp @@ -8,7 +8,7 @@ #include "npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h" #include "mlir/IR/Builders.h" -#include "mlir/IR/Function.h" +#include "mlir/IR/BuiltinOps.h" #include "mlir/IR/SymbolTable.h" #include "mlir/IR/TypeUtilities.h" #include "npcomp/Dialect/Refbackrt/IR/RefbackrtDialect.h" diff --git a/lib/Dialect/TCF/Transforms/ShapeRefinement.cpp b/lib/Dialect/TCF/Transforms/ShapeRefinement.cpp index afc8a5263..0b193e131 100644 --- a/lib/Dialect/TCF/Transforms/ShapeRefinement.cpp +++ b/lib/Dialect/TCF/Transforms/ShapeRefinement.cpp @@ -10,7 +10,7 @@ #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Builders.h" -#include "mlir/IR/Module.h" +#include "mlir/IR/BuiltinOps.h" #include "npcomp/Dialect/TCF/IR/TCFDialect.h" #include "npcomp/Dialect/TCF/IR/TCFOps.h" #include "npcomp/Dialect/TCF/Transforms/Passes.h" diff --git a/lib/Dialect/TCP/Transforms/Bufferize.cpp b/lib/Dialect/TCP/Transforms/Bufferize.cpp index 5faf30bee..776f98c4e 100644 --- a/lib/Dialect/TCP/Transforms/Bufferize.cpp +++ b/lib/Dialect/TCP/Transforms/Bufferize.cpp @@ -11,8 +11,9 @@ #include "mlir/Dialect/Linalg/IR/LinalgOps.h" #include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/IR/Builders.h" -#include "mlir/IR/Module.h" +#include "mlir/IR/BuiltinOps.h" #include "mlir/Transforms/Bufferize.h" #include "mlir/Transforms/DialectConversion.h" #include "npcomp/Dialect/Refback/IR/RefbackDialect.h" @@ -85,7 +86,7 @@ public: SmallVector outputExtents; for (int i = 0, e = resultType.getRank(); i < e; i++) { Value dimIndex = rewriter.create(op.getLoc(), i); - Value outputExtent = rewriter.create( + Value outputExtent = rewriter.create( op.getLoc(), resultShape, ValueRange({dimIndex})); outputExtents.push_back(outputExtent); } @@ -188,6 +189,7 @@ class TCPBufferizePass : public TCPBufferizeBase { target.addLegalDialect(); target.addLegalDialect(); target.addLegalDialect(); + target.addLegalDialect(); if (failed(applyPartialConversion(func, target, std::move(patterns)))) return signalPassFailure(); diff --git a/lib/Python/MlirIr.cpp b/lib/Python/MlirIr.cpp index 95e3eb76e..4ded42489 100644 --- a/lib/Python/MlirIr.cpp +++ b/lib/Python/MlirIr.cpp @@ -12,10 +12,10 @@ #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Attributes.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Diagnostics.h" -#include "mlir/IR/Function.h" #include "mlir/IR/Location.h" -#include "mlir/IR/StandardTypes.h" #include "mlir/Parser.h" #include "llvm/ADT/TypeSwitch.h" #include "llvm/Support/SourceMgr.h" diff --git a/lib/RefBackend/LowerToRefbackrtABI.cpp b/lib/RefBackend/LowerToRefbackrtABI.cpp index 6d9005b36..2a94cfe08 100644 --- a/lib/RefBackend/LowerToRefbackrtABI.cpp +++ b/lib/RefBackend/LowerToRefbackrtABI.cpp @@ -10,7 +10,7 @@ #include "npcomp/RefBackend/RefBackend.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" -#include "mlir/IR/StandardTypes.h" +#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Verifier.h" #include "mlir/Transforms/DialectConversion.h" diff --git a/lib/RefBackend/PassDetail.h b/lib/RefBackend/PassDetail.h index 7d7dcf202..e88aee3cc 100644 --- a/lib/RefBackend/PassDetail.h +++ b/lib/RefBackend/PassDetail.h @@ -9,6 +9,7 @@ #ifndef REFBACKEND_PASSDETAIL_H #define REFBACKEND_PASSDETAIL_H +#include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Pass/Pass.h" namespace mlir { diff --git a/lib/RefBackend/RefBackend.cpp b/lib/RefBackend/RefBackend.cpp index e04b71e3a..30710180c 100644 --- a/lib/RefBackend/RefBackend.cpp +++ b/lib/RefBackend/RefBackend.cpp @@ -34,6 +34,8 @@ #include "mlir/Dialect/SCF/Passes.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/Transforms/Passes.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/Dialect/Tensor/Transforms/Passes.h" #include "mlir/Pass/Pass.h" #include "mlir/Pass/PassRegistry.h" #include "mlir/Transforms/DialectConversion.h" @@ -97,8 +99,8 @@ public: for (int i = 0, e = memrefType.getRank(); i < e; i++) { if (memrefType.isDynamicDim(i)) { auto ci = rewriter.create(op.getLoc(), i); - auto extent = rewriter.create(op.getLoc(), shape, - ValueRange({ci})); + auto extent = rewriter.create(op.getLoc(), shape, + ValueRange({ci})); dynamicExtents.push_back(extent); } } @@ -119,7 +121,7 @@ class LowerAllocMemRefOps patterns.insert(context); ConversionTarget target(*context); target.addIllegalOp(); - target.addLegalOp(); + target.addLegalOp(); target.addLegalOp(); target.addLegalOp(); if (failed(applyPartialConversion(func, target, std::move(patterns)))) { @@ -247,6 +249,7 @@ void mlir::NPCOMP::createRefBackendLoweringPipeline( pm.addNestedPass(createSCFBufferizePass()); pm.addNestedPass(createLinalgBufferizePass()); pm.addNestedPass(createStdBufferizePass()); + pm.addNestedPass(createTensorBufferizePass()); pm.addPass(createFuncBufferizePass()); pm.addNestedPass(createFinalizingBufferizePass()); diff --git a/test/RefBackend/lower-alloc-memref-ops.mlir b/test/RefBackend/lower-alloc-memref-ops.mlir index 61bd70f10..deec44746 100644 --- a/test/RefBackend/lower-alloc-memref-ops.mlir +++ b/test/RefBackend/lower-alloc-memref-ops.mlir @@ -3,7 +3,7 @@ // CHECK-LABEL: func @basic func @basic(%arg0: tensor) -> memref { // CHECK: %[[I:.*]] = constant 0 : index - // CHECK: %[[E:.*]] = extract_element %arg0[%[[I]]] + // CHECK: %[[E:.*]] = tensor.extract %arg0[%[[I]]] // CHECK: alloc(%[[E]]) %0 = refback.alloc_memref %arg0 : memref return %0 : memref @@ -12,7 +12,7 @@ func @basic(%arg0: tensor) -> memref { // ----- // CHECK-LABEL: func @all_static func @all_static(%arg0: tensor) -> memref<3x4x5xf32> { - // CHECK-NOT: extract_element + // CHECK-NOT: tensor.extract // CHECK: alloc() %0 = refback.alloc_memref %arg0 : memref<3x4x5xf32> return %0 : memref<3x4x5xf32> @@ -22,9 +22,9 @@ func @all_static(%arg0: tensor) -> memref<3x4x5xf32> { // CHECK-LABEL: func @some_static func @some_static(%arg0: tensor) -> memref<3x?x5x?x7xf32> { // CHECK-DAG: %[[I1:.*]] = constant 1 : index - // CHECK-DAG: %[[E1:.*]] = extract_element %arg0[%[[I1]]] + // CHECK-DAG: %[[E1:.*]] = tensor.extract %arg0[%[[I1]]] // CHECK-DAG: %[[I3:.*]] = constant 3 : index - // CHECK-DAG: %[[E3:.*]] = extract_element %arg0[%[[I3]]] + // CHECK-DAG: %[[E3:.*]] = tensor.extract %arg0[%[[I3]]] // CHECK: alloc(%[[E1]], %[[E3]]) %0 = refback.alloc_memref %arg0 : memref<3x?x5x?x7xf32> return %0 : memref<3x?x5x?x7xf32> diff --git a/test/npcomp-run-mlir/control-flow-basic.mlir b/test/npcomp-run-mlir/control-flow-basic.mlir index aba30366c..a519accc1 100644 --- a/test/npcomp-run-mlir/control-flow-basic.mlir +++ b/test/npcomp-run-mlir/control-flow-basic.mlir @@ -14,7 +14,7 @@ func @pow2(%arg0: tensor) -> tensor { // TODO: Allow passing plain integers/floats (not tensors) at // calling convention boundaries. - %num_iters_float = extract_element %arg0[] : tensor + %num_iters_float = tensor.extract %arg0[] : tensor %num_iters_i32 = fptosi %num_iters_float : f32 to i32 %num_iters = index_cast %num_iters_i32 : i32 to index @@ -26,4 +26,3 @@ func @pow2(%arg0: tensor) -> tensor { } return %ret : tensor } -