Skip to content

Thin abstraction principle

WAVE defines instruction behavior. Each GPU vendor chooses how to implement it.

Programs query values that vary by target:

ParameterWAVE contract
Wave widthQuery the target width
Register file sizeQuery the hardware limit and declare kernel usage
Workgroup sizeQuery the maximum dimensions
Local memoryQuery the available capacity
Memory orderingUse defined scopes and acquire/release semantics
DivergenceUse structured branches and loops

The GPU schedules threads and executes memory operations. Backends translate WAVE instructions to vendor code. They can specialize that code using the target's parameters.

NVIDIA uses 32-wide warps. AMD supports 32-wide and 64-wide wavefronts. Intel supports several subgroup widths. Apple uses 32-wide SIMD groups.

Query the width when a kernel depends on it:

mov_sr r0, sr_wave_width

The backend can specialize loops after it knows the wave width.

PTX uses branches and predicates. HIP, SYCL, and Metal backends emit structured source control flow for their vendor compilers.

WAVE specifies which lanes execute each branch and where they reconverge. Backends implement if/else/endif and loop/break/endloop with the target's control flow mechanism. See Control flow.

WAVE defines wave, workgroup, device, and system scopes with acquire/release ordering.

PTX uses scoped membar instructions, HIP uses thread-fence functions, and SYCL uses atomic_fence. Metal uses atomic_thread_fence and rejects system scope. Backends preserve the requested ordering and participation requirements. See Memory scoping.

The vendor compiler selects machine instructions, allocates registers, and schedules the generated program. Workgroup size and memory layout also affect execution cost.

WAVE does not expose cache line sizes. Programs use scoped ordering; the backend supplies the required cache operations.