clbr / radeontop

GNU General Public License v3.0
785 stars 69 forks source link

Total VRAM less than expected on Ryzen 5900HS iGPU (Vega) #163

Closed qwertychouskie closed 6 months ago

qwertychouskie commented 6 months ago
qwerty@qwerty-asus-g14:~$ sudo dmesg | grep amdgpu | grep memory
[    4.783841] [drm] amdgpu: 512M of VRAM memory ready
[    4.783843] [drm] amdgpu: 7695M of GTT memory ready.
[    5.839234] amdgpu: HMM registered 512MB device memory

However, radeontop shows 487M total. Why is this?

Umio-Yasuno commented 6 months ago

That's because the AMDGPU driver returns the usable heap size instead of the total heap size.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c#L752-L778

qwertychouskie commented 6 months ago

Good to know. Also, just to confirm, is the value returned by the kernel and radeontop in MiB (base 2) or MB (base 10)?

Umio-Yasuno commented 6 months ago

MiB

  float vram = 100.0f * results->vram / vramsize;
  float vrammb = results->vram / 1024.0f / 1024.0f;
  float vramsizemb = vramsize / 1024.0f / 1024.0f;

https://github.com/clbr/radeontop/blob/master/ui.c#L155-L157

qwertychouskie commented 6 months ago

Awesome, thanks for the insight!