Skip to content

Commit 2de997e

Browse files
committed
Add discovery of arch-specific vulkan ICD
On some RPM-based platforms, the path of the Vulkan ICD file include an architecture-specific infix to distinguish it from other architectures. (Most notably x86_64 vs i686). This change attempts to discover the arch-specific ICD file in addition to the standard nvidia_icd.json. Signed-off-by: Evan Lezar <[email protected]>
1 parent fdcd250 commit 2de997e

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

internal/discover/graphics.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"os"
2222
"path/filepath"
23+
"runtime"
2324
"strings"
2425

2526
"github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
@@ -81,14 +82,25 @@ func NewGraphicsMountsDiscoverer(logger logger.Interface, driver *root.Driver, h
8182
// vulkan ICD files are at {{ .driverRoot }}/vulkan instead of in /etc/vulkan.
8283
func newVulkanConfigsDiscover(logger logger.Interface, driver *root.Driver) Discover {
8384
locator := lookup.First(driver.Configs(), driver.Files())
85+
86+
required := []string{
87+
"vulkan/icd.d/nvidia_icd.json",
88+
"vulkan/icd.d/nvidia_layers.json",
89+
"vulkan/implicit_layer.d/nvidia_layers.json",
90+
}
91+
// For some RPM-based driver packages, the vulkan ICD files are installed to
92+
// /usr/share/vulkan/icd.d/nvidia_icd.%{_target_cpu}.json
93+
// We also include this in the list of candidates for the ICD file.
94+
switch runtime.GOARCH {
95+
case "amd64":
96+
required = append(required, "vulkan/icd.d/nvidia_icd.x86_64.json")
97+
case "arm64":
98+
required = append(required, "vulkan/icd.d/nvidia_icd.aarch64.json")
99+
}
84100
return &mountsToContainerPath{
85-
logger: logger,
86-
locator: locator,
87-
required: []string{
88-
"vulkan/icd.d/nvidia_icd.json",
89-
"vulkan/icd.d/nvidia_layers.json",
90-
"vulkan/implicit_layer.d/nvidia_layers.json",
91-
},
101+
logger: logger,
102+
locator: locator,
103+
required: required,
92104
containerRoot: "/etc",
93105
}
94106
}

0 commit comments

Comments
 (0)