vramgaze.pl: visualize and explore your AMD GPU's VRAM

on blog at

Download: vramgaze-gtk3.pl, vramgaze.pl (gtk2).

Deps for Debian: sudo apt install libglib-perl libgtk3-perl libcairo-perl libpango-perl pdl alsa-utils binutils testdisk

I was having an issue with mouse cursor icon getting corrupted but only on the 2nd monitor in a dual monitor system. I wanted to look at the VRAM representation of the icon. It turns out looking at GPU RAM is a lot harder than system RAM. And basically only modern amdgpu based systems allow it and that through /sys/kernel/debug/dri/*/amdgpu_vram. The region meta-data is from amdgpu_vram_mm in the same debugfs directory. It seems like doing this kind of thing is flat out impossible on nvidia. Any attempt at direct PCIe access or using BAR windows (which are static in position and small) I could not get to work. If anyone out there knows how to read raw vram from nvidia cards I'd love to hear about it. Lucky for me my system was using an AMD RX 580 8GB on amdgpu.

After a day or two of vibe coding, manual fixing, and passing back and forth between claude, gemini, and kimi-k2.5 and feeding in Gtk3 examples from memgaze.pl I ended up with a fairly usable gtk2 vramgaze.pl. I did everything in gtk2 first because that's where I'm comfortable but because this seemed like something others might use I did port to Gtk3 too. They're pretty much the same but Gtk3 required some bending over backwards for cairo use.

I didn't actually find it useful for the cursor problem but it's a lot of fun watching VRAM get allocated and get fragmented under pressure and the like. The actual data in VRAM, which I expected to be full of bit maps (like framebuffers) and the like instead is all... encoded. I haven't seen a single bit of bitmap looking thing at all. It still makes for fun electronic music when interpreted as 8 bit unsigned wav audio.

[comment on this post] Append "/@say/your message here" to the URL in the location bar and hit enter.

[webmention/pingback] Did you respond to this post? What's the URL?