Review checklist — verifying GPU code
A reviewer (human or LLM) verifying a Miri GPU change should answer these six questions in order. If any answer is "no" or "not visible", the change needs work.
- Residency. Does every GPU-touching binding start with
gpu let/gpu var? Does every kernel capture refer to a device-resident binding or a captured host scalar? Does everygpu fnparameter type implementAccelerable? - Cost classes in order. List the cost events (upload, launch, fence + readback). Does the
order match the source top-to-bottom? Are there any unexpected fences beyond a cross-residency assignment or
.slice? - Buffer reuse. Do adjacent kernels over the same
gpu varshare the buffer (no cross-residency assignment between them)? Is there anylet h = g; …; some_kernel(g)where the readback is wasted? - Mutability. Is every captured
gpu varelement written by exactly one thread? Concurrent writes to a non-Atomicelement are a compile error — scatter patterns needAtomicbuffers. Is everysharedwrite followed by akernel.barrier()before another thread reads it? - Bounds + indexing. Does every in-kernel
arr[i]have a visible bounds guard when the index isn't bounded by the iteration range? In host code, are all element reads of device-resident bindings either compiler-rejected or bulk-copied first? - Portability. Does the change rely on 64-bit scalars, subgroup ops, or another gated feature? If so, is each one necessary, and is the requirement stated near the kernel?