Which buffer accesses the hardware treats as out of range, per the V# OOB_SELECT field (word 3 bits [29:28]),
measured natively on AMD GPUs (SHADER-116). The translator reads this field and picks the bounds check by mode
(SHADER-110); the contract row is "Buffer bounds checking" in
design.md. Out of range, a load returns 0 and a store or atomic does not touch memory.
N is NUM_RECORDS (V# word 2), index the VGPR index (idxen), offset the VGPR byte offset (offen) and
soffset the scalar offset. Every access below is a 4-byte buffer_load_dword / buffer_store_dword.
OOB_SELECT |
Out of range on RDNA2 (gfx1036) when | Mesa GFX10 column | Mesa GFX11 column |
|---|---|---|---|
| 0 structured with offset | index >= N or offset + 4 > stride |
offset >= stride: differs |
same |
| 1 structured | index >= N |
same | same |
| 2 disabled | N == 0 |
same | same |
| 3 raw | offset + soffset + 4 > N; index * stride moves the address but is not checked |
offset >= N: differs |
offset + 4 > N, without soffset |
- RDNA2 follows Mesa's GFX11 column, not the GFX10 one: of 732 cases, 729 match GFX11 and 696 match GFX10.
Every GFX10 miss is an access that only partly fits, for example a raw buffer with
N = 3read at offset 0. - In raw mode
soffsetis part of the checked offset. The 3 cases that match neither column are raw reads at offset 8 withsoffset8 andN = 18: 8 + 8 + 4 > 18, out of range on hardware. - Loads and stores agree in every case.
- In-range accesses at a dword-aligned address read and wrote the expected dword (0 exceptions). An address that is
not a multiple of 4 (stride 18 with
index > 0) is rounded by the hardware; where such an access lands was not part of this measurement. - @AlxcBTW measured RDNA3.5 (Radeon 880M, gfx1150) through the HIP runtime and found it matches the GFX11 column
(finding). The RDNA2 result here
agrees with it, plus the
soffsetrule.
Open: the console target is gfx1013 (GFX10.1); gfx1036 is GFX10.3. Mesa uses one GFX10 column for both, and this measurement shows that column is wrong for GFX10.3. Whether GFX10.1 matches GFX10.3 here needs an RDNA1 card (gfx1010–1012, RX 5000 series).
Ryzen 7 9800X3D integrated GPU (gfx1036, RDNA2), AMD driver 3679.0 (PAL, LC), Windows 11. A standalone OpenCL
host (not in this repository) loads the driver's OpenCL.dll, and each case is a one-lane kernel whose inline
assembly runs a single buffer_load_dword or buffer_store_dword with a V# built by hand:
- word 0–1: the buffer's address,
STRIDEin word 1 [29:16]; - word 2:
NUM_RECORDS; - word 3:
DST_SELx/y/z/w,FORMAT= GFX1032_FLOAT(22),RESOURCE_LEVEL= 1,OOB_SELECT= 0–3.
The buffer holds a pattern (dword i = 0xA0000000 | i), so a non-zero load names the dword it read, and a store
writes a marker whose position is found by comparing the whole buffer afterwards. The cases are modes 0–3 × stride
0, 16, 18 × N 0, 3, 18, 48 × offen (offsets 0, 12, 16, 44, 48), idxen (indices 0, 2, 3, 4) and
idxen offen (six index/offset pairs), plus raw cases with soffset 8: 732 in all, each a load and a store.
Three runs gave identical results. Each case was compared with both Mesa columns as listed in @AlxcBTW's finding
(Mesa src/amd/common/ac_descriptors.c).