-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
cuda.coreEverything related to the cuda.core moduleEverything related to the cuda.core moduleenhancementAny code-related improvementsAny code-related improvementstriageNeeds the team's attentionNeeds the team's attention
Milestone
Description
Example:
cuda-python/cuda_core/cuda/core/_stream.pyx
Lines 183 to 186 in 39e3293
| def __hash__(self) -> int: | |
| # Ensure context is initialized for hash consistency | |
| Stream_ensure_ctx(self) | |
| return hash((as_intptr(self._h_context), as_intptr(self._h_stream))) |
@stiepan reported offline that this is problematic because at least for streams we do not always know the CUDA context associated with them (we could be wrapping a foreign stream), and triggering a lookup is expensive. Some of the objects are even independent of CUDA contexts.
We decided to follow cccl-rt and do a simple pointer comparison for __eq__. We should stick to this principle for __hash__ as well.
kkraus14
Metadata
Metadata
Assignees
Labels
cuda.coreEverything related to the cuda.core moduleEverything related to the cuda.core moduleenhancementAny code-related improvementsAny code-related improvementstriageNeeds the team's attentionNeeds the team's attention