Skip to content

Commit b349b3b

Browse files
committed
Move files around
1 parent 5bb6194 commit b349b3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+257
-87
lines changed

include/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
add_subdirectory(polygeist)
1+
add_subdirectory(mlir)

include/mlir/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(Conversion)
2+
add_subdirectory(Dialect)
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set(LLVM_TARGET_DEFINITIONS PolygeistPasses.td)
2+
mlir_tablegen(PolygeistPasses.h.inc -gen-pass-decls -name Conversion)
3+
add_public_tablegen_target(MLIRPolygeistConversionPassIncGen)
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef MLIR_CONVERSION_POLYGEISTPASSES_H_
2+
#define MLIR_CONVERSION_POLYGEISTPASSES_H_
3+
4+
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
5+
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
6+
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
7+
#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h"
8+
#include "mlir/Pass/Pass.h"
9+
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
10+
#include <memory>
11+
12+
namespace mlir {
13+
class PatternRewriter;
14+
class RewritePatternSet;
15+
class DominanceInfo;
16+
namespace polygeist {
17+
std::unique_ptr<Pass> createConvertPolygeistToLLVMPass();
18+
std::unique_ptr<Pass>
19+
createConvertPolygeistToLLVMPass(const LowerToLLVMOptions &options,
20+
bool useCStyleMemRef, bool onlyGpuModules,
21+
std::string gpuTarget);
22+
} // namespace polygeist
23+
} // namespace mlir
24+
25+
#endif // POLYGEISTPASSES_H_
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#ifndef MLIR_CONVERSION_POLYGEISTPASSES
2+
#define MLIR_CONVERSION_POLYGEISTPASSES
3+
4+
include "mlir/Pass/PassBase.td"
5+
include "mlir/Rewrite/PassUtil.td"
6+
7+
def ConvertPolygeistToLLVM : Pass<"convert-polygeist-to-llvm", "mlir::ModuleOp"> {
8+
let summary = "Convert scalar and vector operations from the Standard to the "
9+
"LLVM dialect";
10+
let description = [{
11+
Convert standard operations into the LLVM IR dialect operations.
12+
13+
#### Input invariant
14+
15+
- operations including: arithmetic on integers and floats, constants,
16+
direct calls, returns and branches;
17+
- no `tensor` types;
18+
- all `vector` are one-dimensional;
19+
- all blocks are reachable by following the successors of the first basic
20+
block;
21+
22+
If other operations are present and their results are required by the LLVM
23+
IR dialect operations, the pass will fail. Any LLVM IR operations or types
24+
already present in the IR will be kept as is.
25+
26+
#### Output IR
27+
28+
Functions converted to LLVM IR. Function arguments types are converted
29+
one-to-one. Function results are converted one-to-one and, in case more than
30+
1 value is returned, packed into an LLVM IR struct type. Function calls and
31+
returns are updated accordingly. Block argument types are updated to use
32+
LLVM IR types.
33+
}];
34+
let constructor = "mlir::polygeist::createConvertPolygeistToLLVMPass()";
35+
let dependentDialects = [
36+
"polygeist::PolygeistDialect",
37+
"func::FuncDialect",
38+
"LLVM::LLVMDialect",
39+
"memref::MemRefDialect",
40+
"gpu::GPUDialect",
41+
"arith::ArithDialect",
42+
"cf::ControlFlowDialect",
43+
"scf::SCFDialect",
44+
];
45+
let options = [
46+
Option<"useBarePtrCallConv", "use-bare-ptr-memref-call-conv", "bool",
47+
/*default=*/"false",
48+
"Replace FuncOp's MemRef arguments with bare pointers to the MemRef "
49+
"element types">,
50+
Option<"indexBitwidth", "index-bitwidth", "unsigned",
51+
/*default=kDeriveIndexBitwidthFromDataLayout*/"0",
52+
"Bitwidth of the index type, 0 to use size of machine word">,
53+
Option<"dataLayout", "data-layout", "std::string",
54+
/*default=*/"\"\"",
55+
"String description (LLVM format) of the data layout that is "
56+
"expected on the produced module">,
57+
Option<"useCStyleMemRef", "use-c-style-memref", "bool",
58+
/*default=*/"true",
59+
"Use C-style nested-array lowering of memref instead of "
60+
"the default MLIR descriptor structure">
61+
];
62+
}
63+
64+
#endif

include/mlir/Dialect/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(Polygeist)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(IR)
2+
add_subdirectory(Transforms)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_mlir_dialect(PolygeistOps polygeist)

include/polygeist/Dialect.h include/mlir/Dialect/Polygeist/IR/PolygeistDialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
#include "mlir/IR/Dialect.h"
1313

14-
#include "polygeist/PolygeistOpsDialect.h.inc"
14+
#include "mlir/Dialect/Polygeist/IR/PolygeistOpsDialect.h.inc"
1515

1616
#endif // BFV_BFVDIALECT_H

include/polygeist/Ops.h include/mlir/Dialect/Polygeist/IR/PolygeistOps.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "llvm/Support/CommandLine.h"
2424

2525
#define GET_OP_CLASSES
26-
#include "polygeist/PolygeistOps.h.inc"
26+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h.inc"
2727

2828
#include "mlir/Dialect/Affine/IR/AffineOps.h"
2929
#include "mlir/Dialect/SCF/IR/SCF.h"

include/polygeist/PolygeistOps.td include/mlir/Dialect/Polygeist/IR/PolygeistOps.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#ifndef POLYGEIST_OPS
1010
#define POLYGEIST_OPS
1111

12-
include "Dialect.td"
1312
include "mlir/Interfaces/SideEffectInterfaces.td"
1413
include "mlir/Interfaces/ViewLikeInterface.td"
1514
include "mlir/Interfaces/ControlFlowInterfaces.td"
1615
include "mlir/IR/SymbolInterfaces.td"
1716

17+
include "mlir/Dialect/Polygeist/IR/PolygeistDialect.td"
1818
include "mlir/Dialect/LLVMIR/LLVMOpBase.td"
1919
include "mlir/Dialect/LLVMIR/LLVMInterfaces.td"
2020

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(LLVM_TARGET_DEFINITIONS Passes.td)
2-
mlir_tablegen(Passes.h.inc -gen-pass-decls -name polygeist)
2+
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Polygeist)
33
add_public_tablegen_target(MLIRPolygeistPassIncGen)
44

55
add_mlir_doc(Passes PolygeistPasses ./ -gen-pass-doc)

include/polygeist/Passes/Passes.h include/mlir/Dialect/Polygeist/Transforms/Passes.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
55
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
66
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
7+
#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h"
78
#include "mlir/Pass/Pass.h"
89
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
9-
#include "polygeist/Dialect.h"
1010
#include <memory>
1111

1212
enum PolygeistAlternativesMode { PAM_Static, PAM_PGO_Profile, PAM_PGO_Opt };
@@ -128,7 +128,7 @@ class LLVMDialect;
128128
}
129129

130130
#define GEN_PASS_REGISTRATION
131-
#include "polygeist/Passes/Passes.h.inc"
131+
#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc"
132132

133133
} // end namespace mlir
134134

include/polygeist/BarrierUtils.h include/mlir/Dialect/Polygeist/Utils/BarrierUtils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#include "mlir/Dialect/Func/IR/FuncOps.h"
1515
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
1616
#include "mlir/Dialect/MemRef/IR/MemRef.h"
17+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h"
1718
#include "mlir/Dialect/SCF/IR/SCF.h"
1819
#include "mlir/IR/Block.h"
19-
#include "polygeist/Ops.h"
2020
#include "llvm/ADT/SetVector.h"
2121

2222
std::pair<mlir::Block *, mlir::Block::iterator>

include/polygeist/CMakeLists.txt

-5
This file was deleted.

lib/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
add_subdirectory(polygeist)
1+
add_subdirectory(Conversion)
2+
add_subdirectory(ExecutionEngine)
3+
add_subdirectory(Dialect)

lib/Conversion/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(PolygeistToLLVM)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
add_mlir_conversion_library(MLIRPolygeistToLLVM
2+
PolygeistToLLVM.cpp
3+
4+
ADDITIONAL_HEADER_DIRS
5+
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/PolygeistToLLVM
6+
7+
DEPENDS
8+
MLIRPolygeistConversionPassIncGen
9+
10+
LINK_COMPONENTS
11+
Core
12+
13+
LINK_LIBS PUBLIC
14+
MLIRAsyncDialect
15+
MLIRFuncTransforms
16+
MLIRMathToLLVM
17+
MLIROpenMPToLLVM
18+
MLIRPass
19+
MLIRPolygeistDialect
20+
MLIRPolygeistTransforms
21+
MLIRSCFToControlFlow
22+
MLIRVectorToLLVM
23+
)
24+
25+
target_compile_definitions(obj.MLIRPolygeistToLLVM
26+
PRIVATE
27+
POLYGEIST_PGO_DEFAULT_DATA_DIR="${POLYGEIST_PGO_DEFAULT_DATA_DIR}"
28+
POLYGEIST_PGO_ALTERNATIVE_ENV_VAR="${POLYGEIST_PGO_ALTERNATIVE_ENV_VAR}"
29+
POLYGEIST_PGO_DATA_DIR_ENV_VAR="${POLYGEIST_PGO_DATA_DIR_ENV_VAR}"
30+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//===- PassDetails.h - polygeist pass class details ----------------*- C++
2+
//-*-===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
//
10+
// Stuff shared between the different polygeist passes.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
// clang-tidy seems to expect the absolute path in the header guard on some
15+
// systems, so just disable it.
16+
// NOLINTNEXTLINE(llvm-header-guard)
17+
#ifndef CONVERSION_POLYGEIST_PASSDETAILS_H
18+
#define CONVERSION_POLYGEIST_PASSDETAILS_H
19+
20+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h"
21+
#include "mlir/Dialect/Polygeist/Transforms/Passes.h"
22+
#include "mlir/Pass/Pass.h"
23+
24+
namespace mlir {
25+
class FunctionOpInterface;
26+
// Forward declaration from Dialect.h
27+
template <typename ConcreteDialect>
28+
void registerDialect(DialectRegistry &registry);
29+
namespace polygeist {
30+
31+
class PolygeistDialect;
32+
33+
#define GEN_PASS_CLASSES
34+
#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc"
35+
36+
} // namespace polygeist
37+
} // namespace mlir
38+
39+
#endif // DIALECT_POLYGEIST_TRANSFORMS_PASSDETAILS_H

lib/polygeist/Passes/ConvertPolygeistToLLVM.cpp lib/Conversion/PolygeistToLLVM/PolygeistToLLVM.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// This file implements a pass to lower gpu kernels in NVVM/gpu dialects into
1010
// a generic parallel for representation
1111
//===----------------------------------------------------------------------===//
12+
1213
#include "PassDetails.h"
1314

1415
#include "mlir/../../lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp"
@@ -39,14 +40,14 @@
3940
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
4041
#include "mlir/Dialect/MemRef/IR/MemRef.h"
4142
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
43+
#include "mlir/Dialect/Polygeist/Transforms/Passes.h"
4244
#include "mlir/Dialect/SCF/IR/SCF.h"
4345
#include "mlir/IR/BuiltinOps.h"
4446
#include "mlir/IR/IRMapping.h"
4547
#include "mlir/IR/ImplicitLocOpBuilder.h"
4648
#include "mlir/Target/LLVMIR/Import.h"
4749
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
4850
#include "mlir/Transforms/RegionUtils.h"
49-
#include "polygeist/Passes/Passes.h"
5051
#include "llvm/Support/CommandLine.h"
5152
#include "llvm/Support/Debug.h"
5253
#include "llvm/Support/FormatVariadic.h"
@@ -57,7 +58,7 @@
5758
#include <map>
5859
#include <numeric>
5960

60-
#include "RuntimeWrapperUtils.h"
61+
#include "mlir/Dialect/Polygeist/Utils/RuntimeWrapperUtils.h"
6162

6263
extern llvm::cl::opt<bool> EmitROCM;
6364

lib/Dialect/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(Polygeist)

lib/Dialect/Polygeist/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_subdirectory(IR)
2+
add_subdirectory(Transforms)
3+
#add_subdirectory(Analysis)
4+
#add_subdirectory(Utils)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
add_mlir_dialect_library(MLIRPolygeist
2-
Dialect.cpp
3-
Ops.cpp
1+
add_mlir_dialect_library(MLIRPolygeistDialect
2+
PolygeistDialect.cpp
3+
PolygeistOps.cpp
44

55
ADDITIONAL_HEADER_DIRS
6-
${PROJECT_SOURCE_DIR}/include/polygeist
6+
${PROJECT_SOURCE_DIR}/include/mlir/Dialect/Polygeist
77

88
DEPENDS
99
MLIRPolygeistOpsIncGen
@@ -17,5 +17,3 @@ MLIRAffineDialect
1717
MLIRSupport
1818
MLIRSCFTransforms
1919
)
20-
add_subdirectory(Passes)
21-
add_subdirectory(ExecutionEngine)

lib/polygeist/Dialect.cpp lib/Dialect/Polygeist/IR/PolygeistDialect.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "polygeist/Dialect.h"
9+
#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h"
10+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h"
1011
#include "mlir/IR/DialectImplementation.h"
11-
#include "polygeist/Ops.h"
1212

1313
using namespace mlir;
1414
using namespace mlir::polygeist;
@@ -20,8 +20,8 @@ using namespace mlir::polygeist;
2020
void PolygeistDialect::initialize() {
2121
addOperations<
2222
#define GET_OP_LIST
23-
#include "polygeist/PolygeistOps.cpp.inc"
23+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.cpp.inc"
2424
>();
2525
}
2626

27-
#include "polygeist/PolygeistOpsDialect.cpp.inc"
27+
#include "mlir/Dialect/Polygeist/IR/PolygeistOpsDialect.cpp.inc"

lib/polygeist/Ops.cpp lib/Dialect/Polygeist/IR/PolygeistOps.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "polygeist/Ops.h"
9+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h"
1010
#include "mlir/Dialect/Arith/IR/Arith.h"
1111
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
1212
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
13+
#include "mlir/Dialect/Polygeist/IR/PolygeistDialect.h"
1314
#include "mlir/IR/AffineExpr.h"
1415
#include "mlir/IR/Builders.h"
1516
#include "mlir/IR/OpImplementation.h"
1617
#include "mlir/Interfaces/SideEffectInterfaces.h"
17-
#include "polygeist/Dialect.h"
1818

1919
#define GET_OP_CLASSES
20-
#include "polygeist/PolygeistOps.cpp.inc"
20+
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.cpp.inc"
2121

2222
#include "mlir/Dialect/Affine/IR/AffineOps.h"
2323
#include "mlir/Dialect/Arith/Utils/Utils.h"

lib/polygeist/Passes/AffineCFG.cpp lib/Dialect/Polygeist/Transforms/AffineCFG.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#include "mlir/Dialect/Affine/Passes.h"
55
#include "mlir/Dialect/Arith/IR/Arith.h"
66
#include "mlir/Dialect/MemRef/IR/MemRef.h"
7+
#include "mlir/Dialect/Polygeist/Transforms/Passes.h"
78
#include "mlir/Dialect/SCF/IR/SCF.h"
89
#include "mlir/IR/Dominance.h"
910
#include "mlir/IR/IRMapping.h"
1011
#include "mlir/IR/IntegerSet.h"
1112
#include "mlir/IR/Matchers.h"
1213
#include "mlir/IR/PatternMatch.h"
1314
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
14-
#include "polygeist/Passes/Passes.h"
1515
#include "llvm/ADT/SmallSet.h"
1616
#include "llvm/Support/Debug.h"
1717
#include <deque>

lib/polygeist/Passes/AffineReduction.cpp lib/Dialect/Polygeist/Transforms/AffineReduction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#include "mlir/Dialect/Affine/IR/AffineOps.h"
44
#include "mlir/Dialect/Affine/Passes.h"
55
#include "mlir/Dialect/MemRef/IR/MemRef.h"
6+
#include "mlir/Dialect/Polygeist/Transforms/Passes.h"
67
#include "mlir/IR/Dominance.h"
78
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
8-
#include "polygeist/Passes/Passes.h"
99
#include "llvm/Support/Debug.h"
1010

1111
using namespace mlir;

0 commit comments

Comments
 (0)