Commit Graph
2 Commits
Author SHA1 Message Date
Niko1221 f55afa1521 serve: log a driver GPU pause that happens between requests (AMD on Linux)
The paused-GPU counter of the AMD driver was read only when a request began and when
it ended, so a pause between two requests, or while the engine sat idle after READY,
showed in no line. The engine now also reads the counter at READY and when each request
ends (whichever way it ends), and when the next request begins it prints one line if
the counter moved by 100 ms or more in between:

  strata serve: the graphics driver paused the GPU for N ms between requests while Linux moved memory the GPU uses

The bar is the one the per-request line uses. A failed read leaves no mark, so two
unrelated counters never make a gap, and a counter that went back prints nothing. The
begin-of-request read is the one that was already there; the other builds (no HIP, not
Linux) read nothing. Diagnostic only: no new setting, no change to any existing line.

gpu_pause_time_test gains the line's cases and a sequence test of the bookkeeping
(GpuPauseIdle).
2026-11-12 10:44:10 +01:00
Niko1221 03e687ace4 AMD Linux: show how long the driver paused the GPU (stall report and request line)
The amdgpu driver suspends all GPU queues of a process while the kernel moves
or reclaims host pages the GPU maps, and counts the time per GPU in
/sys/class/kfd/kfd/proc/<pid>/stats_<gpu id>/evicted_ms. On p620 a slow
prompt read lost about exactly that time (RESULTS-GH-URGENT, option 1) and no
log showed it.

- include/strata/core/gpu_pause_time.hpp: header-only reader (sum over the
  process's GPUs; a missing, unreadable or non-numeric counter = not
  available, -1) and the two lines.
- generate.cpp: read once when a request begins and once at its end (a line
  only when the request saw >= 100 ms), and in each pass of the stall report
  beside the memory line (the change over the report's 2 s). HIP on Linux
  only; every other build returns "not available" and prints nothing.
- tests/core/gpu_pause_time_test.cpp: fake KFD tree (present, several GPUs,
  missing, unreadable, garbage) and the line formats.

Both lines are the owner-approved wording of 11-11. The test also reads a
missing KFD tree 10,000 times: not available, no line, mean cost printed.
2026-11-11 07:50:00 +01:00