redbluegreen wiki

The reset chain

One new GPU mapping, made while another process was busy, walks a chain of six steps to a GPU reset.

our process maps new GPU memory needs the driver takes page-table pages sit in 512 MiB VRAM carve-out 468 MiB held by the desktop, 44 MiB free so the driver makes room TTM evicts a local server buffer trips its eviction fence pauses that process sends REMOVE_QUEUE through MES but the server queue runs a kernel MES cannot pause it in time forces the driver resets the GPU kills both processes the eight experiments, in order pass two pass twelve pass idle pass add-first fail created fail header fail runtime fail one-element
A new mapping made while a local model server generates runs a six-step chain from page tables in a full carve-out to a GPU reset that kills both processes.

A queue we create while a local model server is generating never runs. The GPU resets two to three seconds later.

Eight experiments, at most one reset each, split the fault:

  1. Two of our processes at once, 64M and 1000 reps: both finish.
  2. Twelve of our processes at once: all finish, with the bandwidth shared.
  3. The server up but idle: a 64M add runs at full speed.
  4. Our add starts first and the server generates mid run, 20000 reps: all results verify at half speed. Our queues survive being paused.
  5. A queue created during generation hangs and resets the GPU. The same happens with the CWSR header filled, with RUNTIME_ENABLE, and with 1-element buffers.
  6. The 1-element run executes its first packet before the reset comes.

For every failure, the kernel log names the server's queue as the one the driver failed to evict. It names the server as the process it failed to suspend.

The driver source gives the chain:

  1. GPU page tables live in VRAM on this chip. Only "app APUs" use system memory.
  2. VRAM here is a 512 MiB carve-out. The desktop uses 468 MiB of it, per fdinfo.
  3. A new GPU mapping needs page-table pages. TTM evicts another process's VRAM buffer to make room.
  4. A kfd buffer carries an eviction fence. Evicting it pauses that process's queues with REMOVE_QUEUE through MES.
  5. MES cannot pause the server's mid-kernel queue in time. The driver declares MES unrecoverable and resets the GPU.
  6. Both processes die.

The CWSR header, the executable flag on the save area, and RUNTIME_ENABLE all concern pausing our queue. Our queue is never the one being paused.

Rule 4: allocate every GPU buffer at start, never inside a loop, never while another process is busy.

A long-lived training process that maps once is safe on a shared desktop, because our queues survive pauses.

Every reset was ours. The scheduler gives 10 ms per process and 1 ms per gang, and our waves survive that switching with twelve processes at once.

Sources