Re: [PATCH 9/9] gpu/cuda: support CUDA 13 building

Thomas Monjalon
2025-12-05T08:55:38Z

17/09/2025 12:06, Thomas Monjalon:
> 15/09/2025 16:41, Gregory Etelson:
> > From: Bing Zhao <bingz@nvidia.com>
> >
> > The API name and prototype have been changed in the new CUDA, this
> > commit will ensure the compatibility with different versions.
> [...]
> > /* CUDA Driver functions loaded with cuGetProcAddress for versioning */
> > +#if defined(CUDA_VERSION) && (CUDA_VERSION >= 13000)
> > +static PFN_cuGetErrorString_v6000 pfn_cuGetErrorString;
> > +static PFN_cuGetErrorName_v6000 pfn_cuGetErrorName;
> > +static PFN_cuPointerSetAttribute_v6000 pfn_cuPointerSetAttribute;
> > +static PFN_cuDeviceGetAttribute_v2000 pfn_cuDeviceGetAttribute;
> > +static PFN_cuDeviceGetByPCIBusId_v4010 pfn_cuDeviceGetByPCIBusId;
> > +static PFN_cuDevicePrimaryCtxRetain_v7000 pfn_cuDevicePrimaryCtxRetain;
> > +static PFN_cuDevicePrimaryCtxRelease_v11000 pfn_cuDevicePrimaryCtxRelease;
> > +static PFN_cuDeviceTotalMem_v3020 pfn_cuDeviceTotalMem;
> > +static PFN_cuDeviceGetName_v2000 pfn_cuDeviceGetName;
> > +static PFN_cuCtxGetApiVersion_v3020 pfn_cuCtxGetApiVersion;
> > +static PFN_cuCtxSetCurrent_v4000 pfn_cuCtxSetCurrent;
> > +static PFN_cuCtxGetCurrent_v4000 pfn_cuCtxGetCurrent;
> > +static PFN_cuCtxGetDevice_v2000 pfn_cuCtxGetDevice;
> > +static PFN_cuCtxGetExecAffinity_v11040 pfn_cuCtxGetExecAffinity;
> > +static PFN_cuMemAlloc_v3020 pfn_cuMemAlloc;
> > +static PFN_cuMemFree_v3020 pfn_cuMemFree;
> > +static PFN_cuMemHostRegister_v6050 pfn_cuMemHostRegister;
> > +static PFN_cuMemHostUnregister_v4000 pfn_cuMemHostUnregister;
> > +static PFN_cuMemHostGetDevicePointer_v3020 pfn_cuMemHostGetDevicePointer;
> > +static PFN_cuFlushGPUDirectRDMAWrites_v11030 pfn_cuFlushGPUDirectRDMAWrites;
> > +#else
> > static PFN_cuGetErrorString pfn_cuGetErrorString;
> > static PFN_cuGetErrorName pfn_cuGetErrorName;
>
> What is the logic here?
> The old version keeps its original name, and new versions have a suffix?
> Why not use the old version?
> What will happen with next versions?

Looks like we cannot do better than this versioning
when using cuGetProcAddress to avoid linking CUDA.

Applied