gpu: keep slot 57 descriptor keys stable across runs #3730
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3730"
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 R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-12-01T12:07:07Z.
Refs #2413, #3416
Why
A reviewed slot 57 profile is found by
<variant>.mesh57-state, where the variant hashes the descriptor afternormalize_mesh57_descriptor. The helper only removed relocation when the low words at +0x110/+0x288 and +0x270/+0x120 sat 0x10 apart and the two allocation addresses at +0x160/+0x2c0 were equal. Both conditions depend on where the records are allocated. In captures, the same pipeline passed them in one run and failed them in the next. Even recognized descriptors kept the 32-bit values at +0x188/+0x1a8/+0x1c8/+0x2e8 raw.Measured on two 600 s runs of a captured console package with the same scripted input,
X2W_MESH57_CAPTURE_STATE=1, pairing creation archives by identical.m57/.ps57/.rootbytes:On the 199 raw pairs, every field that moved was one of:
So no reviewed profile for these pipelines could load in a later run.
What
For the 0x300-byte layout, recognition now uses the zero and length fields, the two
0x04010000metadata words and the ten record pointers within 2 GiB of +0x38. The placement-dependent checks are dropped. Normalization:2bdc7258: without it a pointer equal to the base and an absent one both normalized to zero);Every caller (
hash_guest_stream, the.s57capture, native preparation and the fixture's profile writer) goes through the helper, so they change together.Tests
mesh57_descriptor_relocations(run bystartup_indirect_mesh_create_result_*):startup_indirect_mesh_create_result_warp.Commit
5132cbdb, release preset, Windows 11 Pro 10.0.26300, MSVC 19.44.35230 (Visual Studio 2022 Build Tools), WARP:4/4 passed, 0 skipped. The
_hardwarevariants were not run.The upstream PR check does not run the
native_*tests, so I ran every non-hardware one on the same commit and host (full release build):compute requires wave32)Not run: the 189
native_*_hardwaretests and the Debug configuration.Review follow-up (
2bdc7258): presence pairs inmesh57_descriptor_relocations, a current/earlier/raw archive control intests/mesh57_profile_draft_check.py, and an earlier-profile-only cache innative_mesh57_outcomes_*.native_mesh57_outcomes_warp,startup_indirect_mesh_create_result_warpandstartup_indirect_mesh57_stream_key_warp: 3/3 passed on WARP;_hardwarenot run.Run check
From the previous run's raw descriptors I predicted each creation archive name under the new rule, using the variant formula of
tools/startup/mesh57_profile.py. I then ran the same 600 s input on this commit (RTX 4090, driver 610.88):Not covered
.s57archives and profiles keep their old names and are not looked up.tools/startup/mesh57_profile.pyrefuses an extended descriptor that is raw or lacks the layout 2 presence word; re-capture withX2W_MESH57_CAPTURE_STATE=1and write the profile again from the same reviewed JSON.5132cbdb, before the presence word; not repeated.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T21:57:38Z.
Review: COMMENTED
Reviewed
5132cbdb6. Thanks for the change. Two points:src/startup_stubs/mesh57_profile.h:59, an optional pointer at0x198equal to the section base normalizes to zero, which is also the value for an absent pointer. The two descriptors then pass the same profile-name and byte checks insrc/startup_stubs/native_mesh57.inl:435and:499. Please preserve presence separately from the relative offset and add a control for this pair.src/startup_stubs/native_mesh57.inl:436only looks up the new variant. For an existing profile whose descriptor has a newly normalized second base, the old file is missed, and renaming it leaves mismatched descriptor bytes. Please define how existing profiles are read or regenerated, and exercise an old-profile-only cache through the writer and runtime lookup. The new helper assertions cover relocation and spacing but leave that path untested.Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-12-01T23:52:08Z.
Thanks, both points were real. Fixed in
2bdc7258, a new commit on top of5132cbdb.1. A pointer at the base vs no pointer. The same collision also happened in the second-base group: the first value re-bases to 0 in whichever slot holds it, so
[A, 0]and[0, A]at +0x188/+0x1a8 normalized the same.normalize_mesh57_descriptornow writes a presence word into the allocation word at +0x160, which it already discarded:iis set for each optional pointer (+0x198/+0x1b8/+0x1d8/+0x2f8) that held a relocated value;4 + iis set for each second-base slot (+0x188/+0x1a8/+0x1c8/+0x2e8) that held one.The descriptor stays 0x300 bytes, so neither the profile format nor the archive format changes.
mesh57_descriptor_relocationsadds both pairs (pointer equal to the section base vs absent, and the same second-base value in either slot). It checks that each pair stays distinct and that each result is idempotent.2. Existing profiles. They are regenerated, not read.
This change renames every extended-layout variant, including the ones
5132cbdbhad already made stable. A.s57archive stores the descriptor after normalization, so an old archive cannot be normalized again. So:tools/startup/mesh57_profile.py(read_creation, which the draft, check and write paths all use) refuses an extended descriptor (both0x04010000metadata words) unless +0x38 is zero and +0x160 carries layout 2. That covers raw archives and archives from the earlier normalization. The message asks for a new capture withX2W_MESH57_CAPTURE_STATE=1, then a rewrite from the same reviewed JSON.profile_absent, and the file is never opened.Tests:
tests/mesh57_profile_draft_check.pyruns a current, an earlier and a raw archive through the writer CLI andbuild_draft. Only the current one writes a profile. Removing either half of the refusal (the presence test or the +0x38 test) fails the check.native_mesh57_outcomes_*adds two extended records, each with a second base and a different metadata byte:Totals:
profile_absent 65(was 64),ready 2,lowering_reached 2, and 68 profile lookups with 3 opens (was 66 with 2). The earlier profile was never opened.docs/experiments/native-fixed-mesh57.mddescribes the presence word and how to regenerate a profile.Commit
2bdc7258, release preset, Windows 11 Pro 10.0.26300, MSVC 19.44, WARP:3/3 passed, 0 skipped.
python -B tests/mesh57_profile_draft_check.pyandtests/docs_links_check.pypass.Not done:
_hardwarevariants;5132cbdb. The presence word depends only on which slots hold a relocated value, and I expect that to be stable too, but I haven't measured it.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T02:13:23Z.
Thanks for the update in
2bdc7258. One observation from testing this head:Some extended fixed descriptors (both metadata words
0x04010000at +0x11C and +0x27C) have a zero section pointer at +0x38. Insrc/startup_stubs/mesh57_profile.h:45-48,normalize_mesh57_descriptorreturns them unchanged through the!is_pointer(section)early return, so +0x160 and +0x2C0 are left as captured. In the captures I inspected, +0x160 still held an allocation address, so the variant can differ between runs.tools/startup/mesh57_profile.pythen refuses those archives (+0x38 is zero, but +0x160 has no layout 2), which is consistent with its "layout the normalizer does not know" message.In one test run, 77 of 318 new slot 57 captures were refused as extended descriptors without the presence word; the ones I inspected all had this shape.
Is this layout meant to stay unsupported in this PR, or should the +0x160/+0x2C0 addresses still be dropped when +0x38 is zero?
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-12-02T11:50:57Z.
Thanks for checking. I see the same layout: in a 180 s capture at
2bdc7258, 82 of 349 extended archives had +0x38 zero and stayed raw. In every one, the other record pointers (+0x78, +0x120, +0x168, …) and +0x110/+0x270 are full process addresses. So dropping +0x160/+0x2C0 alone would not make the variant stable. The layout needs its own base, and choosing one needs the same descriptors from two runs.It stays unsupported in this PR. The helper leaves those descriptors raw, and the writer refuses them, as you saw. I'll take the layout up separately.
bcfb1dd3records the limitation indocs/experiments/native-fixed-mesh57.md.a63bb696merges main (7c9f2639). The only conflict was the outcomes fixture. Main now has the mesh-only creation reach the profile lookup, so with the two extended records the totals are:profile_absent 66;ready 2;Release preset, WARP, at
bcfb1dd3:3/3 and 17/17 passed, including
native_fixed_mesh57_depth_only_warp.tests/mesh57_profile_draft_check.pyandtests/docs_links_check.pypass. Hardware variants not run.Separately, the profile regenerated from a new capture at
2bdc7258loads in a 180 s run:ready 1, and every profile-rejection counter is 0.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-12-02T14:00:44Z.
CI note for
bcfb1dd3: "Build and test on Windows" fails on one test,native_direct_mesh. The cause is on main, not in this PR.AssertionError: native compute +0x34: unmapped graphics exportattests/native_direct_mesh_check.py:883, in theinteger-row/float-rowgfx1013-container-mscase.src/startup_stubs/mesh57_profile.h(included by the runtime shim only),tools/startup/mesh57_profile.py,tests/mesh57_profile_draft_check.py,tests/startup_indirect_draw_indexed.cppanddocs/experiments/native-fixed-mesh57.md.compile_dxiland the mesh frontend are byte-identical to main at7c9f2639, the merged base.7c9f2639(run 46870369449) and5770f14e(run 46880161821) stop earlier, at a compile error innative_compute_pack_refusal_check, sonative_direct_meshnever runs there.I haven't identified which merge on main introduced the failure. The recent mesh frontend merges (#3707, #3841, #3825) are the likely candidates.
AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T16:33:24Z.
Review: CHANGES_REQUESTED
The six independent MSVC Debug checks passed (profile draft, create-result, stream key and outcomes, with WARP and RTX 4060 Laptop where registered). I found one uncovered raw-archive case. With both extended markers,
+0x38 = 0, raw record pointers,+0x160 = 0x0000000230030000and+0x2c0 = 0x0000000240040000, the currentbuild_draft()accepts the source-built archive. The writer only checks the version byte inside+0x160, so this ordinary allocation address looks like layout 2. The runtime leaves the record raw when the section pointer is zero. Please validate the full presence-word shape (including reserved bits and the cleared allocation word), and add this zero-section/raw-allocation negative control to the draft and writer fixture.Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-12-02T16:58:18Z.
Thanks, you're right: the writer only checked the version byte. Fixed in
ea92597f.read_creation(tools/startup/mesh57_profile.py) now accepts an extended descriptor only in the exact shapenormalize_mesh57_descriptorleaves:tests/mesh57_profile_draft_check.pyadds your zero-section raw archive (raw record pointers, +0x160 =0x0000000230030000, +0x2C0 =0x0000000240040000). It is refused by bothbuild_draft()and the writer CLI. There is also one control per condition: reserved bits set, allocation word kept, an absolute record pointer, a nonzero section pointer. I removed each condition from the writer in turn, and each time the matching control failed.On a local 180 s capture, the shape check gives the same result as before: all 267 normalized extended archives are accepted, and the 82 raw zero-section ones are refused. The regenerated profile's archive still passes
--check. The doc paragraph indocs/experiments/native-fixed-mesh57.mdlists the conditions.python -B tests/mesh57_profile_draft_check.pyandtests/docs_links_check.pypass. The C++ side is unchanged, so I didn't rerun the WARP tests for this commit; they passed at2796f82e.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T17:11:26Z.
Review: APPROVED
Re-reviewed
ea92597f. The reader now checks the full layout word, cleared allocation and signed relative record pointers. The zero-section raw archive from my previous review is now refused by both the draft and the writer. Independentpython -B tests/mesh57_profile_draft_check.pypassed on this head. Compared to2796f82e, the runtime and C++ fixtures are unchanged; the six earlier WARP, hardware and profile checks passed on that runtime.