Skip to content

Commit 84f3674

Browse files
committed
[TritonToUnstructure](fix) keep while pointer carriers atomic
Preserve analyzable scalar While pointers on the relative-offset path and switch opaque boundaries atomically when a stable base-plus-offset form cannot be proven. Keep before and after regions from acquiring a mixed pointer and integer carrier contract.
1 parent 2f0e8d2 commit 84f3674

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

third_party/ascend/lib/TritonToUnstructure/ReplaceArguments.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,13 @@ void replacePtrArguments(triton::FuncOp funcOp,
556556
forOp));
557557
});
558558
} else if (auto whileOp = dyn_cast<scf::WhileOp>(op)) {
559-
// Keep ordinary While on the established relative-offset path. Its
560-
// before/after regions are analyzed again by convertTensorPtrPre after
561-
// the clone, where the full boundary cache invalidation can observe the
562-
// live backedge. Complete i64 carriers are still selected for For and
563-
// explicitly marked descriptor slots; applying the opaque fallback to
564-
// every While here changes the two-region T2U contract before that
565-
// reanalysis can run.
559+
// Keep analyzable scalar pointers on the established relative-offset
560+
// path. If any boundary edge has no stable base-plus-offset form, switch
561+
// all scalar pointer edges atomically to complete i64 addresses so the
562+
// before/after regions cannot acquire a mixed pointer/integer contract.
563+
if (shouldPreserveScalarPointers(whileOp.getOperation(), rewriter,
564+
offsetMap))
565+
markOpaqueScalarPointerBoundary(whileOp.getOperation());
566566
SmallVector<Value> newInits = constructOperands(
567567
whileOp.getInits(), tempVar, mapping, rewriter, whileOp);
568568
newOp = rewriter.create<scf::WhileOp>(

0 commit comments

Comments
 (0)