Skip to content

Backend mapping

Backends translate WAVE instructions into vendor compiler inputs. The vendor compiler selects machine instructions. One WAVE instruction can require several target operations.

WAVE conceptNVIDIA PTXAMD HIPIntel SYCLApple Metal
WaveWarp, 32 lanesWavefront, 32 or 64 lanesSub-group with target-dependent widthSIMD-group
WorkgroupCTAThread blockWorkgroupThreadgroup
ThreadThreadThreadWork-itemThread

Threads belong to waves and workgroups. The target determines how those groups use its execution resources.

PTX uses predicates and branch labels. HIP, SYCL, and Metal backends emit structured source control flow. WAVE defines active-lane behavior; vendor compilers implement the target's branch and reconvergence mechanism.

A translation must preserve which lanes execute each operation and which lanes remain live at reconvergence.

WAVE memoryPTXHIPSYCLMetal
Local.sharedDynamic shared allocationlocal_accessorthreadgroup allocation
Deviceld.global and st.globalDevice pointerUSM pointerdevice buffer pointer

Each workgroup owns a separate local-memory region. Its size comes from kernel metadata. Threads use explicit synchronization when exchanging values through it.

Backends load and store values through the device-memory base pointer and WAVE byte offsets. The launch code must supply an allocation large enough for those accesses.

WAVE operationPTXHIPSYCLMetal
Workgroup barrierbar.sync 0__syncthreadsgroup_barrierthreadgroup_barrier
Fencemembar with scope__threadfence variantsatomic_fenceatomic_thread_fence

A barrier coordinates arrival within a workgroup. Programs must satisfy its participation requirements.

A fence orders memory accesses without a rendezvous. Metal supports wave, workgroup, and device scopes through atomic_thread_fence; it rejects system scope. See Memory scoping for the scope mappings.

OperationPTXHIPSYCLMetal
Addatom.addatomicAddatomic_ref::fetch_addatomic_fetch_add_explicit
Compare-and-swapatom.casatomicCASCompare/exchange on atomic_refWeak compare/exchange with retry
Minimum and maximumatom.min, atom.maxatomicMin, atomicMaxMinimum/maximum on atomic_refAtomic minimum/maximum functions
Bitwise operationsatom.and, atom.or, atom.xoratomicAnd, atomicOr, atomicXorBitwise operations on atomic_refAtomic bitwise functions

The translation must preserve return values and comparison operands as well as the memory update. Metal retries a weak compare/exchange when it fails spuriously. PTX subtraction negates the operand before atomic addition.

WAVE operationPTXHIPSYCLMetal
Shuffleshfl.sync.idx__shflselect_from_groupsimd_shuffle
Shuffle downshfl.sync.down__shfl_downshift_group_leftsimd_shuffle_down
Shuffle upshfl.sync.up__shfl_upshift_group_rightsimd_shuffle_up
Shuffle XORshfl.sync.bfly__shfl_xorpermute_group_by_xorsimd_shuffle_xor

Source lanes and participating lanes must satisfy the target's collective-operation requirements. See Shuffle primitive.

Arithmetic, loads, stores, and shuffles often map to corresponding target operations. Control flow, conversions, and atomics can require sequences. Register allocation, instruction selection, and scheduling occur in the vendor compiler, so generated source alone does not establish execution cost.