-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bb6194
commit b349b3b
Showing
65 changed files
with
257 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
add_subdirectory(polygeist) | ||
add_subdirectory(mlir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_subdirectory(Conversion) | ||
add_subdirectory(Dialect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <memory> | ||
|
||
namespace mlir { | ||
class PatternRewriter; | ||
class RewritePatternSet; | ||
class DominanceInfo; | ||
namespace polygeist { | ||
std::unique_ptr<Pass> createConvertPolygeistToLLVMPass(); | ||
std::unique_ptr<Pass> | ||
createConvertPolygeistToLLVMPass(const LowerToLLVMOptions &options, | ||
bool useCStyleMemRef, bool onlyGpuModules, | ||
std::string gpuTarget); | ||
} // namespace polygeist | ||
} // namespace mlir | ||
|
||
#endif // POLYGEISTPASSES_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(Polygeist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_subdirectory(IR) | ||
add_subdirectory(Transforms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_mlir_dialect(PolygeistOps polygeist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
include/polygeist/Passes/CMakeLists.txt → ...alect/Polygeist/Transforms/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
add_subdirectory(polygeist) | ||
add_subdirectory(Conversion) | ||
add_subdirectory(ExecutionEngine) | ||
add_subdirectory(Dialect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(PolygeistToLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <typename ConcreteDialect> | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(Polygeist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_subdirectory(IR) | ||
add_subdirectory(Transforms) | ||
#add_subdirectory(Analysis) | ||
#add_subdirectory(Utils) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.