This is an automated email from the ASF dual-hosted git repository.
spectrometerHBH 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 2f4f4b1de3 [REFACTOR][IR][FFI] Bump tvm-ffi (+ SEqHashDef migration)
and phase out tvm/ir/repr.h (#19627)
2f4f4b1de3 is described below
commit 2f4f4b1de3270e923ac035ff8ad8baf2490ef155
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed May 27 15:33:47 2026 -0400
[REFACTOR][IR][FFI] Bump tvm-ffi (+ SEqHashDef migration) and phase out
tvm/ir/repr.h (#19627)
## Summary
Two-commit PR:
1. Bump `3rdparty/tvm-ffi` from `3c35034` to `98d0029` and migrate all
21 in-tree `SEqHashDef()` call sites to `SEqHashDefRecursive()` (the
conservative variant matching the prior default behavior). Six let-style
sites carry `TODO(tqchen)` comments indicating they should flip to
`SEqHashDefNonRecursive` after the new tvm-ffi ships on pypi.
2. Phase out `include/tvm/ir/repr.h`. The bumped tvm-ffi now provides
ostream `operator<<` for `Any`/`ObjectRef`/`Variant`/`Optional` directly
in `tvm/ffi/extra/dataclass.h`, making the in-tree thin wrapper
redundant. Rewrite 8 includers, rename `src/ir/repr.cc` →
`src/ir/access_path_repr.cc` (preserves `node.AsRepr` +
AccessPath/AccessStep `__ffi_repr__` registrations; drops zero-caller
`tvm::Dump()`), delete the header. Also fixes a Python-level import
regression in `python/tvm/ir/attrs.py` caused by the bump: tvm_ffi
0.1.12.dev changes the field-registration guard from `not hasattr(cls,
name)` to `name not in cls.__dict__`, which breaks `DictAttrs` because
`DictAttrsNode` registers a reflection field named `"__dict__"` — Python
forbids installing a class descriptor with that name via `setattr`. Fix:
define `__dict__` as an explicit Python property on `DictAttrs` so the
auto-installation is skipped.
## TODO follow-ups
After the new tvm-ffi releases on pypi, flip the 6
`SEqHashDefRecursive()` sites that carry `TODO(tqchen)` comments to
`SEqHashDefNonRecursive()`. Locations are enumerated in the commit body
of commit 1.
## Test plan
- [x] Full ninja build clean (638/638).
- [x] 118/118 cpptest pass.
- [x] `import tvm; tvm.cuda(0).exist` returns True.
- [x] `tests/python/all-platform-minimal-test`: 37 passed, 105 skipped.
- [x] `tests/python/relax/test_struct_info.py`: 9 passed.
- [x] `git grep -nE 'SEqHashDef\(|"tvm/ir/repr\.h"'` is empty.
- [x] `pre-commit run --all-files` clean.
---
3rdparty/tvm-ffi | 2 +-
include/tvm/ir/expr.h | 2 +-
include/tvm/ir/repr.h | 72 ---------------------------------
include/tvm/relax/exec_builder.h | 2 +-
include/tvm/relax/expr.h | 9 +++--
include/tvm/relax/struct_info.h | 2 +-
include/tvm/tirx/buffer.h | 15 ++++---
include/tvm/tirx/exec_scope.h | 2 +-
include/tvm/tirx/expr.h | 7 ++--
include/tvm/tirx/function.h | 2 +-
include/tvm/tirx/index_map.h | 2 +-
include/tvm/tirx/predicate.h | 2 +-
include/tvm/tirx/stmt.h | 10 +++--
include/tvm/tirx/var.h | 2 +-
python/tvm/ir/attrs.py | 10 +++++
src/ir/{repr.cc => access_path_repr.cc} | 19 ++++-----
src/ir/instrument.cc | 2 +-
src/ir/transform.cc | 2 +-
src/relax/ir/dataflow_pattern.cc | 1 -
src/relax/ir/transform.cc | 2 +-
src/script/printer/script_printer.cc | 1 -
src/tirx/ir/transform.cc | 2 +-
22 files changed, 57 insertions(+), 113 deletions(-)
diff --git a/3rdparty/tvm-ffi b/3rdparty/tvm-ffi
index 3c35034fd1..98d0029dd4 160000
--- a/3rdparty/tvm-ffi
+++ b/3rdparty/tvm-ffi
@@ -1 +1 @@
-Subproject commit 3c35034fd1026011736e19a4e0e1ed0f22058c42
+Subproject commit 98d0029dd4e002da1516d43f9b92e792f139e709
diff --git a/include/tvm/ir/expr.h b/include/tvm/ir/expr.h
index 1ce7a112a3..fcd267163c 100644
--- a/include/tvm/ir/expr.h
+++ b/include/tvm/ir/expr.h
@@ -24,11 +24,11 @@
#ifndef TVM_IR_EXPR_H_
#define TVM_IR_EXPR_H_
+#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ffi/string.h>
#include <tvm/ir/cast.h>
#include <tvm/ir/cow.h>
-#include <tvm/ir/repr.h>
#include <tvm/ir/source_map.h>
#include <tvm/ir/type.h>
#include <tvm/script/printer/config.h>
diff --git a/include/tvm/ir/repr.h b/include/tvm/ir/repr.h
deleted file mode 100644
index de2f625221..0000000000
--- a/include/tvm/ir/repr.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*!
- * \file tvm/ir/repr.h
- * \brief ostream operator<< for ffi::ObjectRef, Any, and Variant, delegating
to
- * ffi::ReprPrint. Also re-exports the Dump() debug helpers.
- *
- * Include this header wherever you need `os << some_objectref` and you are
- * no longer pulling in the legacy repr_printer.h.
- */
-#ifndef TVM_IR_REPR_H_
-#define TVM_IR_REPR_H_
-
-#include <tvm/ffi/extra/dataclass.h>
-#include <tvm/runtime/base.h>
-
-#include <iostream>
-
-namespace tvm {
-
-/*!
- * \brief Dump the node to stderr, used for debug purposes.
- * \param node The input node
- */
-TVM_DLL void Dump(const ffi::ObjectRef& node);
-
-/*!
- * \brief Dump the node to stderr, used for debug purposes.
- * \param node The input node
- */
-TVM_DLL void Dump(const ffi::Object* node);
-
-} // namespace tvm
-
-namespace tvm {
-namespace ffi {
-
-// ostream << ObjectRef — delegates to ffi::ReprPrint
-inline std::ostream& operator<<(std::ostream& os, const ObjectRef& n) { //
NOLINT(*)
- return os << ffi::ReprPrint(Any(n));
-}
-
-// ostream << Any — delegates to ffi::ReprPrint
-inline std::ostream& operator<<(std::ostream& os, const Any& n) { // NOLINT(*)
- return os << ffi::ReprPrint(n);
-}
-
-// ostream << Variant<...> — delegates to ffi::ReprPrint
-template <typename... V>
-inline std::ostream& operator<<(std::ostream& os, const ffi::Variant<V...>& n)
{ // NOLINT(*)
- return os << ffi::ReprPrint(Any(n));
-}
-
-} // namespace ffi
-} // namespace tvm
-#endif // TVM_IR_REPR_H_
diff --git a/include/tvm/relax/exec_builder.h b/include/tvm/relax/exec_builder.h
index 29e680eff2..74f4b8bce1 100644
--- a/include/tvm/relax/exec_builder.h
+++ b/include/tvm/relax/exec_builder.h
@@ -23,12 +23,12 @@
#ifndef TVM_RELAX_EXEC_BUILDER_H_
#define TVM_RELAX_EXEC_BUILDER_H_
+#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/extra/structural_equal.h>
#include <tvm/ffi/extra/structural_hash.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ir/expr.h>
-#include <tvm/ir/repr.h>
#include <tvm/runtime/vm/bytecode.h>
#include <tvm/runtime/vm/executable.h>
diff --git a/include/tvm/relax/expr.h b/include/tvm/relax/expr.h
index e94a9ea150..6da9cb1692 100644
--- a/include/tvm/relax/expr.h
+++ b/include/tvm/relax/expr.h
@@ -574,7 +574,8 @@ class BindingNode : public ffi::Object {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<BindingNode>()
.def_ro("span", &BindingNode::span,
refl::AttachFieldFlag::SEqHashIgnore())
- .def_ro("var", &BindingNode::var, refl::AttachFieldFlag::SEqHashDef());
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("var", &BindingNode::var,
refl::AttachFieldFlag::SEqHashDefRecursive());
}
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind =
kTVMFFISEqHashKindTreeNode;
@@ -616,7 +617,9 @@ class MatchCastNode : public BindingNode {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<MatchCastNode>()
.def_ro("value", &MatchCastNode::value)
- .def_ro("struct_info", &MatchCastNode::struct_info,
refl::AttachFieldFlag::SEqHashDef());
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("struct_info", &MatchCastNode::struct_info,
+ refl::AttachFieldFlag::SEqHashDefRecursive());
}
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.MatchCast", MatchCastNode,
BindingNode);
};
@@ -822,7 +825,7 @@ class FunctionNode : public BaseFuncNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<FunctionNode>()
- .def_ro("params", &FunctionNode::params,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("params", &FunctionNode::params,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("body", &FunctionNode::body)
.def_ro("ret_struct_info", &FunctionNode::ret_struct_info)
.def_ro("is_pure", &FunctionNode::is_pure);
diff --git a/include/tvm/relax/struct_info.h b/include/tvm/relax/struct_info.h
index de7650e166..049469027b 100644
--- a/include/tvm/relax/struct_info.h
+++ b/include/tvm/relax/struct_info.h
@@ -294,7 +294,7 @@ class FuncStructInfoNode : public StructInfoNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<FuncStructInfoNode>()
- .def_ro("params", &FuncStructInfoNode::params,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("params", &FuncStructInfoNode::params,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("ret", &FuncStructInfoNode::ret)
.def_ro("derive_func", &FuncStructInfoNode::derive_func)
.def_ro("purity", &FuncStructInfoNode::purity);
diff --git a/include/tvm/tirx/buffer.h b/include/tvm/tirx/buffer.h
index f3bccc5372..b32b06b755 100644
--- a/include/tvm/tirx/buffer.h
+++ b/include/tvm/tirx/buffer.h
@@ -126,13 +126,18 @@ class BufferNode : public ffi::Object {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<BufferNode>()
- .def_ro("data", &BufferNode::data, refl::AttachFieldFlag::SEqHashDef())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("data", &BufferNode::data,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("dtype", &BufferNode::dtype)
- .def_ro("shape", &BufferNode::shape,
refl::AttachFieldFlag::SEqHashDef())
- .def_ro("strides", &BufferNode::strides,
refl::AttachFieldFlag::SEqHashDef())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("shape", &BufferNode::shape,
refl::AttachFieldFlag::SEqHashDefRecursive())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("strides", &BufferNode::strides,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("axis_separators", &BufferNode::axis_separators,
- refl::AttachFieldFlag::SEqHashDef())
- .def_ro("elem_offset", &BufferNode::elem_offset,
refl::AttachFieldFlag::SEqHashDef())
+ refl::AttachFieldFlag::SEqHashDefRecursive())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("elem_offset", &BufferNode::elem_offset,
+ refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("name", &BufferNode::name,
refl::AttachFieldFlag::SEqHashIgnore())
.def_ro("data_alignment", &BufferNode::data_alignment)
.def_ro("offset_factor", &BufferNode::offset_factor)
diff --git a/include/tvm/tirx/exec_scope.h b/include/tvm/tirx/exec_scope.h
index 9378c2f545..bce8889394 100644
--- a/include/tvm/tirx/exec_scope.h
+++ b/include/tvm/tirx/exec_scope.h
@@ -126,7 +126,7 @@ class ScopeIdDefNode : public ffi::Object {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<ScopeIdDefNode>()
- .def_ro("def_ids", &ScopeIdDefNode::def_ids,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("def_ids", &ScopeIdDefNode::def_ids,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("extents", &ScopeIdDefNode::extents)
.def_ro("scope", &ScopeIdDefNode::scope)
.def_ro("preferred_extents", &ScopeIdDefNode::preferred_extents);
diff --git a/include/tvm/tirx/expr.h b/include/tvm/tirx/expr.h
index e2c1c3f33d..cd51108b0d 100644
--- a/include/tvm/tirx/expr.h
+++ b/include/tvm/tirx/expr.h
@@ -698,7 +698,8 @@ class LetNode : public PrimExprNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<LetNode>()
- .def_ro("var", &LetNode::var, refl::AttachFieldFlag::SEqHashDef())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("var", &LetNode::var,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("value", &LetNode::value)
.def_ro("body", &LetNode::body);
}
@@ -823,8 +824,8 @@ class CommReducerNode : public ffi::Object {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<CommReducerNode>()
- .def_ro("lhs", &CommReducerNode::lhs,
refl::AttachFieldFlag::SEqHashDef())
- .def_ro("rhs", &CommReducerNode::rhs,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("lhs", &CommReducerNode::lhs,
refl::AttachFieldFlag::SEqHashDefRecursive())
+ .def_ro("rhs", &CommReducerNode::rhs,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("result", &CommReducerNode::result)
.def_ro("identity_element", &CommReducerNode::identity_element)
.def_ro("span", &CommReducerNode::span,
refl::AttachFieldFlag::SEqHashIgnore());
diff --git a/include/tvm/tirx/function.h b/include/tvm/tirx/function.h
index aec5f30454..45a8600a6e 100644
--- a/include/tvm/tirx/function.h
+++ b/include/tvm/tirx/function.h
@@ -105,7 +105,7 @@ class PrimFuncNode : public BaseFuncNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<PrimFuncNode>()
- .def_ro("params", &PrimFuncNode::params,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("params", &PrimFuncNode::params,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("ret_type", &PrimFuncNode::ret_type)
.def_ro("buffer_map", &PrimFuncNode::buffer_map)
.def_ro("body", &PrimFuncNode::body);
diff --git a/include/tvm/tirx/index_map.h b/include/tvm/tirx/index_map.h
index 05dea246c3..7d4c6684b1 100644
--- a/include/tvm/tirx/index_map.h
+++ b/include/tvm/tirx/index_map.h
@@ -156,7 +156,7 @@ class IndexMapNode : public ffi::Object {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<IndexMapNode>()
.def_ro("initial_indices", &IndexMapNode::initial_indices,
- refl::AttachFieldFlag::SEqHashDef())
+ refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("final_indices", &IndexMapNode::final_indices)
.def_ro("inverse_index_map", &IndexMapNode::inverse_index_map,
refl::AttachFieldFlag::SEqHashIgnore());
diff --git a/include/tvm/tirx/predicate.h b/include/tvm/tirx/predicate.h
index 44426d877c..f9e7667cfe 100644
--- a/include/tvm/tirx/predicate.h
+++ b/include/tvm/tirx/predicate.h
@@ -45,7 +45,7 @@ class PredicateNode : public ffi::Object {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<PredicateNode>()
- .def_ro("vars", &PredicateNode::vars,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("vars", &PredicateNode::vars,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("pred", &PredicateNode::pred);
}
diff --git a/include/tvm/tirx/stmt.h b/include/tvm/tirx/stmt.h
index a7443d9405..39cfbac0cd 100644
--- a/include/tvm/tirx/stmt.h
+++ b/include/tvm/tirx/stmt.h
@@ -86,7 +86,8 @@ class BindNode : public StmtNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<BindNode>()
- .def_ro("var", &BindNode::var, refl::AttachFieldFlag::SEqHashDef())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("var", &BindNode::var,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("value", &BindNode::value);
}
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Bind", BindNode, StmtNode);
@@ -273,7 +274,8 @@ class AllocBufferNode : public StmtNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<AllocBufferNode>()
- .def_ro("buffer", &AllocBufferNode::buffer,
refl::AttachFieldFlag::SEqHashDef())
+ // TODO(tqchen): use SEqHashDefNonRecursive after the next pypi
tvm-ffi release
+ .def_ro("buffer", &AllocBufferNode::buffer,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("annotations", &AllocBufferNode::annotations);
}
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.AllocBuffer", AllocBufferNode,
StmtNode);
@@ -619,7 +621,7 @@ class ForNode : public StmtNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<ForNode>()
- .def_ro("loop_var", &ForNode::loop_var,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("loop_var", &ForNode::loop_var,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("min", &ForNode::min)
.def_ro("extent", &ForNode::extent)
.def_ro("kind", &ForNode::kind)
@@ -879,7 +881,7 @@ class SBlockNode : public StmtNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<SBlockNode>()
- .def_ro("iter_vars", &SBlockNode::iter_vars,
refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("iter_vars", &SBlockNode::iter_vars,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("reads", &SBlockNode::reads)
.def_ro("writes", &SBlockNode::writes)
.def_ro("name_hint", &SBlockNode::name_hint,
refl::AttachFieldFlag::SEqHashIgnore())
diff --git a/include/tvm/tirx/var.h b/include/tvm/tirx/var.h
index c38908d56d..8c536ef0d6 100644
--- a/include/tvm/tirx/var.h
+++ b/include/tvm/tirx/var.h
@@ -279,7 +279,7 @@ class IterVarNode : public PrimExprConvertibleNode {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<IterVarNode>()
.def_ro("dom", &IterVarNode::dom)
- .def_ro("var", &IterVarNode::var, refl::AttachFieldFlag::SEqHashDef())
+ .def_ro("var", &IterVarNode::var,
refl::AttachFieldFlag::SEqHashDefRecursive())
.def_ro("iter_type", &IterVarNode::iter_type)
.def_ro("thread_tag", &IterVarNode::thread_tag);
}
diff --git a/python/tvm/ir/attrs.py b/python/tvm/ir/attrs.py
index 5451b65ef6..473f646e6a 100644
--- a/python/tvm/ir/attrs.py
+++ b/python/tvm/ir/attrs.py
@@ -79,6 +79,16 @@ class Attrs(Object):
class DictAttrs(Attrs):
"""Dictionary attributes."""
+ @property
+ def __dict__(self):
+ """Return the underlying key-value map as a Python dict.
+
+ Defined explicitly so that tvm_ffi's _add_class_attrs skips registering
+ the C++ reflection field named '__dict__' (Python forbids adding a
class
+ attribute named '__dict__' via setattr on extension-type subclasses).
+ """
+ return dict(self._dict())
+
def _dict(self):
"""Get internal dict"""
return _ffi_api.DictAttrsGetDict(self)
diff --git a/src/ir/repr.cc b/src/ir/access_path_repr.cc
similarity index 87%
rename from src/ir/repr.cc
rename to src/ir/access_path_repr.cc
index addbd33209..0e56b91ece 100644
--- a/src/ir/repr.cc
+++ b/src/ir/access_path_repr.cc
@@ -18,30 +18,27 @@
*/
/*!
- * \file ir/repr.cc
- * \brief Implements Dump helpers and FFI registration for ffi-repr-based
printing.
+ * \file ir/access_path_repr.cc
+ * \brief FFI registration for ffi-repr-based printing.
*
- * The legacy ReprPrinter has been replaced by ffi::ReprPrint. This file:
- * - Implements the Dump() debug helpers (they call ffi::ReprPrint).
+ * This file:
* - Registers node.AsRepr (for backward Python compatibility) via
ffi::ReprPrint.
- * - Registers __ffi_repr__ hooks for ffi::reflection::AccessPath and
AccessStep.
+ * - Registers __ffi_repr__ hooks for ffi::reflection::AccessPath and
AccessStep
+ * so that ffi.ReprPrint formats them as concise "<root>.field[idx]"
strings.
+ *
+ * Note: tvm::Dump() has been removed (zero in-tree callers). Use
+ * tvm::ffi::ReprPrint(any) directly from gdb instead.
*/
#include <tvm/ffi/cast.h>
#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/access_path.h>
#include <tvm/ffi/reflection/registry.h>
-#include <tvm/ir/repr.h>
-#include <tvm/runtime/device_api.h>
#include <sstream>
namespace tvm {
-void Dump(const ffi::ObjectRef& n) { std::cerr << ffi::ReprPrint(ffi::Any(n))
<< "\n"; }
-
-void Dump(const ffi::Object* n) { Dump(ffi::GetRef<ffi::ObjectRef>(n)); }
-
TVM_FFI_STATIC_INIT_BLOCK() {
namespace refl = tvm::ffi::reflection;
// node.AsRepr: backward-compatible Python entry point.
diff --git a/src/ir/instrument.cc b/src/ir/instrument.cc
index e88713a506..42d4ad0fe0 100644
--- a/src/ir/instrument.cc
+++ b/src/ir/instrument.cc
@@ -21,10 +21,10 @@
* \file src/ir/instrument.cc
* \brief Infrastructure for instrumentation.
*/
+#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ir/instrument.h>
-#include <tvm/ir/repr.h>
#include <tvm/ir/transform.h>
#include <tvm/runtime/logging.h>
diff --git a/src/ir/transform.cc b/src/ir/transform.cc
index 075d5a7e66..2c4618eff6 100644
--- a/src/ir/transform.cc
+++ b/src/ir/transform.cc
@@ -21,11 +21,11 @@
* \file src/ir/transform.cc
* \brief Infrastructure for transformation passes.
*/
+#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/extra/structural_hash.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ffi/rvalue_ref.h>
-#include <tvm/ir/repr.h>
#include <tvm/ir/transform.h>
#include <tvm/relax/expr.h>
#include <tvm/runtime/device_api.h>
diff --git a/src/relax/ir/dataflow_pattern.cc b/src/relax/ir/dataflow_pattern.cc
index 0e9f9df4df..56389c63f5 100644
--- a/src/relax/ir/dataflow_pattern.cc
+++ b/src/relax/ir/dataflow_pattern.cc
@@ -24,7 +24,6 @@
#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/reflection/registry.h>
-#include <tvm/ir/repr.h>
#include <tvm/relax/dataflow_pattern.h>
#include <tvm/relax/dataflow_pattern_functor.h>
diff --git a/src/relax/ir/transform.cc b/src/relax/ir/transform.cc
index 4b4c7077c6..0a80de9a4e 100644
--- a/src/relax/ir/transform.cc
+++ b/src/relax/ir/transform.cc
@@ -22,10 +22,10 @@
* \brief Relax specific transformation passes.
*/
#include <tvm/ffi/cast.h>
+#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ffi/rvalue_ref.h>
-#include <tvm/ir/repr.h>
#include <tvm/relax/analysis.h>
#include <tvm/relax/expr_functor.h>
#include <tvm/relax/struct_info_functor.h>
diff --git a/src/script/printer/script_printer.cc
b/src/script/printer/script_printer.cc
index a7cb7cff65..f3fc27cf42 100644
--- a/src/script/printer/script_printer.cc
+++ b/src/script/printer/script_printer.cc
@@ -21,7 +21,6 @@
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ir/cast.h>
#include <tvm/ir/expr.h>
-#include <tvm/ir/repr.h>
#include <tvm/script/printer/config.h>
#include <algorithm>
diff --git a/src/tirx/ir/transform.cc b/src/tirx/ir/transform.cc
index 74d225d0e9..7156f42114 100644
--- a/src/tirx/ir/transform.cc
+++ b/src/tirx/ir/transform.cc
@@ -21,10 +21,10 @@
* \file tirx/ir/transform.cc
* \brief TIR specific transformation passes.
*/
+#include <tvm/ffi/extra/dataclass.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ffi/rvalue_ref.h>
-#include <tvm/ir/repr.h>
#include <tvm/tirx/transform.h>
namespace tvm {