feat(gpu): add WSL2 CDI spec watcher for GPU passthrough#608
Open
feat(gpu): add WSL2 CDI spec watcher for GPU passthrough#608
Conversation
On WSL2 hosts the NVIDIA device plugin generates CDI specs that cannot be used directly by k3s containerd since it includes a single device name "all" and not one based on the index or UUID of the device. Add a background watch_cdi_specs function to cluster-entrypoint.sh that: - detects WSL2 via /dev/dxg presence - handles specs already present at gateway restart - uses inotifywait to watch for new/updated specs - transforms the spec with jq (cdiVersion=0.5.0, devices[0].name="0") Add inotify-tools and jq to the cluster image apt-get install block to support the watcher. Signed-off-by: Evan Lezar <elezar@nvidia.com>
…architecture Signed-off-by: Evan Lezar <elezar@nvidia.com>
2f1232c to
31ea520
Compare
Member
Author
|
I'm marking this as ready, but it depends on the mentioned PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a CDI spec watcher for WSL2 GPU passthrough. On WSL2, the NVIDIA device plugin writes a CDI spec that references
/dev/dxgbut uses a device name incompatible with theindex-baseddeviceIDStrategy. The watcher transforms this spec at startup and on subsequent updates so the device plugin can correctly enumerate GPUs in WSL2 environments.Related Issue
Closes #404
Depends on #495 and #503.
Changes
deploy/docker/cluster-entrypoint.sh: addswatch_cdi_specsfunction that transforms the device plugin's WSL CDI spec (k8s.device-plugin.nvidia.com-gpu.json) to setcdiVersion: 0.5.0and normalize the device name to"0". Watcher runs as a background process when/dev/dxgis present.deploy/docker/Dockerfile.images: addsinotify-toolsandjqdependencies required by the watcher.deploy/helm/nvidia-device-plugin-helmchart.yaml: setsdeviceIDStrategy: indexso device IDs align with the transformed CDI spec.architecture/gateway-single-node.md: documents the WSL2 CDI spec watcher design and its interaction with the device plugin.Testing
mise run pre-commitpassesChecklist