Skip to content

MDRange iteration order transformation #49

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

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a911162
mdrange: Initial skeleton
cwpearson Dec 19, 2024
aca4a69
mdrange: missing header
cwpearson Dec 19, 2024
6322fbe
mdrange: remove unneeded defs
cwpearson Dec 19, 2024
bf2e025
mdrange: no-op test of no-op pass
cwpearson Dec 19, 2024
c1f6e48
find some relevant stuff in the module
cwpearson Jan 14, 2025
c0f7fac
Symbolic reuse distance and additional utilities
cwpearson Jan 16, 2025
ba6217a
Walk all possible parallel loop configurations
cwpearson Jan 17, 2025
b9d6325
primitive monte-carlo
cwpearson Jan 17, 2025
c98872f
remove unused walk_selections
cwpearson Jan 17, 2025
9ceabce
Add Sub and Div (useful for trip counts)
cwpearson Jan 17, 2025
0a33688
Fix div symbol
cwpearson Jan 17, 2025
9780455
expressions for parallel trip counts
cwpearson Jan 23, 2025
02273e6
Incorporate trip count into cost model
cwpearson Jan 23, 2025
641a3c9
use llvm::DenseMap for ParallelTripCounts
cwpearson Jan 24, 2025
da5942a
use llvm::DenseMap for MemrefInductionCosts
cwpearson Jan 24, 2025
5090616
use llvm::DenseMap in ParallelConfig
cwpearson Jan 24, 2025
cf6c5e7
remove unused VecMap
cwpearson Jan 24, 2025
4801b95
better stack scoping
cwpearson Jan 24, 2025
9f938d0
factor out memref cost generation
cwpearson Jan 24, 2025
e5f777a
replace loop with DenseMap::insert
cwpearson Jan 24, 2025
856f904
Improve names & comments, SmallVector for parallel op stack
cwpearson Jan 24, 2025
187a0c3
clone and replace module ops
cwpearson Jan 24, 2025
fa9a22b
fix redundant scf.reduce, permute scf parallel
cwpearson Jan 24, 2025
e878b59
add nested parallel test
cwpearson Jan 24, 2025
60fc12e
Improve naming, use SmallVector in ParallelConfig
cwpearson Jan 24, 2025
67196be
Fix walk_configurations
cwpearson Jan 24, 2025
757ab30
helper fn for iterating over nested ops
cwpearson Jan 24, 2025
1ac37d7
remove redundant modeling calls
cwpearson Jan 24, 2025
ed1602e
incorporate enclosing parallel trip count
cwpearson May 15, 2025
403dd7d
simplfy parallel region traversal
cwpearson May 15, 2025
218d8e1
handle nesting in cost table, left-most induction variable in cost
cwpearson May 15, 2025
cc9eec0
LayoutRight cost, model cost of nested loops
cwpearson May 15, 2025
a46ace9
Simplify building costs of memrefs
cwpearson May 16, 2025
7c40ba5
incorporate load/store scale factor, guard prints with macro
cwpearson May 16, 2025
88f48fb
More logging improvements
cwpearson May 16, 2025
fc9ea8d
more MDRange loop ordering tests
cwpearson May 16, 2025
297b31a
prevent overflow in Expr eval, more consistent MC simulations
cwpearson May 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mlir/include/lapis/Dialect/Kokkos/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ std::unique_ptr<Pass> createKokkosMemorySpaceAssignmentPass();

std::unique_ptr<Pass> createKokkosDualViewManagementPass();

std::unique_ptr<Pass> createKokkosMdrangeIterationPass();

//===----------------------------------------------------------------------===//
// Registration.
//===----------------------------------------------------------------------===//
Expand Down
14 changes: 14 additions & 0 deletions mlir/include/lapis/Dialect/Kokkos/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,18 @@ def KokkosDualViewManagement : Pass<"kokkos-dualview-management", "ModuleOp"> {
];
}

def KokkosMdrangeIteration : Pass<"kokkos-mdrange-iteration", "ModuleOp"> {
let summary = "Rearange MDRange to improve memory access patterns on GPU";
let description = [{
}];
let constructor = "mlir::createKokkosMdrangeIterationPass()";
let dependentDialects = [
"arith::ArithDialect",
"func::FuncDialect",
"kokkos::KokkosDialect",
"memref::MemRefDialect",
"scf::SCFDialect"
];
}

#endif // MLIR_DIALECT_KOKKOS_TRANSFORMS_PASSES
1 change: 1 addition & 0 deletions mlir/lib/Dialect/Kokkos/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_mlir_dialect_library(MLIRKokkosTransforms
KokkosLoopMapping.cpp
KokkosMemorySpaceAssignment.cpp
KokkosDualViewManagement.cpp
KokkosMdrangeIterationPass.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Kokkos
Expand Down
Loading