AMD GPU: Difference between revisions
CarlenWhite (talk | contribs) m Fix URL for zen patches (previous commits incorrectly signed) |
Updated page to reflect the amdgpu module in nixos 25.05 and unstable. I tried to retain useful information such as what these settings actually do, since they are kind of educational in of themselves. |
||
| (12 intermediate revisions by 9 users not shown) | |||
| Line 3: | Line 3: | ||
== Basic Setup == | == Basic Setup == | ||
For ordinary desktop / gaming usage, AMD GPUs are expected to work out of the box. As with any desktop configuration though, graphics acceleration does need to be enabled. | For ordinary desktop / gaming usage, AMD GPUs are expected to work out of the box. As with any desktop configuration though, graphics acceleration does need to be enabled. | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix">hardware.graphics = { | ||
hardware.graphics = { | |||
enable = true; | enable = true; | ||
enable32Bit = true; | enable32Bit = true; | ||
}; | };</syntaxhighlight>There is also the [https://search.nixos.org/options?channel=unstable&query=hardware.amdgpu amdgpu nixos module available for common configuration options], such as enabling opencl, legacy support, overdrive/overclocking and loading during initrd. | ||
== Problems == | |||
=== Low resolution during initramfs phase === | |||
If you encounter a low resolution output during early boot phases, you can load the amdgpu module in the initial ramdisk<syntaxhighlight lang="nix"> | |||
hardware.amdgpu.initrd.enable = true; # sets boot.initrd.kernelModules = ["amdgpu"]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Dual Monitors === | === Dual Monitors === | ||
| Line 43: | Line 37: | ||
=== System Hang with Vega Graphics (and select GPUs) === | === System Hang with Vega Graphics (and select GPUs) === | ||
Currently on the latest kernel/mesa (currently 6.13 and 24.3.4 respectively), Vega integrated graphics (and other GPUs like the RX 6600<ref>https://bbs.archlinux.org/viewtopic.php?pid=2224147#p2224147</ref>) will have a possibility to hang due to context-switching between Graphics and Compute.<ref>https://bbs.archlinux.org/viewtopic.php?id=301798</ref> There are currently two sets of patches to choose between stability or speed that can be applied: [https://github.com/SeryogaBrigada/linux/commits/v6.13-amdgpu amdgpu-stable] and [https://github.com/SeryogaBrigada/linux/commits/v6.13-amdgpu-testing amdgpu-testing]. | Currently on the latest kernel/mesa (currently 6.13 and 24.3.4 respectively), Vega integrated graphics (and other GPUs like the RX 6600<ref>https://bbs.archlinux.org/viewtopic.php?pid=2224147#p2224147</ref>) will have a possibility to hang due to context-switching between Graphics and Compute.<ref>https://bbs.archlinux.org/viewtopic.php?id=301798</ref> There are currently two sets of patches to choose between stability or speed that can be applied: [https://github.com/SeryogaBrigada/linux/commits/v6.13-amdgpu amdgpu-stable] and [https://github.com/SeryogaBrigada/linux/commits/v6.13-amdgpu-testing amdgpu-testing]. | ||
| Line 80: | Line 75: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Sporadic Crashes === | |||
If getting error messages in <code>dmesg</code> with <code>page fault</code> or <code>GCVM_L2_PROTECTION_FAULT_STATUS</code> it might be from AMD GPU boosting too high without enough voltage | |||
Use a tool like LACT to increase power usage limit to 15%, undervolt by moderate amount (e.g. -50mV for 7900 XTX) and optionally decrease maximum GPU clock. | |||
* https://wiki.gentoo.org/wiki/AMDGPU#Frequent_and_Sporadic_Crashes | |||
* https://gitlab.freedesktop.org/mesa/mesa/-/issues/11532 | |||
* https://gitlab.freedesktop.org/drm/amd/-/issues/3067 | |||
== Special Configuration == | == Special Configuration == | ||
The following configurations are only required if you have a specific reason for needing them. They are not expected to be necessary for a typical desktop / gaming setup. | The following configurations are only required if you have a specific reason for needing them. They are not expected to be necessary for a typical desktop / gaming setup. | ||
=== Enable Southern Islands (SI) and Sea Islands (CIK) support === | === Enable Southern Islands (SI) and Sea Islands (CIK) support (eg. HD 7000/8000) === | ||
The oldest architectures that AMDGPU supports are [[wikipedia:Radeon_HD_7000_series|Southern Islands (SI, i.e. GCN 1)]] and [[wikipedia:Radeon_HD_8000_series|Sea Islands (CIK, i.e. GCN 2)]], but support for them is disabled by default. To use AMDGPU instead of the <code>radeon</code> driver, you can set the kernel parameters | The oldest architectures that AMDGPU supports are [[wikipedia:Radeon_HD_7000_series|Southern Islands (SI, i.e. GCN 1)]] and [[wikipedia:Radeon_HD_8000_series|Sea Islands (CIK, i.e. GCN 2)]], but support for them is disabled by default. To use AMDGPU instead of the <code>radeon</code> driver, you can set the legacySupport option in the amdgpu module.<syntaxhighlight lang="nix"> | ||
hardware.amdgpu.legacySupport.enable = true; | |||
</syntaxhighlight>This will set the kernel parameters as follows (this is redundant if you set the above option) | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# For Southern Islands (SI i.e. GCN 1) cards | boot.kernelParams = [ | ||
# For Southern Islands (SI i.e. GCN 1) cards | |||
# For Sea Islands (CIK i.e. GCN 2) cards | "amdgpu.si_support=1" | ||
"radeon.si_support=0" | |||
# For Sea Islands (CIK i.e. GCN 2) cards | |||
"amdgpu.cik_support=1" | |||
"radeon.cik_support=0" | |||
]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Doing this is required to use [[#Vulkan|Vulkan]] on these cards, as the <code>radeon</code> driver doesn't support it. | Doing this is required to use [[#Vulkan|Vulkan]] on these cards, as the <code>radeon</code> driver doesn't support it. | ||
Please note this also removes support for analog video outputs, which is only available with the <code>radeon</code> driver. | |||
=== HIP === | === HIP === | ||
| Line 122: | Line 136: | ||
=== OpenCL === | === OpenCL === | ||
<syntaxhighlight lang="nix"> | OpenCL support using the ROCM runtime library can be enabled via the amdgpu module.<syntaxhighlight lang="nix"> | ||
hardware. | hardware.amdgpu.opencl.enable = true; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 162: | Line 176: | ||
=== Vulkan === | === Vulkan === | ||
Vulkan is already enabled by default (using Mesa RADV) on 64 bit applications. The settings to control it are: | Vulkan is already enabled by default (using Mesa RADV) on 64 bit applications. The settings to control it are now the same as those shown in the basic setup: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix">hardware.graphics.enable = true; | ||
hardware. | hardware.graphics.enable32Bit = true; # Replaced 'driSupport32Bit' | ||
hardware. | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==== AMDVLK ==== | ==== AMDVLK ==== | ||
The AMDVLK drivers can be used in addition to the Mesa RADV drivers. The program will choose which one to use: | |||
{{Warning|1=AMDVLK is being discontinued, so the only reason you may want to use it is if you have issues with RADV. See: https://github.com/GPUOpen-Drivers/AMDVLK/discussions/416.}} | |||
The AMDVLK drivers can be used in addition to the Mesa RADV drivers. The program will choose which one to use (mostly defaulting to AMDVLK): | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 193: | Line 209: | ||
More information can be found here: https://nixos.org/manual/nixos/unstable/index.html#sec-gpu-accel-vulkan | More information can be found here: https://nixos.org/manual/nixos/unstable/index.html#sec-gpu-accel-vulkan | ||
One way to avoid installing it system-wide, is creating a wrapper like this: | |||
<syntaxhighlight lang="nix"> | |||
with pkgs; writeShellScriptBin "amdvlk-run" '' | |||
export VK_DRIVER_FILES="${amdvlk}/share/vulkan/icd.d/amd_icd64.json:${pkgsi686Linux.amdvlk}/share/vulkan/icd.d/amd_icd32.json" | |||
exec "$@" | |||
''; | |||
</syntaxhighlight> | |||
This wrapper can be used per-game inside Steam (<syntaxhighlight lang="sh" inline>amdvlk-run %command%</syntaxhighlight>) and lets RADV to be the system's default. | |||
===== Performance Issues with AMDVLK ===== | |||
Some games choose AMDVLK over RADV, which can cause noticeable performance issues (e.g. <50% less FPS in games) | |||
To force RADV<syntaxhighlight lang="nix"> | |||
environment.variables.AMD_VULKAN_ICD = "RADV"; | |||
</syntaxhighlight> | |||
=== GUI tools === | === GUI tools === | ||
==== LACT - Linux AMDGPU Controller ==== | ==== LACT - Linux AMDGPU Controller ==== | ||
This application allows you to overclock, undervolt, set fans curves of AMD GPUs on a Linux system. | This application allows you to overclock, undervolt, set fans curves of AMD GPUs on a Linux system. | ||
In order to install the daemon service you need to add the package to <code>systemd.packages</code>. Also the <code>wantedBy</code> field should be set to <code>multi-user.target</code> to start the service during boot. | In order to install the daemon service you need to add the package to <code>systemd.packages</code>. Also the <code>wantedBy</code> field should be set to <code>multi-user.target</code> to start the service during boot. | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
environment.systemPackages = with pkgs; [ lact ]; | environment.systemPackages = with pkgs; [ lact ]; | ||
systemd.packages = with pkgs; [ lact ]; | systemd.packages = with pkgs; [ lact ]; | ||
systemd.services.lactd.wantedBy = ["multi-user.target"]; | systemd.services.lactd.wantedBy = ["multi-user.target"]; | ||
</syntaxhighlight>Simple version is:<syntaxhighlight lang="nix"> | |||
services.lact.enable = true; | |||
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/hardware/lact.nix | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Troubleshooting == | |||
==== Error: <code>amdgpu: Failed to get gpu_info firmware</code> ==== | |||
Solution: | |||
hardware.firmware = [ pkgs.linux-firmware ]; | |||
=== Links === | |||
* https://wiki.archlinux.org/title/AMDGPU | |||
* https://wiki.gentoo.org/wiki/AMDGPU | |||
=== References === | |||
[[Category:Video]] | [[Category:Video]] | ||