Read and report integrated GPU shared memory (GTT) #35

Merged
Breadway merged 4 commits from feature/ram-67-igpu-gtt into main 2026-10-12 00:39:03 +08:00
Owner

The first piece of integrated GPU (iGPU) support: reading and reporting GTT shared memory.

Part of RAM-67. On an iGPU the device memory is a carve-out of host RAM, so it must be counted once and reported separately from host available memory and from dedicated VRAM.

What this adds

  • breadram-core/src/telemetry/igpu.rs: reads mem_info_gtt_used and mem_info_gtt_total under /sys/class/drm/card<N>/device, bounded to a fixed number of cards. A card with neither counter is not an integrated GPU.
  • The memory breakdown gains gtt_used_bytes and gtt_total_bytes (protocol minor 7, both defaulted), summed across cards, shown by breadram diagnostics (human and JSON), and surfaced as the gpu_gtt capability: available when a used count is read, degraded when only a total is, unavailable with a reason when the drm class is unreadable or there is no iGPU.
  • Missing is never zero: an unreadable or absent counter reports unknown with a reason.

Verification

Run on this branch off main:

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo build --workspace --locked
  • cargo test --workspace --locked

All pass. Tests cover a two-card sum, a dedicated card that is not an iGPU, an unreadable drm class, and a used count with no total.

Still to come on RAM-67

Attributing an iGPU-backed model's footprint through the inference adapters so an otherwise idle workload is not released while it holds a loaded iGPU model, counting the GTT carve-out once when it overlaps cgroup accounting, and exercising the reading against a real iGPU host.

The first piece of integrated GPU (iGPU) support: reading and reporting GTT shared memory. Part of RAM-67. On an iGPU the device memory is a carve-out of host RAM, so it must be counted once and reported separately from host available memory and from dedicated VRAM. ## What this adds - `breadram-core/src/telemetry/igpu.rs`: reads `mem_info_gtt_used` and `mem_info_gtt_total` under `/sys/class/drm/card<N>/device`, bounded to a fixed number of cards. A card with neither counter is not an integrated GPU. - The memory breakdown gains `gtt_used_bytes` and `gtt_total_bytes` (protocol minor 7, both defaulted), summed across cards, shown by `breadram diagnostics` (human and JSON), and surfaced as the `gpu_gtt` capability: available when a used count is read, degraded when only a total is, unavailable with a reason when the drm class is unreadable or there is no iGPU. - Missing is never zero: an unreadable or absent counter reports unknown with a reason. ## Verification Run on this branch off main: - cargo fmt --all --check - cargo clippy --workspace --all-targets --locked -- -D warnings - cargo build --workspace --locked - cargo test --workspace --locked All pass. Tests cover a two-card sum, a dedicated card that is not an iGPU, an unreadable drm class, and a used count with no total. ## Still to come on RAM-67 Attributing an iGPU-backed model's footprint through the inference adapters so an otherwise idle workload is not released while it holds a loaded iGPU model, counting the GTT carve-out once when it overlaps cgroup accounting, and exercising the reading against a real iGPU host.
feat: read and report integrated GPU shared memory (GTT)
All checks were successful
CPU checks / check (push) Successful in 55s
ba0cd020e8
First piece of RAM-67. On an iGPU the device memory is a carve-out of host RAM,
so it is reported separately and never folded into host available memory.

- telemetry::igpu reads mem_info_gtt_used and mem_info_gtt_total under the drm
  class, bounded to a fixed number of cards, and treats a card with neither
  counter as not an integrated GPU.
- The memory breakdown gains gtt_used_bytes and gtt_total_bytes (protocol minor
  7, both defaulted), shown by breadram diagnostics and surfaced as the gpu_gtt
  capability: available when a used count is read, degraded when only a total is,
  and unavailable with a reason when the drm class is unreadable or there is no
  iGPU.
- Missing is never zero: an unreadable or absent counter reports unknown.
- Tests cover a two-card sum, a dedicated card that is not an iGPU, an
  unreadable drm class, and a used count with no total.
- docs/IGPU.md records the reading and what remains (inference attribution,
  counting the carve-out once).
docs: record the live iGPU GTT reading on an AMD host
All checks were successful
CPU checks / check (push) Successful in 1m14s
30ce197d9f
Verified on this host's amdgpu integrated GPU (card1): breadramd in monitor mode
plus breadram diagnostics reported GTT used 7.5 GiB of 30.6 GiB and the gpu_gtt
capability available, with the shared-host-memory note. i915/xe hosts remain to
be exercised.
feat: attribute an iGPU model's device memory to host RAM
All checks were successful
CPU checks / check (push) Successful in 56s
8d8bb87d30
On an integrated GPU the model's reported device memory is a carve-out of host
RAM, so counting it as separate device memory would hide where it really lives.

- ProviderEndpoint gains an igpu flag (default false), and the Ollama adapter
  gains with_shared_device_memory. When set, a loaded model's whole size is host
  memory and there is no separate device figure; otherwise the two stay separate.
- The registry passes the flag through and records a note saying how the endpoint
  was attributed.
- A test asserts the iGPU attribution against the two-model fixture.
test: keep integrated GPU memory out of host available memory
All checks were successful
CPU checks / check (push) Successful in 57s
a9de8f95e8
States and tests the count-once invariant: GTT is reported in its own field and
is never folded into host available memory, because on an iGPU it is a carve-out
of the same RAM. The daemon test asserts the breakdown copies the GTT figure and
leaves ram_available_bytes exactly as the kernel reported it.
Breadway force-pushed feature/ram-67-igpu-gtt from a9de8f95e8
All checks were successful
CPU checks / check (push) Successful in 57s
to 2ff1108e87
All checks were successful
CPU checks / check (push) Successful in 57s
2026-10-12 00:26:08 +08:00
Compare
Breadway deleted branch feature/ram-67-igpu-gtt 2026-10-12 00:39:03 +08:00
Author
Owner

Handled as a duplicate. This is the auto-imported PR card for the same PR that RAM-67 tracks: #35. That PR has now been reviewed and squashed onto main as b38f03b (branch feature/ram-67-igpu-gtt deleted), so the work this card represents has landed under RAM-67. No separate delivery here. Closing it out.

**Handled as a duplicate.** This is the auto-imported PR card for the same PR that RAM-67 tracks: https://git.breadway.dev/Breadway/breadram/pulls/35. That PR has now been reviewed and squashed onto main as b38f03b (branch feature/ram-67-igpu-gtt deleted), so the work this card represents has landed under RAM-67. No separate delivery here. Closing it out.
Sign in to join this conversation.
No reviewers
No labels
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
Breadway/breadram!35
No description provided.