by boulos · 4y ago · 0 comments
DirectX and GL predated CUDA and already had opaque buffer allocation things (e.g., vertex buffers). Partly this was a function of limited fixed-function units, maximum sizes of frame buffers and texture dimensions, and so on.
But yes, CUDA had a memory model that wasn't necessarily "magic" but just like regular malloc and free, it's pretty obvious what it does. (And you just live with pinned memory, host <=> device copies, and so on).
See: https://on-demand.gputechconf.com/gtc/2017/presentation/s728...
And: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index....
However, the Windows driver infrastructure's unified memory support is much further behind, with the pre-Pascal feature set.
For those you'll have to use Linux. Note that WSL2 is considered as Windows for this, it's a driver infrastructure limitation in Windows.
It also allows for significantly more approachable programming models. For example: https://developer.nvidia.com/blog/accelerating-standard-c-wi...
The unified memory support in CUDA (originally intended for Denver, IIRC) is mostly a response to people finding it too hard to decide (a la mmap, really).
So it's not that CUDA doesn't have these. It's that it does, but many people never have to understand anything beyond "there's a thing called malloc, and there's host and device".
https://docs.nvidia.com/cuda/cuda-runtime-api/api-sync-behav...
Pinned memory is typically used to get around the synchronization aspects.