I felt like making this guide because for a lot of people, they want to try out eGPU's but seeing the community has ran into some problems and often performance issue with Linux. Cant speak for windows but yes anyhow:
If you're experiencing lag, input delay, bad performance, or issues maybe this will be able to help.
Fixes:
1) CABLE:
MAKE SURE THAT THE CABLE THAT YOU ARE USING IS A CERTIFIED THUNDERBOLT CABLE CAPABLE OF 40Gbps or better
I cannot stress this enough, if you had a bad cable or an older one that has issues or is lower bandwidth, your eGPU will tank, the frames will be less and you'll have a very bad time trying to do anything intensive on the eGPU.
Generally 0.5-0.8m cables are the sweet spot as they don't need retimer chips or anything, anything longer needs AN ACTIVE THUNDERBOLT CABLE, if its longer than 0.8m then it NEEDS to be a ACTIVE CABLE. USB 4 cables should work but I'd recommend proper TB4 cables to be on the safe side.
Cable issues can lead to bad performance, drop in PCIe bandwidth and connectivity issues. If you're a gamer like me your games WILL suffer.
To check if ur getting ur full advertised bandwidth run this in your terminal:
boltctl
(It should say 40Gbps 2 Lanes 20Gbps)
2) DISPLAY OUT
One of the biggest reasons why eGPU performance is garbage is because a lot of people tend to use their laptops screen, what this does is cause frame copying from the eGPU to the iGPU, which then causes stuttering and performance losses. Connecting an external display will almost always help you with it since it avoids that.
3) PCIe speeds (AMD ONLY)
Linux can be finicky with this, make sure that you pass along arguments to ensure that your GPU is running at full intended PCIe 3x4/4x4/5x4, sometimes it may drop to PCIe 1x1 which will reduce your performance to a crawl.
To do this, open your terminal and type with evevated privileges to edit this file:
/etc/modprobe.d/amd-egpu-pcie-speed.conf
Type in:
options amdgpu pcie_gen_cap=0x40000
(This ensures it runs at full intended speeds)
Run a new build of your kernel to ensure its saved and reboot for effect.
4) Compositor rendering on discrete external GPU (HUGE SILENT PERFORMANCE KILLER)
Sometimes, often times you'll find that you've set it all up, you're trying to play a game, but the performance is bad and the GPU is consuming barely any power yet is under 99% load.
What happens is that since the starting device is your iGPU, KDE in my case, it will run the Wayland server on my iGPU, which means even if I have a display out from the dGPU, it still needs to send every frame it made back to the iGPU from the thunderbolt cable, and the iGPU, being slower will send it back to the dGPU to display, which causes a huge performance drop. To verify this you can lookup what openGL renderer is being used by Kwin or Mutter or whatever you're using at a given moment (everyone will have a different command but this is generally easily accessible info), if it indeed is the iGPU them you'll need to make an environment config that says if a dGPU is detected then the compositor will only render on the dGPU, if not, the fallback is the iGPU
(You might NOT want to do this since if you have a dGPU connected it disables the internal display as it doesn't have it enabled since rendering is done on the dGPU but this removes the huge performance penalty that is associated with this)
I hope this helps any future framework users or any Linux users with eGPUs for that matter. Have a great day folks.