Skip to content

[MLIR] Use cached symbol tables to get the called function during bufferization - #141341

Merged
mscuttari merged 1 commit into
llvm:mainfrom
mscuttari:bufferization-call-symbol-tables-caching
May 26, 2025
Merged

mscuttari merged 1 commit into
llvm:mainfrom
mscuttari:bufferization-call-symbol-tables-caching

Conversation

@mscuttari

@mscuttari mscuttari commented May 24, 2025 •

Copy link
Copy Markdown
Member

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

llvmbot commented May 24, 2025

Copy link
Copy Markdown
Member

@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

llvmbot commented May 24, 2025

Copy link
Copy Markdown
Member

@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
@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