Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Raise to linalg #404

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/polygeist/Ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ bool mayAlias(mlir::MemoryEffects::EffectInstance a,

bool mayAlias(mlir::MemoryEffects::EffectInstance a, mlir::Value b);

bool mayAlias(mlir::Value v, mlir::Value v2);

extern llvm::cl::opt<bool> BarrierOpt;

template <bool NotTopLevel = false>
Expand Down
5 changes: 5 additions & 0 deletions include/polygeist/Passes/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ std::unique_ptr<Pass> replaceAffineCFGPass();
std::unique_ptr<Pass> createOpenMPOptPass();
std::unique_ptr<Pass> createCanonicalizeForPass();
std::unique_ptr<Pass> createRaiseSCFToAffinePass();
std::unique_ptr<Pass> createRaiseAffineToLinalgPass();
std::unique_ptr<Pass> createCPUifyPass(StringRef method = "");
std::unique_ptr<Pass> createBarrierRemovalContinuation();
std::unique_ptr<Pass> detectReductionPass();
Expand Down Expand Up @@ -123,6 +124,10 @@ namespace affine {
class AffineDialect;
}

namespace linalg {
class LinalgDialect;
}

namespace LLVM {
class LLVMDialect;
}
Expand Down
9 changes: 9 additions & 0 deletions include/polygeist/Passes/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ def SCFRaiseToAffine : Pass<"raise-scf-to-affine"> {
];
}

def AffineRaiseToLinalg : Pass<"raise-affine-to-linalg"> {
let summary = "Raise affine to linalg";
let constructor = "mlir::polygeist::createRaiseAffineToLinalgPass()";
let dependentDialects = [
"affine::AffineDialect",
"linalg::LinalgDialect",
];
}

def SCFCanonicalizeFor : Pass<"canonicalize-scf-for"> {
let summary = "Run some additional canonicalization for scf::for";
let constructor = "mlir::polygeist::createCanonicalizeForPass()";
Expand Down
3 changes: 2 additions & 1 deletion lib/polygeist/Ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ bool isStackAlloca(Value v) {
v.getDefiningOp<memref::AllocOp>() ||
v.getDefiningOp<LLVM::AllocaOp>();
}
static bool mayAlias(Value v, Value v2) {

bool mayAlias(Value v, Value v2) {
v = getBase(v);
v2 = getBase(v2);
if (v == v2)
Expand Down
1 change: 1 addition & 0 deletions lib/polygeist/Passes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_mlir_dialect_library(MLIRPolygeistTransforms
OpenMPOpt.cpp
BarrierRemovalContinuation.cpp
RaiseToAffine.cpp
RaiseToLinalg.cpp
ParallelLower.cpp
TrivialUse.cpp
ConvertPolygeistToLLVM.cpp
Expand Down