Skip to content

Commit 68bf33c

Browse files
committed
[TritonIntelGPUToLLVM] Implement mlir::triton::intel::AllocationAnalysis
This is just a copy of `mlir::triton::AllocationAnalysis` for now. Signed-off-by: victor-eds <[email protected]>
1 parent 08786ac commit 68bf33c

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

include/triton/Analysis/Allocation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ namespace mlir {
1717

1818
namespace triton {
1919
class AllocationAnalysis;
20+
namespace intel {
21+
class AllocationAnalysis;
22+
}
2023

2124
// To convert a tensor from one layout to another, we need to allocate a
2225
// temporary buffer (i.e., scratch buffer) in shared memory. The conversion may
@@ -238,6 +241,7 @@ class Allocation {
238241
size_t sharedMemorySize = 0;
239242

240243
friend class triton::AllocationAnalysis;
244+
friend class triton::intel::AllocationAnalysis;
241245
};
242246

243247
template <>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef TRITON_INTEL_ANALYSIS_ALLOCATION_H
2+
#define TRITON_INTEL_ANALYSIS_ALLOCATION_H
3+
4+
#include "triton/Analysis/Allocation.h"
5+
6+
namespace mlir {
7+
template <>
8+
void Allocation::run<triton::intel::AllocationAnalysis>(
9+
FuncAllocMapT &funcAllocMap);
10+
} // namespace mlir
11+
12+
#endif

third_party/intel/lib/Analysis/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
add_triton_library(TritonIntelAnalysis
2+
Allocation.cpp
23
AxisInfo.cpp
34
DPAS.cpp
45
Liveness.cpp

third_party/intel/lib/TritonIntelGPUToLLVM/AllocateSharedMemory.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ struct AllocateSharedMemory
2222
void runOnOperation() override {
2323
ModuleOp mod = getOperation();
2424
MLIRContext *ctx = &getContext();
25-
ModuleAllocation allocation = ModuleAllocation::get(mod);
25+
ModuleAllocation allocation =
26+
ModuleAllocation::get<triton::intel::AllocationAnalysis>(mod);
2627

2728
mod.walk([&](FunctionOpInterface funcOp) {
2829
if (allocation.isRoot(funcOp) && allocation.getSharedMemorySize()) {

third_party/intel/lib/TritonIntelGPUToLLVM/TritonGPUToLLVM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ struct ConvertTritonGPUToLLVM
9494

9595
// Allocate shared memory and set barrier
9696
if (!pipelineManager.skipSharedMemoryAllocation()) {
97-
ModuleAllocation allocation = ModuleAllocation::get(mod);
97+
ModuleAllocation allocation =
98+
ModuleAllocation::get<triton::intel::AllocationAnalysis>(mod);
9899
ModuleMembarAnalysis membarPass(&allocation);
99100
membarPass.run();
100101
}

0 commit comments

Comments
 (0)