Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanradanov committed Jun 21, 2024
1 parent 7183562 commit 9599f30
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 40 deletions.
8 changes: 4 additions & 4 deletions lib/polygeist/Passes/PolyhedralOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using namespace polygeist;
static llvm::cl::opt<std::string>
UsePolyhedralOptimizerCl("use-polyhedral-optimizer",
llvm::cl::init("pluto"),
llvm::cl::desc("pluto or tadashi"));
llvm::cl::desc("pluto or islexternal"));

namespace {

Expand Down Expand Up @@ -212,8 +212,8 @@ void PolyhedralOptPass::runOnOperation() {
return;
}
mlir::func::FuncOp g = nullptr;
if (UsePolyhedralOptimizerCl == "tadashi") {
g = polymer::tadashiTransform(f, b);
if (UsePolyhedralOptimizerCl == "islexternal") {
g = polymer::islexternalTransform(f, b);
} else if (UsePolyhedralOptimizerCl == "pluto") {
g = polymer::plutoTransform(f, b, "");
}
Expand All @@ -236,7 +236,7 @@ void PolyhedralOptPass::runOnOperation() {

// Conversion from ISL emits scf so we need to lower the statements before
// inlining them
if (UsePolyhedralOptimizerCl == "tadashi" && failed(lowerAffine.run(m))) {
if (UsePolyhedralOptimizerCl == "islexternal" && failed(lowerAffine.run(m))) {
signalPassFailure();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/const_for_if_then_else.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[] : (-d0 + 50 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/for_if_then_else.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/for_if_then_else_store.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/for_step.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/matmul.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi
#map = affine_map<()[s0] -> (s0)>
module {
func.func @gemm(%alpha: f32, %beta: f32,
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/matmul_if.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/matmul_par.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi
#map = affine_map<()[s0] -> (s0)>
module {
func.func @gemm(%alpha: f32, %beta: f32,
Expand Down
7 changes: 6 additions & 1 deletion test/polygeist-opt/isl/multi_scop.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: [ "%polymer_enabled" == "" ] || polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s

// RUN: mkdir -p %t/schedules
// RUN: mkdir -p %t/accesses
// RUN: [ "%polymer_enabled" == "" ] || polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal --islexternal-dump-schedules=%t/schedules --islexternal-dump-accesses=%t/accesses -debug-only=islexternal-opt,islscop %s
// RUN: [ "%polymer_enabled" == "" ] || polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal --islexternal-import-schedules=%t/schedules -debug-only=islexternal-opt,islscop %s

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/onlyconst.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/test1.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i64, dense<64> : vector<2xi32>>, #dlti.dl_entry<f80, dense<128> : vector<2xi32>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi32>>, #dlti.dl_entry<i8, dense<8> : vector<2xi32>>, #dlti.dl_entry<i1, dense<8> : vector<2xi32>>, #dlti.dl_entry<i32, dense<32> : vector<2xi32>>, #dlti.dl_entry<i16, dense<16> : vector<2xi32>>, #dlti.dl_entry<f16, dense<16> : vector<2xi32>>, #dlti.dl_entry<!llvm.ptr<270>, dense<32> : vector<4xi32>>, #dlti.dl_entry<f128, dense<128> : vector<2xi32>>, #dlti.dl_entry<f64, dense<64> : vector<2xi32>>, #dlti.dl_entry<!llvm.ptr<272>, dense<64> : vector<4xi32>>, #dlti.dl_entry<!llvm.ptr<271>, dense<32> : vector<4xi32>>, #dlti.dl_entry<"dlti.stack_alignment", 128 : i32>, #dlti.dl_entry<"dlti.endianness", "little">>, llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu", "polygeist.target-cpu" = "x86-64", "polygeist.target-features" = "+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87", "polygeist.tune-cpu" = "generic"} {
func.func @f(%arg0: i64, %arg1: memref<?x?xf64>) attributes {llvm.linkage = #llvm.linkage<external>} {
%0 = arith.index_cast %arg0 : i64 to index
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/test2.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i64, dense<64> : vector<2xi32>>, #dlti.dl_entry<f80, dense<128> : vector<2xi32>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi32>>, #dlti.dl_entry<i8, dense<8> : vector<2xi32>>, #dlti.dl_entry<i1, dense<8> : vector<2xi32>>, #dlti.dl_entry<i32, dense<32> : vector<2xi32>>, #dlti.dl_entry<i16, dense<16> : vector<2xi32>>, #dlti.dl_entry<f16, dense<16> : vector<2xi32>>, #dlti.dl_entry<!llvm.ptr<270>, dense<32> : vector<4xi32>>, #dlti.dl_entry<f128, dense<128> : vector<2xi32>>, #dlti.dl_entry<f64, dense<64> : vector<2xi32>>, #dlti.dl_entry<!llvm.ptr<272>, dense<64> : vector<4xi32>>, #dlti.dl_entry<!llvm.ptr<271>, dense<32> : vector<4xi32>>, #dlti.dl_entry<"dlti.stack_alignment", 128 : i32>, #dlti.dl_entry<"dlti.endianness", "little">>, llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu", "polygeist.target-cpu" = "x86-64", "polygeist.target-features" = "+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87", "polygeist.tune-cpu" = "generic"} {
func.func @f(%arg0: i64, %arg1: memref<?x?xf64>) attributes {llvm.linkage = #llvm.linkage<external>} {
%0 = arith.index_cast %arg0 : i64 to index
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/veccopy.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
2 changes: 1 addition & 1 deletion test/polygeist-opt/isl/vecinit.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=tadashi -debug-only=tadashi-opt,islscop %s; fi
// RUN: if [ %polymer_enabled == 1 ]; then polygeist-opt --polyhedral-opt --use-polyhedral-optimizer=islexternal -debug-only=islexternal-opt,islscop %s; fi

#map = affine_map<()[s0] -> (s0)>
#set1 = affine_set<(d0)[s0] : (-d0 + s0 -1 >= 0)>
Expand Down
4 changes: 2 additions & 2 deletions tools/polymer/include/polymer/Support/PolymerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include "mlir/Dialect/Func/IR/FuncOps.h"

namespace polymer {
mlir::func::FuncOp tadashiTransform(mlir::func::FuncOp f,
mlir::OpBuilder &rewriter);
mlir::func::FuncOp islexternalTransform(mlir::func::FuncOp f,
mlir::OpBuilder &rewriter);
mlir::func::FuncOp plutoTransform(mlir::func::FuncOp f,
mlir::OpBuilder &rewriter,
std::string dumpClastAfterPluto,
Expand Down
2 changes: 1 addition & 1 deletion tools/polymer/lib/Support/IslScop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void IslScop::dumpAccesses(llvm::raw_ostream &os) {
}
}
void IslScop::dumpSchedule(llvm::raw_ostream &os) {
LLVM_DEBUG(llvm::errs() << "Dumping tadashi\n");
LLVM_DEBUG(llvm::errs() << "Dumping islexternal\n");
LLVM_DEBUG(llvm::errs() << "Schedule:\n\n");
LLVM_DEBUG(isl_schedule_dump(schedule));
LLVM_DEBUG(llvm::errs() << "\n");
Expand Down
2 changes: 1 addition & 1 deletion tools/polymer/lib/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(POLYGEIST_POLYMER_ENABLE_PLUTO)
)
elseif(POLYGEIST_POLYMER_ENABLE_ISL)
set(POLYMER_TRANSFORM_SRC
TadashiTransform.cc
IslExternalTransform.cc
)
endif()

Expand Down
3 changes: 2 additions & 1 deletion tools/polymer/lib/Transforms/ExtractISL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,8 @@ static void dump_isl(osl_scop_p scop, PlutoOptions *options) {
}

namespace polymer {
mlir::func::FuncOp tadashiTransform(mlir::func::FuncOp f, OpBuilder &rewriter) {
mlir::func::FuncOp islexternalTransform(mlir::func::FuncOp f,
OpBuilder &rewriter) {
LLVM_DEBUG(dbgs() << "Pluto transforming: \n");
LLVM_DEBUG(f.dump());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,43 @@ using namespace polymer;

using llvm::dbgs;

#define DEBUG_TYPE "tadashi-opt"
#define DEBUG_TYPE "islexternal-opt"

static llvm::cl::opt<std::string>
ClTadashiDumpSchedule("tadashi-dump-schedule",
llvm::cl::desc("Directory to dump ISL schedules to"));
static llvm::cl::opt<std::string> ClIslExternalDumpSchedules(
"islexternal-dump-schedules",
llvm::cl::desc("Directory to dump ISL schedules to"));

static llvm::cl::opt<std::string>
ClTadashiDumpAccesses("tadashi-dump-accesses",
llvm::cl::desc("Directory to dump ISL accesses to"));
static llvm::cl::opt<std::string> ClIslExternalDumpAccesses(
"islexternal-dump-accesses",
llvm::cl::desc("Directory to dump ISL accesses to"));

static llvm::cl::opt<std::string> ClTadashiImportSchedule(
"tadashi-import-schedule",
static llvm::cl::opt<std::string> ClIslExternalImportSchedules(
"islexternal-import-schedules",
llvm::cl::desc("Directory to import ISL schedules from"));

namespace polymer {

mlir::func::FuncOp tadashiTransform(mlir::func::FuncOp f, OpBuilder &rewriter) {
LLVM_DEBUG(dbgs() << "Tadashi transforming: \n");
mlir::func::FuncOp islexternalTransform(mlir::func::FuncOp f,
OpBuilder &rewriter) {
LLVM_DEBUG(dbgs() << "IslExternal transforming: \n");
LLVM_DEBUG(f.dump());

StringRef funcName = f.getName();

std::unique_ptr<IslScop> scop = createIslFromFuncOp(f);

std::error_code EC;
if (ClTadashiDumpSchedule.getNumOccurrences() > 0) {
std::string fname = (ClTadashiDumpSchedule + "/" + funcName).str();
if (ClIslExternalDumpSchedules.getNumOccurrences() > 0) {
std::string fname = (ClIslExternalDumpSchedules + "/" + funcName).str();
llvm::raw_fd_ostream ScheduleOut(fname, EC);
if (EC) {
llvm::errs() << "Can't open " << fname << "\n";
abort();
}
scop->dumpSchedule(ScheduleOut);
}
if (ClTadashiDumpAccesses.getNumOccurrences() > 0) {
std::string fname = (ClTadashiDumpAccesses + "/" + funcName).str();
if (ClIslExternalDumpAccesses.getNumOccurrences() > 0) {
std::string fname = (ClIslExternalDumpAccesses + "/" + funcName).str();
llvm::raw_fd_ostream AccessesOut(fname, EC);
if (EC) {
llvm::errs() << "Can't open " << fname << "\n";
Expand All @@ -82,11 +83,11 @@ mlir::func::FuncOp tadashiTransform(mlir::func::FuncOp f, OpBuilder &rewriter) {
}

isl_schedule *newSchedule;
if (ClTadashiImportSchedule.getNumOccurrences() == 0) {
if (ClIslExternalImportSchedules.getNumOccurrences() == 0) {
// Do a round trip
newSchedule = isl_schedule_copy(scop->getSchedule());
} else {
std::string fname = (ClTadashiImportSchedule + "/" + funcName).str();
std::string fname = (ClIslExternalImportSchedules + "/" + funcName).str();
auto ScheduleIn = llvm::MemoryBuffer::getFileAsStream(fname);
if (std::error_code EC = ScheduleIn.getError()) {
llvm::errs() << "Can't open " << fname << "\n";
Expand Down
3 changes: 2 additions & 1 deletion tools/polymer/lib/Transforms/PlutoTransform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ std::unique_ptr<mlir::Pass> createDedupIndexCastPass() {
std::unique_ptr<mlir::Pass> createPlutoParallelizePass() {
return std::make_unique<PlutoParallelizePass>();
}
mlir::func::FuncOp tadashiTransform(mlir::func::FuncOp f, OpBuilder &rewriter) {
mlir::func::FuncOp islexternalTransform(mlir::func::FuncOp f,
OpBuilder &rewriter) {
llvm_unreachable("not compiled with isl suport");
}
} // namespace polymer

0 comments on commit 9599f30

Please sign in to comment.