-
Notifications
You must be signed in to change notification settings - Fork 4
cdi: Add CDI spec generation #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds CDI (Container Device Interface) spec generation for NVIDIA GPUs and NVSwitches after device enumeration. The changes refactor device discovery to use go-nvlib's nvpci interface instead of manual filesystem operations, and generate CDI specifications before starting device plugins.
Changes:
- Replaced manual PCI device discovery with go-nvlib's nvpci library for device enumeration
- Added CDI spec generation for GPUs and NVSwitches with support for both IOMMUFD and legacy VFIO modes
- Refactored device structures to include additional metadata (device name, IommuFD, IsNVSwitch flag)
Reviewed changes
Copilot reviewed 7 out of 3089 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/device_plugin/generic_device_plugin.go | Improved context cancellation handling and removed manual VFIO device discovery logic |
| pkg/device_plugin/generic_device_plugin_test.go | Updated tests to use structured device data with complete PCI addresses and device metadata |
| pkg/device_plugin/device_plugin.go | Replaced filesystem-based device discovery with nvpci library and added device name formatting |
| pkg/device_plugin/device_plugin_test.go | Rewrote tests to use nvpci mocks instead of filesystem operations |
| pkg/device_plugin/constants.go | Added CDI-related constants and removed unused basePath variable |
| pkg/device_plugin/cdi.go | New file implementing CDI spec generation for discovered devices |
| go.mod | Updated Go version and added dependencies for nvpci and CDI libraries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
NvSwitches and GPUs are sorted |
Next step NVSWITCH_ALIAS |
rajatchopra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We can optimize the structures in a follow up if needed.
2813e05 to
6205624
Compare
After enumerating all the target devices, create the CDI spec before starting the device-plugin Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
After enumerating the needed devices via go-nvlib, create the CDI spec before starting the device-plugin.
Depends On: #25