Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 0 additions & 143 deletions include/tvm/runtime/container/adt.h

This file was deleted.

52 changes: 0 additions & 52 deletions include/tvm/runtime/container/closure.h

This file was deleted.

2 changes: 0 additions & 2 deletions include/tvm/runtime/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ struct TypeIndex {
/*! \brief runtime::RPCObjectRef */
kRuntimeRPCObjectRef = 9,
// static assignments that may subject to change.
kRuntimeClosure,
kRuntimeADT,
kStaticIndexEnd,
/*! \brief Type index is allocated during runtime. */
kDynamic = kStaticIndexEnd
Expand Down
1 change: 0 additions & 1 deletion include/tvm/runtime/relax_vm/executable.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#ifndef TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_
#define TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_

#include <tvm/runtime/container/closure.h>
#include <tvm/runtime/object.h>
#include <tvm/runtime/packed_func.h>
#include <tvm/runtime/registry.h>
Expand Down
8 changes: 4 additions & 4 deletions include/tvm/runtime/relax_vm/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum class VMInstrumentReturnKind : int {
/*!
* \brief An object representing a vm closure.
*/
class VMClosureObj : public ClosureObj {
class VMClosureObj : public Object {
public:
/*!
* \brief The function name. The function could be any
Expand All @@ -78,14 +78,14 @@ class VMClosureObj : public ClosureObj {

static constexpr const uint32_t _type_index = TypeIndex::kDynamic;
static constexpr const char* _type_key = "relax.vm.Closure";
TVM_DECLARE_FINAL_OBJECT_INFO(VMClosureObj, ClosureObj);
TVM_DECLARE_FINAL_OBJECT_INFO(VMClosureObj, Object);
};

/*! \brief reference to closure. */
class VMClosure : public Closure {
class VMClosure : public ObjectRef {
public:
VMClosure(String func_name, PackedFunc impl);
TVM_DEFINE_OBJECT_REF_METHODS(VMClosure, Closure, VMClosureObj);
TVM_DEFINE_OBJECT_REF_METHODS(VMClosure, ObjectRef, VMClosureObj);

/*!
* \brief Create another PackedFunc with last arguments already bound to last_args.
Expand Down
10 changes: 0 additions & 10 deletions python/tvm/relax/op/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,6 @@ def render_object(val: tvm.Object) -> str:
"""
if isinstance(val, tvm.nd.NDArray):
return str(val)
# no pretty-printer by default, so if we don't handle this,
# then we can't look inside tuples
if isinstance(val, tvm.runtime.container.ADT):
# the fields array of an ADT cannot be directly accessed in Python
# so we have to get the length and index into the fields separately
fields = ", ".join([render_object(val[i]) for i in range(len(val))])
# special case: tag = 0 is a tuple
if val.tag == 0:
return f"({fields})"
return f"ADT(tag={val.tag}, fields=[{fields}])"
if isinstance(val, tvm.ir.Array):
fields = ", ".join([render_object(val[i]) for i in range(len(val))])
return f"({fields})"
Expand Down
53 changes: 0 additions & 53 deletions python/tvm/runtime/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Runtime container structures."""
import tvm._ffi
from .object import Object, PyNativeObject
from .object_generic import ObjectTypes
from . import _ffi_api


Expand Down Expand Up @@ -60,58 +59,6 @@ def getitem_helper(obj, elem_getter, length, idx):
return elem_getter(obj, idx)


@tvm._ffi.register_object("runtime.ADT")
class ADT(Object):
"""Algebatic data type(ADT) object.

Parameters
----------
tag : int
The tag of ADT.

fields : list[Object] or tuple[Object]
The source tuple.
"""

def __init__(self, tag, fields):
for f in fields:
assert isinstance(
f, ObjectTypes
), f"Expect object or tvm NDArray type, but received : {type(f)}"
self.__init_handle_by_constructor__(_ffi_api.ADT, tag, *fields)

@property
def tag(self):
return _ffi_api.GetADTTag(self)

def __getitem__(self, idx):
return getitem_helper(self, _ffi_api.GetADTFields, len(self), idx)

def __len__(self):
return _ffi_api.GetADTSize(self)


def tuple_object(fields=None):
"""Create a ADT object from source tuple.

Parameters
----------
fields : list[Object] or tuple[Object]
The source tuple.

Returns
-------
ret : ADT
The created object.
"""
fields = fields if fields else []
for f in fields:
assert isinstance(
f, ObjectTypes
), f"Expect object or tvm NDArray type, but received : {type(f)}"
return _ffi_api.Tuple(*fields)


@tvm._ffi.register_object("runtime.String")
class String(str, PyNativeObject):
"""TVM runtime.String object, represented as a python str.
Expand Down
32 changes: 0 additions & 32 deletions python/tvm/runtime/name_transforms.py

This file was deleted.

Loading
Loading