Recompiler: handle packed ISG1 vertex inputs sharing a register (#105) #310
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/313"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Michael-Glaser on 2026-11-23T23:07:37Z.
Part of #105.
Mode::VertexnamedXclInfieldsa{e.register}and ignorede.mask, emitting duplicate field names and reading wrong channels when twoISG1inputs share a register. Overlaps #297 / #1371 (same packed-ISG1 issue, different approach).What is in it
crates/xcl/src/gpu/recomp/emit.rs: nameXclInfieldsa{k}by index (matchingMode::Pixel) and map VGPR channels usinge.mask.crates/xcl/src/gpu/recomp/tests.rs: unit testvertex_packed_isg1_inputs_get_distinct_fields_and_components.Tested
aarch64-apple-darwin, Rust 1.100.0):cargo check --offline --target x86_64-pc-windows-msvc --workspace --tests(0 errors, 0 new warnings).40f90f7by@JJAutoCompare(Windows 11, DXC 1.9.2609.5:vertex_packed_isg1_inputs_get_distinct_fields_and_components1 passed, 0 failed) and@DavidM1911(RTX 3060 Ti, merged withmain:cargo test -p xcl --libpassed); plus earlier revision run by@regiumlepidi(RTX 5070 Ti + RDNA2 iGPU: 667 passed, 0 failed, 41 ignored; negative control confirmed).Regression run
Retail 60 s smoke run contributed by
@Toons29(AMD Radeon RX 9070 RDNA4, driver 32.0.32029.2010, Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0, release build,XCL_NETWORK=0):Not tested
AI use
@Toons29with Claude Code (Claude Opus 5.5).Imported from ivall/xcl. Originally posted by regiumlepidi on 2026-11-23T23:46:24Z.
A Windows run for this draft, and a note that #297 (draft) fixes the same packed-ISG1 case in another way; the two conflict in
emit.rs.This PR:
18ca3b6merged onto currentmaindb1ddb2(clean merge) builds and passes on both adapters: 667 passed, 0 failed, 41 ignored on an RTX 5070 Ti (driver 617.42) and on the Ryzen 7 9800X3D's RDNA2 iGPU (driver 32.0.21030.2001,XCL_ADAPTER=radeon);mainalone is 666 / 0 / 41 on both.vertex_packed_isg1_inputs_get_distinct_fields_and_componentsfails withmain'semit.rsand passes with this PR's. Windows 11 Pro 25H2, Ryzen 7 9800X3D, rustc 1.100.0 MSVC, DXC from Windows SDK 10.0.26100, debug, noXCL_SAMPLE_*.Cross-check with #297 (
a5b7825; #297 does not merge withmaindb1ddb2any more, so each PR at its own head, on9ab7d76). Each PR's tests appended to the other'stests.rs, both adapters, same result on each:gpu_vs_packed_isg1_inputs(draws on the GPU)vs_packed_isg1_inputs_are_members_of_their_own(HLSL text)vertex_packed_isg1_inputs_get_distinct_fields_and_components(HLSL text)mainfloat2 a1_0/float2 a1_2, notfloat4 a1/a2a1_0memberSo on the one test that draws (packed TEXCOORD0 .xy / TEXCOORD1 .zw through an R32G32 input layout), both fixes give the expected pixels on NVIDIA and on RDNA2; the failing cross cases only assert the other PR's member names. Both read a component no element covers as
0u, and both keep an element alone in its register asfloat4 a…. The difference that is left: #313 declares every packed element as a 4-vector starting at component 0 and indexes by the bits of its mask, #297 declares each with its own width.Not tested:
scripts/smoke.ps1on a real title (I have none); RDNA3 / RDNA4, Intel.AI use: Claude Code with Claude Opus 5.5 ran the builds and the cross-check and wrote this comment; the numbers come from those runs.
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T14:07:48Z.
This and #297 (opened 28 minutes earlier) both fix the packed ISG1 vertex inputs of #105: two elements in one register become two
XclInmembers instead of two members with one name. They differ in how a fetch-shader VGPR finds its member:a{register}_{first}and declares only the components of its mask. It maps VGPRinput_vgpr + cto componentc - first. A component no element covers stays 0.a{k}, each a full4-vector. It maps by the popcount of the element's mask below the channel, and falls back to the first element whose register holds the VGPR.Both have tests. They edit the same lines of
emit.rs, so only one can land. Read from the diffs only; I have not run either.AI-assisted (Claude Code).
Imported from ivall/xcl. Originally posted by throny on 2026-11-24T19:38:27Z.
Two contributors checked independently and found that #297 #1371 solves the same problem (for #105) in a different way: #1607, group D20. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T02:54:27Z.
Regression run of
40f90f7bon the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:13:04Z.
Tested
Independent native Windows run for xcl-dev/xcl#313 at
40f90f7b09fcad72ebcc4822b77b8f521e3049a7, verified as the open PR head before the run. The assigned detached checkout was clean before and after testing. The PR discussion had a same-head AMD retail smoke run and an older-revision Windows suite run. It had no equivalent exact-head focused CPU result.STOR-WINLAB, Windows 11 Enterprise Evaluation 25H2 x64 (build 26200.9974), AMD Ryzen 7 3800X, Rust and Cargo 1.100.0 (
stable-x86_64-pc-windows-msvc, rustc0ef1bc386). Cargo used the unoptimized test profile with debug info and incremental compilation disabled. XCL logged dxcompiler and dxil 1.9.2609.5.Exit 0. 1 passed, 0 failed, 0 ignored, 0 skipped, 719 filtered out. The synthetic fixture asserts complete HLSL translation, distinct
float4fieldsa0,a1, anda2forPOSITION0,TEXCOORD0, andTEXCOORD1, and VGPR readsv4/v7froma0[0/3],v8/v9froma1[0/1], andv10/v11froma2[0/1], including the remap from the shared register's.zw. The run loaded DXC and successfully compiledmainasvs_6_6to DXIL with DXC's default validation. The build emitted one deprecation warning forfetch_updateinxgameruntime.Not tested
Separate DXIL validation, D3D12 pipeline creation, GPU execution, retail titles, the workspace suite, and comparison with #1371.
AI use
T3 Code / Codex (gpt-6.2-sol) inspected the fixture, ran the existing test, and wrote this report.
Raw evidence:
L:/XclTooling/pr313/environment.log,L:/XclTooling/pr313/cargo-test.log,L:/XclTooling/pr313/pr-313.html.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:43:34Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by Michael-Glaser on 2026-11-27T12:01:38Z.
Thanks @Toons29, @JJAutoCompare, @DavidM1911, and @upipibi! Added the verbatim
xcl-smoke v1regression blocks for40f90f7and the exact-head DXC test results into the PR description. Happy to defer to #297 / #1371 if maintainers prefer one of those approaches.Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T19:20:39Z.
merge-check claim
head:
40f90f7b09Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T19:40:33Z.
merge-check
base:
ff0c364b3dhead:
40f90f7b09merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, run in the same batch: 2888 passed, 1 failed, 51 ignored, 28 SKIPPED lines; its one failure,
hle::d3d12x::pso_async::used_tests::emission_resolves_the_retained_recipe_after_title_address_reuse, passed in this merged run and in the six others of the batch, so it is intermittent on the base and not this PR's. The new testvertex_packed_isg1_inputs_get_distinct_fields_and_componentspassed (it compiles the result with DXC), and so did the existingvs_system_values_in_isg1_registers.review: no blocking finding; two files, every hunk read.
XclInfields are now named by the element's index, not its register, so two ISG1 elements packed into one register no longer produce two fields of the same name. A VGPR of a packed register reads the element whose mask covers that channel, at component popcount(mask below the channel), since the input assembler loads each semantic from component 0; a channel no mask covers falls back to the register's first element at the raw channel, which keeps the old result (e.g. POSITION.w with mask 0x7). The only otherxi.a{..}inemit.rsis the pixel-stage interpolation, which has its own struct and is not touched. Two notes, not blocking: #297 addresses the same issue (#105) and currently conflicts withmain, so only one of the two should go in; and there is no GPU run of a vertex shader with packed inputs here, the evidence is the generated HLSL and its DXC compile. Not done: a retail title run.performance: none at run time: only the names and component indices of vertex input fields in the generated HLSL change.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T19:48:07Z.
merge-check claim
head:
40f90f7b09Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T19:53:17Z.
merge-check
base:
ff0c364b3dhead:
40f90f7b09merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new test gpu::recomp::tests::vertex_packed_isg1_inputs_get_distinct_fields_and_components passed (including DXC vs_6_6 compile)
review: none. Read the full diff (+59/-4 across crates/xcl/src/gpu/recomp/emit.rs and crates/xcl/src/gpu/recomp/tests.rs). Naming non-SV vertex inputs in XclIn by enumerated index
a{k}avoids duplicate HLSL field names when multiple ISG1 elements share a register; channel lookup matches(e.mask >> chan) & 1 != 0and computes the packed component index via(e.mask & ((1u8 << chan) - 1)).count_ones(), with a fallback to the first element at that register for unmasked channels (e.g. POSITION.w on mask 0x7). Unit test verifies distinct fields (a0/a1/a2), component mapping for.xy(0x3) and.zw(0xC) sharing register 1, unmasked.wfallback, and DXCvs_6_6compilation. Already tracked in #1607 group D20 (#297, #313, #1371 — triaged as different approaches); no new duplicates found.performance: none (compile-time HLSL emission only; generated vertex shader reads the same inputs)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:07:02Z.
Triage (#1607) – head
40f90f7#297 and #1371 fix the same duplicate
a{register}XclIn member (#105), in different ways (group D20 in #1607). #297 gives only packed elements their own member,a{reg}_{first}, sized to the mask, and has a GPU draw test. This PR renames every input toa{k}and maps each channel by the mask bits. #1371 reads the packed member at the register channel, so a .zw element gets the IA default.In emit.rs (Mode::Vertex), a component that no element at a packed register covers falls back to the first element's
a{k}[v-b], which is that element's IA default. #297 reads 0u there.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.