mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 19:08:38 +00:00
A compute program of one console wave of 32 lanes and no group barrier is translated to a host group of K (2, 4 or 8) such waves: host thread t is console thread t % 32 of slot t / 32 (thread ids taken apart by the console group's shape), the console group number is the host group's (X + 65535 Y) times K plus the slot, taken apart by the console's grid, which the host puts in three root constants (USER_PACK_X/Y/GROUPS, whose metadata dword is K). Threads past the grid's groups leave at once, group-shared memory is a slice for each slot, and K comes down until it fits 32 KiB and 64 K registers. shader::pack_grid and pack_group are the host's dispatch and the group a thread runs, pure, for the host and the tests. Of the 2,703 compute programs 1,396 qualify at 4 (1,237 are not groups of 32, 41 are counted in threads, 28 are console wave64); all translate and pass dxil.dll's validator. translate_cdxil --census prints "pack K" or "pack 0 <why>" for each. Tests (pack_tests.rs, hardware adapter, validated): hand-written programs of 5 group shapes, with and without group-shared memory, run unpacked and packed 2, 4 and 8 over 1-D and 3-D grids with a partial last host group and a grid folded into a second row, compared with what the console stores; the group-shared memory test fails if the slices are shared (checked by mutation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>