What Is an AMD GPU Wavefront? Handle Lane Widths and Masks for the Target Device
A wavefront is the innermost execution group on an AMD GPU: several threads process the same instruction flow with lane-specific data. AMD ISA documentation generally calls this group a wavefront, while the HIP API also calls it a warp; seeing warpSize in code therefore does not mean NVIDIA CUDA’s 32-lane rule applies. In AMD’s official documentation, the default wavefront width is 32 threads for RDNA 1, 2, and 3, and 64 for CDNA 1, 2, and 3. Code and masks must account for the target device. [AMD HIP Programming Model](https://rocm.docs.amd.com/projects/HIP/en/latest/understand/programming_model.html) [HIP Hardware Features](https://rocm.docs.amd.com/projects/HIP/en/latest/reference/hardware_features.html)
What Is an AMD GPU Wavefront? Handle Lane Widths and Masks for the Target Device
A wavefront is the innermost execution group on an AMD GPU: several threads process the same instruction flow with lane-specific data. AMD ISA documentation generally calls this group a wavefront, while the HIP API also calls it a warp; seeing warpSize in code therefore does not mean NVIDIA CUDA’s 32-lane rule applies. In AMD’s official documentation, the default wavefront width is 32 threads for RDNA 1, 2, and 3, and 64 for CDNA 1, 2, and 3. Code and masks must account for the target device. AMD HIP Programming Model HIP Hardware Features
This article follows the AMD ROCm/HIP online documentation checked on 2026-11-21, including pages labeled HIP 7.17.0. For generations or compiler settings not listed in the cited hardware table, check the actual target information.
How are threads grouped into a wavefront?
In a HIP kernel, a thread (or work-item) is a unit of work with its own register state and control state. A block (work-group) groups threads that may cooperate on data. For execution, threads in a block are further arranged into wavefronts, called warps in HIP documentation. A grid groups all blocks in one kernel launch. A block and a wavefront are different units: one block can contain several wavefronts, but a wavefront does not combine threads from different blocks. AMD’s programming model describes the lanes of one wavefront as applying the same instruction to different data. That does not mean each lane permanently occupies one physical core. AMD HIP Programming Model
The simplified diagram below shows a one-dimensional block. A block contains one or more wavefronts, and each thread has a lane number within its own wavefront.
grid
└─ block / work-group
├─ wavefront 0: lane 0 ... lane (warpSize - 1)
├─ wavefront 1: lane 0 ... lane (warpSize - 1)
└─ ...For a one-dimensional block, dividing threadIdx.x by warpSize gives the lane position as the remainder and the wavefront number within the block as the quotient. The HIP documentation shows the following form:
unsigned int laneId = threadIdx.x % warpSize;
unsigned int waveId = threadIdx.x / warpSize;This formula assumes a one-dimensional thread array. For a two- or three-dimensional block, first linearize the thread coordinates in the documented order; dividing only threadIdx.x may fail to distinguish threads in different rows. HIP C++ Language Extensions — warpSize AMD HIP Programming Model
Why does wavefront width depend on the GPU generation?
Wavefront does not mean the same fixed number on every AMD GPU. AMD’s hardware feature table lists a width of 32 for RDNA 1, 2, and 3, and 64 for CDNA 1, 2, and 3. These are the documented default widths for those families. RDNA also has an experimental compiler option named mwavefrontsize64, but the hardware feature page says the HIP runtime does not support it. Do not treat that exception as a portable HIP runtime setting. HIP Hardware Features
| GPU family in the documentation | Default wavefront width in the table | Meaning for code |
|---|---|---|
| RDNA 1, 2, 3 | 32 threads | Lane IDs range from 0 to 31 |
| CDNA 1, 2, 3 | 64 threads | Lane IDs range from 0 to 63 |
The same block size can be divided into a different number of wavefronts when the width changes. For example, a one-dimensional block of 96 threads needs three logical groups at width 32 and two at width 64; the final group in the latter case contains only 32 threads. This is a mapping example. It does not predict performance or how many blocks run at once.
blockDim.x = 96
warpSize = 32
waveId: 0 1 2
threadIdx.x: 0..31 32..63 64..95
laneId: 0..31 0..31 0..31
warpSize = 64
waveId: 0 1
threadIdx.x: 0..63 64..95
laneId: 0..63 0..31Execution-group width also matters for memory access and branches. When adjacent lanes in one wavefront request adjacent array elements, HIP documentation says the requests can be coalesced into fewer memory transactions. If lanes request distant addresses, the transaction count and useful bytes can differ. If lanes take different branch paths, only part of the group may be doing useful work on a given path. Width alone does not determine runtime: data type, alignment, layout, path length, caches, and target architecture also matter. AMD HIP Programming Model — Coalesced Memory Accesses
How should code handle warpSize and lane masks?
In device code, HIP’s warpSize represents the number of threads per warp for the target device. Host code can query the selected GPU through a HIP runtime attribute instead. The following is a short host-side fragment:
int warpSizeHost = 0;
hipDeviceGetAttribute(&warpSizeHost, hipDeviceAttributeWarpSize, deviceId);Run this after initializing the runtime and selecting a valid deviceId. Error handling and return-status checks are omitted, and this fragment has not been executed or validated here. The returned value can guide kernel configuration or specialization, but a value queried from one GPU must not be treated as a constant for every device. HIP C++ Language Extensions — warpSize
Lane masks need special care when porting CUDA code. In a 64-lane group, lane 40 is beyond the range of a 32-bit integer mask. HIP’s cross-lane built-ins take a 64-bit unsigned mask for their _sync variants, including on devices with 32 lanes; use the type required by the API contract. Each calling lane must include its own bit, and all active lanes named by the mask must make the same call at the same point with the same mask. Otherwise the result is undefined. HIP C++ Language Extensions — Warp Cross-Lane Functions Porting CUDA Code to HIP — Lane Masks
| Check | Safer approach | Common pitfall |
|---|---|---|
| Lane position | Use the device’s warpSize for the remainder and quotient | Hard-coding 32 changes group boundaries on a 64-lane target |
| Width on the host | Query hipDeviceAttributeWarpSize for the selected device | Reusing a value obtained from another GPU |
| Lane mask | Use the integer width and mask rules required by the HIP function | A uint32_t mask cannot represent lanes 32–63 |
| Cross-lane function | Check the target ROCm version, build target, supported feature, and participating lanes | Assuming CUDA names, types, or sync contracts are identical |
A shuffle transfers a value from one lane to another; it is not a block barrier or memory barrier. HIP 7.17 documentation explicitly says warp cross-lane functions do not provide a memory barrier. The _sync variants have been available since ROCm 7.0 and, according to the current documentation, require a 64-bit mask and matching participation. On older ROCm versions or builds with changed options, check whether the function and contract are available. HIP C++ Language Extensions — Warp Shuffle and _sync Variants
What should be checked when porting CUDA or measuring performance?
CUDA and HIP share names such as thread, block, and grid, but their warp widths, lane-mask types, and some cross-lane contracts may differ. AMD recommends that portable HIP code not assume a fixed warpSize. Renaming warp to wavefront is therefore not enough to make a kernel portable. Porting CUDA Code to HIP
Use this sequence to separate width assumptions, mask errors, and actual performance:
**Fix the target and version.** Record the device model, gfx target, and ROCm/HIP version, then confirm that the API documentation matches the build.
**Query the execution width.** Check hipDeviceGetAttribute(..., hipDeviceAttributeWarpSize, deviceId) on the host or use warpSize in the kernel.
**Work out the grouping.** Write down lane IDs, wave IDs, and any partial final wave for a one-dimensional block. For multidimensional blocks, verify coordinate linearization.
**Check mask and intrinsic contracts.** Make sure the type can represent the lane range, all participating lanes follow the same call rule, and the API is supported by the target.
**Verify correctness before measuring.** Compare results on both platforms, including boundary, branch, and partial-group inputs, then profile the real workload on the target GPU. Do not infer a speedup from lane count or wavefront count alone.
A wavefront is a useful abstraction for understanding AMD GPU execution, but it is neither an identical hardware component across all generations nor an API contract interchangeable with a CUDA warp. For reusable code, follow HIP’s width query and the target version’s mask and cross-lane documentation; make performance claims only after measuring the target GPU.
Sources
[AMD HIP Programming Model](https://rocm.docs.amd.com/projects/HIP/en/latest/understand/programming_model.html)
[HIP Hardware Features](https://rocm.docs.amd.com/projects/HIP/en/latest/reference/hardware_features.html)
[HIP C++ Language Extensions](https://rocm.docs.amd.com/projects/HIP/en/latest/how-to/hip_cpp_language_extensions.html)
[Porting CUDA Code to HIP](https://rocm.docs.amd.com/projects/HIP/en/latest/how-to/hip_porting_guide.html)