15 Commits
Author SHA1 Message Date
geramyloveless 67cfb2cb26 Driver 199: report the UMC-busy source as unavailable, stop reading a non-existent register
The selector 68 UMC memory-busy counter read MM_PERFSTATUS at offset
0x04c18, but that register does not exist on gfx1201 (RDNA4): no MMHUB
PERFSTATUS/PERFCTR is defined in any upstream AMD register header, and the
read returned 0xFFFFFFFF at both idle and under an active 27B decode — an
unmapped MMIO address, not a slow-to-arrive counter. The offset was a
fabrication (the "NBIO UMC convention" the comment cited has no basis in the
vendored header), and the only firmware UMC field (SMU AverageUclkActivity,
offset 126) reads ~0-1% even under a verified copy sweep, so it is not a
useful memory-busy proxy either.

gfx1201 therefore has no working, verified UMC-busy counter. Instead of
publishing 0xFFFFFFFF as if it were a live value, selector 68 now returns a
distinct "unavailable" status (kIOReturnUnsupported) with zeroed data, so
consumers can tell "no counter" from "counter read 0". The read path is
retained behind a kMmhubPerfStatusSupported gate for a future ASIC that
exposes a real MMHUB UMC-busy register; the old offsets are kept as
labeled placeholders.

- amdgpu_ip.h: drop the fabricated offset narrative; add the support gate.
- MacAMDGPU.cpp: selector 68 returns unavailable when unsupported.
- amdgpu_mtop: the umc_activity_source label + umcValue comment state that
  the SMU field is the only (low-sensitivity) source and there is no MMHUB
  hardware counter on this ASIC.
- project.yml: 198 -> 199.

Built, resigned (minimal DriverKit entitlements), installed and activated;
verified driver=199 stage=0 and selector 68 now returns status
0xe00002c7 / raw 0x0 (was 0xFFFFFFFF) at idle and under a short decode load.
2026-09-26 10:52:27 -07:00
geramyloveless 32b9c675a2 amdgpu_mtop: make the top charts adaptive so the dashboard fits the terminal
c5b0313 rendered both top charts at the full 20 braille text rows each
(5 cell rows x 4 sub-rows), which made the dashboard ~86 rows tall. On a
normal 40-50 row terminal that pushed the GFX/UMC usage rows, VRAM,
power/sensor state, GRBM/GRBM2, and the processes panel below the fold,
leaving a screen that is mostly graphs.

The chart height is now computed from the terminal instead of hardcoded:

  chart budget = terminal_rows - (rows needed by everything else)

The "everything else" count is measured from the actual render:
device-list header (3 rows single GPU) + VRAM/POWER block (8) + GRBM
block (17, 16 when hidden) + processes block (8) + footer (1) + blank
separators (4, 3 hidden) = 41 rows. The remaining rows are split evenly
between the two charts and clamped to a floor of 4 text rows (one braille
cell row, still a chart) and a ceiling of 20 (five cell rows, the full
axis). At 50 rows the charts get 4 text rows each and the whole
dashboard fits in one screen; at 80+ rows they grow back to the full
20 rows.

Y-axis labels degrade gracefully with the chart height: each quarter
(100/75/50/25/0%) labels the row nearest its position, matching the
original 20-row chart's convention; 4-row charts show only 100%/0% so a
label never sits at the wrong height. Captions are unchanged.

The UMC source caption fallback (no plotted point yet) now follows the
source the next live sample will actually prefer (fresh+plausible SMU
field vs MMHUB PERFCTR delta) instead of assuming the SMU table.

No data sources, sampling, or observer protocol changes; TUI layout only.

The render test now asserts the user-visible regression directly: an
interactive 50-row frame contains both charts and every panel (VRAM,
power/sensor, GRBM/GRBM2, processes) with the footer as the last row,
plus a tall-terminal case (80 and 100 rows) that asserts the charts grow
back to the full quarter-labeled axis.
2026-09-25 22:13:11 -07:00
geramyloveless c5b0313202 amdgpu_mtop: render the full braille chart rows so the history is visible
mtop::tui::braille() returns height*4 text rows (one braille sub-row per
terminal row: 5 cell rows x 4 = 20 rows), but both braille charts only
rendered rows 0..4 with the 100/75/50/25/0% axis labels. Rows 0..4 are
the top braille cell row, i.e. only the 75..100% band of the scale, so
any series at or below 75% (idle dispatch-in-flight, SMU/UMC activity)
plotted in rows 5..19 that were never drawn. The headline percentage
came straight from the same history series, which is why the number
moved while the chart under it stayed blank.

Both the GPU CORE LOAD and SMU MEMORY ACTIVITY (UMC) charts now render
all 20 rows, with axis labels only at the 100/75/50/25% sub-row
positions so the caption column stays compact. The UMC chart stays
honestly empty while the source has no samples (stage 0 driver, or the
incoherent SMU table without the selector-68 MMHUB fallback), and
fills in as soon as a value arrives.

The render test's interactive-layout assertion now uses an 80-row
terminal: the dashboard legitimately needs ~78 rows with both full
braille charts, so the sort footer at 50 rows no longer asserts.
2026-09-25 21:15:46 -07:00
geramyloveless 4e858bdfe0 amdgpu_mtop: live GFX/UMC usage rows with honest provenance
The SMU metrics table on this host is incoherent for the activity fields:
AverageGfxActivity (offset 124) reads ~100% at verified idle and
AverageUmcActivity (offset 126) reads 0% under real traffic, per the
build 193 idle/load capture in docs/GPU_MONITOR.md. The TUI therefore
showed n/a (or a meaningless 0%) for both usage rows while all other
sensors (power, temperature, fan, clocks) were live.

GFX usage: the GPU CORE LOAD chart already uses the driver
dispatch-in-flight delta (software_stats selector 61); it now carries an
explicit source caption stating the SMU AverageGfxActivity field is
incoherent on this host, and the JSON gfx_activity_source label matches.

UMC usage: the SMU MEMORY ACTIVITY chart now keeps per-sample provenance.
It uses the SMU UmcActivityPercent field when it is fresh and plausible,
and falls back to a new hardware source: the MMHUB PERFSTATUS UMC busy
accumulator (dext selector 68, build 198+), computed as a delta over the
sample window with saturation/wrap regressions dropped, exactly like the
pendingNs-based busy counter. The chart source caption follows the value
actually used, so no fake SMU value is ever rendered. The TUI queries the
new observer selector only on driver builds that expose it (198+); the
installed build 197 keeps the SMU path and degrades to n/a.

Also fixes the duplicated 'min n/a' label in the activity chart footer.
2026-09-25 20:53:08 -07:00
geramyloveless 665ebc857c amdgpu_mtop: fix --dark palette for dark terminals
The --dark bright-on-dark scheme was tuned for the original neon spec and
looks wrong on a real dark terminal: #505064 borders nearly disappear,
dim-attribute empty bars wash out, and the #00F0FF->#FF0055 gradient glares.

Rework the dark palette (default dark-on-light untouched):
- data values near-white #e5e7eb, labels #d1d5db, bold #e5e7eb sections
- borders mid-grey #4b5563, empty bars truecolor #374151, n/a #6b7280
- footer #d1d5db instead of bold default foreground
- gradient ramp cyan #22d3ee -> blue #60a5fa -> yellow #fbbf24 ->
  orange #fb923c -> crimson #f87171 (vivid, not neon)

Tests assert exact SGR codes for both palettes, dark gradient stops, and
per-cell gradientBar colors.
2026-09-25 19:40:28 -07:00
geramyloveless a8c0667322 amdgpu_mtop: dark-on-light palette + --dark flag + SMU/MEM-CTRL chart rows
Palette rework: the original bright neon colors (cyan #00F0FF, blue #0072FF,
yellow, orange, crimson) are unreadable on terminals with light backgrounds.
The default palette now uses dark text that stays legible on white; a new
--dark flag restores the original bright-on-dark colors.

- tui.h: add mtop::tui::Palette (border/empty/n/a/value/label/section SGR
  codes) and makePalette(bool dark). gradient(percent, dark) selects darkened
  stops for the light palette and the original bright stops for --dark.
  gradientBar takes a Palette for the empty-bar color and gradient stops.
  A safe default Palette constructor means a caller that omits one never
  dereferences a null SGR.
- main.cpp: add --dark flag; dashboard() takes a Palette and routes all
  bright()/dim()/kBorder usage through it.

New SMU MEMORY ACTIVITY (UMC) chart row. Per the layout correction the TUI is
(1) GPU LOAD (the true dispatch-in-flight utilization, already the GPU CORE
LOAD braille chart) and (2) a real 0-100% memory-activity chart. The memory
source is UmcActivityPercent in the SMU metrics table (firmware offset 126,
sibling to GfxActivityPercent at 124): the unified-memory-controller busy
fraction, 0-100%, no extra scaling. It is already sampled into
d.metrics.values[UmcActivityPercent] and verified by metrics_test.cpp.

- history.h: ActivityPoint.umcPercent; add() gains a umcPercent parameter.
- main.cpp: feed umcPercent from hardwareValue(..., UmcActivityPercent, ...)
  and render a braille chart (same treatment as GPU CORE LOAD: braille matrix,
  x-axis caption, min/max/avg footer) with a dim source citation.

MMHUB PERFSTATUS is still not exposed, but the SMU table does expose a
memory-controller activity percentage, so the memory row uses that real
signal rather than a bare n/a placeholder.

Tests: mtop-render-test bumped to a 50-row frame for the extra chart and
gains assertions for the SMU MEMORY ACTIVITY row (label, UmcActivityPercent
source, min/max/avg footer); mtop_tui_test updated for the dual-palette
gradient/gradientBar. All 7 ctest suites and the kitty/iTerm/text PTY tests
pass.
2026-09-25 18:33:39 -07:00
geramyloveless e8e7c4911b Rebuild amdgpu_mtop as btop-style TUI per TUI-DESIGN-SPEC
Add tui.h: Braille 2x4 dot-matrix canvas, 8-level sub-cell bars,
TrueColor gradient bars (cyan->blue->yellow->orange->crimson),
rounded box-drawing borders, hotkey dispatch, y-scale/x-axis geometry.

Rewrite dashboard() in main.cpp to the spec layout:
  Section 1: header (model, CUs/SEs, build, sensors)
  Section 2: GPU CORE LOAD Braille chart (120 x, 5 rows)
  Section 3: VRAM/GTT sub-cell bars + POWER & SENSOR STATE
  Section 4: PERFORMANCE COUNTERS (GRBM / GRBM2)
  Section 5: GPU PROCESSES (fdinfo) -- documented n/a
  Footer:    [q] Quit [h] Interval [p] [m] [g] [r] hotkeys

Every metric is cited from live driver sources or rendered as a dim
n/a with the exact missing query. No driver code modified.

Add mtop-tui-test: Braille canvas, sub-cell bars, gradient stops,
y-scale geometry, hotkey dispatch, layout fit. Update
mtop-render-test for new layout invariants. Update PTY terminal
test footer assertion.

All 7 ctest suites + 3 PTY protocol tests pass.
2026-09-25 18:15:02 -07:00
geramyloveless 884f984661 Rework amdgpu_mtop: sparkline histories, delta-based utilization, 0.01/0.1 s refresh
Replace the Braille charts with Rust-amdgpu_top-style 8-level block
sparklines (▁▂▃▄▅▆▇█) showing 60 s history per metric: GPU utilization,
VRAM used, temperature, and the raw SMU AverageGfxActivity. Each row
carries the current value plus min/avg/max.

Wire the driver's software_stats pendingNs (cumulative dispatch-in-flight
union) into a true delta-based utilization row: (pendingNs delta) /
(wall window) clamped to 0-100%. The old SMU-only headline (documented
as 'idle can report 100%') is retained as a secondary reference row.

Refresh rates: slow 0.1 s (default), fast 0.01 s (was 0.5 s / 0.1 s).

Add a read-only QueryInfo tag-8 GFXSpecSnapshot query for chip geometry
(CU count, SE count) in the header; kIOReturnNotReady before GC
discovery is handled gracefully.

CPU-side unit tests: busyRatio edge cases (rollback, saturation, window
delta), sparkline known-series to expected bar strings (exact UTF-8
byte comparison), stats min/max/avg. Render tests updated for the new
layout. PTY test updated for the new refresh labels and block
characters.
2026-09-25 17:33:08 -07:00
geramyloveless 6f24602d32 Render pixel GPU charts with responsive observer sampling
Add Kitty and iTerm2 PNG charts, compact labeled clocks and sensors, differential terminal redraws, and background sampling. Replace refresh-dependent aggregate copy spikes with directional one-second completion rates and state their coverage. Validate rendering, input responsiveness, counter resets, and protocol framing.
2026-09-23 21:56:02 -07:00
geramyloveless 8fa37f8a2a Optimize Loom inference and qualify host waits and monitoring
Add Q6 panel reuse, pointwise fusion, compiler calibration and measured decode batching to the macOS LSE adapter. Preserve FP32 calculations and record exact MLX token comparisons and bounded performance evidence.

Add verified HRX transfer and owned-idle diagnostics, configurable blocked signal polling, and monitor graphs that distinguish stale or unreliable raw activity counters. Document reproduction, validation limits and remaining performance work.
2026-09-23 20:23:33 -07:00
geramyloveless 3fe89e1ace Scale GPU buffers and integrate validated HSA signals with LSE
Grow and reclaim BO metadata in64-entry pages, raise client capacity to4096 handles, and prevent VRAM free-range metadata exhaustion. Add GPU activity history, bounded sensor sampling and clock/counter reporting.

Select the qualified GPU-owned signal mailbox by default while gating native mixed atomics on original PCIe evidence. Include native HRX/LSE adapters, guarded compute tests, reproducible signing and local build/server guides linked to Lemon Seed Engine.

Hardware validation covers1024 live buffers with fragmented reuse, pooled HRX allocations and2GiB boundaries, shared signal lifecycle, Q6 projection and680 exact convolution outputs. Full-model token generation remains blocked on the missing Loom repeat template.
2026-09-23 17:52:41 -07:00
geramyloveless bde3f99364 Add native compute dispatch and live VRAM allocation monitoring 2026-09-23 00:03:15 -07:00
geramyloveless ddfad8b9ea Add GPU-only VRAM buffers and bounded owned-buffer transfers
Separate model storage above BAR0 from visible staging allocations. Add checked upload/readback and synchronous SDMA copy endpoints, retain buffers after published copy failures, and provide a 22 GiB sampled transfer test.

Record two successful build 176 shader dispatches and allocation reuse. Report firmware interface 0x33 as unsupported by the verified 0x2e telemetry layout without treating compatibility rejection as a firmware fault.

Bump host and driver to 177. All 25 regression suites, the Debug build and strict signatures pass; new buffer hardware acceptance remains pending.
2026-09-22 23:41:56 -07:00
geramyloveless 0844f74f65 Select compute VMID through GFX IBs and expose cached SMU metrics
Submit each compute checkpoint through an explicitly addressed VMID 0 IB after build 175 faulted on shader instruction fetch under VMID 3. Retain distinct verified IB storage until completion or reset.

Retain SMU table staging and add bounded owner sampling with a cached observer ABI for amdgpu_mtop. Invalidate samples during teardown, reject stale data, and keep periodic collection disabled pending hardware validation.

Bump host and driver to 176, record hardware evidence, and pin the HSA interface requirements to the HRX revision used by LSE. All 24 regression suites, the Debug build and strict signatures pass.
2026-09-22 23:29:32 -07:00
geramyloveless e8040ae9b0 Add compute checkpoints and the native amdgpu_mtop monitor
Separate cache, register and shader completion fences to locate the first stalled phase. Capture CP fault state and distinguish missing readback from successful verification. Record the version 174 timeout and successful software recovery; bump to 0.1.75.

Add a standalone observer-only terminal dashboard with stable GPU selection and JSON snapshots. Validate the SMU 14.0.3 metrics decoder against the Linux ABI. Dynamic telemetry remains unavailable pending firmware collection integration.
2026-09-22 23:10:33 -07:00