Skip to content

Commit a4ab31d

Browse files
authored
[BACKEND] Prevent combinatory explosion when checking tmem_load uses (#8477)
1 parent 3b3c852 commit a4ab31d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Dialect/TritonNvidiaGPU/Transforms/OptimizeTMemLayouts.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,11 @@ class TMemToSharedMemPattern : public OpRewritePattern<TMEMLoadOp> {
363363
SmallVector<std::pair<Value, Attribute>> uses;
364364
uses.push_back({tmemLoadOp.getResult(), newEncoding});
365365
bool foundImprovedStore = false;
366+
llvm::DenseSet<std::pair<Value, Attribute>> visited;
366367
while (!uses.empty()) {
367368
auto [v, encoding] = uses.pop_back_val();
369+
if (!visited.insert({v, encoding}).second)
370+
continue;
368371
for (auto user : v.getUsers()) {
369372
if (auto localStore = dyn_cast<gpu::LocalStoreOp>(user)) {
370373
// Check if the store benefits from the new layout.

0 commit comments

Comments
 (0)