This is an automated email from the ASF dual-hosted git repository.
cyx-6 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 0565724c23 [FFI][ABI] Bump tvm-ffi to 0.1.11rc2 (#19484)
0565724c23 is described below
commit 0565724c230a23a86620f6c3a6b36c7196108921
Author: Tianqi Chen <[email protected]>
AuthorDate: Thu Apr 30 11:06:40 2026 -0400
[FFI][ABI] Bump tvm-ffi to 0.1.11rc2 (#19484)
## Summary
Bumps `3rdparty/tvm-ffi` from `1fed0ae` (0.1.10) to `3c35034`
(0.1.11rc2).
Two TVM-side fixes are needed for the bump:
- `include/tvm/ir/type.h`: drop redundant `span` field registration
from `TupleTypeNode`, `FuncTypeNode`, and `TensorMapTypeNode`.
tvm-ffi now warns when a child re-registers an ancestor field;
`span` is already registered on `TypeNode` with `SEqHashIgnore`.
- `python/tvm/relax/frontend/torch/dynamo.py`: short-circuit
`to_torch_tensor` for `torch.Tensor` items. [tvm-ffi
#517](https://github.com/apache/tvm-ffi/pull/517) added
recursive DLPack container conversion so `torch.Tensor` inputs
auto-promote `Array` elements to `torch.Tensor` on iteration; the
helper previously only handled `tvm.runtime.Tensor` / `tvm_ffi.Array`.
---
3rdparty/tvm-ffi | 2 +-
include/tvm/ir/type.h | 9 +++------
python/tvm/relax/frontend/torch/dynamo.py | 5 +++++
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/3rdparty/tvm-ffi b/3rdparty/tvm-ffi
index 1fed0ae042..3c35034fd1 160000
--- a/3rdparty/tvm-ffi
+++ b/3rdparty/tvm-ffi
@@ -1 +1 @@
-Subproject commit 1fed0ae0421e614d45662e8ee6bcae353d3ab2ea
+Subproject commit 3c35034fd1026011736e19a4e0e1ed0f22058c42
diff --git a/include/tvm/ir/type.h b/include/tvm/ir/type.h
index d153cad70b..db6151fda7 100644
--- a/include/tvm/ir/type.h
+++ b/include/tvm/ir/type.h
@@ -198,9 +198,7 @@ class TupleTypeNode : public TypeNode {
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
- refl::ObjectDef<TupleTypeNode>()
- .def_ro("fields", &TupleTypeNode::fields)
- .def_ro("span", &TupleTypeNode::span);
+ refl::ObjectDef<TupleTypeNode>().def_ro("fields", &TupleTypeNode::fields);
}
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.TupleType", TupleTypeNode, TypeNode);
};
@@ -260,8 +258,7 @@ class FuncTypeNode : public TypeNode {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<FuncTypeNode>()
.def_ro("arg_types", &FuncTypeNode::arg_types)
- .def_ro("ret_type", &FuncTypeNode::ret_type)
- .def_ro("span", &FuncTypeNode::span);
+ .def_ro("ret_type", &FuncTypeNode::ret_type);
}
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.FuncType", FuncTypeNode, TypeNode);
};
@@ -292,7 +289,7 @@ class TensorMapTypeNode : public TypeNode {
public:
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
- refl::ObjectDef<TensorMapTypeNode>().def_ro("span",
&TensorMapTypeNode::span);
+ refl::ObjectDef<TensorMapTypeNode>();
}
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.TensorMapType", TensorMapTypeNode,
TypeNode);
};
diff --git a/python/tvm/relax/frontend/torch/dynamo.py
b/python/tvm/relax/frontend/torch/dynamo.py
index a490054aee..c8fde62be2 100644
--- a/python/tvm/relax/frontend/torch/dynamo.py
+++ b/python/tvm/relax/frontend/torch/dynamo.py
@@ -58,6 +58,11 @@ def relax_dynamo(pipeline: tvm.transform.Pass | None = None):
def to_torch_tensor(nd_tensor):
"""A helper function to transfer a Tensor to torch.tensor."""
+ if isinstance(nd_tensor, torch.Tensor):
+ # tvm-ffi #517 (Recursive DLPack container conversion)
auto-converts
+ # ffi::Tensor items returned in containers back to
torch.Tensor when
+ # the call site passed torch.Tensor inputs.
+ return nd_tensor
if isinstance(nd_tensor, tvm.runtime.Tensor):
return torch.from_numpy(nd_tensor.numpy())
elif isinstance(nd_tensor, tvm_ffi.Array):