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/res.sh
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

24 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# One row per device kernel in a build tree: VGPRs, SGPRs, LDS bytes, scratch bytes, spilled
# registers, the waves a SIMD the VGPR count alone allows, and the workgroup size.
#
# BUILD=/path/to/build res.sh
#
# SPILL IS THE LOUD COLUMN, and SCRATCH after it: spilled registers are a memory round trip the
# source does not show, and scratch without spills is a private array the compiler could not keep
# in registers. WAVES is the other one: on gfx1201 a SIMD has 1536 VGPRs in wave32 allocated in
# groups of 24, so 96 VGPRs is 16 waves, 97 is 12 and 256 is 5 -- and LDS can cut it further, which
# this column does NOT model. The parse is rows.awk, which selftest.sh checks at those boundaries.
: "${ROCM:=/opt/rocm}"
: "${BUILD:=build}"
: "${ISA_OUT:=/tmp/r4disa}"
D="$ISA_OUT/res"; rm -rf "$D"; mkdir -p "$D"
here=$(cd "$(dirname "$0")" && pwd)
for o in $(find "$BUILD" -name '*.hip.o'); do
n=$(basename "$o" .hip.o)
ISA_OUT="$D" "$here/co.sh" "$o" >/dev/null 2>&1 || continue
"$ROCM/llvm/bin/llvm-readelf" --notes "$D/$n.co" 2>/dev/null > "$D/$n.md"
done
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' vgpr sgpr lds scratch spill waves wg kernel
awk -f "$here/rows.awk" "$D"/*.md | sort -k5,5nr -k4,4nr -k1,1nr