No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!384
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-384"
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?
@SchmashinPrunes on GitHub · 2026-11-25 16:04 UTC · original
SchmashinPrunes:lds-size-all-compute→main· +60 −12 · 4 files · 1 commits · openFollow-up to #257, as announced on #350. @omonkeyz
Why
tb_ldswas sized fromCOMPUTE_PGM_RSRC2.LDS_SIZEonly in compute shaders with a 64-bit LDS atomic. Every other compute shader declaredgroupshared uint tb_lds[8192](32 KiB), whatever the program allocates. That has two effects:ds_permute/ds_bpermutenext to LDS. These were always refused in a compute shader that also uses LDS, because the fixed 32 KiB left no room for the exchange arrays (BLOCKERS, Trackmania 15ae33bc / 18f7efba).Change
plan_lds64now plans the LDS size for every compute shader that has a non-GDS DS instruction. Mesh and amplification shaders keep their own sizing.declared_dwords, with #257's location per FSSM sub-version and its validity checks). It is used only when it fits the 32 KiB groupshared limit and every static DS offset reaches inside it. Otherwise the shader silently keeps today'stb_lds[8192]. Nothing that translates today is refused by this change.& (n − 1)for a power of two,% notherwise,& 8191for the fallback.xlane_header: it now acceptsds_permute/ds_bpermutetogether with LDS when the planned LDS plus the three exchange arrays fit in 32 KiB.Past the declared size this keeps #257's wrap. On gfx1036 an out-of-range LDS read returns 0 and the write is dropped (measured for #245). With a known size that could be reproduced exactly, at the cost of one compare per access. Tell me if you want it.
Tests
tests/exec_mem/ds.rs:ds_lds_compute_in_the_declared_lds:ds_ldscase list (70 cases, 32 mnemonics, with runtime-input reruns) runs again with 16 granules declared. The HLSL is checked fortb_lds[2048]/& 2047u]and no lock word.tb_lds[8192]/& 8191u: a static offset past the declared size (1 granule), a declared size over 32 KiB (80 granules), and no container.tb_lds[1152]/% 1152u.ds_permute_with_lds_is_refused:ds_bpermute_b32returns the right lanes.ds_lds_atomic64_sizing: its last check pinned the old behaviour (a plain 32-bit LDS shader stays at 8192 even with a declared size). It now expectstb_lds[640]/% 640ufrom 5 granules, and still 8192 without a container.Results (Windows 11, DXC from
TOMBOX_DXC_DIR):execds_*ds_lds_declared70 cases ok,ds_permute_with_declared_ldsokTOMBOX_EXEC_HW=1),execds_*tombox-xshadersuitetests/exec.rs190/190 (2 ignored), lib 149/149tests/exec.rsThe PR gate is clean. Occupancy itself can't be measured in CI. The #350 numbers came from a separate probe.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.