cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

RFC: Remove `StridedMemoryView` (to somewhere else)?

Open leofang opened this issue 2 months ago • 2 comments

As part of https://github.com/NVIDIA/cuda-python/issues/674#issuecomment-3656821898 it was raised that our library design should strictly follow what the underlying CUDA driver/runtime/library APIs offer (Update: added "library" to cover other CTK libraries such as NVRTC and cuFILE, I missed that when summarizing the meeting notes I took).

StridedMemoryView is not a fundamental object of CUDA and was offered only for Python users' convenience.

I have a somewhat strong opinion that a data structure should co-live with the data algorithm implementations. Otherwise, we do not know if a data structure is properly designed, and to test it would require us to duplicate the algorithms implemented elsewhere. Since we decided to purge StridedLayout, it would make sense to stick to the same design guidelines and purge SMV as well. It should be moved to the library that would provide algorithms that consume SMV.

This RFC aims for downstream SMV users to provide feedbacks.

leofang avatar Dec 15 '25 18:12 leofang

In an offline discussion @cpcloud pointed out that with Python memoryview assignment is allowed:

>>> m = memoryview(bytearray(10))
>>> m[1]
0
>>> m[1]= 3
>>> m[1]
3

This adds to another reason to move SMV elsewhere. We cannot possibly support assignment or in general anything that requires launching a CUDA kernel in cuda.core, unless we relax the design requirement that cuda.core offers abstractions on top of CUDA.

leofang avatar Dec 15 '25 19:12 leofang

(Update: I updated the issue description to cover CTK libraries such as NVRTC and cuFILE, I missed that when summarizing the meeting notes I took)

leofang avatar Dec 15 '25 19:12 leofang