Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Conversation

@ericcurtin
Copy link
Contributor

@ericcurtin ericcurtin commented Sep 20, 2025

Need this to talk to device via Vulkan, ROCm, etc.

Summary by Sourcery

Enable passthrough of various AI accelerator devices (e.g., DRM, ROCm, DaVinci) by globbing known /dev paths and adding them to the container’s device mappings with read-write-mount permissions.

New Features:

  • Automatically detect and mount AI accelerator device nodes into the controller container

Enhancements:

  • Silently skip glob or stat errors when scanning for accelerator devices

@gemini-code-assist
Copy link

Summary of Changes

Hello @ericcurtin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances container creation by enabling automatic detection and mounting of AI accelerator devices. The change ensures that containers can access necessary hardware interfaces, such as those used by Vulkan or ROCm, by mapping relevant device files from the host into the container during its setup. This streamlines the process for applications requiring direct hardware access for AI workloads.

Highlights

  • AI Accelerator Device Mounting: Introduced new logic within CreateControllerContainer to automatically detect and mount common AI accelerator devices into the container. This includes paths like /dev/dri, /dev/kfd, /dev/accel, and others.
  • Dynamic Device Detection: The implementation uses filepath.Glob to find potential device files based on predefined paths and os.Stat to confirm their existence before adding them as device mappings to the container's host configuration.
  • Dependency Update: The path/filepath package was imported to facilitate the globbing functionality required for dynamic device path detection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 20, 2025

Reviewer's Guide

This PR extends CreateControllerContainer to automatically detect and mount AI accelerator devices (e.g., Vulkan, ROCm) by globbing common device paths under /dev and adding them to the container’s hostConfig.Devices with proper permissions.

File-Level Changes

Change Details Files
Enable automatic mounting of AI accelerator devices in CreateControllerContainer
  • Imported the filepath package
  • Defined a list of common accelerator device path patterns
  • Used filepath.Glob to locate matching device files, skipping errors to avoid creation failures
  • Appended each existing device path to hostConfig.Devices with read-write-mount permissions
pkg/standalone/containers.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for mounting AI accelerator devices into the controller container. The implementation is straightforward, but there are a couple of areas for improvement regarding maintainability and efficiency. I've suggested extracting the hardcoded device paths into a package-level variable and removing a redundant os.Stat call to optimize the device discovery loop. These changes will make the code cleaner and more performant.

@ericcurtin ericcurtin force-pushed the ai-accelerator-device-mounting-support branch from 6edf099 to 2ffd27c Compare September 20, 2025 13:59
Need this to talk to device via Vulkan, ROCm, etc.

Signed-off-by: Eric Curtin <[email protected]>
@ericcurtin ericcurtin force-pushed the ai-accelerator-device-mounting-support branch from 2ffd27c to bf84c9d Compare September 20, 2025 14:01
@ericcurtin ericcurtin merged commit f611d70 into docker:main Sep 22, 2025
5 checks passed
@ericcurtin ericcurtin deleted the ai-accelerator-device-mounting-support branch September 22, 2025 09:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants