-
Notifications
You must be signed in to change notification settings - Fork 466
internal/discover: use explicit driver version for matching libraries #1578
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
Signed-off-by: Ronit Sabhaya <ronitsabhaya75@gmail.com>
| logger logger.Interface | ||
| hookCreator HookCreator |
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.
Question: Why were these members removed?
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.
Question: Why were these members removed?
@elezar I accidentally removed those members lemme revert those. I'm really sorry for this mistake
internal/discover/graphics.go
Outdated
| } | ||
| // We use the driver version as a pattern for matching libraries. | ||
| // This pattern is used to identify libraries that are part of the driver. | ||
| cudaVersionPattern := driverVersion |
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.
Let's just update the strings below to use driverVersion directly.
elezar
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.
Thanks for the contribution addressing a long-outstanding TODO.
I think it looks fine in practice, but needs some minor cleanup.
Signed-off-by: Ronit Sabhaya <ronitsabhaya75@gmail.com>
@elezar I'll work on those reviews and clean it up |
…covery Signed-off-by: Ronit Sabhaya <ronitsabhaya75@gmail.com>
elezar
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.
Thanks. I have some further suggestions.
Please also rebase and squash your changes into a single commit.
| // driverVersion is the version of the driver that is being used. | ||
| driverVersion string | ||
| logger logger.Interface | ||
| hookCreator HookCreator |
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.
| // driverVersion is the version of the driver that is being used. | |
| driverVersion string | |
| logger logger.Interface | |
| hookCreator HookCreator | |
| logger logger.Interface | |
| hookCreator HookCreator | |
| // driverVersionSuffix is the version of the driver that is being used | |
| // prefixed with a '.' | |
| driverVersionSuffix string |
| Discover: Merge(libraries, xorgLibraries), | ||
| logger: logger, | ||
| hookCreator: hookCreator, | ||
| driverVersion: driverVersion, |
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.
| Discover: Merge(libraries, xorgLibraries), | |
| logger: logger, | |
| hookCreator: hookCreator, | |
| driverVersion: driverVersion, | |
| Discover: Merge(libraries, xorgLibraries), | |
| logger: logger, | |
| hookCreator: hookCreator, | |
| driverVersionSuffix: "." + driverVersion, |
| func (d graphicsDriverLibraries) isDriverLibrary(filename string, libraryName string) bool { | ||
| // TODO: Instead of `.*.*` we could use the driver version. | ||
| pattern := strings.TrimSuffix(libraryName, ".") + ".*.*" | ||
| pattern := strings.TrimSuffix(libraryName, ".") + "." + d.driverVersion |
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.
| pattern := strings.TrimSuffix(libraryName, ".") + "." + d.driverVersion | |
| pattern := libraryName + d.driverVersionSuffix |
Note that we never call this function with a libraryName ending in ., so we can remove the additional TrimSuffix to further simplify this.
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.
@elezar thank you for the review I'll sure work on the commits and once im free from work
Previous Behavior
The discovery logic used a generic . wildcard pattern to identify driver libraries. This was less precise and could potentially match unrelated files or incorrect versions.
Current Behavior
The update modifies graphicsDriverLibraries to explicitly use the detected driver version when constructing the match pattern. This ensures that only libraries matching the active driver version are processed, preventing false positives and ensuring consistency.