diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index da66b9bf293f..5a46e222eab5 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(polygeist) +add_subdirectory(mlir) diff --git a/include/mlir/CMakeLists.txt b/include/mlir/CMakeLists.txt new file mode 100644 index 000000000000..629c08af6754 --- /dev/null +++ b/include/mlir/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(Conversion) +add_subdirectory(Dialect) diff --git a/include/mlir/Conversion/CMakeLists.txt b/include/mlir/Conversion/CMakeLists.txt new file mode 100644 index 000000000000..5e22f2f99787 --- /dev/null +++ b/include/mlir/Conversion/CMakeLists.txt @@ -0,0 +1,3 @@ +set(LLVM_TARGET_DEFINITIONS PolygeistPasses.td) +mlir_tablegen(PolygeistPasses.h.inc -gen-pass-decls -name Conversion) +add_public_tablegen_target(MLIRPolygeistConversionPassIncGen) diff --git a/include/mlir/Conversion/PolygeistPasses.h b/include/mlir/Conversion/PolygeistPasses.h new file mode 100644 index 000000000000..7f1ac7d3a298 --- /dev/null +++ b/include/mlir/Conversion/PolygeistPasses.h @@ -0,0 +1,25 @@ +#ifndef MLIR_CONVERSION_POLYGEISTPASSES_H_ +#define MLIR_CONVERSION_POLYGEISTPASSES_H_ + +#include "mlir/Conversion/LLVMCommon/LoweringOptions.h" +#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" +#include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Transforms/GreedyPatternRewriteDriver.h" +#include + +namespace mlir { +class PatternRewriter; +class RewritePatternSet; +class DominanceInfo; +namespace polygeist { +std::unique_ptr createConvertPolygeistToLLVMPass(); +std::unique_ptr +createConvertPolygeistToLLVMPass(const LowerToLLVMOptions &options, + bool useCStyleMemRef, bool onlyGpuModules, + std::string gpuTarget); +} // namespace polygeist +} // namespace mlir + +#endif // POLYGEISTPASSES_H_ diff --git a/include/mlir/Conversion/PolygeistPasses.td b/include/mlir/Conversion/PolygeistPasses.td new file mode 100644 index 000000000000..32b5224bd3e4 --- /dev/null +++ b/include/mlir/Conversion/PolygeistPasses.td @@ -0,0 +1,64 @@ +#ifndef MLIR_CONVERSION_POLYGEISTPASSES +#define MLIR_CONVERSION_POLYGEISTPASSES + +include "mlir/Pass/PassBase.td" +include "mlir/Rewrite/PassUtil.td" + +def ConvertPolygeistToLLVM : Pass<"convert-polygeist-to-llvm", "mlir::ModuleOp"> { + let summary = "Convert scalar and vector operations from the Standard to the " + "LLVM dialect"; + let description = [{ + Convert standard operations into the LLVM IR dialect operations. + + #### Input invariant + + - operations including: arithmetic on integers and floats, constants, + direct calls, returns and branches; + - no `tensor` types; + - all `vector` are one-dimensional; + - all blocks are reachable by following the successors of the first basic + block; + + If other operations are present and their results are required by the LLVM + IR dialect operations, the pass will fail. Any LLVM IR operations or types + already present in the IR will be kept as is. + + #### Output IR + + Functions converted to LLVM IR. Function arguments types are converted + one-to-one. Function results are converted one-to-one and, in case more than + 1 value is returned, packed into an LLVM IR struct type. Function calls and + returns are updated accordingly. Block argument types are updated to use + LLVM IR types. + }]; + let constructor = "mlir::polygeist::createConvertPolygeistToLLVMPass()"; + let dependentDialects = [ + "polygeist::PolygeistDialect", + "func::FuncDialect", + "LLVM::LLVMDialect", + "memref::MemRefDialect", + "gpu::GPUDialect", + "arith::ArithDialect", + "cf::ControlFlowDialect", + "scf::SCFDialect", + ]; + let options = [ + Option<"useBarePtrCallConv", "use-bare-ptr-memref-call-conv", "bool", + /*default=*/"false", + "Replace FuncOp's MemRef arguments with bare pointers to the MemRef " + "element types">, + Option<"indexBitwidth", "index-bitwidth", "unsigned", + /*default=kDeriveIndexBitwidthFromDataLayout*/"0", + "Bitwidth of the index type, 0 to use size of machine word">, + Option<"dataLayout", "data-layout", "std::string", + /*default=*/"\"\"", + "String description (LLVM format) of the data layout that is " + "expected on the produced module">, + Option<"useCStyleMemRef", "use-c-style-memref", "bool", + /*default=*/"true", + "Use C-style nested-array lowering of memref instead of " + "the default MLIR descriptor structure"> + ]; +} + +#endif diff --git a/include/mlir/Dialect/CMakeLists.txt b/include/mlir/Dialect/CMakeLists.txt new file mode 100644 index 000000000000..104c82fab0f1 --- /dev/null +++ b/include/mlir/Dialect/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(Polygeist) diff --git a/include/mlir/Dialect/Polygeist/CMakeLists.txt b/include/mlir/Dialect/Polygeist/CMakeLists.txt new file mode 100644 index 000000000000..9f57627c321f --- /dev/null +++ b/include/mlir/Dialect/Polygeist/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(IR) +add_subdirectory(Transforms) diff --git a/include/mlir/Dialect/Polygeist/IR/CMakeLists.txt b/include/mlir/Dialect/Polygeist/IR/CMakeLists.txt new file mode 100644 index 000000000000..f0404deebca5 --- /dev/null +++ b/include/mlir/Dialect/Polygeist/IR/CMakeLists.txt @@ -0,0 +1 @@ +add_mlir_dialect(PolygeistOps polygeist) diff --git a/include/polygeist/Dialect.h b/include/mlir/Dialect/Polygeist/IR/PolygeistDialect.h similarity index 87% rename from include/polygeist/Dialect.h rename to include/mlir/Dialect/Polygeist/IR/PolygeistDialect.h index 04e7eb741366..3f7b1fded06f 100644 --- a/include/polygeist/Dialect.h +++ b/include/mlir/Dialect/Polygeist/IR/PolygeistDialect.h @@ -11,6 +11,6 @@ #include "mlir/IR/Dialect.h" -#include "polygeist/PolygeistOpsDialect.h.inc" +#include "mlir/Dialect/Polygeist/IR/PolygeistOpsDialect.h.inc" #endif // BFV_BFVDIALECT_H diff --git a/include/polygeist/Dialect.td b/include/mlir/Dialect/Polygeist/IR/PolygeistDialect.td similarity index 100% rename from include/polygeist/Dialect.td rename to include/mlir/Dialect/Polygeist/IR/PolygeistDialect.td diff --git a/include/polygeist/Ops.h b/include/mlir/Dialect/Polygeist/IR/PolygeistOps.h similarity index 99% rename from include/polygeist/Ops.h rename to include/mlir/Dialect/Polygeist/IR/PolygeistOps.h index cae361d2f399..c06716a5674c 100644 --- a/include/polygeist/Ops.h +++ b/include/mlir/Dialect/Polygeist/IR/PolygeistOps.h @@ -23,7 +23,7 @@ #include "llvm/Support/CommandLine.h" #define GET_OP_CLASSES -#include "polygeist/PolygeistOps.h.inc" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h.inc" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/SCF/IR/SCF.h" diff --git a/include/polygeist/PolygeistOps.td b/include/mlir/Dialect/Polygeist/IR/PolygeistOps.td similarity index 99% rename from include/polygeist/PolygeistOps.td rename to include/mlir/Dialect/Polygeist/IR/PolygeistOps.td index 159f6c144947..05e6f94b3a7a 100644 --- a/include/polygeist/PolygeistOps.td +++ b/include/mlir/Dialect/Polygeist/IR/PolygeistOps.td @@ -9,12 +9,12 @@ #ifndef POLYGEIST_OPS #define POLYGEIST_OPS -include "Dialect.td" include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Interfaces/ViewLikeInterface.td" include "mlir/Interfaces/ControlFlowInterfaces.td" include "mlir/IR/SymbolInterfaces.td" +include "mlir/Dialect/Polygeist/IR/PolygeistDialect.td" include "mlir/Dialect/LLVMIR/LLVMOpBase.td" include "mlir/Dialect/LLVMIR/LLVMInterfaces.td" diff --git a/include/polygeist/Passes/CMakeLists.txt b/include/mlir/Dialect/Polygeist/Transforms/CMakeLists.txt similarity index 70% rename from include/polygeist/Passes/CMakeLists.txt rename to include/mlir/Dialect/Polygeist/Transforms/CMakeLists.txt index da545fc5c853..ca9fe3ef8849 100644 --- a/include/polygeist/Passes/CMakeLists.txt +++ b/include/mlir/Dialect/Polygeist/Transforms/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Passes.td) -mlir_tablegen(Passes.h.inc -gen-pass-decls -name polygeist) +mlir_tablegen(Passes.h.inc -gen-pass-decls -name Polygeist) add_public_tablegen_target(MLIRPolygeistPassIncGen) add_mlir_doc(Passes PolygeistPasses ./ -gen-pass-doc) diff --git a/include/polygeist/Passes/Passes.h b/include/mlir/Dialect/Polygeist/Transforms/Passes.h similarity index 97% rename from include/polygeist/Passes/Passes.h rename to include/mlir/Dialect/Polygeist/Transforms/Passes.h index 5f3777441d1a..8d897b86cb94 100644 --- a/include/polygeist/Passes/Passes.h +++ b/include/mlir/Dialect/Polygeist/Transforms/Passes.h @@ -4,9 +4,9 @@ #include "mlir/Conversion/LLVMCommon/LoweringOptions.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Dialect.h" #include enum PolygeistAlternativesMode { PAM_Static, PAM_PGO_Profile, PAM_PGO_Opt }; @@ -128,7 +128,7 @@ class LLVMDialect; } #define GEN_PASS_REGISTRATION -#include "polygeist/Passes/Passes.h.inc" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc" } // end namespace mlir diff --git a/include/polygeist/Passes/Passes.td b/include/mlir/Dialect/Polygeist/Transforms/Passes.td similarity index 100% rename from include/polygeist/Passes/Passes.td rename to include/mlir/Dialect/Polygeist/Transforms/Passes.td diff --git a/include/polygeist/Passes/Utils.h b/include/mlir/Dialect/Polygeist/Transforms/Utils.h similarity index 100% rename from include/polygeist/Passes/Utils.h rename to include/mlir/Dialect/Polygeist/Transforms/Utils.h diff --git a/include/polygeist/BarrierUtils.h b/include/mlir/Dialect/Polygeist/Utils/BarrierUtils.h similarity index 98% rename from include/polygeist/BarrierUtils.h rename to include/mlir/Dialect/Polygeist/Utils/BarrierUtils.h index 5620b91b8574..7f154f3ad3d8 100644 --- a/include/polygeist/BarrierUtils.h +++ b/include/mlir/Dialect/Polygeist/Utils/BarrierUtils.h @@ -14,9 +14,9 @@ #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/Block.h" -#include "polygeist/Ops.h" #include "llvm/ADT/SetVector.h" std::pair diff --git a/lib/polygeist/Passes/RuntimeWrapperUtils.h b/include/mlir/Dialect/Polygeist/Utils/RuntimeWrapperUtils.h similarity index 100% rename from lib/polygeist/Passes/RuntimeWrapperUtils.h rename to include/mlir/Dialect/Polygeist/Utils/RuntimeWrapperUtils.h diff --git a/include/polygeist/CMakeLists.txt b/include/polygeist/CMakeLists.txt deleted file mode 100644 index efcf93f70329..000000000000 --- a/include/polygeist/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_mlir_dialect(PolygeistOps polygeist) -add_mlir_doc(PolygeistDialect -gen-dialect-doc PolygeistDialect Polygeist/) -add_mlir_doc(PolygeistOps -gen-op-doc PolygeistOps Polygeist/) - -add_subdirectory(Passes) \ No newline at end of file diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index da66b9bf293f..2d634281f750 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1 +1,3 @@ -add_subdirectory(polygeist) +add_subdirectory(Conversion) +add_subdirectory(ExecutionEngine) +add_subdirectory(Dialect) diff --git a/lib/Conversion/CMakeLists.txt b/lib/Conversion/CMakeLists.txt new file mode 100644 index 000000000000..a9fe8d3cd46a --- /dev/null +++ b/lib/Conversion/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(PolygeistToLLVM) diff --git a/lib/Conversion/PolygeistToLLVM/CMakeLists.txt b/lib/Conversion/PolygeistToLLVM/CMakeLists.txt new file mode 100644 index 000000000000..69f9ed734a74 --- /dev/null +++ b/lib/Conversion/PolygeistToLLVM/CMakeLists.txt @@ -0,0 +1,30 @@ +add_mlir_conversion_library(MLIRPolygeistToLLVM + PolygeistToLLVM.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/PolygeistToLLVM + + DEPENDS + MLIRPolygeistConversionPassIncGen + + LINK_COMPONENTS + Core + + LINK_LIBS PUBLIC + MLIRAsyncDialect + MLIRFuncTransforms + MLIRMathToLLVM + MLIROpenMPToLLVM + MLIRPass + MLIRPolygeistDialect + MLIRPolygeistTransforms + MLIRSCFToControlFlow + MLIRVectorToLLVM +) + +target_compile_definitions(obj.MLIRPolygeistToLLVM + PRIVATE + POLYGEIST_PGO_DEFAULT_DATA_DIR="${POLYGEIST_PGO_DEFAULT_DATA_DIR}" + POLYGEIST_PGO_ALTERNATIVE_ENV_VAR="${POLYGEIST_PGO_ALTERNATIVE_ENV_VAR}" + POLYGEIST_PGO_DATA_DIR_ENV_VAR="${POLYGEIST_PGO_DATA_DIR_ENV_VAR}" +) diff --git a/lib/Conversion/PolygeistToLLVM/PassDetails.h b/lib/Conversion/PolygeistToLLVM/PassDetails.h new file mode 100644 index 000000000000..95def3f56711 --- /dev/null +++ b/lib/Conversion/PolygeistToLLVM/PassDetails.h @@ -0,0 +1,39 @@ +//===- PassDetails.h - polygeist pass class details ----------------*- C++ +//-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Stuff shared between the different polygeist passes. +// +//===----------------------------------------------------------------------===// + +// clang-tidy seems to expect the absolute path in the header guard on some +// systems, so just disable it. +// NOLINTNEXTLINE(llvm-header-guard) +#ifndef CONVERSION_POLYGEIST_PASSDETAILS_H +#define CONVERSION_POLYGEIST_PASSDETAILS_H + +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { +class FunctionOpInterface; +// Forward declaration from Dialect.h +template +void registerDialect(DialectRegistry ®istry); +namespace polygeist { + +class PolygeistDialect; + +#define GEN_PASS_CLASSES +#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc" + +} // namespace polygeist +} // namespace mlir + +#endif // DIALECT_POLYGEIST_TRANSFORMS_PASSDETAILS_H diff --git a/lib/polygeist/Passes/ConvertPolygeistToLLVM.cpp b/lib/Conversion/PolygeistToLLVM/PolygeistToLLVM.cpp similarity index 99% rename from lib/polygeist/Passes/ConvertPolygeistToLLVM.cpp rename to lib/Conversion/PolygeistToLLVM/PolygeistToLLVM.cpp index f1d6a6ffa3ac..1306331d6f0b 100644 --- a/lib/polygeist/Passes/ConvertPolygeistToLLVM.cpp +++ b/lib/Conversion/PolygeistToLLVM/PolygeistToLLVM.cpp @@ -9,6 +9,7 @@ // This file implements a pass to lower gpu kernels in NVVM/gpu dialects into // a generic parallel for representation //===----------------------------------------------------------------------===// + #include "PassDetails.h" #include "mlir/../../lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp" @@ -39,6 +40,7 @@ #include "mlir/Dialect/LLVMIR/ROCDLDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/IRMapping.h" @@ -46,7 +48,6 @@ #include "mlir/Target/LLVMIR/Import.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/RegionUtils.h" -#include "polygeist/Passes/Passes.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FormatVariadic.h" @@ -57,7 +58,7 @@ #include #include -#include "RuntimeWrapperUtils.h" +#include "mlir/Dialect/Polygeist/Utils/RuntimeWrapperUtils.h" extern llvm::cl::opt EmitROCM; diff --git a/lib/Dialect/CMakeLists.txt b/lib/Dialect/CMakeLists.txt new file mode 100644 index 000000000000..104c82fab0f1 --- /dev/null +++ b/lib/Dialect/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(Polygeist) diff --git a/lib/Dialect/Polygeist/CMakeLists.txt b/lib/Dialect/Polygeist/CMakeLists.txt new file mode 100644 index 000000000000..30d527e6f162 --- /dev/null +++ b/lib/Dialect/Polygeist/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(IR) +add_subdirectory(Transforms) +#add_subdirectory(Analysis) +#add_subdirectory(Utils) diff --git a/lib/polygeist/CMakeLists.txt b/lib/Dialect/Polygeist/IR/CMakeLists.txt similarity index 53% rename from lib/polygeist/CMakeLists.txt rename to lib/Dialect/Polygeist/IR/CMakeLists.txt index 88aea0de4dd5..92ad5d7a662c 100644 --- a/lib/polygeist/CMakeLists.txt +++ b/lib/Dialect/Polygeist/IR/CMakeLists.txt @@ -1,9 +1,9 @@ -add_mlir_dialect_library(MLIRPolygeist -Dialect.cpp -Ops.cpp +add_mlir_dialect_library(MLIRPolygeistDialect +PolygeistDialect.cpp +PolygeistOps.cpp ADDITIONAL_HEADER_DIRS -${PROJECT_SOURCE_DIR}/include/polygeist +${PROJECT_SOURCE_DIR}/include/mlir/Dialect/Polygeist DEPENDS MLIRPolygeistOpsIncGen @@ -17,5 +17,3 @@ MLIRAffineDialect MLIRSupport MLIRSCFTransforms ) -add_subdirectory(Passes) -add_subdirectory(ExecutionEngine) diff --git a/lib/polygeist/Dialect.cpp b/lib/Dialect/Polygeist/IR/PolygeistDialect.cpp similarity index 76% rename from lib/polygeist/Dialect.cpp rename to lib/Dialect/Polygeist/IR/PolygeistDialect.cpp index 692a3dfbc87b..7439fe61e237 100644 --- a/lib/polygeist/Dialect.cpp +++ b/lib/Dialect/Polygeist/IR/PolygeistDialect.cpp @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "polygeist/Dialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" #include "mlir/IR/DialectImplementation.h" -#include "polygeist/Ops.h" using namespace mlir; using namespace mlir::polygeist; @@ -20,8 +20,8 @@ using namespace mlir::polygeist; void PolygeistDialect::initialize() { addOperations< #define GET_OP_LIST -#include "polygeist/PolygeistOps.cpp.inc" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.cpp.inc" >(); } -#include "polygeist/PolygeistOpsDialect.cpp.inc" +#include "mlir/Dialect/Polygeist/IR/PolygeistOpsDialect.cpp.inc" diff --git a/lib/polygeist/Ops.cpp b/lib/Dialect/Polygeist/IR/PolygeistOps.cpp similarity index 99% rename from lib/polygeist/Ops.cpp rename to lib/Dialect/Polygeist/IR/PolygeistOps.cpp index 926891b40611..448f5828ac0e 100644 --- a/lib/polygeist/Ops.cpp +++ b/lib/Dialect/Polygeist/IR/PolygeistOps.cpp @@ -6,18 +6,18 @@ // //===----------------------------------------------------------------------===// -#include "polygeist/Ops.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/LLVMIR/LLVMTypes.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" #include "mlir/IR/AffineExpr.h" #include "mlir/IR/Builders.h" #include "mlir/IR/OpImplementation.h" #include "mlir/Interfaces/SideEffectInterfaces.h" -#include "polygeist/Dialect.h" #define GET_OP_CLASSES -#include "polygeist/PolygeistOps.cpp.inc" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.cpp.inc" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Arith/Utils/Utils.h" diff --git a/lib/polygeist/Passes/AffineCFG.cpp b/lib/Dialect/Polygeist/Transforms/AffineCFG.cpp similarity index 99% rename from lib/polygeist/Passes/AffineCFG.cpp rename to lib/Dialect/Polygeist/Transforms/AffineCFG.cpp index 1e5ca001fd9d..1369d5382c07 100644 --- a/lib/polygeist/Passes/AffineCFG.cpp +++ b/lib/Dialect/Polygeist/Transforms/AffineCFG.cpp @@ -4,6 +4,7 @@ #include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" @@ -11,7 +12,6 @@ #include "mlir/IR/Matchers.h" #include "mlir/IR/PatternMatch.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Passes/Passes.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Support/Debug.h" #include diff --git a/lib/polygeist/Passes/AffineReduction.cpp b/lib/Dialect/Polygeist/Transforms/AffineReduction.cpp similarity index 99% rename from lib/polygeist/Passes/AffineReduction.cpp rename to lib/Dialect/Polygeist/Transforms/AffineReduction.cpp index eaabf22a6e56..0a1e3e665e4a 100644 --- a/lib/polygeist/Passes/AffineReduction.cpp +++ b/lib/Dialect/Polygeist/Transforms/AffineReduction.cpp @@ -3,9 +3,9 @@ #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/IR/Dominance.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Passes/Passes.h" #include "llvm/Support/Debug.h" using namespace mlir; diff --git a/lib/polygeist/Passes/BarrierRemovalContinuation.cpp b/lib/Dialect/Polygeist/Transforms/BarrierRemovalContinuation.cpp similarity index 99% rename from lib/polygeist/Passes/BarrierRemovalContinuation.cpp rename to lib/Dialect/Polygeist/Transforms/BarrierRemovalContinuation.cpp index 4bc785a9bce3..2510e421974e 100644 --- a/lib/polygeist/Passes/BarrierRemovalContinuation.cpp +++ b/lib/Dialect/Polygeist/Transforms/BarrierRemovalContinuation.cpp @@ -18,6 +18,8 @@ #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" +#include "mlir/Dialect/Polygeist/Utils/BarrierUtils.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/BuiltinOps.h" @@ -27,8 +29,6 @@ #include "mlir/IR/PatternMatch.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" -#include "polygeist/BarrierUtils.h" -#include "polygeist/Passes/Passes.h" using namespace mlir; using namespace mlir::arith; diff --git a/lib/polygeist/Passes/CMakeLists.txt b/lib/Dialect/Polygeist/Transforms/CMakeLists.txt similarity index 98% rename from lib/polygeist/Passes/CMakeLists.txt rename to lib/Dialect/Polygeist/Transforms/CMakeLists.txt index 5d6164ef53d7..d48e78f190f1 100644 --- a/lib/polygeist/Passes/CMakeLists.txt +++ b/lib/Dialect/Polygeist/Transforms/CMakeLists.txt @@ -13,7 +13,6 @@ add_mlir_dialect_library(MLIRPolygeistTransforms RaiseToAffine.cpp ParallelLower.cpp TrivialUse.cpp - ConvertPolygeistToLLVM.cpp InnerSerialization.cpp ForBreakToWhile.cpp ConvertParallelToGPU.cpp @@ -47,7 +46,7 @@ add_mlir_dialect_library(MLIRPolygeistTransforms MLIRMemRefDialect MLIRNVVMDialect MLIRPass - MLIRPolygeist + MLIRPolygeistDialect MLIRSideEffectInterfaces MLIRSCFToControlFlow MLIRTargetLLVMIRImport diff --git a/lib/polygeist/Passes/CanonicalizeFor.cpp b/lib/Dialect/Polygeist/Transforms/CanonicalizeFor.cpp similarity index 99% rename from lib/polygeist/Passes/CanonicalizeFor.cpp rename to lib/Dialect/Polygeist/Transforms/CanonicalizeFor.cpp index d04487d4689f..0292940d4c74 100644 --- a/lib/polygeist/Passes/CanonicalizeFor.cpp +++ b/lib/Dialect/Polygeist/Transforms/CanonicalizeFor.cpp @@ -3,13 +3,13 @@ #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/Math/IR/Math.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" #include "mlir/IR/Matchers.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Passes/Passes.h" using namespace mlir; using namespace mlir::scf; diff --git a/lib/polygeist/Passes/CollectKernelStatistics.cpp b/lib/Dialect/Polygeist/Transforms/CollectKernelStatistics.cpp similarity index 99% rename from lib/polygeist/Passes/CollectKernelStatistics.cpp rename to lib/Dialect/Polygeist/Transforms/CollectKernelStatistics.cpp index 176f2b311cc0..d44c94acef20 100644 --- a/lib/polygeist/Passes/CollectKernelStatistics.cpp +++ b/lib/Dialect/Polygeist/Transforms/CollectKernelStatistics.cpp @@ -13,7 +13,7 @@ #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/Passes.h" -#include "polygeist/Passes/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" using namespace mlir; using namespace polygeist; diff --git a/lib/polygeist/Passes/ConvertParallelToGPU.cpp b/lib/Dialect/Polygeist/Transforms/ConvertParallelToGPU.cpp similarity index 99% rename from lib/polygeist/Passes/ConvertParallelToGPU.cpp rename to lib/Dialect/Polygeist/Transforms/ConvertParallelToGPU.cpp index 866282215e50..47967820e110 100644 --- a/lib/polygeist/Passes/ConvertParallelToGPU.cpp +++ b/lib/Dialect/Polygeist/Transforms/ConvertParallelToGPU.cpp @@ -14,6 +14,10 @@ #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/LLVMIR/NVVMDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Utils.h" +#include "mlir/Dialect/Polygeist/Utils/BarrierUtils.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" @@ -27,10 +31,6 @@ #include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/RegionUtils.h" -#include "polygeist/BarrierUtils.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" -#include "polygeist/Passes/Utils.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallSet.h" @@ -38,7 +38,7 @@ #include #include "ParallelLoopUnroll.h" -#include "RuntimeWrapperUtils.h" +#include "mlir/Dialect/Polygeist/Utils/RuntimeWrapperUtils.h" static llvm::cl::opt GPUKernelEmitCoarsenedAlternatives( "gpu-kernel-emit-coarsened-alternatives", llvm::cl::init(false), diff --git a/lib/polygeist/Passes/ConvertToOpaquePtr.cpp b/lib/Dialect/Polygeist/Transforms/ConvertToOpaquePtr.cpp similarity index 99% rename from lib/polygeist/Passes/ConvertToOpaquePtr.cpp rename to lib/Dialect/Polygeist/Transforms/ConvertToOpaquePtr.cpp index 12a2698f2334..214f57d8863f 100644 --- a/lib/polygeist/Passes/ConvertToOpaquePtr.cpp +++ b/lib/Dialect/Polygeist/Transforms/ConvertToOpaquePtr.cpp @@ -12,8 +12,8 @@ #include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Passes/Passes.h" -#include "polygeist/Passes/Utils.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Utils.h" #include "llvm/ADT/STLExtras.h" #include diff --git a/lib/polygeist/Passes/ForBreakToWhile.cpp b/lib/Dialect/Polygeist/Transforms/ForBreakToWhile.cpp similarity index 99% rename from lib/polygeist/Passes/ForBreakToWhile.cpp rename to lib/Dialect/Polygeist/Transforms/ForBreakToWhile.cpp index 8d3927dcc16d..2ade1f55e1fc 100644 --- a/lib/polygeist/Passes/ForBreakToWhile.cpp +++ b/lib/Dialect/Polygeist/Transforms/ForBreakToWhile.cpp @@ -17,7 +17,7 @@ #include "mlir/IR/MLIRContext.h" #include "mlir/IR/PatternMatch.h" -#include "polygeist/Passes/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" using namespace mlir; using namespace mlir::scf; diff --git a/lib/polygeist/Passes/InnerSerialization.cpp b/lib/Dialect/Polygeist/Transforms/InnerSerialization.cpp similarity index 98% rename from lib/polygeist/Passes/InnerSerialization.cpp rename to lib/Dialect/Polygeist/Transforms/InnerSerialization.cpp index 120edb3f78fb..3d4800e63069 100644 --- a/lib/polygeist/Passes/InnerSerialization.cpp +++ b/lib/Dialect/Polygeist/Transforms/InnerSerialization.cpp @@ -4,13 +4,13 @@ #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" #include "mlir/IR/Matchers.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Passes/Passes.h" using namespace mlir; using namespace mlir::func; diff --git a/lib/polygeist/Passes/LoopRestructure.cpp b/lib/Dialect/Polygeist/Transforms/LoopRestructure.cpp similarity index 99% rename from lib/polygeist/Passes/LoopRestructure.cpp rename to lib/Dialect/Polygeist/Transforms/LoopRestructure.cpp index c9cb3abc8243..e3e71231b41c 100644 --- a/lib/polygeist/Passes/LoopRestructure.cpp +++ b/lib/Dialect/Polygeist/Transforms/LoopRestructure.cpp @@ -12,6 +12,8 @@ #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/Builders.h" #include "mlir/IR/Dominance.h" @@ -19,8 +21,6 @@ #include "mlir/IR/RegionGraphTraits.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/Passes.h" -#include "polygeist/Dialect.h" -#include "polygeist/Passes/Passes.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/Dominators.h" #include "llvm/Support/Debug.h" diff --git a/lib/polygeist/Passes/LowerAlternatives.cpp b/lib/Dialect/Polygeist/Transforms/LowerAlternatives.cpp similarity index 96% rename from lib/polygeist/Passes/LowerAlternatives.cpp rename to lib/Dialect/Polygeist/Transforms/LowerAlternatives.cpp index e6265bba02b4..bcb051aa302b 100644 --- a/lib/polygeist/Passes/LowerAlternatives.cpp +++ b/lib/Dialect/Polygeist/Transforms/LowerAlternatives.cpp @@ -2,9 +2,9 @@ #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/Func/Transforms/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/RegionUtils.h" -#include "polygeist/Passes/Passes.h" #include #include @@ -12,9 +12,9 @@ #include #include -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" -#include "polygeist/Passes/Utils.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Utils.h" using namespace mlir; using namespace polygeist; diff --git a/lib/polygeist/Passes/OpenMPOpt.cpp b/lib/Dialect/Polygeist/Transforms/OpenMPOpt.cpp similarity index 98% rename from lib/polygeist/Passes/OpenMPOpt.cpp rename to lib/Dialect/Polygeist/Transforms/OpenMPOpt.cpp index 569a3f8cc816..99252c6bd001 100644 --- a/lib/polygeist/Passes/OpenMPOpt.cpp +++ b/lib/Dialect/Polygeist/Transforms/OpenMPOpt.cpp @@ -4,14 +4,14 @@ #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" #include "mlir/IR/Matchers.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" using namespace mlir; using namespace mlir::func; diff --git a/lib/polygeist/Passes/ParallelLICM.cpp b/lib/Dialect/Polygeist/Transforms/ParallelLICM.cpp similarity index 99% rename from lib/polygeist/Passes/ParallelLICM.cpp rename to lib/Dialect/Polygeist/Transforms/ParallelLICM.cpp index 2fce2676954a..ff0c756bac16 100644 --- a/lib/polygeist/Passes/ParallelLICM.cpp +++ b/lib/Dialect/Polygeist/Transforms/ParallelLICM.cpp @@ -5,6 +5,7 @@ #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/Dominance.h" @@ -13,7 +14,6 @@ #include "mlir/IR/Matchers.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/LoopInvariantCodeMotionUtils.h" -#include "polygeist/Passes/Passes.h" #define DEBUG_TYPE "parallel-licm" diff --git a/lib/polygeist/Passes/ParallelLoopDistribute.cpp b/lib/Dialect/Polygeist/Transforms/ParallelLoopDistribute.cpp similarity index 99% rename from lib/polygeist/Passes/ParallelLoopDistribute.cpp rename to lib/Dialect/Polygeist/Transforms/ParallelLoopDistribute.cpp index e31345aa20bf..96937df6b338 100644 --- a/lib/polygeist/Passes/ParallelLoopDistribute.cpp +++ b/lib/Dialect/Polygeist/Transforms/ParallelLoopDistribute.cpp @@ -13,6 +13,10 @@ #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Utils.h" +#include "mlir/Dialect/Polygeist/Utils/BarrierUtils.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/Dominance.h" @@ -23,10 +27,6 @@ #include "mlir/Support/LLVM.h" #include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/BarrierUtils.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" -#include "polygeist/Passes/Utils.h" #include #include diff --git a/lib/polygeist/Passes/ParallelLoopUnroll.cpp b/lib/Dialect/Polygeist/Transforms/ParallelLoopUnroll.cpp similarity index 99% rename from lib/polygeist/Passes/ParallelLoopUnroll.cpp rename to lib/Dialect/Polygeist/Transforms/ParallelLoopUnroll.cpp index 4d37f255454f..c90cc8a30e2c 100644 --- a/lib/polygeist/Passes/ParallelLoopUnroll.cpp +++ b/lib/Dialect/Polygeist/Transforms/ParallelLoopUnroll.cpp @@ -14,6 +14,8 @@ #include "mlir/Analysis/SliceAnalysis.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Utils/Utils.h" #include "mlir/IR/BuiltinOps.h" @@ -22,8 +24,6 @@ #include "mlir/IR/Value.h" #include "mlir/Support/MathExtras.h" #include "mlir/Transforms/RegionUtils.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" diff --git a/lib/polygeist/Passes/ParallelLoopUnroll.h b/lib/Dialect/Polygeist/Transforms/ParallelLoopUnroll.h similarity index 100% rename from lib/polygeist/Passes/ParallelLoopUnroll.h rename to lib/Dialect/Polygeist/Transforms/ParallelLoopUnroll.h diff --git a/lib/polygeist/Passes/ParallelLower.cpp b/lib/Dialect/Polygeist/Transforms/ParallelLower.cpp similarity index 99% rename from lib/polygeist/Passes/ParallelLower.cpp rename to lib/Dialect/Polygeist/Transforms/ParallelLower.cpp index 449e29a9adb4..863b77269553 100644 --- a/lib/polygeist/Passes/ParallelLower.cpp +++ b/lib/Dialect/Polygeist/Transforms/ParallelLower.cpp @@ -23,13 +23,13 @@ #include "mlir/Dialect/LLVMIR/NVVMDialect.h" #include "mlir/Dialect/LLVMIR/ROCDLDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/OpDefinition.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/Passes.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringRef.h" @@ -38,7 +38,7 @@ #include #include -#include "RuntimeWrapperUtils.h" +#include "mlir/Dialect/Polygeist/Utils/RuntimeWrapperUtils.h" #define DEBUG_TYPE "parallel-lower-opt" diff --git a/lib/polygeist/Passes/PassDetails.h b/lib/Dialect/Polygeist/Transforms/PassDetails.h similarity index 87% rename from lib/polygeist/Passes/PassDetails.h rename to lib/Dialect/Polygeist/Transforms/PassDetails.h index b61dc810465c..57eec5e184cf 100644 --- a/lib/polygeist/Passes/PassDetails.h +++ b/lib/Dialect/Polygeist/Transforms/PassDetails.h @@ -17,9 +17,9 @@ #ifndef DIALECT_POLYGEIST_TRANSFORMS_PASSDETAILS_H #define DIALECT_POLYGEIST_TRANSFORMS_PASSDETAILS_H +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Pass/Pass.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" namespace mlir { class FunctionOpInterface; @@ -31,7 +31,7 @@ namespace polygeist { class PolygeistDialect; #define GEN_PASS_CLASSES -#include "polygeist/Passes/Passes.h.inc" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc" } // namespace polygeist } // namespace mlir diff --git a/lib/polygeist/Passes/PolygeistCanonicalize.cpp b/lib/Dialect/Polygeist/Transforms/PolygeistCanonicalize.cpp similarity index 96% rename from lib/polygeist/Passes/PolygeistCanonicalize.cpp rename to lib/Dialect/Polygeist/Transforms/PolygeistCanonicalize.cpp index 1d12aaf2ad00..c728a4cee73b 100644 --- a/lib/polygeist/Passes/PolygeistCanonicalize.cpp +++ b/lib/Dialect/Polygeist/Transforms/PolygeistCanonicalize.cpp @@ -24,12 +24,12 @@ #include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Dialect.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" using namespace mlir; using namespace polygeist; diff --git a/lib/polygeist/Passes/PolygeistMem2Reg.cpp b/lib/Dialect/Polygeist/Transforms/PolygeistMem2Reg.cpp similarity index 99% rename from lib/polygeist/Passes/PolygeistMem2Reg.cpp rename to lib/Dialect/Polygeist/Transforms/PolygeistMem2Reg.cpp index fb3027ad5dbd..0257ae8eba1f 100644 --- a/lib/polygeist/Passes/PolygeistMem2Reg.cpp +++ b/lib/Dialect/Polygeist/Transforms/PolygeistMem2Reg.cpp @@ -21,11 +21,11 @@ #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/LLVMIR/NVVMDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/IR/Dominance.h" #include "mlir/Support/LLVM.h" #include "mlir/Transforms/Passes.h" -#include "polygeist/Passes/Passes.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include @@ -33,8 +33,8 @@ #include #include -#include "polygeist/Ops.h" -#include "polygeist/Passes/Utils.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Utils.h" #define DEBUG_TYPE "mem2reg" diff --git a/lib/polygeist/Passes/RaiseToAffine.cpp b/lib/Dialect/Polygeist/Transforms/RaiseToAffine.cpp similarity index 99% rename from lib/polygeist/Passes/RaiseToAffine.cpp rename to lib/Dialect/Polygeist/Transforms/RaiseToAffine.cpp index bcdb9fcef1dd..ec31527ed0a2 100644 --- a/lib/polygeist/Passes/RaiseToAffine.cpp +++ b/lib/Dialect/Polygeist/Transforms/RaiseToAffine.cpp @@ -4,13 +4,13 @@ #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" #include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "polygeist/Passes/Passes.h" #include "llvm/Support/Debug.h" #define DEBUG_TYPE "raise-to-affine" diff --git a/lib/polygeist/Passes/SerializeToCubin.cpp b/lib/Dialect/Polygeist/Transforms/SerializeToCubin.cpp similarity index 100% rename from lib/polygeist/Passes/SerializeToCubin.cpp rename to lib/Dialect/Polygeist/Transforms/SerializeToCubin.cpp diff --git a/lib/polygeist/Passes/SerializeToHsaco.cpp b/lib/Dialect/Polygeist/Transforms/SerializeToHsaco.cpp similarity index 99% rename from lib/polygeist/Passes/SerializeToHsaco.cpp rename to lib/Dialect/Polygeist/Transforms/SerializeToHsaco.cpp index 84fd34473ac2..db47609c24c7 100644 --- a/lib/polygeist/Passes/SerializeToHsaco.cpp +++ b/lib/Dialect/Polygeist/Transforms/SerializeToHsaco.cpp @@ -1,5 +1,5 @@ #include "mlir/Dialect/GPU/Transforms/Passes.h" -#include "polygeist/Passes/Passes.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #if POLYGEIST_ENABLE_ROCM #include "mlir/Analysis/DataLayoutAnalysis.h" diff --git a/lib/polygeist/Passes/TrivialUse.cpp b/lib/Dialect/Polygeist/Transforms/TrivialUse.cpp similarity index 91% rename from lib/polygeist/Passes/TrivialUse.cpp rename to lib/Dialect/Polygeist/Transforms/TrivialUse.cpp index d607bf2c07b9..f3efbb438fa1 100644 --- a/lib/polygeist/Passes/TrivialUse.cpp +++ b/lib/Dialect/Polygeist/Transforms/TrivialUse.cpp @@ -11,8 +11,8 @@ //===----------------------------------------------------------------------===// #include "PassDetails.h" -#include "polygeist/Ops.h" -#include "polygeist/Passes/Passes.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #define DEBUG_TYPE "trivial-use" diff --git a/lib/polygeist/ExecutionEngine/CMakeLists.txt b/lib/ExecutionEngine/CMakeLists.txt similarity index 100% rename from lib/polygeist/ExecutionEngine/CMakeLists.txt rename to lib/ExecutionEngine/CMakeLists.txt diff --git a/lib/polygeist/ExecutionEngine/CudaRuntimeWrappers.cpp b/lib/ExecutionEngine/CudaRuntimeWrappers.cpp similarity index 100% rename from lib/polygeist/ExecutionEngine/CudaRuntimeWrappers.cpp rename to lib/ExecutionEngine/CudaRuntimeWrappers.cpp diff --git a/lib/polygeist/ExecutionEngine/PGORuntime.h b/lib/ExecutionEngine/PGORuntime.h similarity index 100% rename from lib/polygeist/ExecutionEngine/PGORuntime.h rename to lib/ExecutionEngine/PGORuntime.h diff --git a/lib/polygeist/ExecutionEngine/RocmRuntimeWrappers.cpp b/lib/ExecutionEngine/RocmRuntimeWrappers.cpp similarity index 100% rename from lib/polygeist/ExecutionEngine/RocmRuntimeWrappers.cpp rename to lib/ExecutionEngine/RocmRuntimeWrappers.cpp diff --git a/llvm-project b/llvm-project index 26eb4285b56e..836ca5bbf7d6 160000 --- a/llvm-project +++ b/llvm-project @@ -1 +1 @@ -Subproject commit 26eb4285b56edd8c897642078d91f16ff0fd3472 +Subproject commit 836ca5bbf7d6366df7c35ec9d1f235b1ebc9744e diff --git a/tools/cgeist/CMakeLists.txt b/tools/cgeist/CMakeLists.txt index 1b0e7434c773..8327949fda8e 100644 --- a/tools/cgeist/CMakeLists.txt +++ b/tools/cgeist/CMakeLists.txt @@ -58,7 +58,8 @@ target_include_directories(cgeist PRIVATE target_compile_definitions(cgeist PUBLIC -DLLVM_OBJ_ROOT="${LLVM_BINARY_DIR}") target_link_libraries(cgeist PRIVATE MLIRSCFTransforms - MLIRPolygeist + MLIRPolygeistDialect + MLIRPolygeistToLLVM MLIRSupport MLIRIR diff --git a/tools/cgeist/Lib/ValueCategory.cc b/tools/cgeist/Lib/ValueCategory.cc index 3817a64ee14f..31d6c5fcedb9 100644 --- a/tools/cgeist/Lib/ValueCategory.cc +++ b/tools/cgeist/Lib/ValueCategory.cc @@ -11,9 +11,9 @@ #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" #include "mlir/IR/OpDefinition.h" #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" -#include "polygeist/Ops.h" using namespace mlir; using namespace mlir::arith; diff --git a/tools/cgeist/Lib/clang-mlir.h b/tools/cgeist/Lib/clang-mlir.h index 117bcf162557..5da674b38361 100644 --- a/tools/cgeist/Lib/clang-mlir.h +++ b/tools/cgeist/Lib/clang-mlir.h @@ -18,13 +18,13 @@ #include "mlir/Dialect/LLVMIR/NVVMDialect.h" #include "mlir/Dialect/Math/IR/Math.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h" #include "mlir/IR/Builders.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/OpDefinition.h" #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/TypeFromLLVM.h" #include "mlir/Target/LLVMIR/TypeToLLVM.h" -#include "polygeist/Ops.h" #include "pragmaHandler.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/StmtVisitor.h" diff --git a/tools/cgeist/driver.cc b/tools/cgeist/driver.cc index 2eee90d1a54c..f16ffac23883 100644 --- a/tools/cgeist/driver.cc +++ b/tools/cgeist/driver.cc @@ -72,8 +72,8 @@ #include "llvm/Transforms/IPO/Internalize.h" #include -#include "polygeist/Dialect.h" -#include "polygeist/Passes/Passes.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" #include diff --git a/tools/polygeist-opt/CMakeLists.txt b/tools/polygeist-opt/CMakeLists.txt index ccfebd421d81..c8fea25eaa55 100644 --- a/tools/polygeist-opt/CMakeLists.txt +++ b/tools/polygeist-opt/CMakeLists.txt @@ -4,7 +4,8 @@ set(LIBS ${dialect_libs} ${conversion_libs} MLIROptLib - MLIRPolygeist + MLIRPolygeistDialect + MLIRPolygeistToLLVM MLIRPolygeistTransforms MLIRFuncAllExtensions ) diff --git a/tools/polygeist-opt/polygeist-opt.cpp b/tools/polygeist-opt/polygeist-opt.cpp index 95fe1b1fc4a4..21467366bffd 100644 --- a/tools/polygeist-opt/polygeist-opt.cpp +++ b/tools/polygeist-opt/polygeist-opt.cpp @@ -30,8 +30,8 @@ #include "mlir/Tools/mlir-opt/MlirOptMain.h" #include "mlir/Transforms/Passes.h" -#include "polygeist/Dialect.h" -#include "polygeist/Passes/Passes.h" +#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h" +#include "mlir/Dialect/Polygeist/Transforms/Passes.h" using namespace mlir; @@ -62,7 +62,7 @@ int main(int argc, char **argv) { registry.insert(); registry.insert(); - mlir::registerpolygeistPasses(); + mlir::registerPolygeistPasses(); mlir::func::registerInlinerExtension(registry); // Register the standard passes we want.