Path: blob/21.2-virgl/src/freedreno/computerator/examples/test-regfile.sh
4570 views
#!/bin/bash12# This tests for the size of the register file. We do this by launching a3# lot of workgroups with only one invocation, which causes the GPU to be4# saturated with in-flight waves. Each thread records its wave id using "getwid"5# (only available in a6xx+!) and stores it in the buffer. We then vary the6# register footprint by introducing uses of higher and higher registers. This7# lets us determine:8# 1. The total number of waves available (always 16 for known models)9# 2. The wave granularity (how many waves are always launched together, always 210# for known models).11# 3. The total size of the register file that is divvied up between the waves.1213set -e1415gen_shader() {16n=$1;17cat <<EOF18@localsize 1, 1, 119@buf 128 ; g[0]20@wgid(r48.x)21getwid.u32 r1.x22mov.u32u32 r0.x, r48.x2324; busy loop to make sure it actually uses all possible waves25mov.u32u32 r0.y, 1626(rpt2)nop27loop:28cmps.u.gt p0.x, r0.y, 029sub.u r0.y, r0.y, 130(rpt5)nop31br p0.x, #loop32add.f r1.y, r1.x, r$n.w3334(ss)(sy)(rpt5)nop35stib.b.untyped.1d.u32.1.imm r1.x, r0.x, 036end37nop38EOF39}4041# generate reference:42gen_shader 1 | ./computerator -g 128,1,1 | tee reference.log4344for n in `seq 2 32`; do45echo "Trying max reg: r$n"46gen_shader $n | ./computerator -g 128,1,1 | tee new.log47diff reference.log new.log48if [ "$?" != "0" ]; then49echo "Changes at r$n"50break51fi52done535455