Completely remove all traces of AMD drivers, ROCm, and any related OpenCL components from your Ubuntu system

To completely remove all traces of AMD drivers, ROCm, and any related OpenCL components from your Ubuntu system, follow these steps:

sudo amdgpu-uninstall
sudo apt remove --purge 'rocm*' 'rock-dkms' 'hsa-rocr-dev'
sudo rm -rf /opt/rocm

sudo apt remove --purge 'amdgpu' 'amd' 'ocl-icd*'
sudo apt autoremove --purge

sudo rm -rf /etc/apt/sources.list.d/amdgpu*
sudo rm -rf /etc/apt/sources.list.d/rocm*
sudo apt update


sudo apt list --installed | grep -i amdgpu
sudo apt list --installed | grep -i rocm

sudo reboot

After rebooting, your system should no longer have any AMD drivers or related software installed.