-
Notifications
You must be signed in to change notification settings - Fork 467
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?
Changes from all commits
e1c13bd
1ac460c
66e907b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -109,17 +109,21 @@ func newVulkanConfigsDiscover(logger logger.Interface, driver *root.Driver) Disc | |||||||||||||||||||
|
|
||||||||||||||||||||
| type graphicsDriverLibraries struct { | ||||||||||||||||||||
| Discover | ||||||||||||||||||||
| logger logger.Interface | ||||||||||||||||||||
| hookCreator HookCreator | ||||||||||||||||||||
| // driverVersion is the version of the driver that is being used. | ||||||||||||||||||||
| driverVersion string | ||||||||||||||||||||
| logger logger.Interface | ||||||||||||||||||||
| hookCreator HookCreator | ||||||||||||||||||||
|
Comment on lines
+112
to
+115
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var _ Discover = (*graphicsDriverLibraries)(nil) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| func newGraphicsLibrariesDiscoverer(logger logger.Interface, driver *root.Driver, hookCreator HookCreator) (Discover, error) { | ||||||||||||||||||||
| cudaVersionPattern, err := driver.Version() | ||||||||||||||||||||
| driverVersion, err := driver.Version() | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return nil, fmt.Errorf("failed to get driver version: %w", err) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| // We use the driver version as a pattern for matching libraries. | ||||||||||||||||||||
| // This pattern is used to identify libraries that are part of the driver. | ||||||||||||||||||||
| cudaLibRoot, err := driver.GetDriverLibDirectory() | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return nil, fmt.Errorf("failed to get libcuda.so parent directory: %w", err) | ||||||||||||||||||||
|
|
@@ -140,8 +144,8 @@ func newGraphicsLibrariesDiscoverer(logger logger.Interface, driver *root.Driver | |||||||||||||||||||
| // * libnvidia-allocator.so.RM_VERSION | ||||||||||||||||||||
| // * libnvidia-vulkan-producer.so.RM_VERSION | ||||||||||||||||||||
| // but need to be handled for the legacy case too. | ||||||||||||||||||||
| "libnvidia-allocator.so." + cudaVersionPattern, | ||||||||||||||||||||
| "libnvidia-vulkan-producer.so." + cudaVersionPattern, | ||||||||||||||||||||
| "libnvidia-allocator.so." + driverVersion, | ||||||||||||||||||||
| "libnvidia-vulkan-producer.so." + driverVersion, | ||||||||||||||||||||
| }, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -156,14 +160,15 @@ func newGraphicsLibrariesDiscoverer(logger logger.Interface, driver *root.Driver | |||||||||||||||||||
| driver.Root, | ||||||||||||||||||||
| []string{ | ||||||||||||||||||||
| "nvidia_drv.so", | ||||||||||||||||||||
| "libglxserver_nvidia.so." + cudaVersionPattern, | ||||||||||||||||||||
| "libglxserver_nvidia.so." + driverVersion, | ||||||||||||||||||||
| }, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return &graphicsDriverLibraries{ | ||||||||||||||||||||
| Discover: Merge(libraries, xorgLibraries), | ||||||||||||||||||||
| logger: logger, | ||||||||||||||||||||
| hookCreator: hookCreator, | ||||||||||||||||||||
| Discover: Merge(libraries, xorgLibraries), | ||||||||||||||||||||
| logger: logger, | ||||||||||||||||||||
| hookCreator: hookCreator, | ||||||||||||||||||||
| driverVersion: driverVersion, | ||||||||||||||||||||
|
Comment on lines
+168
to
+171
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
| }, nil | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -231,8 +236,7 @@ func (d graphicsDriverLibraries) Hooks() ([]Hook, error) { | |||||||||||||||||||
|
|
||||||||||||||||||||
| // isDriverLibrary checks whether the specified filename is a specific driver library. | ||||||||||||||||||||
| 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 | ||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Note that we never call this function with a libraryName ending in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||||||||||||||||||
| match, _ := filepath.Match(pattern, filename) | ||||||||||||||||||||
| return match | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
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.
@elezar I accidentally removed those members lemme revert those. I'm really sorry for this mistake