Skip to content

Commit 491f42b

Browse files
rcombsBtbN
authored andcommitted
Add functions to identify devices in more ways
- cuDeviceGetUuid_v2, giving distinct IDs for different MIG instances - cuDeviceGetLuid, giving a Win32 LUID to match with DXGI and other APIs - cuDeviceGetByPCIBusId, retrieving a device that matches a PCI bus ID string - cuDeviceGetPCIBusId, giving a PCI bus ID string for a device Closes #11 Signed-off-by: Timo Rothenpieler <[email protected]>
1 parent 2055784 commit 491f42b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/ffnvcodec/dynlink_cuda.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal);
414414
typedef CUresult CUDAAPI tcuDeviceGetAttribute(int *pi, CUdevice_attribute attrib, CUdevice dev);
415415
typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev);
416416
typedef CUresult CUDAAPI tcuDeviceGetUuid(CUuuid *uuid, CUdevice dev);
417+
typedef CUresult CUDAAPI tcuDeviceGetUuid_v2(CUuuid *uuid, CUdevice dev);
418+
typedef CUresult CUDAAPI tcuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev);
419+
typedef CUresult CUDAAPI tcuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId);
420+
typedef CUresult CUDAAPI tcuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev);
417421
typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, CUdevice dev);
418422
typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int flags, CUdevice dev);
419423
typedef CUresult CUDAAPI tcuCtxSetLimit(CUlimit limit, size_t value);

include/ffnvcodec/dynlink_loader.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ typedef struct CudaFunctions {
142142
tcuDeviceGetAttribute *cuDeviceGetAttribute;
143143
tcuDeviceGetName *cuDeviceGetName;
144144
tcuDeviceGetUuid *cuDeviceGetUuid;
145+
tcuDeviceGetUuid_v2 *cuDeviceGetUuid_v2;
146+
tcuDeviceGetLuid *cuDeviceGetLuid;
147+
tcuDeviceGetByPCIBusId *cuDeviceGetByPCIBusId;
148+
tcuDeviceGetPCIBusId *cuDeviceGetPCIBusId;
145149
tcuDeviceComputeCapability *cuDeviceComputeCapability;
146150
tcuCtxCreate_v2 *cuCtxCreate;
147151
tcuCtxSetLimit *cuCtxSetLimit;
@@ -369,6 +373,10 @@ static inline int cuda_load_functions(CudaFunctions **functions, void *logctx)
369373
LOAD_SYMBOL(cuGraphicsResourceGetMappedPointer, tcuGraphicsResourceGetMappedPointer, "cuGraphicsResourceGetMappedPointer_v2");
370374

371375
LOAD_SYMBOL_OPT(cuDeviceGetUuid, tcuDeviceGetUuid, "cuDeviceGetUuid");
376+
LOAD_SYMBOL_OPT(cuDeviceGetUuid_v2, tcuDeviceGetUuid_v2, "cuDeviceGetUuid_v2");
377+
LOAD_SYMBOL_OPT(cuDeviceGetLuid, tcuDeviceGetLuid, "cuDeviceGetLuid");
378+
LOAD_SYMBOL_OPT(cuDeviceGetByPCIBusId, tcuDeviceGetByPCIBusId, "cuDeviceGetByPCIBusId");
379+
LOAD_SYMBOL_OPT(cuDeviceGetPCIBusId, tcuDeviceGetPCIBusId, "cuDeviceGetPCIBusId");
372380
LOAD_SYMBOL_OPT(cuImportExternalMemory, tcuImportExternalMemory, "cuImportExternalMemory");
373381
LOAD_SYMBOL_OPT(cuDestroyExternalMemory, tcuDestroyExternalMemory, "cuDestroyExternalMemory");
374382
LOAD_SYMBOL_OPT(cuExternalMemoryGetMappedBuffer, tcuExternalMemoryGetMappedBuffer, "cuExternalMemoryGetMappedBuffer");

0 commit comments

Comments
 (0)