[PR #209] feat(api): add GDDR6/GDDR6X VRAM temperature reading via BAR0 registers #210

Open
opened 2026-05-05 03:27:53 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/XuehaiPan/nvitop/pull/209
Author: @dansolombrino
Created: 4/25/2026
Status: 🔄 Open

Base: mainHead: feat/gddr6-vram-temperature


📝 Commits (2)

  • 2d94ce1 feat(api): add GDDR6/GDDR6X VRAM temperature reading via BAR0 registers
  • 4a6bf90 fix self._name_maxlen access in device panel

📊 Changes

7 files changed (+476 additions, -124 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 nvitop/api/device.py (+18 -0)
nvitop/api/libgddr6.py (+244 -0)
📝 nvitop/tui/library/device.py (+7 -0)
📝 nvitop/tui/screens/main/__init__.py (+2 -1)
📝 nvitop/tui/screens/main/panels/device.py (+158 -91)
📝 nvitop/tui/screens/main/panels/host.py (+45 -32)

📄 Description

Summary

  • Add GDDR6/GDDR6X VRAM (memory junction) temperature reading via direct GPU BAR0 register access through /dev/mem
  • New Device.vram_temperature() API method returning temperature in Celsius or NA
  • Conditional "MTmp" column in TUI device panel — only shown when at least one GPU reports VRAM temperature data, preserving the original 79-column layout otherwise
  • Supports ~23 NVIDIA GPU models (RTX 30xx/40xx series + select data center cards like A10, L4, L40S)

Requirements

  • Linux only (uses /dev/mem and sysfs)
  • Root access required
  • iomem=relaxed kernel parameter required
  • Gracefully returns N/A when any requirement is not met — no errors, no crashes

Implementation details

  • nvitop/api/libgddr6.py: New module with thread-safe singleton context, mmap caching, and PCI device table mapping device IDs to BAR0 register offsets
  • nvitop/api/device.py: vram_temperature() method with lazy import to avoid /dev/mem access at import time
  • nvitop/tui/screens/main/panels/device.py: Conditional layout — detects VRAM temp availability at init, selects between 79-col (standard) and 84-col (with MTmp) layouts. All width constants parameterized via base_width
  • nvitop/tui/screens/main/panels/host.py: Accepts dynamic base_width to match device panel

Attribution

Ported from olealgoritme/gddr6 (C implementation).

Test plan

  • Run sudo python -m nvitop on a supported GPU — verify MTmp column appears with temperatures
  • Run python -m nvitop as non-root — verify original 79-col layout with no MTmp column
  • Verify from nvitop import Device; d = Device(0); print(d.vram_temperature()) returns int or NA
  • Verify box-drawing characters align correctly in both layout modes
  • Run ruff check and ruff format --check on changed files

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/XuehaiPan/nvitop/pull/209 **Author:** [@dansolombrino](https://github.com/dansolombrino) **Created:** 4/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/gddr6-vram-temperature` --- ### 📝 Commits (2) - [`2d94ce1`](https://github.com/XuehaiPan/nvitop/commit/2d94ce1804b4dd6fcf8c1cdf0b55f181fc155b24) feat(api): add GDDR6/GDDR6X VRAM temperature reading via BAR0 registers - [`4a6bf90`](https://github.com/XuehaiPan/nvitop/commit/4a6bf908114c43e6a4a5ec3f09d28a2a32dbe945) fix self._name_maxlen access in device panel ### 📊 Changes **7 files changed** (+476 additions, -124 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `nvitop/api/device.py` (+18 -0) ➕ `nvitop/api/libgddr6.py` (+244 -0) 📝 `nvitop/tui/library/device.py` (+7 -0) 📝 `nvitop/tui/screens/main/__init__.py` (+2 -1) 📝 `nvitop/tui/screens/main/panels/device.py` (+158 -91) 📝 `nvitop/tui/screens/main/panels/host.py` (+45 -32) </details> ### 📄 Description ## Summary - Add GDDR6/GDDR6X VRAM (memory junction) temperature reading via direct GPU BAR0 register access through `/dev/mem` - New `Device.vram_temperature()` API method returning temperature in Celsius or `NA` - Conditional "MTmp" column in TUI device panel — only shown when at least one GPU reports VRAM temperature data, preserving the original 79-column layout otherwise - Supports ~23 NVIDIA GPU models (RTX 30xx/40xx series + select data center cards like A10, L4, L40S) ## Requirements - **Linux only** (uses `/dev/mem` and sysfs) - **Root access** required - **`iomem=relaxed`** kernel parameter required - Gracefully returns `N/A` when any requirement is not met — no errors, no crashes ## Implementation details - `nvitop/api/libgddr6.py`: New module with thread-safe singleton context, mmap caching, and PCI device table mapping device IDs to BAR0 register offsets - `nvitop/api/device.py`: `vram_temperature()` method with lazy import to avoid `/dev/mem` access at import time - `nvitop/tui/screens/main/panels/device.py`: Conditional layout — detects VRAM temp availability at init, selects between 79-col (standard) and 84-col (with MTmp) layouts. All width constants parameterized via `base_width` - `nvitop/tui/screens/main/panels/host.py`: Accepts dynamic `base_width` to match device panel ## Attribution Ported from [olealgoritme/gddr6](https://github.com/olealgoritme/gddr6) (C implementation). ## Test plan - [ ] Run `sudo python -m nvitop` on a supported GPU — verify MTmp column appears with temperatures - [ ] Run `python -m nvitop` as non-root — verify original 79-col layout with no MTmp column - [ ] Verify `from nvitop import Device; d = Device(0); print(d.vram_temperature())` returns int or NA - [ ] Verify box-drawing characters align correctly in both layout modes - [ ] Run `ruff check` and `ruff format --check` on changed files 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 03:27:53 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/nvitop#210
No description provided.