Stupid question about internals (api hooking, ...)
Hi, Sorry my question might be completely stupid but from what I can see I assume you use API hooking to redirect cuda calls to zluda ones. Why just providing nvcuda.dll is not enough ?
When I compare exports from nvidia/nvcuda64.dll and from zluda/nvcuda.dll I can see that the following functions are missing and I would like to know if it's normal ?
cuFuncGetName
cuGraphAddDependencies_v2
cuGraphAddNode_v2
cuGraphConditionalHandleCreate
cuGraphGetEdges_v2
cuGraphNodeGetDependencies_v2
cuGraphNodeGetDependentNodes_v2
cuGraphRemoveDependencies_v2
cuKernelGetName
cuStreamBeginCaptureToGraph
cuStreamBeginCaptureToGraph_ptsz
cuStreamGetCaptureInfo_v3
cuStreamGetCaptureInfo_v3_ptsz
cuStreamUpdateCaptureDependencies_v2
cuStreamUpdateCaptureDependencies_v2_ptsz
dumpbin /exports nvcuda.dll > nvcuda-exports.txt dumpbin /exports nvcuda64.dll > nvcuda64-exports.txt
Not a stupid question. We go through that all that mess of API hooking and detouring because there's a lot of creative ways applications load CUDA libraries. Sometimes they are linked load-time, sometimes run-time. Sometimes run-time linked dll has a load-time linked CUDA dependency.
This allows a user to opt into ZLUDA on a case-by-case basis.
We could have users just dump ZLUDA into "C:\Windows\System32". It would work and you can do this right now if you wish (it's your computer), but it can cause hard to debug problems. If there's no nvcuda.dll then an app can handle that just fine, maybe have a non-CUDA fallback path. If there's an incompatible nvcuda.dll then app can crash in unexpected ways. We don't want to start crashing unrelated applications on your PC for the convenience of not using zluda.exe
As for exports it's totally normal and expected. Those exports are just from the most recent CUDA (12.3). ZLUDA regenerated its exports last time for 12.1 or 12.2. Even if an app uses any of those new APIs, it will usually (implicitly, though CUDA runtime) query for its presence and fail gracefully.