Repository navigation
runtime: rewrite bound delay QueryApiImpl and always log it - #4
Closed
SimSalabimse wants to merge 1575 commits into
Closed
SimSalabimse wants to merge 1575 commits into
SimSalabimse wants to merge 1575 commits into
Conversation
Refs R0Y00#721 Written with Gemini 4 Hydrogen (Antigravity CLI), reviewed by Claude.
…-round-mode shader: lower s_round_mode 0x0 and 0xc as MODE[3:2] writes in pixel_aot
compute: lower v_bcnt_u32_b32 in compute_store_aot
…records tests: record form coverage for eight merged compute_store_aot slices
The format of a gfx1013 buffer_load_format_{x,xy,xyz,xyzw} through t0 is
now read at run time from V# word 3, a ready constant word named once
per load with --load-format-constant. This mirrors the descriptor-format
stores. One HLSL function decodes the GFX10 and legacy identities and the
store format set. Its conversions are integer arithmetic: UNORM and
SNORM16 round to nearest even by long division, and FLOAT16 widens
exactly. An unknown format, other fixed bits, or an opcode wider than the
format returns zeros. d16, offen, gfx1030 and --source-format stay
refused. The descriptor itself is still the static t0 binding.
A --compute-store-case file may now end with 320 t0 words, so the
fixture can put edge values in each field. Fourteen loads compare all
320 words for one and two groups, plus an 8_SNORM refusal run. Nine
wrong references and eight mutated HLSL sources must fail on the GPU.
LLVM 15 assembles the fixture and the round trip matches.
Refs R0Y00#2022 (item A, first slice)
AI-assisted (Claude Code); reviewed and run locally.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shader: lower compute v_sub_co_u32 / v_subrev_co_u32 and their carry-in forms
…riptor unchanged The consumer compares the destination's 32 bytes after each of the fifteen refused calls and exits with 60 plus the call's position when one changed them. Accepting 2x1 now fails with 61. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The racing cases now fail when the reader never reached the store read seam, and for slot 20 when it never stopped between two blob reads, so a read path that bypasses the hook cannot pass. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
shader: lower s_sext_i32_i8/i16, s_cmov_b32/b64 and s_cmovk_i32 in gfx2hlsl (Part of R0Y00#1723)
storage: implement next DirectStorage/BCPack slice (Part of R0Y00#1198)
shader: lower compute v_dot2_u32_u16 and v_dot4_u32_u8
…port debug_launch.py arms the runtime and movie-player call hooks together with the file hooks, so with file tracing off (--offline 0 without --trace-files 1) --trace-calls 1 arms nothing. The summary already printed "call tracing: off" in that case, but gave no reason, so the flag looked ignored. It now says that --trace-calls 1 needs file tracing. The hooked export names move into RUNTIME_CALL_HOOKS and MOVIE_CALL_HOOKS. startup_debug requires its fixture's module and export to be in that list (with a control that the guard rejects the export once it is dropped), so the call-count case cannot pass with nothing hooked, and adds a case: --trace-calls 1 with file tracing off counts no call and prints the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under the declared wave32 guest profile (lower(..., wave_size=32)), s_and_saveexec_b32 sN, vcc_lo|sM opens the same structured masked region as s_and_saveexec_b64. A wave32 guest's EXEC is exec_lo, so the following forms work on the one saved SGPR, with the wave64 arm, join, skip, wait, scalar-load and scalar-ALU rules unchanged: - s_mov_b32 exec_lo, sN and s_or_b32 exec_lo, exec_lo, sN close the region; - s_andn2_b32 exec_lo, sN, exec_lo switches it once to its else arm; - s_cbranch_execz targets the wave32 close or else. A region accepts only the close and else spellings of its own width, so a wave32 form in a wave64 region keeps its old refusal message. The opener is refused without the profile, with any other operand spelling, when it saves into the condition register, when the save register is pending or out of range, when the condition is untracked or spans two registers, and outside the entry mask. check_wave32_region_controls derives each wave32 fixture from a wave64 fixture by replacing its exec lines. The fixtures are the plain, complementary and skip regions, every saveexec if/else shape, and the saveexec wait, scalar-ALU, scalar-load and body families. Each wave32 fixture must lower to identical HLSL, and every refusal is pinned with its message. The exec_regions draws and the LLVM 15 round trip (+wavefrontsize32) include the wave32 twins. tests/form_coverage_check.py no longer lists s_and_saveexec_b32 as rejected and asserts that it is covered. Fixes R0Y00#2137 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…opt-in
Review follow-up. A resolve that covered a never-begun index, or one ended
with the other occlusion type, could reach ResolveQueryData and read
uninitialized query data.
- A resolve is forwarded only if every index in its range has an observed
EndQuery of the same type on the current recording. A new BeginQuery on
the index clears its completion; Close clears all of them with the rest of
the recording state.
- The query slots refuse every command-list type other than DIRECT.
- Which console methods sit at slots 28 to 30 is still a hypothesis, so the
bindings are now a diagnostic opt-in, X2W_D3D12_QUERY_SLOTS=1 (render
mode). Unset, the three slots stay no-ops as before. The test-only
X2W_TEST_QUERY_IGNORE is removed.
- startup_list_queries sets the opt-in and keeps both successful readbacks.
New untouched-sentinel cases cover a never-begun index, a range with a
hole and the wrong type. The control is now
startup_list_queries_default_{warp,hardware}_control: it runs without the
switch and must report the untouched sentinel in the first word.
- Known limit: a resolve recorded on a later list than the EndQuery calls it
covers is refused.
Refs R0Y00#870
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…y-semantic startup: link stream pixel attributes to vertex parameters by semantic
Following the review on R0Y00#2022, a descriptor-format load is valid only when its opcode reads exactly the format's channel count, the format is handled, and the fixed bits are an identity value. load_descriptor_format now reports that validity, and every load is staged before the first store. If any load is invalid, the invocation returns before storing, so no placeholder result is published and zero data from a valid read stays distinguishable. The format words are uniform constants, so the whole dispatch leaves u0 unwritten. The fixture now uses matching widths only (32_32_32_UINT and 32_32_FLOAT replace the narrower and wider reads). Four invalid-format runs (8_SNORM, a narrower and a wider opcode, a non-identity DST_SEL) must leave all 320 words at the sentinel. Zero-filled and D3D-fill references must fail on them, as must sources with the refusal removed, either width accepted, or the selectors ignored. A control also checks that the gfx1030 caller-format loads are unchanged. Refs R0Y00#2022 (item A, first slice) AI-assisted (Claude Code); reviewed and run locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…formation-error startup: return the failed call's error from the stand-in's File::GetFileInformation
…ne flag encoding in the fixture Part of R0Y00#2125. A quad swap now needs an earlier s_wqm of exec into itself; without it the swap is refused, since the hardware masks inactive source lanes of a partly covered quad and QuadReadAcross does not. A restored older EXEC copy drops the proof. The fixture flag is the inline 2.0 so the llvm-mc round trip matches.
…med-root startup: refuse a malformed root signature blob per request in gfx2hlsl
…eared use flag AI-assisted.
…ries startup: forward occlusion queries on command-list slots 28 to 30
Refs R0Y00#721 Written with Gemini 4 Hydrogen (Antigravity CLI), reviewed by Claude.
…t-queries docs: record adjacent coverage queries on desktop Intel UHD 770
* shader: draw the core pixel shader set on a Vulkan device draw-core-vulkan runs check_render (core set) unchanged on a Vulkan 1.2 device: compile_shader emits SPIR-V with non-colliding bindings and tests/vk_offscreen.py stands in for offscreen_check in the four modes that set reaches. A device without shaderDenormPreserveFloat32 is a capability skip; --allow-denorm-mismatch draws anyway as a diagnostic. Refs R0Y00#614 * tests: check every channel and run the fake host on Windows in vk_offscreen The one-ulp control only perturbed channel 2, so a compare() that skipped alpha still passed the self-test. It now perturbs each channel in turn and checks which channel the report flags. The fake host was an extensionless shebang script, which CreateProcess refuses, so every batch case ended as status=error on Windows. The script is now fake_host.py, started through sys.executable by a .cmd launcher on Windows and a sh launcher elsewhere.
…irstlane_b32 (R0Y00#2309) * shader: preserve one-path SGPRs and uniform loop counters for v_readfirstlane_b32 * shader: address review nits on readfirstlane proof loop and defaults
Use four single-thread groups to cover the old EXEC and source bits. Check saved EXEC, SCC and new EXEC for five forms against the AMD RDNA 2 ISA, section 12.3 (SOP1). Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
R0Y00#2313) tbuffer_load_format_* with gfx10 format 27 (LLVM 15: BUF_DATA_FORMAT_16_16 with BUF_NUM_FORMAT_UINT) reads two unsigned 16-bit fields, the low half into X, with Z = 0 and W = 1 like the other integer rows. It was refused as an unknown buffer format. Test: startup_vertex_fetch_formats_check.py gains the format (stride 6, offset 2, so half of the elements cross a dword) and three mutations: a normalized low half, the high half from the low half, and a missing W read as 1.0. WARP and hardware readbacks match the byte reference and every mutation fails.
…plit with pure-Python unit and CLI suite (R0Y00#2312)
* startup: lower image_get_lod on a 2D texture in gfx2hlsl image_get_lod returns [0], the clamped LOD a sample would use, and [1], the computed LOD before the clamp (Mesa nir_texop_lod, which ACO emits as image_get_lod; GLSL textureQueryLod x/y). It is lowered to HLSL CalculateLevelOfDetail and CalculateLevelOfDetailUnclamped on the same texture and sampler. Both calls take implicit derivatives, so the rule of image_sample_b applies: pixel stage, entry mask, no branches. The clamped value depends on the sampler's LOD limits and bias, so the sampler must be a constant descriptor under the same validation as image_sample_b (no bias, mipmapping enabled, MIN_LOD <= MAX_LOD), with its limits carried to the static sampler. Only dim 2D, two address registers, dmask 0x1-0x3 and the cache-policy bits are accepted. Test: tests/startup_gfx2hlsl_image_get_lod_check.py (synthetic fixture derived from the recorded c_lz stage, MIMG opcode 0x60). Controls: dmask 0x4, a 2D array, a branch, a sampler bias and a sampler with mipmapping disabled are refused; negative control: the stage is refused without op_image_get_lod, as on main. * test: pin image_get_lod dmask 0x2 packing (unclamped LOD into the first register)
…R0Y00#2320) A compute buffer store through a descriptor whose dword 1 was ANDed with 0xc000ffff is now accepted. The operation clears the stride field (bits 29:16) and keeps the base address bits 15:0 and bits 31:30. The result is the raw descriptor a byte-address store already assumes. - The clear is marked on its own (a 'stride0' word, compute only). Every other modification is recorded separately and still refuses the store: another mask, another dword, a repeated modification, and the same clear on an image store. - Loads through the descriptor keep treating it as modified, so graphics output is unchanged. - The clear is a scalar ALU op on descriptor data, so the stale-SCC rule refuses an SCC read before a fresh compare; pinned for s_cselect and s_cbranch_scc. Fixture case I is case A with the clear before the store. The runner binds a root UAV and reads no descriptor, so the GPU run checks the translation only. The pure-Python controls pin the accepted mask (either operand order) and the refused neighbours. Refs R0Y00#2274 Refs R0Y00#2302 Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Agent environment: Codex + GPT-6.2 Astra xhigh
Cover the same-handle duplicate-load case identified in review of R0Y00#2303.
… with unit and CLI suite (R0Y00#2321)
…ORPS) in cpu_sse_fp_aot (R0Y00#2084) * cpu: lower legacy SSE packed bitwise FP logic (ANDPS, ANDNPS, ORPS, XORPS) in cpu_sse_fp_aot * Keep localized MSVC diagnostics in the SSE fixture --------- Co-authored-by: Royoo <3230853833@qq.com>
…dary-adapter tests: accept adapter selection notices in compute readbacks
…PMULHUW, PSADBW) in cpu_sse_mmx_aot (R0Y00#2094)
An inline sampler descriptor can be built from scalar constants with s_movk_i32, s_bfm_b32, s_mov_b32 and s_brev_b32. The first three already gave known words; s_brev_b32 was a run-time reversebits, so the descriptor was refused as partly constant. Stage.scalar now folds the operations in SCALAR_CONST_FOLD (s_brev_b32: AMD RDNA 2 ISA D[31:0] = S0[0:31], no SCC write) when every operand is a known constant. The emitted HLSL changes for stages that already translated (reversebits(c) becomes the folded word), so the shader cache revision moves to x2w-startup-shader-13 in the runtime, gfx2hlsl and the tests that pin it. Test: tests/startup_gfx2hlsl_scalar_brev_fold_check.py. It checks brev of an inline constant and of a folded s_bfm_b32, and a sampler word written by s_brev_b32 that now samples through a constant sampler. Controls: an operand that is not known keeps reversebits; without the fold table the results are not constants and the sampler is refused. Co-authored-by: Royoo <3230853833@qq.com>
…unit and CLI coverage (R0Y00#2080) * script: extract testable main(argv) in script_path_replay and expand unit and CLI coverage * script: fix container tuple precedence and add OSError host DLL test * script: document mock resolver contract and pin over-up relative path test
…I suite (R0Y00#2050) * tooling: validate family names in expected_values and add unit and CLI suite * tooling: verify generated HLSL body matches variant family, size, and expected values
…0Y00#2327) * startup: translate a bounded dword LDS exchange across a group barrier * tests: verify cross-lane LDS exchange and broadcast on desktop GPUs Agent environment: Codex + GPT-6.2 Astra xhigh * startup: check the barrier operand and document the local-ID proof --------- Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
* xapu: optional Opus packet decode behind X2W_WITH_OPUS With -DX2W_WITH_OPUS=ON and typed completions on, a type 3 command decodes one Opus packet with an installed libopus and completes with the decoded byte count at result +0x34. Refused commands queue nothing and leave the output untouched. The default configure and CI do not depend on libopus. Refs R0Y00#1145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * xapu: refuse a full queue before decoding and keep the slot decoder on failure Queue room is reserved before a decode, reset or close, so a refused command changes no decoder state. A decoder for a new rate or channel count replaces the slot's only after a good decode. Tests cover the full queue, reset and close separately, and a rate change on a live slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: note the optional +0x34 decoded bytes in the typed completion text Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * runtime: check Opus failures on an active decoder slot --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Royoo <3230853833@qq.com>
Without XSAVEC (CPUID.(0xD,1):EAX[1]) a restore with XCOMP_BV[63] set always raises #GP. native_exports_for_host drops the compacted fixtures on such hosts, but the entry-MXCSR control restored compacted_avx through the general op_xrstor64_avx_xsaveopt64_avx export, and the SSE compacted control was gated only on XSAVEOPT. cpu_aot_xsave_state stopped with "access violation reading 0xffffffffffffffff" on a host with XSAVEOPT and no XSAVEC. The native compacted restore now runs only with XSAVEC; the standard image comparison still runs. The SSE compacted control goes with XSAVEC, and the gate check covers a host with XSAVEOPT but no XSAVEC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lower gfx1013 explicit-LOD 2D image_gather4_l across pixel and compute stages via gather_2d_lod(...) using Texture2D.GetDimensions and clamped bilinear-footprint Load taps, with shared 2D gather setup validation and fixed-table unmodified compute descriptor provenance checks. Refs R0Y00#1802
…gate tests: gate the native compacted XRSTOR controls on XSAVEC
…00#1723) (R0Y00#2088) * shader: lower s_lshl_b64, s_lshr_b64, s_ashr_i64, s_bfe_i32, s_bfe_u64 and s_bfe_i64 in gfx2hlsl (Part of R0Y00#1723) Scalar 64-bit shifts and bitfield extracts fold constant operands and otherwise emit one block that reads every source before writing a destination; SCC is set to (result != 0). Adds bfe32/bfe64 helpers and a pure-Python check that runs the emitted helper text against a bit-string reference. * shader: sign-extend s_bfe fields past the source MSB, clear lane-mask tags on overwrite, refuse masks in either source word (Part of R0Y00#1723) --------- Co-authored-by: Royoo <3230853833@qq.com>
…rs with unit and CLI suite (R0Y00#2334)
Account-picker TRACE_API still shows zero providers after the scoped package
GPA patch. Delay-imported QueryApiImpl binds through the CRT helper (unhooked
GetProcAddress), so the title keeps calling the real export. Rewrite that slot
only after it equals the remembered export; leave unbound thunks alone. Always
log GetProcAddress("QueryApiImpl") past the generic 40-line GPA cap, and record
how the real export was first remembered.
Synthetic PE control covers bound vs unbound delay slots; the Windows scope
fixture delay-loads QueryApiImpl with unbound and pre-attach-cache negatives.
Refs R0Y00#870.
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
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.
Change
Account-picker TRACE_API on tip-of-main still shows zero
QueryApiImpl/provider … proxiedafter the scoped package GPA patch (R0Y00#2166). Y reaches GameInput (0x20);#2201never gets a chance. Do not treat this as FakeUser slot-7 evidence.Delay-imported
xgameruntime.dll!QueryApiImplbinds through the CRT delay helper (its own unhookedGetProcAddress), so the title keeps calling the real export while the proxy only remembered it. This change:QueryApiImplIAT slot only when it already equals the remembered real export (delay_query_slot_is_bound); unbound thunks stay untouchedGetProcAddress("QueryApiImpl")past the generic 40-line GPA capQueryApiImpl remembered via {gpa|iat|export}and a one-shotQueryApiImpl statuswhenxgameruntimeis loadedSynthetic PE control + Windows
startup_runtime_proxy_scopecover the bound rewrite; unbound delay and a pre-attach cached pointer are negative controls (the cache still calls the real export — claimable follow-up).Refs R0Y00#870.
AI-assisted.
Verification
On Windows after configure (not run on this Linux host):
Evidence and follow-up
Source-built / synthetic only; no game files.
docs/startup-runtime.mdX2W_RUNTIME_PROXYrow updated.User re-test: rebuild GameInput/runtime proxy from this branch, same
run.ps1with$env:X2W_TRACE_API='1', press Y once the picker is up. Look forQueryApiImpl remembered via, always-onGetProcAddress(..., "QueryApiImpl"),bound delay QueryApiImpl import(s) rewritten, and anyprovider … proxied. Still zero providers → pre-attach export trampoline / non-IAT path (see linked issues). Still no FakeUser slot-7 guess.Checklist