[v0.30] Add support for AMD GPUs

Adds very basic support for AMD (experimental). The only install
requirement is ROCm. Unlike NVIDIA, we don't need the CUDA equivalent
(HIP) to make gpufetch work, which reduces the installation
requirements quite significantly.

Major changes:

* CMakeLists:
  - Make CUDA not compiled by default (since we now may want to target
    AMD only)
  - Set build flags on gpufetch cmake target instead of doing
    "set(CMAKE_CXX_FLAGS". This fixes a warning coming from ROCm.
  - Assumes that the ROCm CMake files are installed (should be fixed
    later)

* hsa folder: AMD support is implemented via HSA (Heterogeneous System
  Architecture) calls. Therefore, HSA is added as a new backend to
  gpufetch. We only print basic stuff for now, so we may need more
  things in the future to give full support for AMD GPUs.

NOTE: This commit will probably break AUR packages since we used to
build CUDA by default, which is no longer the case. The AUR package
should be updated and use -DENABLE_CUDA_BACKEND or -DENABLE_HSA_BACKEND
as appropriate.
This commit is contained in:
Dr-Noob
2025-10-12 12:34:56 +02:00
parent 57caadf530
commit b29b17d14f
11 changed files with 344 additions and 21 deletions

View File

@@ -9,6 +9,7 @@
enum {
GPU_VENDOR_NVIDIA,
GPU_VENDOR_AMD,
GPU_VENDOR_INTEL
};
@@ -44,6 +45,11 @@ struct topology_c {
int32_t tensor_cores;
};
// HSA topology
struct topology_h {
int32_t compute_units;
};
// Intel topology
struct topology_i {
int32_t slices;
@@ -72,6 +78,8 @@ struct gpu_info {
struct memory* mem;
struct cache* cach;
struct topology_c* topo_c;
// HSA specific
struct topology_h* topo_h;
// Intel specific
struct topology_i* topo_i;
};