diff --git a/pkg/standalone/containers.go b/pkg/standalone/containers.go index 78759e3..0b3439f 100644 --- a/pkg/standalone/containers.go +++ b/pkg/standalone/containers.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "os" + "path/filepath" "strconv" "strings" "time" @@ -272,6 +273,32 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, hostConfig.DeviceRequests = []container.DeviceRequest{{Count: -1, Capabilities: [][]string{{"gpu"}}}} } + // devicePaths contains glob patterns for common AI accelerator device files. + // Enable access to AI accelerator devices if they exist + devicePaths := []string{ + "/dev/dri", // Direct Rendering Infrastructure (used by Vulkan, Mesa, Intel/AMD GPUs) + "/dev/kfd", // AMD Kernel Fusion Driver (for ROCm) + "/dev/accel", // Intel accelerator devices + "/dev/davinci*", // TI DaVinci video processors + "/dev/devmm_svm", // Huawei Ascend NPU + "/dev/hisi_hdc", // Huawei Ascend NPU + } + + for _, path := range devicePaths { + devices, err := filepath.Glob(path) + if err != nil { + // Skip on glob error, don't fail container creation + continue + } + for _, device := range devices { + hostConfig.Devices = append(hostConfig.Devices, container.DeviceMapping{ + PathOnHost: device, + PathInContainer: device, + CgroupPermissions: "rwm", + }) + } + } + // Create the container. If we detect that a concurrent installation is in // progress (as indicated by a conflicting container name (which should have // been detected just before installation)), then we'll allow the error to