mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 06:59:57 -04:00
Give NVN2 compute programs the local memory their control section asks for, and put spills after it.
An NVN2 compute program's control section gives its local memory in bytes a thread at +0x68, beside the shared memory size at +0x64 that the job already carried. Without it the translator declared its default of 0x1000 bytes: one of the game's compute programs needs 4,752 bytes a thread, and its translation declared a 1,024-word local array that it indexed up to word 1,187, outside the array. The job now carries "local_mem" from +0x68, and the lowering starts a compute program's spill area after its own local memory (at least 0x1000 bytes) instead of always at 0x1000, where a larger program's own memory would have overlapped it. Checked: that program's translation now declares 1,188 words (indices up to 1,187) and passes spirv-val; two programs of 3,456 bytes a thread translate as before. All 266 compute programs whose stored input id starts with 0 in an installed shader cache translate and pass spirv-val (vulkan1.3), and tools/xlate_smoke.py passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1527,6 +1527,11 @@ static size_t build_request(char *o0, const char *hex, const char *stage, const
|
||||
memcpy(&magic0, control, 4);
|
||||
if (!shared && magic0 == 0x98761234u && !strcmp(stage, "cs")) memcpy(&shared, control + 0x64, 4);
|
||||
o += sprintf(o, "},\"shared\":%u", shared);
|
||||
// Their local memory, bytes a thread, follows at +0x68. Without it the translator declares its 0x1000-byte
|
||||
// default: one compute program of the game needs 4,752 bytes a thread and indexed past the end of its array.
|
||||
uint32_t local = 0;
|
||||
if (magic0 == 0x98761234u && !strcmp(stage, "cs")) memcpy(&local, control + 0x68, 4);
|
||||
if (local && local <= (1u << 20)) o += sprintf(o, ",\"local_mem\":%u", local);
|
||||
}
|
||||
if (!strcmp(stage, "cs")) {
|
||||
uint32_t l[3] = {1, 1, 1};
|
||||
|
||||
Reference in New Issue
Block a user