Skip to content

internal/discover: use explicit driver version for matching libraries#1578

Closed
Ronitsabhaya75 wants to merge 1 commit into
NVIDIA:mainfrom
Ronitsabhaya75:main
Closed

internal/discover: use explicit driver version for matching libraries#1578
Ronitsabhaya75 wants to merge 1 commit into
NVIDIA:mainfrom
Ronitsabhaya75:main

Conversation

@Ronitsabhaya75

Copy link
Copy Markdown
Contributor

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.

pattern := strings.TrimSuffix(libraryName, ".") + ".*.*"

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.

pattern := strings.TrimSuffix(libraryName, ".") + "." + d.driverVersion

@copy-pr-bot

copy-pr-bot Bot commented Jan 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment on lines -112 to -113
logger logger.Interface
hookCreator HookCreator

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

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

Comment thread 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

Copy link
Copy Markdown
Member

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 elezar left a comment

Copy link
Copy Markdown
Member

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.

@Ronitsabhaya75

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution addressing a long-outstanding TODO.

I think it looks fine in practice, but needs some minor cleanup.

@elezar I'll work on those reviews and clean it up

@Ronitsabhaya75
Ronitsabhaya75 requested a review from elezar January 14, 2026 16:49

@elezar elezar left a comment

Copy link
Copy Markdown
Member

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.

Comment thread internal/discover/graphics.go Outdated
Comment on lines +112 to +115
// driverVersion is the version of the driver that is being used.
driverVersion string
logger logger.Interface
hookCreator HookCreator

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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

Comment thread internal/discover/graphics.go Outdated
Comment on lines +168 to +171
Discover: Merge(libraries, xorgLibraries),
logger: logger,
hookCreator: hookCreator,
driverVersion: driverVersion,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Discover: Merge(libraries, xorgLibraries),
logger: logger,
hookCreator: hookCreator,
driverVersion: driverVersion,
Discover: Merge(libraries, xorgLibraries),
logger: logger,
hookCreator: hookCreator,
driverVersionSuffix: "." + driverVersion,

Comment thread internal/discover/graphics.go Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Copy Markdown
Contributor Author

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

@elezar elezar added this to the v1.19.0 milestone Jan 22, 2026
@Ronitsabhaya75
Ronitsabhaya75 requested a review from elezar February 8, 2026 15:11
@elezar elezar modified the milestones: v1.19.0, next-minor Feb 9, 2026
@rajatchopra

Copy link
Copy Markdown

@Ronitsabhaya75 Please ensure that your commit is signed off. Use git commit -s.

@cdesiniotis

Copy link
Copy Markdown
Contributor

@Ronitsabhaya75 are you able to rebase (and resolve the merge conflicts) and sign off your commit? Thanks.

@Ronitsabhaya75

Copy link
Copy Markdown
Contributor Author

@Ronitsabhaya75 are you able to rebase (and resolve the merge conflicts) and sign off your commit? Thanks.

Yeah I'm bit busy with my school tests right now and completely forgot about this :(

Signed-off-by: Ronit Sabhaya <ronitsabhaya75@gmail.com>
@Ronitsabhaya75

Copy link
Copy Markdown
Contributor Author

@rajatchopra @cdesiniotis did the work I'm really sorry I got caught between classes and completely forgot about this :(

hookCreator HookCreator
// driverVersionSuffix is the version of the driver that is being used
// prefixed with a '.'
driverVersionSuffix string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see an advantage to using the driverVersionSuffix over the driverVersion as the struct field. The latter reads better IMO and is more "reusable" should we ever want to use the same information for something else in the future.

func (d graphicsDriverLibraries) isDriverLibrary(filename string, libraryName string) bool {
// TODO: Instead of `.*.*` we could use the driver version.
pattern := strings.TrimSuffix(libraryName, ".") + ".*.*"
pattern := libraryName + d.driverVersionSuffix

@tariq1890 tariq1890 Jun 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding to my earlier comment, I'd just build the string here by concatenating the libraryName, . and d.driverVersion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elezar It looks like my comment contradicts the review comment you've provided earlier. Let me know if you have any concerns with my reasoning here or If I've missed anything

@tariq1890

Copy link
Copy Markdown
Contributor

@Ronitsabhaya75 Gentle reminder to address the remaining review comments

@tariq1890

Copy link
Copy Markdown
Contributor

Closing as #1948 has been merged.

Thank you @Ronitsabhaya75 for your contribution! You have been added as a co-author in the other PR

@tariq1890 tariq1890 closed this Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants