tqchen commented on code in PR #68:
URL: https://github.com/apache/tvm-ffi/pull/68#discussion_r2384408101
##########
tests/python/test_load_inline.py:
##########
@@ -193,9 +195,18 @@ def test_load_inline_cuda() -> None:
)
if torch is not None:
+ # test with raw stream
x_cuda = torch.asarray([1, 2, 3, 4, 5], dtype=torch.float32,
device="cuda")
y_cuda = torch.empty_like(x_cuda)
- mod.add_one_cuda(x_cuda, y_cuda)
+ mod.add_one_cuda(x_cuda, y_cuda, 0)
+ torch.testing.assert_close(x_cuda + 1, y_cuda)
+
+ # test with torch stream
+ y_cuda = torch.empty_like(x_cuda)
+ stream = torch.cuda.Stream()
+ with torch.cuda.stream(stream):
+ mod.add_one_cuda(x_cuda, y_cuda, stream.cuda_stream)
+ stream.synchronize()
torch.testing.assert_close(x_cuda + 1, y_cuda)
Review Comment:
likely needed for mypy
--
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]