Repository navigation
perf(shader): emit runtime V# byte writes through the looping helper - #6706
Conversation
The scan tests' includes now sit before <array>, where boykopovar#6706 and boykopovar#5859 add theirs after it, and the pass counter's address flag is set after the read-only check instead of next to the pass reads boykopovar#6566 rewrites. No behaviour change.
86f5f12 to
7eeb12f
Compare
A store through a V# the shader computes (EmitBdaWrite) still emitted its byte path inline: one get_bda_write_pointer lookup, a mapped check, a byte store and a note_bda_write per byte, five write lookups per 32-bit store. It now calls write_bda_bytes after the same overflow check, like stores through bound V#s since 70a8844; the helper does the same lookup, store and note per byte in order, so faults are recorded as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7eeb12f to
2f3e71b
Compare
|
Rebased onto Tests on the RTX 4070 Ti (NVIDIA 595.99.02): 7 of the 8 tests matching AI-assisted: yes (Claude Code) |
|
AMD on Windows: the tests this PR names pass on an RDNA 3.5 GPU. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release.
AI-assisted |
|
Thanks @LeandroLP23 for the AMD run on Windows. I added it to the description. AI-assisted: yes (Claude Code) |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Checked that |
What
#6372 (70a8844) made BDA stores through a bound V# (
EmitBdaStore) send their byte path through one looping helper,write_bda_bytes. Stores through a V# the shader computes (EmitBdaWrite, fromSpirvRuntimeBuffer.cpp) still emitted that path inline. Each 32-bit store had fourget_bda_write_pointerlookups, mapped checks, byte stores andnote_bda_writecalls for its unaligned case, plus one lookup for the aligned case. Each 8- or 16-bit store had one lookup and one note per byte.EmitBdaWritenow does the same overflow check as before and then callswrite_bda_bytes. The helper does the same lookup, store and note per byte, in order, so faults and written pages are recorded as before.Crimson Desert (PPSA25286) runs large compute programs whose stores go through computed V#s. On NVIDIA, how long a pipeline takes to create tracks how many calls its module makes. These modules make 500 to 2,000 calls, mostly fault, lookup and note calls, and on
mainthey take up to two minutes each to create. The title reaches them only with #6612 and #6613.In Crimson Desert, 900 s limit with scripted pad input,
APS5_PROFILE_DRAW=1(which logs every compute pipeline over 100,000 SPIR-V words with its creation time), #6612, #6613 and #6178 (for memory) on both sides:AGC graphics: fragment shader must export float4 colors to its attachmentsThe #6612 heads differ only in their tessellation hull code, which these compute programs don't use. That new stop is a separate change.
Tested
Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.
agc_driver_bda_device: its runtime write cases (byte, split short, split unaligned dword, read-only byte and suffix, unmapped middle byte, split aligned dword, each plain and coherent) already checked stored bytes, faults and written pages, and they pass with this change. A throwaway build that fails on this byte path shows that only this test reaches it in the 468 area tests. A new check inRunBdaContractTestsrequires a runtime V# write's byte path to go throughwrite_bda_bytes. A 32-bit write may then make twoget_bda_write_pointercalls (the helper's and the aligned store's), and an 8- or 16-bit write one. Withmain'sSpirvBdaRead.cppit fails witha runtime V# write of 8 bits has 2 write lookups and 0 byte-loop calls. It passes 3 of 3 with this change.^agc_driver_|^agc_vertex_barrier|recompiler|shader_cache|request_serializer|spirv, 468 tests): 467 pass.agc_driver_store_over_untrackedfails the same way onmain5d9dcc4 here; test(agc): keep waiting for the neighbour copy case's result #6385 addresses it.APS5_DUMP_SHADERSrequest files. Each was recompiled withagc_shader_replaybuilt frommainand from this PR. The SPIR-V was put into that program's own pipeline capture (APS5_DUMP_COMPUTE_PIPELINES, same layout and specialization), and creation was timed withagc_compute_pipeline_replay, with the NVIDIA shader disk cache off (__GL_SHADER_DISK_CACHE=0). The replay tool compiles for its own target, so the word counts differ a little from the title's. One run each:That's 680 s for the eight on
mainand 177 s with this change. Program H, the slowest per word, has 776 write lookups and 776 write notes onmain. The driver needs 8.6 GiB of memory to create its pipeline onmain, and 1.2 GiB with this change (peak RSS of the replay process). Program A's own captured module, as the title compiled it, took 34.5 s in the same replay.Validated on Windows 11 with an AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001) by @LeandroLP23 (comment), in one build of
main6efb726 with this head and 13 other pull requests:agc_driver_bda_deviceandagc_driver_store_over_untrackedpass 3 runs of 3. 713 of 716agc_*tests pass; the 3 that fail fail the same way onmainthere.Not checked on Intel or on a console.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code