|
| | TensorMemoryPool (size_t page_size=4096) |
| |
| virtual | ~TensorMemoryPool () |
| |
| virtual ffi::Tensor | Empty (ffi::ShapeView shape, DLDataType dtype, DLDevice device, ffi::Optional< ffi::String > mem_scope=std::nullopt) |
| | Return an owning compact tensor in ordinary global memory.
|
| |
| virtual ffi::Tensor | CreateView (ffi::Tensor backing, ffi::Shape shape, DLDataType dtype, uint64_t byte_offset=0, ffi::Optional< ffi::String > mem_scope=std::nullopt) |
| | Create a bounded owning view of a backing tensor.
|
| |
| void | Clear () |
| | Release cached backing; live tensors remain valid and may return later.
|
| |
| size_t | UsedMemory () const |
| | Bytes held by this pool, including checked-out backing.
|
| |
| | TVM_FFI_DECLARE_OBJECT_INFO ("runtime.TensorMemoryPool", TensorMemoryPool, ffi::Object) |
| |
A cache of owning device tensors.
Construct pools with ffi::make_object. Live tensors retain the pool directly; only unpooled backing tensors enter its cache. A backend supplies independent backing owners, never a deleter that calls or retains this pool.
This class protects host ownership, not device execution. An adapter must keep separate pools for incompatible contexts/streams, or establish device ordering before reuse. Callers must finish using tensors before releasing their owners.