redbluegreen wiki

Completion

How the command processor reports a finished dispatch, and the two faults that stopped it.

waves end signals end-of-pipe event, our buffer delivers CP release fence writes CP takes the signal 1 to 0 break: non-COHERENT buffers. The CP never sees completion. The signal stays 1. Reset. fix: COHERENT on the ring, both pointers, the kernel object, the kernarg and the signal. Kernel data, the target, stays coarse. advances read pointer advances later REMOVE_QUEUE at destroy break: no EOP buffer. REMOVE_QUEUE hangs MES. Reset. fix: a 4 KiB coarse EXECUTABLE EOP buffer, as libhsakmt makes. our code CP and driver kernel
The command processor walks this chain after the waves end, and the two faults break it at the signal and at REMOVE_QUEUE.

When a kernel finishes, the CP sets the completion signal to 0. Two faults stopped that report.

The Linux kernel accepted both faults. The hardware refused both. This hardware refuses by hanging, and a hang costs a GPU reset.

The first fault is a missing EOP buffer.

The ioctl treats the EOP buffer as optional, "not required for all ASICs". The gfx11 MQD code programs its address and size into the hardware queue descriptor with no zero check.

A queue without an EOP buffer hangs MES on REMOVE_QUEUE when we destroy it. Our fix is a 4 KiB coarse EXECUTABLE buffer, the same buffer libhsakmt allocates.

The second fault is the memory type.

With non-coherent buffers, the kernel runs and the target holds 42. The completion signal stays 1, the queue cannot be removed, and no page fault is logged.

ROCr allocates every buffer the CP touches fine-grained, which is COHERENT. Without COHERENT, the CP's own reads and atomics do not see the bytes the CPU wrote.

We set COHERENT on six buffers:

  1. The ring.
  2. The write pointer.
  3. The read pointer.
  4. The kernel object.
  5. The kernarg buffer.
  6. The signal.

Coherent memory also changes how a packet starts. The CP polls the write pointer, so a packet runs without a doorbell write.

The kernel accepts many things that the hardware then refuses. Our buffers mirror what ROCr allocates. What the ioctl permits is not enough.

Sources