Repository navigation
RT-NULL-BARRIER-CLEAR: console null-resource barriers and null-view clears no longer drop the submission - #1504
Closed
ubiquitarianism wants to merge 31 commits into
Closed
ubiquitarianism wants to merge 31 commits into
ubiquitarianism wants to merge 31 commits into
Conversation
…ibrary programs 50 of the 2,684 library programs in shaders.rpf (1.0.2.1) start with two VOP3 opcode-0x180 words (words 0 and 3) instead of three, and their code starts at word 6. code_range only knew the 36-byte form, so it disassembled them from word 0 and they never decoded: 1 of the 50 translated. With the 24-byte form all 50 disassemble with 0 invalid words and 49 translate and pass spirv-val. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e mask - s_bitreplicate_b64_b32 with a VCC destination: lane L gets S0 bit L // 2, stored as mov64 stores a mask into VCC (EXEC already took this path). - s_flbit_i32_b64 of a lane mask reads the wave's whole mask (wave_mask), as s_ff1_i32_b64 does; s_flbit_i32_i64 of a mask stays Unsupported. Both occur in pipeline-library compute programs that the retail boot creates. Tests: tests/semantic/test_lane_mask_bitreplicate_flbit.py runs both on every lane of a wave64 (run_workgroup); docs/design.md contract rows updated. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… vcc from the blob when llvm-mc rejects them llvm-mc skips the first word of s_buffer_load_dwordx8 into s[100:107], an image resource in s[100:107] or a buffer resource in s[104:107] and leaves the second word as junk, so translate() refused those shaders (reachable instruction with normalized encoding) or translated them without the load. restore_vcc_tuples reads the uncovered words of the code range with rdna2_decode and keeps only instructions whose operands hold a VCCTuple list, the form the translator already takes. Other undecodable words are unchanged.
Clamp blob[at:at + 20] to min(at + 20, stop) and check at + nbytes <= stop so multi-dword NSA MIMG instructions starting near code_end cannot read trailing bytes past code_end. Adds synthetic 12-byte NSA1 regression test.
…a tuple into vcc llvm-mc rejects a scalar tuple that runs into vcc and prints the second word as junk. That junk is often longer than the word, so it also covers the instruction after the tuple, which stayed missing and refused the program with 'fall-through into undecodable words'. The words after a restored tuple are now decoded from the blob until the stream is back at a printed instruction. Pipeline library of 1.0.2.1, 2,684 compute programs: 1,816 -> 2,567 translate and pass spirv-val; the 1,816 modules are byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
llvm-mc 21 cannot decode SMEM loads whose SOFFSET is null (0x7D), so whole pipeline-library compute programs of 1.0.2.1 came out with invalid words and failed to translate. For compute programs, shader_disasm now falls back to rdna2_decode when that decodes more of the program, and rdna2_decode reads VOPC with DPP16/DPP8 as the 8-byte form it is. rdna2spirv: - SMEM with vcc as its base reads the vcc_lo/vcc_hi pair. - s_flbit_i32_b64 of a lane mask reads the wave's 64-bit mask (18 library programs), as s_ff1_i32_b64 already does. - s_bitreplicate_b64_b32 of a lane mask into plain scalar data replicates the wave's mask word (6 library programs); into exec/vcc it stays Unsupported. test_salu_flbit_64: the lane-mask case now translates (the subgroup op is outside the single-invocation interpreter), so the test checks that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alid words Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The retail boot reached 50 pipeline-library compute programs that had no translation. Dumped from the running game, they all translate and pass spirv-val after these changes: - fspx_unpack.code_range: some programs carry a 24-byte hash prologue (two VOP3 words, then s_inst_prefetch) instead of 36 bytes; two or three hash words now count (shader_library uses the same range). - fspx_unpack --last-endpgm: early exits branch past the first s_endpgm, and data after the code can hold s_endpgm words, so a program ends at the first s_endpgm whose listing keeps every branch inside the code. - rdna2spirv: v_cmp_*_dpp into vcc (12 compares in reductions), taken when every lane writes (full row/bank masks with bound_ctrl:1, or DPP8). - rdna2spirv: s_bitreplicate_b64_b32 of a constant into vcc (6 programs), as the exec form does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ect branch targets Do not scan unreachable embedded data words skipped by s_branch or after s_endpgm / s_setpc_b64 in restore_vcc_tuples. Walk only offsets reachable from code_start via matched instructions, fall-through, and direct/folded far branches, and discard any restored instruction whose interior dwords are targeted by a reachable branch. Fixes the synthetic edge case reported on #596 / #674 by @Snooozs where an unreachable data word equal to the first dword of an 8-byte vcc-tuple load right before a branch target caused restore_vcc_tuples to swallow the target instruction and fail with 'branch into data'. Adds regression tests covering: skipped data word before a matched branch target, skipped data word before a vcc-tuple load at the branch target, data word after s_endpgm before a branch target, and fall-through into a data word directly before a branch target.
…r's wave size #596 walks only reachable offsets. The resync after a restored tuple now runs inside that walk, follows swallowed branches, and drops the rest of a run when a branch targets an instruction's interior. decode_bytes gets the program's wave size, so a swallowed VOP3 compare writes an SGPR pair in wave64 (reported on #674). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hash (TOOLS-LIBRARY-COMPUTE-BY-HASH) The run time finds a pipeline-library compute program by the SHA-256 of its code and of its record's state blob. shader_library.py kept one state per program, the last record's, so when two compute records used one program with different state blobs only one of the two pairs got an entry and a .state file. Each distinct state of a program is now written: the first under the program's name, each further one as <name>_state_<blob index>, with its own .code, .json, .state, listing and index entry. library.json names the entry of each record. A program with one state, the case of every program in the measured 1.0.2.1 library, is written exactly as before. --compute-hashes FILE writes only the compute programs whose code has one of the SHA-256 digests listed in FILE, with every state they are used with. It cannot be combined with --stages, and a digest no compute program has is an error before anything is written. tests/test_shader_library.py gets three tests on a synthetic library; all three fail on the base. The standard-library tests and the translator suite add no failing file. No retail library was read for this change. AI-assisted (Claude Code). Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rds llvm-mc rejects, so the FSR4 FSPX programs translate The FidelityFX upscaler programs hold 89 such words in 8 programs (docs/fspx.md); the translator already models the form but the listing could not carry it, so the programs were refused as a fall-through into undecodable words.
…ve64_masks Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_b64 of a lane mask) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c rejects) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fuses) Conflicts resolved toward what main and #583/#593 already have: the 24-byte prologue (#583's code_range), VOPC DPP decode and translation (main's 'DPP on a VOPC compare'), s_bitreplicate_b64_b32 into VCC and s_flbit_i32_b64 of a lane mask (#593). Kept from #998: code_range_last / branch_targets_inside / --last-endpgm in fspx_unpack, the compute fallback to tools/rdna2_decode.py in shader_disasm, and s_bitreplicate_b64_b32 of a lane-mask source into scalar data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fer store through a vcc resource luizwidmer/palmetto repairs these words outside the translator with tools/widen_smem_decode.py (the console's 112-SGPR file is wider than llvm-mc's 106). Here restore_vcc_tuples (#674) already decodes them from the blob; these cases pin the two forms its tests did not cover: s_buffer_load_dwordx8 into s[100:107] with an SGPR soffset and an immediate offset, and buffer_store_dword with its resource in s[104:107]. Encodings built from the field layout. Ported from luizwidmer/palmetto (GPL-3.0): the forms, from its docs/boot_frontier.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…red fields llvm-mc decodes a VOP3P v_dot4_i32_i8 whose op_sel_hi is not [1,1,1] (op_sel bit 1 clear) but prints and re-encodes it with op_sel 0 / op_sel_hi 7, so translate() refused it as a dropped field. When those two fields are the only difference between the stored and the printed bytes, they are now read from the blob, in check_printed_encodings and in both re-anchoring paths, and the v_dot4_i32_i8 rule applies them as measured on gfx1036 (a non-default S2 half stays refused). Any other difference is still refused. Ported from luizwidmer/palmetto (GPL-3.0): its restore_vop3p_dot4. Its console_dot4_word (the op_sel 2 / op_sel_hi 5 words llvm-mc rejects) is not ported: #1317 prints those in shader_disasm.py. Test: tests/semantic/test_dot4_printed_op_sel.py, hand-built words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ct-table sentence #998 added the rule (a 32-bit EXEC/VCC half as S0, read through Gen.wave_mask) without a test or a design.md entry. test_lane_mask_bitreplicate_flbit.py now runs it on every lane of a wave64 in the CPU interpreter, from exec_lo/exec_hi and from a compare's vcc_lo/vcc_hi, against the ISA pseudocode. design.md says it is interpreter-checked only, not measured on hardware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 files conflicted (about 200 hunks). Where main already had a reviewed version of the same feature, main's was kept and only what #984 adds on top was re-applied; what #984 adds that main lacks was taken. - d3d12_xs_device: slot 81 stays main's GetFrameStatisticsX with the presentation handler (#984's frame-events slot not taken); the presenter routing runs before #984's internal PresentX. Slots 25/26/127 and route_xbox_device_slot are main's (#984's null-heap check on 127 re-applied); slots 61/74 keep main's console-caller gating; slot 73 is main's (console list IID answered as ID3D12GraphicsCommandList, so #984's d3d12_xs_command_list_iid.h is dropped). Taken from #984: the console list proxy (slot 12 path, upload arena, tail names), queue layout detection, slot 9 allocator callback, slots 55/57/70/71/86/133, Vulkan-backed CPU heaps, the frame token source and the lease bias. The lease section both sides moved is kept once. - d3d12_vulkan_device: #984's staged/deferred title images and pool with main's create_image lambda and NVIDIA host-transfer retry around the final bind; main's B4G4R4A4 and stencil masks. - vulkan_backend.h / vulkan_replay.h: main's structure (device-lost flag, mark_device_lost outside the lock) with #984's observe_result and unsupported_at(__LINE__). - file_system / dstorage: #984's kernel_writes reads, main's touch_pages retry kept as the fallback. - rdna2spirv / shader_disasm / shader_ir: main's DPP compares, s_load VCC base and widen_wave64_masks, plus #984's skipped-instruction restore and per-line invalid-word offsets. rdna2_decode is main's: #984's f32-only DPP-compare block ran before main's general one and broke its decode. - xgameruntime_offline, d3d12_xs.cpp: main's. - Tests: main's and #984's checks both kept, adapted to the merged behaviour (queue tail S_OK, fence slot 12, slot 127 mask). Policy: executable-relative addresses that #984 quoted were removed (docs/fspx.md, docs/movies.md, docs/embedded_shaders.md, d3d12_vulkan.md, d3d12_xs_alloc_size.h, windows-boot scripts). The hang-watchdog kick in main.cpp and the transient-pool dump in startup_trace.h now take their locations from LEONIDA_TITLE_WATCHDOG_KICK / LEONIDA_POOL_DIAG_AT instead of hard-coded RVAs; the boot script's state peeks come from LEONIDA_GAME_STATE_RVA / LEONIDA_SESSION_STATE_RVA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dxgi_swapchain_count_test: main's failed-resize case passes the diagnostics argument #984 added to VulkanSwapchain. xs_proxy_mock_test follows the merge's choices: slot 81 is GetFrameStatisticsX (no frame events slot 102 in the env mode), slot 73 refuses an IID it does not know as main's did, and console queue slots the presenter does not route stay with the queue proxy (S_OK tail) instead of E_NOTIMPL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge kept main's widen_wave64_masks for wave64 lane masks; #984's variant had no caller left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These failed on #984's head as well. The loop guard (spirv_loop_guard.py) puts OpPhi into every loop, which the branch interpreter of test_control_flow_branches did not model; it now evaluates a block's phis together from the predecessor. spirv_mini_interp now models OpSwitch, so it runs the emulated wave64 scheduler that the ds_swizzle and permlane16 tests expected it to reject: they now compare the 64 lanes with their reference models. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to's dot4 op_sel fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/design.md # docs/fspx.md # tests/semantic/test_alu_dot4_i8.py # tests/semantic/test_salu_flbit_64.py # tests/semantic/test_vcc_tuple_fallback.py # tools/fspx_unpack.py # tools/rdna2spirv.py # tools/shader_library.py
…the console list List slot 146 (Barrier -> GCL7 80): a texture barrier with no resource, which the console takes as a global barrier, is forwarded as a D3D12_GLOBAL_BARRIER with the same sync and access; a mixed texture group is split into runs in order, in storage that lives for the call. Calls with nothing to convert keep the title's pointer. A group array that cannot be read safely (null with a nonzero count, an unknown group type, absurd counts) is refused whole and logged once per reason. List slot 52 (ClearRenderTargetView -> PC 48): the device proxy marks the real handle when CreateRenderTargetView gets no resource (moved by RTV descriptor copies, cleared by a view made with a resource), and the clear of a marked view is skipped, as on the console. Other views keep today's path. Before this, both calls put the PC list in its error state, so Close failed and ExecuteCommandLists dropped the submission. xs_proxy_mock_test models that error state in its mock list and covers both paths; the two old slot-146 cases that passed garbage words now pass valid ones. The null-resource barrier and null-view clear behaviour were first reported by luizwidmer/palmetto.
Merged
4 tasks done
aslan2142
added a commit
that referenced
this pull request
Nov 26, 2026
…eased The null-view marks (#1504, by ubiquitarianism) are kept by the real CPU handle. They were moved by descriptor copies and cleared by a view made with a resource, but never dropped when the heap went away, so an RTV heap made later at the same address inherited stale marks and its clears were skipped. The heap proxy now records an RTV heap's real CPU range and heap_release drops the marks in it. The barrier conversion keeps no state across calls, so it needs nothing here. xs_proxy_mock_test: an RTV heap's marked view is skipped while the heap lives and cleared after it is released; a mark outside it stays; a second heap at the same address starts unmarked and marks again. docs/d3d12_vulkan.md says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Closing as included: #2138, merged as AI-assisted (Claude Code, Claude Opus 5.5). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-NULL-BARRIER-CLEAR (#14 (comment))
Depends on: #1495
The retail title makes two console command-list calls that each put the PC list into its error state. When that happens,
Closefails andExecuteCommandListsdrops the whole submission. This PR handles both the way the console does.List slot 146:
Barrier, GCL7 slot 80The console treats a texture barrier with no resource as a global barrier.
D3D12_GLOBAL_BARRIERwith the same sync and access words.List slot 52:
ClearRenderTargetView, PC slot 48The title creates some render-target views with no resource and clears them every frame. On the console that clear does nothing.
CreateRenderTargetViewgets a null resource.CopyDescriptorsandCopyDescriptorsSimpleof RTVs move the marks with the descriptors. A view later re-created with a resource clears the mark.The proxy keeps its own marks because the layer's descriptor state can't tell a null-resource view apart from a view it failed to create.
Known gap: RTV records that the title copies with its own
memcpyare not followed.Tests
xs_proxy_mock_testnow models the PC error state in its mock list, so itsClosefails the way the real layer does.check_console_null_barrier_and_clearcases:Windows 11, VS 2026, Windows SDK 10.0.26100: ctest has 310 of 312 passing. The two failures,
d3d12_texture_tilesandd3d12_clear, also fail on plainmain. These cases are confirmed by the mock tests only, not by a retail run.docs/d3d12_vulkan.md§4.9 records both behaviours.