Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/config/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package config

import "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi"

// RuntimeConfig stores the config options for the NVIDIA Container Runtime
type RuntimeConfig struct {
DebugFilePath string `toml:"debug"`
Expand All @@ -31,6 +33,7 @@ type RuntimeConfig struct {
type modesConfig struct {
CSV csvModeConfig `toml:"csv"`
CDI cdiModeConfig `toml:"cdi"`
JitCDI jitCDIModeConfig `toml:"jit-cdi,omitempty"`
Legacy legacyModeConfig `toml:"legacy"`
}

Expand All @@ -43,6 +46,11 @@ type cdiModeConfig struct {
AnnotationPrefixes []string `toml:"annotation-prefixes"`
}

type jitCDIModeConfig struct {
// NVCDIFeatureFlags sets a list of nvcdi features explicitly.
NVCDIFeatureFlags []nvcdi.FeatureFlag `toml:"nvcdi-feature-flags,omitempty"`
}

type csvModeConfig struct {
MountSpecPath string `toml:"mount-spec-path"`
}
Expand Down
1 change: 1 addition & 0 deletions internal/modifier/cdi.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func newAutomaticCDISpecModifier(logger logger.Interface, cfg *config.Config, de
nvcdi.WithVendor(automaticDeviceVendor),
nvcdi.WithClass(perModeDeviceClass[mode]),
nvcdi.WithMode(mode),
nvcdi.WithFeatureFlags(cfg.NVIDIAContainerRuntimeConfig.Modes.JitCDI.NVCDIFeatureFlags...),
)
if err != nil {
return nil, fmt.Errorf("failed to construct CDI library for mode %q: %w", mode, err)
Expand Down
4 changes: 3 additions & 1 deletion pkg/nvcdi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ const (
// FeatureEnableExplicitDriverLibraries enables the inclusion of a list of
// explicit driver libraries.
FeatureEnableExplicitDriverLibraries = FeatureFlag("enable-explicit-driver-libraries")

// FeatureDisableNvsandboxUtils disables the use of nvsandboxutils when
// querying devices.
FeatureDisableNvsandboxUtils = FeatureFlag("disable-nvsandbox-utils")
FeatureDisableNvsandboxUtils = FeatureFlag("disable-nvsandboxutils")

// FeatureEnableCoherentAnnotations enables the addition of annotations
// coherent or non-coherent devices.
FeatureEnableCoherentAnnotations = FeatureFlag("enable-coherent-annotations")
Expand Down
5 changes: 5 additions & 0 deletions pkg/nvcdi/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ func WithFeatureFlags[T string | FeatureFlag](featureFlags ...T) Option {
o.featureFlags = make(map[FeatureFlag]bool)
}
for _, featureFlag := range featureFlags {
// The initial release of the FeatureDisableNvsandboxUtils feature
// flag included a typo which we handle here.
if string(featureFlag) == "disable-nvsandbox-utils" {
featureFlag = T(FeatureDisableNvsandboxUtils)
}
o.featureFlags[FeatureFlag(featureFlag)] = true
}
}
Expand Down