[FEA] Ensure MatX can be loaded on machines without an NVIDIA driver
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 127
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem? Please describe.
This stems from https://github.com/NVIDIA/MatX/issues/1243.
MatX currently makes occasional use of the CUDA driver APIs directly. MatX can be compiled on a machine without an NVIDIA driver, using the driver stubs, but the driver library is DT_NEEDED on linux. This in turn prevents a library (or app) using MatX from being loaded on linux, on machines without an NVIDIA driver. On Windows, the issue is less severe since, at least in my very limited Windows knowledge, libraries are loaded lazily only when a symbol is requested.
Describe the solution you'd like
MatX should ideally always be loadable, even on machines without a driver. This allows e.g. an application using MatX to be started, then probing the driver availability to select the appropriate implementation. A test should verify this case.
Describe alternatives you've considered
An alternative I could think of is creating a thin shared library wrapper, only to be loaded conditionally at runtime. This is the usual approach in frameworks like, e.g., onnxruntime, it works as expected, but largely defies the purpose of having a header-only library. It also leads to concerns related to code protection in contexts where static linking is the norm.
Additional context
I am not very familiar with low-level CUDA driver APIs, even less so with MatX code, but some research reveals that driver calls can usually be replaced by CUDA-runtime calls. Such calls are largely equivalent, even if not identical, and ensure that the driver is only loaded if available through the CUDA runtime itself.
I prepared a tentative patch, leveraging to a large extent a LLM, in https://github.com/NVIDIA/MatX/pull/1247. While I built and tested the code successfully on a local machine, please only take it as a possible starting point. I am using such patch in further tests I am doing with MatX.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the tentative changes in PR #1247 and locating MatX's direct CUDA driver API uses described in the issue. Compare the proposed driver calls with CUDA-runtime alternatives, then add a test that verifies MatX can be loaded without an NVIDIA driver.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- hpc
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100