AMD GPU: Difference between revisions
I updated the Vuilkan portion as driSupport is no longer enabled in opengl and instead is part of graphics's 'enable' and 'enable32Bit' variables. |
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. |
||
| (4 intermediate revisions by 4 users not shown) | |||
| Line 6: | Line 6: | ||
enable = true; | enable = true; | ||
enable32Bit = true; | enable32Bit = true; | ||
};</syntaxhighlight> | };</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 == | == 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> | |||
=== Dual Monitors === | === Dual Monitors === | ||
| Line 85: | Line 90: | ||
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 123: | 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 170: | Line 183: | ||
==== 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 ===== | ===== Performance Issues with AMDVLK ===== | ||
| Line 213: | Line 240: | ||
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> | </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> | |||
== Troubleshooting == | |||
==== Error: <code>amdgpu: Failed to get gpu_info firmware</code> ==== | |||
Solution: | |||
hardware.firmware = [ pkgs.linux-firmware ]; | |||
=== Links === | === Links === | ||