This is an automated email from the ASF dual-hosted git repository.

csullivan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 86ba26d854 [Bugfix][TIR] Avoid symbol conflicts in 
MakePackedAPI/MakeUnpackedAPI (#14950)
86ba26d854 is described below

commit 86ba26d85446655318100b267b938031876caf7f
Author: Eric Lunderberg <[email protected]>
AuthorDate: Thu May 25 17:35:56 2023 -0500

    [Bugfix][TIR] Avoid symbol conflicts in MakePackedAPI/MakeUnpackedAPI 
(#14950)
    
    PRs https://github.com/apache/tvm/pull/14913 and
    https://github.com/apache/tvm/pull/14914 made analogous changes to
    `MakePackedAPI` and `MakeUnpackedAPI` to handle subroutine calls.
    Both PRs introduced the same symbol,
    `tvm::tir::SubroutineCallRewriter`, a local utility to update internal
    calls to a modified function.  While each PR passed CI individually,
    and was therefore able to merge, having both changes caused a
    duplicate symbol.
    
    This commit updates `MakePackedAPI` and `MakeUnpackedAPI` to place
    their local utilities into anonymous namespaces, avoiding the
    conflict.
---
 src/tir/transforms/make_packed_api.cc   | 3 +++
 src/tir/transforms/make_unpacked_api.cc | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/src/tir/transforms/make_packed_api.cc 
b/src/tir/transforms/make_packed_api.cc
index dd9d471c50..825a8da45b 100644
--- a/src/tir/transforms/make_packed_api.cc
+++ b/src/tir/transforms/make_packed_api.cc
@@ -42,6 +42,7 @@ namespace tir {
 
 static constexpr const char* kDeviceContextVar = "device_api_context";
 
+namespace {
 class ReturnRewriter : public StmtMutator {
  public:
   explicit ReturnRewriter(Var ret_var, Var ret_tcode) : ret_var_(ret_var), 
ret_tcode_(ret_tcode) {}
@@ -176,6 +177,8 @@ class SubroutineCallRewriter : public StmtExprMutator {
   bool made_change_{false};
 };
 
+}  // namespace
+
 inline Stmt MakeAssertEQ(PrimExpr lhs, PrimExpr rhs, std::string msg) {
   return AssertStmt(lhs == rhs, tvm::tir::StringImm(msg), Evaluate(0));
 }
diff --git a/src/tir/transforms/make_unpacked_api.cc 
b/src/tir/transforms/make_unpacked_api.cc
index 82685411f5..bdb3a953e9 100644
--- a/src/tir/transforms/make_unpacked_api.cc
+++ b/src/tir/transforms/make_unpacked_api.cc
@@ -40,6 +40,8 @@
 namespace tvm {
 namespace tir {
 
+namespace {
+
 class SubroutineCallRewriter : public StmtExprMutator {
  public:
   static Optional<Stmt> Apply(const std::unordered_set<const GlobalVarNode*>& 
external_methods,
@@ -84,6 +86,8 @@ class SubroutineCallRewriter : public StmtExprMutator {
   bool made_change_{false};
 };
 
+}  // namespace
+
 PrimFunc MakeUnpackedAPI(PrimFunc func) {
   // A function with an explicit calling convention has already been
   // lowered, and should not be modified.

Reply via email to