Skip to content

[FEA]: cuda.core constructs which share underlying C structure should hash to same value #664

@carterbox

Description

@carterbox

Is this a duplicate?

Area

cuda.core

Is your feature request related to a problem? Please describe.

Both cupy and pytorch define __hash__() methods which use the pointer address (and sometimes device index) of the underlying CUDA API structure such two Python level objects which represent the same underlying CUDA API structure will hash the same.

https://github.com/pytorch/pytorch/blob/v2.7.0/torch/cuda/streams.py#L14
https://github.com/cupy/cupy/blob/v13.4.1/cupy/cuda/stream.pyx

Describe the solution you'd like

cuda.core should also implement __hash__() such that caching and comparison are easier to implement.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

P1Medium priority - Should docuda.coreEverything related to the cuda.core moduleenhancementAny code-related improvements

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions