CPU, GPU AND RAM

GPU command queues: how dispatch reaches the device

In this article
THE QUICK TAKE

A dispatch packet must be published before notification and its inputs must outlive execution; queue submission is distinct from kernel completion.

A GPU dispatch queue is a submission structure connecting software-produced commands with device execution. Filling a command packet, publishing it, notifying the device, and observing completion are separate actions. The low-level ROCr interface makes these distinctions visible. They explain why a fast host-side submission does not prove a kernel has started and why command metadata needs an ordering protocol of its own.

Command storage precedes execution

A dispatch packet describes a kernel and its launch-related state. Software first reserves or selects a valid queue position and fills the required fields. The device cannot safely consume a partially written description. The runtime’s publication rules determine when the packet becomes visible as a complete command. Ordinary applications should use the supported high-level runtime unless they specifically need and can correctly implement the lower-level queue contract.

Primary reference: HIP Documentation: Hardware Implementation.

Notification does not replace publication

A doorbell or notification tells the execution system that queue work is available. It is not a substitute for correctly ordered packet writes. If notification can become visible before the command description is complete, the consumer may observe invalid metadata. Follow the documented acquire and release requirements rather than relying on a host processor’s apparently favorable store order. A bug can disappear during debugging because observation changes timing without repairing the protocol.

Primary reference: HIP C++ Language Extensions.

Kernel arguments have a separate lifetime

Publishing a valid packet does not make referenced argument storage immortal. The kernel can start later, after the submitting function has returned. Argument buffers and referenced data must remain valid through the required execution interval. Reusing a host-side temporary too early can therefore corrupt a launch whose queue packet itself looks correct. Draw packet ownership and argument-buffer ownership separately; they can have different allocation and cleanup mechanisms.

Primary reference: ROCr Runtime API Reference.

Completion is an observable later event

A completion signal or higher-level synchronization object identifies a later execution boundary. Host enqueue duration measures how quickly work was submitted, while completion duration includes waiting and execution. Distinguish queued, running, and completed states in a trace. A large gap before execution can reflect dependency waits or scheduling pressure rather than expensive arithmetic. Conversely, a tiny enqueue does not imply that the application has received its usable output.

Queue depth is not useful throughput

A growing queue can mean productive overlap, but it can also mean the producer submits faster than the device can consume. Measure completed useful work and latency, not only queued command count. Check backpressure and resource lifetime under a stalled consumer. A robust runtime boundary prevents unbounded command accumulation from turning into unbounded live buffers. Low-level queue understanding is most useful when it clarifies these application-level limits rather than encouraging unnecessary custom dispatch code.

Related reading: A GPU inference benchmark you can trust; Reproducible inference stacks: preserving a GPU pilot’s result.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles