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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
add_subdirectory(polygeist)
1+
add_subdirectory(mlir)

include/mlir/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(Conversion)
2+
add_subdirectory(Dialect)
Lines changed: 3 additions & 0 deletions
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)
Lines changed: 25 additions & 0 deletions
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_
Lines changed: 64 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(Polygeist)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(IR)
2+
add_subdirectory(Transforms)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_mlir_dialect(PolygeistOps polygeist)

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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)