gemini-code-assist[bot] commented on code in PR #236:
URL: https://github.com/apache/tvm-ffi/pull/236#discussion_r2504909957
##########
tests/python/test_stream.py:
##########
@@ -30,6 +31,24 @@
torch = None
+try:
+ from cuda.bindings import driver as cuda_driver # type:
ignore[import-not-found]
+except ImportError:
+ cuda_driver = None
+
+
[email protected](cuda_driver is None, reason="Requires cuda-python")
+def test_cuda_driver_stream() -> None:
+ assert cuda_driver is not None
+ echo = tvm_ffi.get_global_func("testing.echo")
+ stream = cuda_driver.CUstream(0)
+ y = echo(stream)
+ assert y is not None
+ z = echo(cuda_driver.CUstream(1))
+ isinstance(z, ctypes.c_void_p)
Review Comment:

This `isinstance` check is a statement and has no effect. To verify the type
of `z`, it should be an assertion.
```suggestion
assert isinstance(z, ctypes.c_void_p)
```
##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -301,6 +307,19 @@ cdef int TVMFFIPyArgSetterCUDAStream_(
return 0
+cdef int TVMFFIPyArgSetterCUDADriverStreamFallback_(
+ TVMFFIPyArgSetter* handle, TVMFFIPyCallContext* ctx,
+ PyObject* py_arg, TVMFFIAny* out
+) except -1:
+ """Setter for cuda stream protocol"""
Review Comment:

The docstring is a bit generic. It would be clearer if it specifically
mentioned that this is a fallback for `cuda.bindings.driver.CUstream` objects.
```
"""Setter for cuda.bindings.driver.CUstream as a fallback."""
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]