Apple Silicon MacBooks have been almost been drug-like for me over the last few years, I love how everything just works, the POSIX shell and Homebrew. Yet a thought always lingered over my head, I shouldn’t trust their proprietary software for so long and risk my metadata being logged. The time has finally come for me to part myself from Apple. Also, sorry die hard Linux fans, but I’m not going to rely on vintage hardware like ThinkPads and third-party GPU clusters to train and run my models.
I wanted something stylish and MacBook-like, so I decided to purchase the new ASUS ROG Zephyrus G16 (GA605WI) with HX370 and RTX4070, which I must add, is insanely overpriced at the moment, at least in Australia. I’d wait a few months before buying this computer, especially since NVidia Blackwell (5000 series) GPUs are coming soon.
Installing Arch & ASUS Packages
This is pretty self explanatory, and if you have any trouble with this part, I’d advise you to “read the f#**ing manual.” I decided to install NVidia’s proprietary drivers, I advise to you to not do this right now!!!
After I installed Arch, I proceeded to install the recommended utilities as well as the custom kernel at:
https://asus-linux.org/guides/arch-guide/
The ASUS G14 kernel requires a NVidia driver rebuild
After installing the kernel from asus-linux.org, I immediately faced issues with sddm. The log read something along the lines of: Failed to read display number from pipe.
To resolve this issue, I completely uninstalled all nvidia drivers, reinstalled nvidia-dkms drivers and rebuilt the initramfs:
sudo pacman -Rns nvidia nvidia-utils nvidia-settings
sudo pacman -S nvidia-dkms
sudo mkinitcpio -P
sudo reboot
And it worked! In hindsight, I should’ve installed drivers after I installed the kernel but I digress.
The system refuses to use iGPU by default (and drains battery)
No matter what I tried, I could not manage to get my system to default to using integrated graphics (Radeon 890M). Here’s a list of some of the things I tried:
- Remove all references to the NVidia GPU from my X11 configuration at
/etc/X11/xorg.conf
- Blacklist NVidia drivers. This worked, but I could not selectively switch to my dGPU for Gaming, 3D or AI workflows.
- Using switching tools such as
switcherooctl
,optimus-manager
andbumblebee
.
Note: The PCI addresses from lspci
are in hexidecimal, whereas the entries in xorg.conf
are in decimal. This means that an address of
corresponds to a 64:00.0
BusID
of PCI:100:0:0
in xorg.conf
.
After a bit of tinkering, I discovered that the issue was that the iGPU was card 1 and dGPU was card 0, the card orders were inverted. I added the following lines to /etc/environment
, rebooted and my problems were solved:
DRI_PRIME=1
MESA_VK_DEVICE_SELECT=1
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json
KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0
__NV_PRIME_RENDER_OFFLOAD=0
__GLX_VENDOR_LIBRARY_NAME=mesa
To run certain programs using the dGPU
Just run them with the following environment variables:
DRI_PRIME=0 MESA_VK_DEVICE_SELECT=0 VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json __GLX_VENDOR_LIBRARY_NAME=nvidia
Out of the above environment variables, I found VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
to be the most important one.