Skip to content

Commit 76f576c

Browse files
authored
[AMD] Workaround for missing support of pointer canonicalization of ifOp (#6275)
This code in ifOp conversion clearly doesn't support cases where the origin op has multiple results because the array ref will have only 1 range: ``` rewriter.replaceOpWithMultiple(ifOp, {newIfOp.getResults()}); ``` I tried to fix it for a bit but I'm not fully understand the logic of this pass so I'm just skipping it in the unsupported case for now.
1 parent 020cb91 commit 76f576c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,23 @@ void TritonAMDGPUCanonicalizePointersPass::runOnOperation() {
14421442

14431443
auto func = getOperation();
14441444

1445+
// Skip the pass as a workaround as if op with multiple results are not
1446+
// supported yet.
1447+
bool hasIfOpWithMultipleResults =
1448+
func.walk([&](scf::IfOp ifOp) {
1449+
if (ifOp.getNumResults() > 1) {
1450+
for (auto result : ifOp.getResultTypes()) {
1451+
if (llvm::isa<tt::PointerType>(result)) {
1452+
return WalkResult::interrupt();
1453+
}
1454+
}
1455+
}
1456+
return WalkResult::advance();
1457+
})
1458+
.wasInterrupted();
1459+
if (hasIfOpWithMultipleResults)
1460+
return;
1461+
14451462
FatPointers fatPrs;
14461463
PatternRewriter rewriter(&getContext());
14471464
// Convert tt.func; %1 = unrealize_cast(%arg0: tt.ptr, c0: i32) -> tt.ptr

0 commit comments

Comments
 (0)