xshader: declare the console's group memory size for compute programs #633
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/633"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T18:08:56Z.
Summary
An ordinary compute program that uses group memory declared
tb_ldsat 8192 words, the whole 32 KiB, whatever the console allocated. On NVIDIA a group's shared memory limits how many groups an SM holds: at 32 KiB a 32-thread group leaves room for about seven, so a latency-bound program runs with few warps.The console's allocation is in the program's FSSM (
fssm::compute_lds_bytes, which the swizzle and indexed-lane paths already use). The emitter now declares that, rounded up to 512-byte (128-word) granules. That granularity is inferred: AMD's public compiler encodesLDS_SIZEin 512-byte units from GFX7 on. Reads pastTB_LDS_WORDSalready return 0 and writes are dropped (tb_lds_load,tb_lds_store, and the bounds on every atomic), which is what the console does past its allocation, so a program that strays past it behaves as on the console.The default of 8192 words stays:
lds_tile), whose exchange reuses the array at its own lane offsets;wave_cull::lds_words, micropoly).Mesh programs are unchanged.
Tested
Unit test.
group_memory_is_the_console_allocation_in_its_granulesbuilds a layout-6 FSSM and checks that 2048 bytes gives 512 words, 100 bytes gives 128, 32768 gives 8192, and that 0 or no FSSM gives 8192. It fails without the change (8192 where 512 is expected).Survey of all 5,367 compute programs a ProjectScarlett run recorded. Every program was translated in the ordinary form, plus the 32-lane-host form of the 1,222 that need 64-lane waves: 6,589 translations, base
fb17e160against this branch.#define TB_LDS_WORDSline, always from 8192. The new sizes, commonest first, are 128 words (427), 512 (167), 1024 (70), 256 (67), 3072 (63) and 896 (58).GPU time affected. In a 20-minute timed run on an RTX 5090, the programs this changes took 63 ms of GPU time a frame (of about 413 ms timed). The largest is one ray-query program: 28 ms in one call a frame, 32-thread groups, 2 KiB allocated on the console against the 32 KiB declared until now.
Microbenchmark, RTX 5090, driver 620.70.10, GE-Proton11-15 vkd3d-proton.
Code checks.
python tuxbox.py check --no-gpu:Evidence: TuxBox check of 99160d28fcb0, no uncommitted changes, no GPU checks: 13 passed, 0 failed, 0 not run.GPU checks: the translator row of the table (translator checks and the
lanes-shader-cache,lanes-raster-tables,lanes-compute-root,lanes-compute-root-recoveryandlanes-bindless-computesuites) on AMD and NVIDIA. Fullpython tuxbox.py checkof99160d28(GE-Proton11-15), which includes the translator checks and the Lanes suites: RTX 5090 (10de:2b85, 620.70.10) 210 pass, AMD iGPU (1002:13c0, RADV) 209 pass. The one failure on each islanes-selftest-texture-publication, which is #625 and fails on main too.Limits
🤖 Generated with Claude Code