Skip to content

Instantly share code, notes, and snippets.

@x1unix
Created April 14, 2026 21:13
Show Gist options
  • Select an option

  • Save x1unix/34bcf583a3694bbc64e74543cb92f4a3 to your computer and use it in GitHub Desktop.

Select an option

Save x1unix/34bcf583a3694bbc64e74543cb92f4a3 to your computer and use it in GitHub Desktop.
Disable AMD iGPU if discrete GPU is available
ACTION=="add", SUBSYSTEM=="pci", KERNEL=="0000:03:00.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="disable-amd-igpu.service"

Problem

When both iGPU and dGPU are AMD, this causes programs that use ROCm, HIP, etc to prefer iGPU even if it doesn't support them.

Solutions like HIP_VISIBLE_DEVICES env var are brittle and work only on certain apps that respect it.

Solution

Disable iGPU on boot.

  • Simple script that disables iGPU and removes it.
  • Udev rule to trigger the script when iGPU is present.
  • Systemd unit to trigger the script when dGPU is available.

Notes

Files below are made for AMD Raphael iGPU and AMD RX7090XT PCI IDs.

You can find appropriate PCI IDs:

ls -l /dev/dri/by-path/*

inxi -Ga

Installation

sudo chmod 755 /usr/local/sbin/disable-amd-igpu
sudo systemctl daemon-reload
sudo udevadm control --reload
sudo udevadm trigger --subsystem-match=pci --attr-match=vendor=0x1002
#!/usr/bin/env bash
set -euo pipefail
DGPU="0000:03:00.0"
IGPU="0000:13:00.0"
[[ -e "/sys/bus/pci/devices/$DGPU" ]] || exit 0
[[ -e "/sys/bus/pci/devices/$IGPU" ]] || exit 0
echo none > "/sys/bus/pci/devices/$IGPU/driver_override"
if [[ -L "/sys/bus/pci/devices/$IGPU/driver" ]]; then
echo "$IGPU" > /sys/bus/pci/drivers/amdgpu/unbind
fi
echo 1 > "/sys/bus/pci/devices/$IGPU/remove"
[Unit]
Description=Disable Raphael iGPU when dGPU is present
After=systemd-udevd.service
ConditionPathExists=/sys/bus/pci/devices/0000:03:00.0
ConditionPathExists=/sys/bus/pci/devices/0000:13:00.0
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/disable-amd-igpu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment