You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2023/03/20 13:20:59 UTC

[tvm] branch unity updated: [Unity] Remove Python interface of RemoveUnusedFunction (#14336)

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

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


The following commit(s) were added to refs/heads/unity by this push:
     new 4b75414b79 [Unity] Remove Python interface of RemoveUnusedFunction (#14336)
4b75414b79 is described below

commit 4b75414b79304c04cc91c0a13fc9111dc3ac3c65
Author: Ruihang Lai <ru...@cs.cmu.edu>
AuthorDate: Mon Mar 20 09:20:50 2023 -0400

    [Unity] Remove Python interface of RemoveUnusedFunction (#14336)
    
    The pass RemoveUnusedFunctions was renamed and enhanced to the DCE pass
    in #14262. This PR removes the Python interface of RemoveUnusedFunctions
    in transform.py.
    
    It is surprising that this Python API was never tested in any testing
    file before.
    
    This PR also fixes `alter_op_impl.cc` and `to_mixed_precision.cc` to for
    Clang build warnings.
---
 python/tvm/relax/transform/transform.py   | 18 ------------------
 src/relax/transform/alter_op_impl.cc      |  2 ++
 src/relax/transform/to_mixed_precision.cc |  2 +-
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/python/tvm/relax/transform/transform.py b/python/tvm/relax/transform/transform.py
index b710196347..95f81f7e6c 100644
--- a/python/tvm/relax/transform/transform.py
+++ b/python/tvm/relax/transform/transform.py
@@ -190,24 +190,6 @@ def BindParams(
     return _ffi_api.BindParams(func_name, tvm_params)  # type: ignore
 
 
-def RemoveUnusedFunctions(entry_functions: Optional[List[str]] = None) -> tvm.ir.transform.Pass:
-    """Remove unused relax/prim functions without external linkage in a IRModule.
-
-    Parameters
-    ----------
-    entry_functions: Optional[List[str]]
-        The set of entry functions to start from.
-
-    Returns
-    -------
-    ret : tvm.transform.Pass
-        The registered pass to remove unused functions.
-    """
-    if entry_functions is None:
-        entry_functions = ["main"]
-    return _ffi_api.RemoveUnusedFunctions(entry_functions)  # type: ignore
-
-
 def RunCodegen(
     target_options: Optional[dict] = None,
     entry_functions: Optional[List[str]] = None,
diff --git a/src/relax/transform/alter_op_impl.cc b/src/relax/transform/alter_op_impl.cc
index 6a740b4f55..1fadb86d71 100644
--- a/src/relax/transform/alter_op_impl.cc
+++ b/src/relax/transform/alter_op_impl.cc
@@ -92,6 +92,8 @@ class AlterOpImplMutator : public ExprMutator {
   }
 
  private:
+  using ExprMutator::VisitExpr_;
+
   Expr VisitExpr_(const CallNode* op) final {
     auto call = Downcast<Call>(ExprMutator::VisitExpr_(op));
 
diff --git a/src/relax/transform/to_mixed_precision.cc b/src/relax/transform/to_mixed_precision.cc
index 1cb6ff9e66..e74ca7a4d8 100644
--- a/src/relax/transform/to_mixed_precision.cc
+++ b/src/relax/transform/to_mixed_precision.cc
@@ -321,7 +321,7 @@ class ToMixedPrecisionRewriter : public ExprMutator {
   // Util function to check if any of the tensors in the args is fp32
   bool AnyArgIsFP32(const NType& cur_type) {
     bool result = false;
-    auto fvisitleaf = [&, this](const String& dtype) {
+    auto fvisitleaf = [&](const String& dtype) {
       if (dtype == "float32") {
         result = true;
       }