Skip to content

Commit 99bc7f5

Browse files
authored
[NFC] Add debug information in software pipeline. (#4813)
Add debug information in software pipeline. --------- Signed-off-by: Lu,Chengjun <[email protected]>
1 parent 4afd331 commit 99bc7f5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

third_party/intel/lib/TritonIntelGPUTransforms/Pipeliner/MatmulLoopPipeline.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,25 @@ bool ttgi::preProcessLoopAndGetSchedule(scf::ForOp &forOp, int numStages,
301301

302302
LLVM_DEBUG({
303303
DBGS() << "Loads to pipeline:\n";
304-
for (const LoadDotOperand &load : loads)
305-
DBGS() << " " << *load.load << "\n";
304+
unsigned prefetchBytes = 0;
305+
for (LoadDotOperand &load : loads) {
306+
tt::LoadOp &op = load.load;
307+
if (auto tensorType =
308+
dyn_cast<RankedTensorType>(op.getResult().getType())) {
309+
ArrayRef<int64_t> shape = tensorType.getShape();
310+
auto numElems = product<int64_t>(shape);
311+
prefetchBytes +=
312+
numElems * tensorType.getElementType().getIntOrFloatBitWidth() / 8;
313+
}
314+
DBGS() << " " << *op << "\n";
315+
}
316+
prefetchBytes *= numStages;
317+
constexpr unsigned BYTES_PER_KB = 1024;
318+
DBGS() << "Total number of bytes to prefetch: "
319+
<< (prefetchBytes > BYTES_PER_KB
320+
? std::to_string(prefetchBytes / BYTES_PER_KB) + " KB"
321+
: std::to_string(prefetchBytes) + " B")
322+
<< " in " << numStages << " stages\n";
306323
});
307324

308325
// 2. Create the prefetching operations for the loads collected.

0 commit comments

Comments
 (0)