-
Notifications
You must be signed in to change notification settings - Fork 236
cuda.core.system: Add device attributes, and other simple device-related APIs #1447
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
base: main
Are you sure you want to change the base?
Conversation
mdboom
commented
Jan 9, 2026
- New or existing tests cover these changes.
- The documentation is up to date with these changes.
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
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 device-related APIs to the cuda.core.system module, expanding the device metadata and attribute capabilities. The changes introduce new properties for device information and support for additional device lookup methods via PCI bus ID.
Key changes:
- Added DeviceAttributes class exposing various device hardware attributes (multiprocessor count, memory size, engine counts, etc.)
- Added new Device properties: brand, index, attributes, is_c2c_mode_enabled, and persistence_mode_enabled (with setter)
- Enhanced Device constructor to support PCI bus ID lookup in addition to existing index and UUID methods
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| cuda_core/tests/system/test_system_device.py | Added comprehensive tests for new device properties (brand, PCI bus ID lookup, attributes, C2C mode, persistence mode); removed obsolete test_device_index_handle |
| cuda_core/docs/source/api.rst | Updated API documentation to include new system module exports (get_driver_branch, BrandType, DeviceAttributes) with reorganized ordering |
| cuda_core/cuda/core/system/_device.pyx | Implemented DeviceAttributes class, added BrandType export, extended Device with new properties and PCI bus ID constructor parameter, added persistence mode setter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @property | ||
| def memory_size_mb(self) -> int: | ||
| """ | ||
| Device memory size in MiB |
Copilot
AI
Jan 9, 2026
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.
The property name is memory_size_mb which suggests megabytes (MB), but the docstring says "MiB" which is mebibytes. These are different units: 1 MB = 1,000,000 bytes, while 1 MiB = 1,048,576 bytes. The naming should be consistent with the actual unit returned by the underlying NVML API to avoid confusion.
| Device memory size in MiB | |
| Device memory size in MB |
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.
This would be a deviation from the naming in NVML itself. What do you think, @leofang?
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.
Is it difficult to push a change to NVML? To correct the function so we can be consistent.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/ok to test |
|
|
/ok to test |