gpu_info_rocm.h 1020 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __APPLE__
  2. #ifndef __GPU_INFO_ROCM_H__
  3. #define __GPU_INFO_ROCM_H__
  4. #include "gpu_info.h"
  5. // Just enough typedef's to dlopen/dlsym for memory information
  6. typedef enum rsmi_status_return {
  7. RSMI_STATUS_SUCCESS = 0,
  8. // Other values omitted for now...
  9. } rsmi_status_t;
  10. typedef enum rsmi_memory_type {
  11. RSMI_MEM_TYPE_VRAM = 0,
  12. RSMI_MEM_TYPE_VIS_VRAM,
  13. RSMI_MEM_TYPE_GTT,
  14. } rsmi_memory_type_t;
  15. typedef struct rocm_handle {
  16. void *handle;
  17. rsmi_status_t (*initFn)(uint64_t);
  18. rsmi_status_t (*shutdownFn)(void);
  19. rsmi_status_t (*totalMemFn)(uint32_t, rsmi_memory_type_t, uint64_t *);
  20. rsmi_status_t (*usageMemFn)(uint32_t, rsmi_memory_type_t, uint64_t *);
  21. // rsmi_status_t (*getHandle)(uint32_t, uint16_t *);
  22. } rocm_handle_t;
  23. typedef struct rocm_init_resp {
  24. char *err; // If err is non-null handle is invalid
  25. rocm_handle_t rh;
  26. } rocm_init_resp_t;
  27. void rocm_init(rocm_init_resp_t *resp);
  28. void rocm_check_vram(rocm_handle_t rh, mem_info_t *resp);
  29. #endif // __GPU_INFO_ROCM_H__
  30. #endif // __APPLE__