AMDVLK

From Gentoo Wiki
Jump to:navigation Jump to:search

AMDVLK (AMD Open source Driver for Vulkan) is an open-source Vulkan driver for AMD Radeon™ graphics adapters on Linux led by GPUOpen initiative.

AMDVLK can work with the AMDGPU driver or headlessly. It also greatly supports interoperability with the mesa RADV driver.

Prerequisites

Supported models

The AMD Open Source Driver for Vulkan is designed to support the following AMD GPUs. For the latest supported hardware, the amdvlk page on GitHub:

  • Radeon™ RX 7900 Series (since 2022.4.4)
  • Radeon™ RX 6900/6800/6700/6600/6500 Series
  • Radeon™ RX 5700/5600/5500 Series
  • Radeon™ RX Vega Series
  • Radeon™ RX 400/500 Series
  • Radeon™ Pro WX 9100, x200 Series
  • Radeon™ Pro W5700/W5500 Series

Hardware detection

Follow the hardware detection guide on the AMDGPU page if in doubt.

Vulkan ICD

The driver automatically pulls the vulkan ICD loader package. Check the Vulkan page for more information on choosing a Vulkan driver.

Additional system requirements to build

16 GiB of RAM are recommended to successfully build AMDVLK driver from source. On systems with less than 16 GiBs of RAM, try building the driver with single thread via MAKEOPTS="-j1" and play along with different compilation flags. Use CHECKREQS_DONOTHING=1 to bypass the memory checking during installation (check-reqs.eclass).

This can be performed in a one-shot from the command-line via:

root #CHECKREQS_DONOTHING=1 MAKEOPTS="-j1" emerge --ask media-libs/amdvlk

UPD: There are succesfull experiments with building it on vm with "-O1" optimization flag and 4GB RAM

Installation

Connecting the GURU ebuild repository

Important
The Gentoo Security team warns: GURU repository packages is manually reviewed by trusted contibutors, however, it's primary maintained by users. Do not use it if using hardened or in a critical environment or if it is not allowed to use testing ~ packages

The main AMDVLK package is placed in GURU overlay and maintained by User:RarogCmex. Follow the guide Project:GURU/Information for End Users to enable GURU ebuild repository.

Installing the driver

AMDVLK has a USE flag to add wayland support. If wayland support is necessary then be sure to set the flag and re-emerge:

root #emerge --ask media-libs/amdvlk

After installation Xorg or Wayland may require re-configuring.

Raytracing support and DXC

media-libs/amdvlk since 2022.4.3 support raytracing via corresponding use flag and requires the dev-util/DirectXShaderCompiler package from GURU to build its support. However, it generally recommended to always keep this flag enabled to improve compatibility unless on weak hardware.

Turn on DRI3 and disable modesetting X driver on Xorg

Note
This section is for Xorg users only. Wayland users can skip this section.

On systems that use Gentoo's mainline AMDGPU driver stack, there is a high chance that all necessary stuff is already available: DRI3 and xf86-video-amdgpu driver configured and installed. If not, follow the Xorg/Hardware_3D_acceleration_guide and AMDGPU to configure it. Generally, the following lines may need added to xorg.conf file:

FILE /etc/X11/xorg.conf
Section "Device"
Identifier "AMDgpu"
Option  "DRI" "3"
EndSection

Ensure that there is no Driver "modesetting" line in the xorg.conf file.

Configuration and features

Mesa RADV interoperability

AMDVLK can be simultaniously installed in pair with mesa's RADV driver. If RADV is also installed in the system, AMDVLK driver will be enabled by default after installation. It is possible to switch the driver between AMDVLK and RADV by environment variable AMD_VULKAN_ICD=AMDVLK or AMD_VULKAN_ICD=RADV.

Runtime settings

The driver exposes many settings that can customize the driver's behavior and facilitate debugging. Settings can be added into the amdVulkanSettings.cfg or amdPalSettings.cfg files under one of below paths, formatted with one name/value pair per-line:

  • /etc/amd
  • ${AMD_CONFIG_DIR}

See the AMDVLK Github Page for full list of settings.

Headless usage

AMDVLK can be installed and used on headless system to run headless Vulkan applications (like waifu2x-ncnn-vulkan).

Troubleshooting

Wrong ELF class

That misleading error occurs if using a multilib system. See the Vulkan#Wrong_ELF_class.

Known issues and limitations

From GitHub page:

  • CTS may hang in VK.synchronization.internally_synchronized_objects.pipeline_cache_compute with Linux kernel versions lower than 4.13
  • The driver can only work with firmware of ME feature version >= 25 (it is possible to check the version with command "sudo cat /sys/kernel/debug/dri/0/amdgpu_firmware_info"). If using upstream stack with GPUs of SI or CI family, it may needed to upgrade the kernel to 4.19 or later version and firmware (under /lib/firmware/amdgpu/) to the right version from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/amdgpu, and then update ramfs (sudo mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`)
  • Timeline semaphore is not fully supported in Linux kernel until version 5.5. It is possible to install Vulkan timeline semaphore layer to enable the extension if using earlier version of the Linux kernel.

Also the package maintainer (User:RarogCmex) warns about:

  • Usage with DRI_PRIME with lead nvidia GPU is impossible at this moment because the driver does not work with modesetting.
  • The driver is still might contain bugs. Report if experiencing any troubles.

See also

  • Vulkan — a next-generation graphics API created by The Khronos Group.
  • AMDGPU — the next generation family of open source graphics drivers using the new Display Core (DC) framework for Vega GPUs and Raven Ridge GPUs. It is however also capable of handling newer AMD/ATI Radeon graphics cards based on GCN1.0+, namely the Southern Islands, Sea Islands, Volcanic Islands, and Arctic Islands chipsets.