Skip to content

Generate app profile for EGL/Vulkan use case#1939

Merged
henry118 merged 1 commit into
NVIDIA:mainfrom
henry118:app-profile
Jul 23, 2026
Merged

Generate app profile for EGL/Vulkan use case#1939
henry118 merged 1 commit into
NVIDIA:mainfrom
henry118:app-profile

Conversation

@henry118

Copy link
Copy Markdown
Member

Fixes #1899

The current CDI/CDI-JIT implementation does not create nvidia application profile in the CDI/JIT-CDI code path.

In the legacy mode, the profile is created when the container has the "graphics/display" capability.

Adding a hook for CDI mode to create the nvidia application profile.

Comment thread cmd/nvidia-cdi-hook/update-application-profile/minors_linux.go
Comment thread cmd/nvidia-cdi-hook/update-app-profile/minors_linux.go Outdated
Comment thread cmd/nvidia-cdi-hook/update-app-profile/update-app-profile.go Outdated
Comment thread internal/discover/hooks.go Outdated
Comment thread cmd/nvidia-cdi-hook/update-app-profile/update-app-profile.go Outdated
Comment thread internal/discover/app_profile.go Outdated
Comment thread cmd/nvidia-cdi-hook/update-app-profile/update-app-profile.go Outdated
Comment thread cmd/nvidia-cdi-hook/update-application-profile/minors_linux.go
Comment thread cmd/nvidia-cdi-hook/update-application-profile/minors_linux.go
Comment thread cmd/nvidia-cdi-hook/update-app-profile/minors_linux.go Outdated
@coveralls

coveralls commented Jul 14, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29937480821

Coverage decreased (-0.2%) to 43.635%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 93 uncovered changes across 4 files (17 of 110 lines covered, 15.45%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
cmd/nvidia-cdi-hook/update-application-profile/update-application-profile.go 62 13 20.97%
cmd/nvidia-cdi-hook/update-application-profile/minors_linux.go 40 0 0.0%
pkg/nvcdi/common-nvml.go 3 0 0.0%
cmd/nvidia-cdi-hook/commands/commands.go 1 0 0.0%
Total (6 files) 110 17 15.45%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15263
Covered Lines: 6660
Line Coverage: 43.63%
Coverage Strength: 0.49 hits per line

💛 - Coveralls

Comment thread cmd/nvidia-cdi-hook/update-app-profile/minors_linux.go Outdated

@tariq1890 tariq1890 left a comment

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.

Thanks @henry118 !

@henry118
henry118 requested a review from cdesiniotis July 20, 2026 20:41
Comment thread cmd/nvidia-cdi-hook/update-application-profile/minors_linux.go Outdated
// listDeviceNodes enumerates the entries under the container's /dev directory.
// The char-device check uses the cheap readdir type; the minor number is
// resolved for char-device entries.
func listDeviceNodes(containerRoot *os.Root) ([]deviceNode, error) {

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.

Potentially for a follow-up -- There may be an opportunity for code reuse here. We are essentially globbing for files in a root. We do this as well in the cudacompat hook, see

func (r root) globFiles(pattern string) ([]string, error) {
dir := filepath.Dir(pattern)
basePattern := filepath.Base(pattern)
d, err := pathrs.OpenatInRoot(r.File, dir)
if err != nil {
return nil, err
}
defer d.Close()
dirInRoot, err := pathrs.Reopen(d, unix.O_RDONLY|unix.O_DIRECTORY|unix.O_CLOEXEC)
if err != nil {
return nil, err
}
defer dirInRoot.Close()
dEntries, err := dirInRoot.ReadDir(-1)
if err != nil {
return nil, fmt.Errorf("failed to get dentries from %q: %w", dir, err)
}
var files []string
dir = strings.TrimPrefix(dirInRoot.Name(), r.Name())
for _, dentry := range dEntries {
if match, err := filepath.Match(basePattern, dentry.Name()); err != nil || !match {
continue
}
if dentry.IsDir() {
continue
}
if !dentry.Type().IsRegular() {
continue
}
files = append(files, filepath.Join(dir, dentry.Name()))
}
sort.Strings(files)
return files, nil
}
. We may benefit from a internal/root package that can be reused by all of our hooks. It should provide the ability to perform file operations "safely" in a root fs.

I was going to suggest we reuse the CharDeviceLocator, from https://github.com/NVIDIA/nvidia-container-toolkit/blob/main/pkg/lookup/device.go, but this code operates on file paths and therefore is not suitable for a hook where we don't trust the root fs we are operating on.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good suggestion. Let me create another PR for this refactor work to limit its scope.

Signed-off-by: Henry Wang <henrwang@nvidia.com>
@henry118
henry118 merged commit cee12f9 into NVIDIA:main Jul 23, 2026
90 of 103 checks passed
@henry118
henry118 deleted the app-profile branch July 23, 2026 17:22
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.

[Bug]: JIT-CDI graphics visibility is inconsistent on multi-GPU hosts: Vulkan works for one single-GPU pod but not another

4 participants