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

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

commit cd135dc34880c12debc492ed40c81d738eb4c65b
Author: tqchen <[email protected]>
AuthorDate: Sat Feb 15 09:30:43 2025 -0500

    remove astext
---
 python/tvm/dlight/benchmark/utils.py |  2 +-
 python/tvm/ir/expr.py                | 30 ------------------------------
 python/tvm/ir/module.py              | 28 ----------------------------
 python/tvm/ir/op.py                  | 28 ----------------------------
 python/tvm/target/datatype.py        |  4 ++--
 5 files changed, 3 insertions(+), 89 deletions(-)

diff --git a/python/tvm/dlight/benchmark/utils.py 
b/python/tvm/dlight/benchmark/utils.py
index 72e0ac8de0..8edb2addae 100644
--- a/python/tvm/dlight/benchmark/utils.py
+++ b/python/tvm/dlight/benchmark/utils.py
@@ -37,7 +37,7 @@ def get_func_name_from_gv(gv: tvm.ir.GlobalVar) -> str:  # 
pylint: disable=inval
     result : str
         The global variable name without the prefix "...@".
     """
-    return gv.astext().split("@")[1] if "@" in gv.astext() else gv.astext()
+    return gv.name_hint
 
 
 def dym_var_sample_str(sample: Dict[Union[str, tvm.relax.expr.Call], int]) -> 
str:
diff --git a/python/tvm/ir/expr.py b/python/tvm/ir/expr.py
index 543ea00214..3c173baa15 100644
--- a/python/tvm/ir/expr.py
+++ b/python/tvm/ir/expr.py
@@ -116,36 +116,6 @@ class GlobalVar(RelayExpr):
         arg_types = [type(x) for x in args]
         raise RuntimeError(f"Do not know how to handle GlobalVar.__call__ for 
types {arg_types}")
 
-    def astext(
-        self, show_meta_data: bool = True, annotate: 
Optional[Callable[[Object], str]] = None
-    ) -> str:
-        """Get the text format of the expression.
-
-        Parameters
-        ----------
-        show_meta_data : bool
-            Whether to include meta data section in the text
-            if there is meta data.
-
-        annotate: Optional[Object->str]
-            Optionally annotate function to provide additional
-            information in the comment block.
-
-        Returns
-        -------
-        text : str
-            The text format of the expression.
-
-        Notes
-        -----
-        The meta data section is necessary to fully parse the text format.
-        However, it can contain dumps that are big (e.g constant weights),
-        so it can be helpful to skip printing the meta data section.
-        """
-        from tvm.relay import astext  # pylint: disable=import-outside-toplevel
-
-        return astext(self, show_meta_data, annotate)
-
 
 @tvm._ffi.register_object
 class Range(Node, Scriptable):
diff --git a/python/tvm/ir/module.py b/python/tvm/ir/module.py
index 3c76dbfdd8..9ee87c5224 100644
--- a/python/tvm/ir/module.py
+++ b/python/tvm/ir/module.py
@@ -395,31 +395,3 @@ class IRModule(Node, Scriptable):
             attr_map = attr_map._dict()
 
         return _ffi_api.Module_WithAttrs(self, attr_map)
-
-    def astext(self, show_meta_data=True, annotate=None):
-        """Get the text format of the expression.
-
-        Parameters
-        ----------
-        show_meta_data : bool
-            Whether to include meta data section in the text
-            if there is meta data.
-
-        annotate: Optional[Object->str]
-            Optionally annotate function to provide additional
-            information in the comment block.
-
-        Returns
-        -------
-        text : str
-            The text format of the expression.
-
-        Notes
-        -----
-        The meta data section is necessary to fully parse the text format.
-        However, it can contain dumps that are big (e.g constant weights),
-        so it can be helpful to skip printing the meta data section.
-        """
-        from tvm.relay import astext  # pylint: disable=import-outside-toplevel
-
-        return astext(self, show_meta_data, annotate)
diff --git a/python/tvm/ir/op.py b/python/tvm/ir/op.py
index 70aba97951..3ab5bb55c0 100644
--- a/python/tvm/ir/op.py
+++ b/python/tvm/ir/op.py
@@ -29,34 +29,6 @@ class Op(RelayExpr):
     def __init__(self):
         raise RuntimeError("Cannot create op, use get instead")
 
-    def astext(self, show_meta_data=True, annotate=None):
-        """Get the text format of the expression.
-
-        Parameters
-        ----------
-        show_meta_data : bool
-            Whether to include meta data section in the text
-            if there is meta data.
-
-        annotate: Optional[Object->str]
-            Optionally annotate function to provide additional
-            information in the comment block.
-
-        Returns
-        -------
-        text : str
-            The text format of the expression.
-
-        Notes
-        -----
-        The meta data section is necessary to fully parse the text format.
-        However, it can contain dumps that are big (e.g constant weights),
-        so it can be helpful to skip printing the meta data section.
-        """
-        from tvm.relay import astext  # pylint: disable=import-outside-toplevel
-
-        return astext(self, show_meta_data, annotate)
-
     @staticmethod
     def get(op_name):
         """Get the Op for a given name
diff --git a/python/tvm/target/datatype.py b/python/tvm/target/datatype.py
index 03dfb9995e..aaf30afaf5 100644
--- a/python/tvm/target/datatype.py
+++ b/python/tvm/target/datatype.py
@@ -303,7 +303,7 @@ def create_lower_func(extern_func_map):
             key = (src_bits, t.bits)
 
         if key not in extern_func_map:
-            raise RuntimeError(f"missing key {key} in extern_func_map for 
{op.astext()}")
+            raise RuntimeError(f"missing key {key} in extern_func_map for 
{op}")
 
         if isinstance(op, _Cast):
             return call_pure_extern(dtype, extern_func_map[key], op.value)
@@ -314,7 +314,7 @@ def create_lower_func(extern_func_map):
         if isinstance(op, _BinaryOpExpr):
             return call_pure_extern(dtype, extern_func_map[key], op.a, op.b)
 
-        raise RuntimeError(f"lowering unsupported op: {op.astext()}")
+        raise RuntimeError(f"lowering unsupported op: {op}")
 
     return lower
 

Reply via email to