-
Notifications
You must be signed in to change notification settings - Fork 165
Apply __new__
approach to disabling __init__
#484
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
Conversation
The starting point for this change was extracted from PR NVIDIA#458: * NVIDIA#458 (comment) * NVIDIA#458 (comment)
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
/ok to test |
This comment has been minimized.
This comment has been minimized.
Looks fine to me! Merge? |
I forgot that I wanted to add a couple more small tests. Doing that now. |
@leofang Test coverage is now systematically complete, covering "front doors" and "back doors"; see comments added with commit eda324f. Testing that the back doors are locked is done through APIs that are unavoidably (for all practical purposes) visible through public APIs. Recently I experienced pushback when testing private functionality under the CCCL repo, so I asked ChatGPT about it: The lists of pros and cons are complex. I'm convinced it would be unproductive to be to pure one way or another, case-by-case judgement is important. That's how I decided to add tests that ensure the back doors are locked, and remain so. |
/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.
LGTM other than fixing one error message.
self._device_id = None # delayed | ||
self._ctx_handle = None # delayed |
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.
IIUC this is actually a bug fix too! I wonder why it wasn't caught before...
self._device_id = None # delayed | ||
self._ctx_handle = None # delayed |
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.
ditto
NVIDIA#484 (comment) Right now, if one wants to create a stream from a protocol-supported object, the intended way is to do `s = Device().create_stream(object_with_dunder_cuda_stream)`.
Since the previous run was green and the most recent change is comment-only, I suggest we admin-merge this without another CI run. @rwgk ready? |
Yes, please! :-) |
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Contributes to #198
Make disabling
__init__
uniform across cuda.core:Use
@classmethod
as the only constructor: Best for strict enforcement.Uniform
raise RuntimeError()
with a standardized message form.The starting point for this change was extracted from PR #458:
Clearer error messages (cuda.core) #458 (comment)
Clearer error messages (cuda.core) #458 (comment)