[Hardware/AMD] move ROCm specific config in dedicated file

Add option to effortlessly add corresponding HSA_OVERRIDE_GFX_VERSION to
make HIP programs work despite the GPU not being explicitely supported.
This commit is contained in:
Antoine Viallon 2024-11-26 11:50:30 +01:00
parent bc32a4f954
commit 30d16ce34d
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
3 changed files with 120 additions and 33 deletions

View file

@ -8,26 +8,14 @@ in {
config = mkIf (cfg.enable && cfg.kernelDriver == "amdgpu") {
boot.initrd.kernelModules = [ "amdgpu" ];
aviallon.boot.cmdline = {
# for Southern Islands (SI ie. GCN 1) cards
"radeon.si_support" = 0;
"amdgpu.si_support" = 1;
# for Sea Islands (CIK ie. GCN 2) cards
"radeon.cik_support" = 0;
"amdgpu.cik_support" = 1;
hardware.amdgpu.legacySupport.enable = true;
aviallon.boot.cmdline = {
"amdgpu.ppfeaturemask" = mkIf generalCfg.unsafeOptimizations "0xfff7ffff";
#"amdgpu.mes" = mkIf generalCfg.unsafeOptimizations 1;
"amdgpu.seamless" = mkIf generalCfg.unsafeOptimizations 1;
};
environment.systemPackages = with pkgs; []
++ [ rocmPackages.rocm-smi ]
++ optionals devCfg.enable [
rocmPackages.rocminfo
]
;
aviallon.programs.config.rocmSupport = mkDefault devCfg.enable;
services.xserver.videoDrivers =
@ -39,29 +27,10 @@ in {
hardware.amdgpu.amdvlk.enable = cfg.defaultVulkanImplementation == "amdvlk";
hardware.amdgpu.amdvlk.support32Bit.enable = mkDefault config.hardware.amdgpu.amdvlk.enable;
systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"
];
environment.variables = {
AMD_VULKAN_ICD = mkIf (cfg.defaultVulkanImplementation == "amdvlk") (strings.toUpper cfg.defaultVulkanImplementation);
ROC_ENABLE_PRE_VEGA = "1"; # Enable OpenCL with Polaris GPUs
};
# Make rocblas and rocfft work
nix.settings.extra-sandbox-paths = [
"/dev/kfd?"
"/sys/devices/virtual/kfd?"
"/dev/dri/renderD128?"
];
nix.settings.substituters = [ "https://nixos-rocm.cachix.org" ];
nix.settings.trusted-public-keys = [ "nixos-rocm.cachix.org-1:VEpsf7pRIijjd8csKjFNBGzkBqOmw8H9PRmgAq14LnE=" ];
nixpkgs.overlays = [(final: prev: {
# Overlay Blender to use the HIP build if we have a compatible AMD GPU
blender = final.blender-hip;
blender-prev = prev.blender;
})];
};
}