Skip to content

Commit 9fbf44f

Browse files
peiying779Peiying Hua
andauthored
[AMD] Add messages for debugging BlockPingpong (#8804)
For some num_warps, num_stages and tile_size, BlockPingpong will exit early without leaving a message. Added message for these cases so people can be aware that pingpong wasn't really involved. Also add some transparency for debugging. This shouldn't change the way how BlockPingong or anything else in Triton is used. <!--- The core Triton is a small number of people, and we receive many PRs (thank you!). To help us review your code more quickly, **if you are a new contributor (less than 3 PRs merged) we ask that you complete the following tasks and include the filled-out checklist in your PR description.** Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> # New contributor declaration - [X] I am not making a trivial change, such as fixing a typo in a comment. - [X] I have written a PR description following these [rules](https://cbea.ms/git-commit/#why-not-how). - [X] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`. - Select one of the following. - [ ] I have added tests. - `/test` for `lit` tests - `/unittest` for C++ tests - `/python/test` for end-to-end tests - [X] This PR does not need a test because `Just added a few message to make sure BlockPingpong won't silently exit early, making it easier to debug`. - Select one of the following. - [X] I have not added any `lit` tests. - [ ] The `lit` tests I have added follow these [best practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices), including the "tests should be minimal" section. (Usually running Python code and using the instructions it generates is not minimal.) Co-authored-by: Peiying Hua <[email protected]>
1 parent 2760a7e commit 9fbf44f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

third_party/amd/lib/TritonAMDGPUTransforms/BlockPingpong.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,8 +1185,19 @@ void Pingponger::getDotPingponged() {
11851185
// times for issuing the memory operations and issuing dot operations,
11861186
// smaller tile sizes are not likely to get any advantage from current dot
11871187
// centric pingpong scheduling.
1188-
if (tileSize <= smallTile && tileSize >= minTile)
1188+
if (tileSize <= smallTile && tileSize >= minTile) {
11891189
transformOnePPClusters(builder, loc);
1190+
LDBG("Pingpong scheduling applied for numWarps=4 with tileSize=" +
1191+
std::to_string(tileSize) + " (in range [" + std::to_string(minTile) +
1192+
", " + std::to_string(smallTile) +
1193+
"]), One Dot-Memory (ping-pong) cluster used.");
1194+
} else {
1195+
std::stringstream message;
1196+
message << "Skipping pingpong for numWarps=4: tileSize=" << tileSize
1197+
<< " is outside the range [" << minTile << ", " << smallTile
1198+
<< "]";
1199+
LDBG(message.str());
1200+
}
11901201
// numWarps=4 doesn't need asymmetric sync, return.
11911202
return;
11921203
} else if (numWarps == 8 && numStages == 2) {
@@ -1216,8 +1227,15 @@ void Pingponger::getDotPingponged() {
12161227
"cluster transformation");
12171228
return;
12181229
}
1219-
} else
1230+
} else {
1231+
std::stringstream message;
1232+
message << "Skipping pingpong for numWarps=8, numStages=2: tileSize="
1233+
<< tileSize
1234+
<< " does not match supported tile sizes (medium=" << mediumTile
1235+
<< " or large=" << largeTile << ")";
1236+
LDBG(message.str());
12201237
return;
1238+
}
12211239

12221240
// Let half of the warps start the loop first and the others follow later
12231241
// but in the synchronized way. This can be accomplished by calling

0 commit comments

Comments
 (0)