AMD GPU: Difference between revisions

Qubasa (talk | contribs)
Combine multiple rocm packages, as ollama needs that (and other AI packages)
Some redundancies were removed, like unnecessary configuration recommendations. Also, many of the sections in this page should be ignored unless you specifically know you need them. This was made clearer.
Line 1: Line 1:
This guide is about setting up NixOS to correctly use your AMD Graphics card if it is relatively new (aka, after the GCN architecture).
This guide is about setting up NixOS to correctly use your AMD Graphics card if it is relatively new (aka, after the GCN architecture).


== Make the kernel use the correct driver early ==
== 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.<syntaxhighlight lang="nix">
hardware.opengl = {
  enable = true;
  driSupport = true;
  driSupport32Bit = true;
};
 
</syntaxhighlight>


The kernel can load the correct driver right away:
== Problems ==
 
=== Dual Monitors ===
 
If you encounter problems having multiple monitors connected to your GPU, adding `video` parameters for each connector to the kernel command line sometimes helps.
 
For example:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelParams = [
  "video=DP-1:2560x1440@144"
  "video=DP-2:2560x1440@144"
];
</syntaxhighlight>
</syntaxhighlight>


== XServer ==
With the connector names (like `DP-1`), the resolution and frame rate adjusted accordingly.


Make sure Xserver uses the `modesetting` driver in your configuration.nix:
To figure out the connector names, execute the following command while your monitors are connected:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="bash">
services.xserver.enable = true;
head /sys/class/drm/*/status
services.xserver.videoDrivers = [ "modesetting" ];
</syntaxhighlight>
</syntaxhighlight>
= 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.


== Enable Southern Islands (SI) and Sea Islands (CIK) support ==
== Enable Southern Islands (SI) and Sea Islands (CIK) support ==


The oldest architectures that AMDGPU supports are [https://en.wikipedia.org/wiki/Radeon_HD_7000_series Southern Islands (SI, i.e. GCN 1)] and [https://en.wikipedia.org/wiki/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 kernel parameters:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 54: Line 73:
=== Blender ===
=== Blender ===


Hardware accelerated rendering can be achieved by using the package <syntaxhighlight lang="nix" inline>blender-hip</syntaxhighlight>.
Hardware accelerated rendering can be achieved by using the package <syntaxhighlight lang="nix" inline="">blender-hip</syntaxhighlight>.


Currently, you need to [[Linux kernel|use the latest kernel]] for <syntaxhighlight lang="nix" inline="">blender-hip</syntaxhighlight> to work.
Currently, you need to [[Linux kernel|use the latest kernel]] for <syntaxhighlight lang="nix" inline="">blender-hip</syntaxhighlight> to work.
Line 102: Line 121:


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
== Problems ==
=== Dual Monitors ===
If you encounter problems having multiple monitors connected to your GPU, adding `video` parameters for each connector to the kernel command line sometimes helps.
For example:
<syntaxhighlight lang="nix">
boot.kernelParams = [
  "video=DP-1:2560x1440@144"
  "video=DP-2:2560x1440@144"
];
</syntaxhighlight>
With the connector names (like `DP-1`), the resolution and frame rate adjusted accordingly.
To figure out the connector names, execute the following command while your monitors are connected:
<syntaxhighlight lang="bash">
head /sys/class/drm/*/status
</syntaxhighlight>
[[Category:Video]]
[[Category:Video]]