Skip to content

Commit ea82489

Browse files
committed
Disable generation of coherent CDI specs by default
This change disables the functionality for splitting generated CDI specifications based on device coherence by default. This was added in #1247, but due to discussions around whether coherence is an property that should be exposed, we are disabling this by default. Note that users can opt in to the feature by running the `nvidia-ctk cdi generate` with the `--feature-flag=enable-coherent-annotations` command line flag. Alternatively the `nvidia-ctk cdi generate` command can be run with the `NVIDIA_CTK_CDI_GENERATE_FEATURE_FLAGS` enviroment set to include "enable-coherent-annotations" (in a comma-separated list). Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent e131f8e commit ea82489

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

cmd/nvidia-ctk/cdi/generate/generate_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"tags.cncf.io/container-device-interface/specs-go"
3030

3131
"github.com/NVIDIA/nvidia-container-toolkit/internal/test"
32-
"github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi"
3332
)
3433

3534
func TestGenerateSpec(t *testing.T) {
@@ -478,7 +477,6 @@ containerEdits:
478477
}
479478
tc.options.nvmllib = server
480479

481-
tc.options.featureFlags = []string{string(nvcdi.FeatureDisableCoherentAnnotations)}
482480
specs, err := c.generateSpecs(&tc.options)
483481
require.ErrorIs(t, err, tc.expectedError)
484482

pkg/nvcdi/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const (
8080
// FeatureDisableNvsandboxUtils disables the use of nvsandboxutils when
8181
// querying devices.
8282
FeatureDisableNvsandboxUtils = FeatureFlag("disable-nvsandbox-utils")
83-
// FeatureDisableCoherentAnnotations disables the addition of annotations
83+
// FeatureEnableCoherentAnnotations enables the addition of annotations
8484
// coherent or non-coherent devices.
85-
FeatureDisableCoherentAnnotations = FeatureFlag("disable-coherent-annotations")
85+
FeatureEnableCoherentAnnotations = FeatureFlag("enable-coherent-annotations")
8686
)

pkg/nvcdi/full-gpu-nvml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (l *fullGPUDeviceSpecGenerator) device() (device.Device, error) {
112112
}
113113

114114
func (l *fullGPUDeviceSpecGenerator) getDeviceAnnotations() (map[string]string, error) {
115-
if l.featureFlags[FeatureDisableCoherentAnnotations] {
115+
if !l.featureFlags[FeatureEnableCoherentAnnotations] {
116116
return nil, nil
117117
}
118118

pkg/nvcdi/mig-device-nvml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (l *migDeviceSpecGenerator) GetUUID() (string, error) {
4141
}
4242

4343
func (l *nvmllib) newMIGDeviceSpecGeneratorFromDevice(i int, d device.Device, j int, m device.MigDevice) (*migDeviceSpecGenerator, error) {
44-
parent, err := l.newFullGPUDeviceSpecGeneratorFromDevice(i, d, map[FeatureFlag]bool{FeatureDisableCoherentAnnotations: true})
44+
parent, err := l.newFullGPUDeviceSpecGeneratorFromDevice(i, d, make(map[FeatureFlag]bool))
4545
if err != nil {
4646
return nil, err
4747
}

0 commit comments

Comments
 (0)