fix(cache): remove same-priority device conflicts - #144
Merged
Conversation
Signed-off-by: Evan Lezar <elezar@nvidia.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a cache correctness bug in Cache::refresh() where same-priority conflicts were reported as errors but could still remain resolvable after the refreshed device map replaced self.devices. The change aligns the Rust cache behavior with the Go CDI cache by ensuring conflicting fully-qualified device names are removed from the newly built local device map before it is installed into the cache.
Changes:
- Remove same-priority conflicting device names from the rebuilt
devicesmap (instead of mutating the soon-to-be-overwrittenself.devices). - Extend the conflict test to assert that
get_device()cannot resolve a device name involved in a same-priority conflict.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Make same-priority conflicts for a fully qualified CDI device name unresolvable after cache refresh. This aligns the Rust cache with the Go CDI cache, which removes conflicting names from the newly built local device map before installing it.
The Rust cache currently removes a conflict from
self.devicesand then overwrites that map with the rebuilt localdevicesmap, leaving the conflict selectable despiterefresh()reporting an error.Related Issue
No issue required: localized cache correctness fix.
Changes
get_device.Downstream motivation
OpenShell currently has a temporary workaround for this cache behavior in NVIDIA/OpenShell#2775. Once it updates to a release containing this fix, that workaround can be removed.
Testing
cargo test cache::testscargo fmt --check(the pinned Rust 1.94.0 toolchain lacks therustfmtcomponent in this environment)Checklist