Skip to content

Add Vulkan patches and update Docker build process#671

Open
ericcurtin wants to merge 1 commit intomainfrom
16k-patches
Open

Add Vulkan patches and update Docker build process#671
ericcurtin wants to merge 1 commit intomainfrom
16k-patches

Conversation

@ericcurtin
Copy link
Contributor

Add three Vulkan driver patches to fix venus compatibility, force 16k alignment for allocations, and silence stuck wait messages. Update Dockerfile to copy all scripts and install patched Mesa drivers on ARM64 systems. This ensure Linux VMs with 4k kernels can use Vulkan on macOS which has a 16k kernel.

@gemini-code-assist
Copy link
Contributor

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 significantly enhances Vulkan compatibility and performance for specific deployment environments, particularly for Linux virtual machines on macOS. By integrating targeted driver patches and refining the Docker build process, it resolves critical allocation and compatibility issues, ensuring a smoother and more functional Vulkan experience. The changes are focused on enabling robust graphics capabilities in previously challenging configurations.

Highlights

  • Vulkan Driver Patches: Three new Vulkan driver patches have been added to address specific issues: reverting Venus physical device filtering, forcing 16k alignment for memory allocations, and silencing 'stuck in wait' log messages.
  • Docker Build Process Update: The Dockerfile has been updated to copy all scripts into a dedicated directory and then remove them after execution, streamlining the build process.
  • Conditional Mesa Driver Installation: The apt-install.sh script now conditionally rebuilds and installs patched Mesa drivers from source specifically for ARM64 systems, ensuring compatibility with 16k kernel macOS hosts.
  • Linux VM Vulkan Compatibility: These changes collectively enable Vulkan usage on Linux VMs running 4k kernels when hosted on macOS systems with 16k kernels.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Dockerfile
    • Updated the script copying mechanism to copy the entire scripts/ directory to /scripts/.
    • Modified the RUN command to execute apt-install.sh from its new location and then remove the /scripts directory.
  • scripts/0001-Revert-venus-filter-out-venus-incapable-physical-dev.patch
    • Added a new patch file to revert a change that filtered out Venus-incapable physical devices in vn_physical_device.c.
  • scripts/0001-virtio-vulkan-force-16k-alignment-for-allocations-HA.patch
    • Added a new patch file to introduce 16k memory alignment for Vulkan allocations in vn_device_memory.c, vn_renderer_virtgpu.c, and vn_ring.c.
  • scripts/0002-virtio-vulkan-silence-stuck-in-wait-message-HACK.patch
    • Added a new patch file to comment out a logging message related to 'stuck in wait' in vn_common.c.
  • scripts/apt-install.sh
    • Introduced SCRIPT_DIR variable for path management.
    • Added enable_source_repos function to enable deb-src repositories for building packages.
    • Implemented rebuild_and_install_mesa function to fetch, patch, and build Mesa drivers from source, applying the three new Vulkan patches.
    • Modified the main installation logic to call rebuild_and_install_mesa specifically when running on an aarch64 architecture, otherwise installing standard mesa-vulkan-drivers.
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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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.

Copy link
Contributor

@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 - I've left some high level feedback:

  • On Debian/Ubuntu images uname -m typically returns arm64 rather than aarch64, so the aarch64 check in apt-install.sh may never trigger; consider using dpkg --print-architecture or checking for both values.
  • The enable_source_repos function rewrites all .sources files and uncomments all deb-src lines globally, which may be broader than needed; you might want to scope this to the specific Ubuntu repo entries you rely on to avoid unexpected side effects.
  • The temporary build directory for rebuilding Mesa is only cleaned up on success; using a trap to remove it on exit or error would avoid leaving build artifacts around when the script fails midway.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- On Debian/Ubuntu images `uname -m` typically returns `arm64` rather than `aarch64`, so the aarch64 check in `apt-install.sh` may never trigger; consider using `dpkg --print-architecture` or checking for both values.
- The `enable_source_repos` function rewrites all `.sources` files and uncomments all `deb-src` lines globally, which may be broader than needed; you might want to scope this to the specific Ubuntu repo entries you rely on to avoid unexpected side effects.
- The temporary build directory for rebuilding Mesa is only cleaned up on success; using a `trap` to remove it on exit or error would avoid leaving build artifacts around when the script fails midway.

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
Contributor

@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 introduces patches for the Vulkan driver to enhance compatibility and performance, particularly for running on macOS with a 16k kernel via a Linux VM. The Docker build process is updated to apply these patches and build a custom Mesa driver for ARM64 systems. The changes are logical and well-structured. I have a couple of suggestions on the patch files to improve maintainability and reduce risks, particularly regarding a magic number and a commented-out log message.

Add three Vulkan driver patches to fix venus compatibility, force 16k
alignment for allocations, and silence stuck wait messages. Update
Dockerfile to copy all scripts and install patched Mesa drivers on ARM64
systems. This ensure Linux VMs with 4k kernels can use Vulkan on macOS
which has a 16k kernel.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant