-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix _util.device_from_ctx #203
Conversation
/ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I follow. self._device_id
could be None
if we wrap a foreign stream using Device.create_stream(obj=some_foreign_stream_object)
. Then, the cuStreamGetCtx
-> (set to the stream ctx) ->cuCtxGetDevice
-> (set back to original ctx) combo is the only way to reliably retrieve the device ID. get_device_from_ctx
is meant to make this combo cleaner.
How did you encounter a circular dependency? It might be an overlook in our test coverage depending on what the trigger path is. It is true that we forgot to import Device
in get_device_from_ctx
(good catch!), but circular dependency can be easily resolved by importing the object inside the function, as is already done in Stream.device
.
Thankyou for pointing out my oversight. I now clearly see that device_id is None when a foreign stream is provided. There are still some issues which I will seek to address, and will switch this from draft once I get it working / identify the problem. |
The changes import Device inside function to avoid circular import cdef class CUcontext:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, blocking the merge until we conclude beta 1 QA process.
Co-authored-by: Leo Fang <leof@nvidia.com>
The obvious issue is that both of these call get_device_from_ctx which references the unimported Device(). Importing it would cause a circular dependency. Importing it within the get_device_from_ctx solves that issue. A couple other little issues in the method itself are also addressed.
Expected behaviour is: The tests added, should fail without each of the _utils changes. They should pass with the changes. This was observed locally.
Closes #202