tqchen commented on a change in pull request #7819:
URL: https://github.com/apache/tvm/pull/7819#discussion_r613236203
##########
File path: python/tvm/_ffi/runtime_ctypes.py
##########
@@ -262,9 +262,23 @@ def max_thread_dimensions(self):
"""
return json.loads(self._GetDeviceAttr(self.device_type,
self.device_id, 8))
- def sync(self):
+ def create_stream(self):
+ """Create a new runtime stream at the context."""
Review comment:
document the return value per numpy docs convention(see documentation
for max_thread_dimensions)
##########
File path: python/tvm/_ffi/runtime_ctypes.py
##########
@@ -262,9 +262,23 @@ def max_thread_dimensions(self):
"""
return json.loads(self._GetDeviceAttr(self.device_type,
self.device_id, 8))
- def sync(self):
+ def create_stream(self):
+ """Create a new runtime stream at the context."""
+ stream = ctypes.c_void_p()
+ check_call(_LIB.TVMStreamCreate(self.device_type, self.device_id,
ctypes.byref(stream)))
+ return stream
+
+ def free_stream(self, stream):
+ """Free a created stream handle."""
+ check_call(_LIB.TVMStreamFree(self.device_type, self.device_id,
stream))
+
+ def set_stream(self, stream):
+ """Set a created stream handle."""
Review comment:
document all arguments and return value
##########
File path: python/tvm/_ffi/runtime_ctypes.py
##########
@@ -262,9 +262,23 @@ def max_thread_dimensions(self):
"""
return json.loads(self._GetDeviceAttr(self.device_type,
self.device_id, 8))
- def sync(self):
+ def create_stream(self):
+ """Create a new runtime stream at the context."""
+ stream = ctypes.c_void_p()
+ check_call(_LIB.TVMStreamCreate(self.device_type, self.device_id,
ctypes.byref(stream)))
+ return stream
+
+ def free_stream(self, stream):
Review comment:
document the return value per numpy docs convention(see documentation
for max_thread_dimensions)
##########
File path: python/tvm/_ffi/runtime_ctypes.py
##########
@@ -262,9 +262,23 @@ def max_thread_dimensions(self):
"""
return json.loads(self._GetDeviceAttr(self.device_type,
self.device_id, 8))
- def sync(self):
+ def create_stream(self):
+ """Create a new runtime stream at the context."""
Review comment:
Given that the stream we have is quite low-level (not managed by python)
we might want to think about how to introduce a better pythonic wrapper later.
As a result, we might want to name the API more carefully to indicate it is a
low-level api.
How about we do `create_raw_stream`, and add a note that the user expects to
free the stream after use. Do the same thing for the other apis
--
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]