tqchen commented on a change in pull request #5324: [Runtime][Relay][Cleanup] 
Clean up for memory pass to enable heterogenous execution support.
URL: https://github.com/apache/incubator-tvm/pull/5324#discussion_r408199110
 
 

 ##########
 File path: include/tvm/relay/attrs/memory.h
 ##########
 @@ -27,10 +27,37 @@
 #include <tvm/ir/attrs.h>
 #include <tvm/relay/expr.h>
 #include <string>
+#include <vector>
 
 namespace tvm {
 namespace relay {
 
+std::vector<TensorType> FlattenTupleType(const Type& type);
+std::vector<Expr> FromTupleType(const Type& type, const Expr& expr);
+Expr ToTupleType(const Type& t, const Array<Expr>& exprs);
+
+/*!
+ * \brief Options for allocating storage.
+ */
+struct AllocStorageAttrs : public tvm::AttrsNode<AllocStorageAttrs> {
+  DataType dtype;
+  int device_id;
+  int device_type;
+
+  TVM_DECLARE_ATTRS(AllocStorageAttrs, "relay.attrs.AllocStorageAttrs") {
+    TVM_ATTR_FIELD(dtype)
+      .describe(
+         "The dtype of the tensor to allocate.")
+      .set_default(DataType::Float(32, 1));
+    TVM_ATTR_FIELD(device_id)
 
 Review comment:
   I think both of you talks about the same thing, but perhaps need some 
clarifications.
   
   I think the `device_id` here actually means a virtual device id that 
corresponds to a virtual device, and perhaps should not be confused with the 
actual device.
   
   Some alternative related APIs are
   
   
   - S0 `allocate_storage(device_type, 
TranslateDeviceIndex(virtual_device_id))`: directly calls low level allocation, 
translate device id translate virtual one into the real device
   - S1 `allocate_storage(virtual_device_id)`: implicitly calls translation 
under the hood

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to