I'm having the same issues, both on Sierra and High Sierra. Following the idea that was Nvidia-related, I switched to a
Radeon RX 580 8192 MB, who is natively supported, and uninstalled the web drivers. I still have the freezes, which happens most of the time when I'm compiling an application...