tqchen commented on code in PR #17571:
URL: https://github.com/apache/tvm/pull/17571#discussion_r1939843299
##########
include/tvm/runtime/device_api.h:
##########
@@ -135,12 +136,32 @@ class TVM_DLL DeviceAPI {
*/
virtual void* AllocDataSpace(Device dev, int ndim, const int64_t* shape,
DLDataType dtype,
Optional<String> mem_scope = NullOpt);
+
+ /*!
+ * \brief Create a new view with given spec over existing tensor.
+ * \param dev The device device to perform operation.
+ * \param data The source array.
+ * \param shape The shape of allocated tensor.
+ * \param dtype The type of elements.
+ * \param mem_scope The memory scope of allocated tensor.
+ * \return The allocated device pointer.
+ */
+ virtual void* AllocDataSpaceView(Device dev, void* data, ShapeTuple shape,
DLDataType dtype,
Review Comment:
We might be able to in tihs case have StorageObj to refer back to a raw ptr
of allocator, in this case
`StorageObj => AllocNDArrayWithScope => allocator_-> CreateView(Storage
storage)`. The main thing is you need an allocator specific dispatch to create
such view, while previously we don't have to.
That does mean allocator needs to have a new virtual function(CreateView)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]