This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/libr4d/isa/rows.awk
T
orca b56139a96a fix(isa): wave32 VGPRs allocate in 24s, not 8s
res.sh rounded the VGPR count up to a multiple of 8 before dividing the SIMD's
1536 registers, so 128 VGPRs reported 12 waves where the hardware allows 10, and
256 reported 6 where it allows 5. gfx1201 wave32 allocates in multiples of 24;
wave64 keeps the 8 the script used for both, which nothing measured says is
wrong.

gfx1201 Wave32, 1536 VGPRs/SIMD, measured over every kernel this tree builds
(3369 rows, ROCm 7.15 / clang 23, -O3) -- 755 rows change:

    6 -> 5   214 rows   (256 VGPRs)
    11 -> 10 119 rows
    14 -> 12 118 rows
    10 -> 9  112 rows
    13 -> 12  96 rows
    12 -> 10  96 rows

The parse moved into rows.awk so selftest.sh can check it at the boundaries
(96/97, 120/121, 144/145, 240/241) without a build tree. Five of those nine
boundary checks fail on the arithmetic this replaces.
2026-10-27 17:57:10 +01:00

32 lines
1.4 KiB
Awk

# One row per device kernel from llvm-readelf --notes of one code object.
#
# The metadata is msgpack printed as YAML and its keys are ALPHABETICAL, so .vgpr_count comes after
# .symbol and .sgpr_count before it. Emitting a row at .symbol prints the previous kernel's VGPR
# count. The row is flushed at .wavefront_size, which is last.
#
# WAVES is register-limited: on gfx1201 a SIMD has 1536 VGPRs, a wave32 allocates them in groups of
# 24 and a wave64 in groups of 8. So 96 VGPRs is 16 waves, 97 is 12, 128 is 10 and 241 is 5 -- the
# rounding is the whole point of the column, not a rounding error in it. LDS can cut it further and
# this does not model that. The 8 for wave64 is the quantum the script used for both before there
# was a wave-size column to tell them apart; nothing measured says it is wrong.
BEGIN { OFS = "\t" }
/^ *\.group_segment_fixed_size:/ { lds = $2 }
/^ *\.private_segment_fixed_size:/ { sc = $2 }
/^ *\.sgpr_count:/ { s = $2 }
/^ *\.sgpr_spill_count:/ { ss = $2 }
/^ *\.vgpr_count:/ { v = $2 }
/^ *\.vgpr_spill_count:/ { vs = $2 }
/^ *\.max_flat_workgroup_size:/ { wg = $2 }
/^ *\.name:/ { nm = $2 }
/^ *\.wavefront_size:/ {
wf = $2
if (nm != "") {
q = (wf == 64) ? 8 : 24
g = int((v + q - 1) / q) * q
w = (g > 0) ? int(1536 / g) : 16
if (w > 16) w = 16
print v, s, lds, sc, vs + ss, w, wg, nm
nm = ""
}
}