Skip to content

Conversation

mscuttari
Copy link
Member

@mscuttari mscuttari commented May 24, 2025

Avoid recomputing the symbol tables by using the BufferizationState class introduced in #141019.
There is also one similar TODO remaining within the getBufferType function, but that requires more reasoning and one more API change.

@llvmbot llvmbot added mlir mlir:bufferization Bufferization infrastructure labels May 24, 2025
@llvmbot
Copy link
Member

llvmbot commented May 24, 2025

@llvm/pr-subscribers-mlir-bufferization

Author: Michele Scuttari (mscuttari)

Changes

Avoid recomputing the symbol tables by using the BufferizationState class introduced in #141019.
There is also one similar TODO remaining, but that requires more reasoning as tightly bounded to the getBufferType, which is called both during analysis and bufferization.


Full diff: https://github.com/llvm/llvm-project/pull/141341.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp (+1-4)
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
index 080796208bfc1..6210f1d787bf4 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
@@ -265,10 +265,7 @@ struct CallOpInterface
     //    bufferized callee.
     SmallVector<Value> newOperands;
 
-    // TODO Avoid recomputing the symbol tables every time.
-    SymbolTableCollection symbolTable;
-
-    FuncOp funcOp = getCalledFunction(callOp, symbolTable);
+    FuncOp funcOp = getCalledFunction(callOp, state.getSymbolTables());
     assert(funcOp && "expected CallOp to a FuncOp");
     FunctionType funcType = funcOp.getFunctionType();
 

@llvmbot
Copy link
Member

llvmbot commented May 24, 2025

@llvm/pr-subscribers-mlir

Author: Michele Scuttari (mscuttari)

Changes

Avoid recomputing the symbol tables by using the BufferizationState class introduced in #141019.
There is also one similar TODO remaining, but that requires more reasoning as tightly bounded to the getBufferType, which is called both during analysis and bufferization.


Full diff: https://github.com/llvm/llvm-project/pull/141341.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp (+1-4)
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
index 080796208bfc1..6210f1d787bf4 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
@@ -265,10 +265,7 @@ struct CallOpInterface
     //    bufferized callee.
     SmallVector<Value> newOperands;
 
-    // TODO Avoid recomputing the symbol tables every time.
-    SymbolTableCollection symbolTable;
-
-    FuncOp funcOp = getCalledFunction(callOp, symbolTable);
+    FuncOp funcOp = getCalledFunction(callOp, state.getSymbolTables());
     assert(funcOp && "expected CallOp to a FuncOp");
     FunctionType funcType = funcOp.getFunctionType();
 

@mscuttari mscuttari merged commit 03f4fe1 into llvm:main May 26, 2025
14 checks passed
@mscuttari mscuttari deleted the bufferization-call-symbol-tables-caching branch May 26, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:bufferization Bufferization infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants