tooling: scan slot 57 mesh-layout blocks for the unlocated registers #3889

Merged
Leyukaka merged 4 commits from upstream-pr/3889 into main 2026-12-02 21:16:16 +00:00
Leyukaka commented 2026-12-02 20:48:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T20:48:19Z.


Problem

A reviewed slot 57 profile needs register fields that no decoder reads yet: the colour write masks, CB_COLOR_CONTROL, the pixel input setup (SPI_PS_INPUT_ADDR / _ENA, SPI_PS_IN_CONTROL), the sample masks, PA_SU_SC_MODE_CNTL and DB_ALPHA_TO_MASK. Their position in the mesh-layout creation blocks is not known. The guest builds state blocks A and B itself, so no source-built pipeline can produce a block with one field changed. The offsets in use today (DB_* at A+0x10C, CB_BLENDn_CONTROL at A+0x124) were found by reading captured blocks against the gfx10 field layouts (#1216, #3503).

This advances the profile work in #3416 (part of #2413), and the open location questions in #1216 (CB_TARGET_MASK) and #1999 item B (PA_SU_SC_MODE_CNTL).

Change

  • tools/startup/mesh57_register_scan.py <request_dir> repeats that comparison over a whole capture corpus without assuming a location. For each register it tests every aligned offset of blocks A and B against a predicate built from the gfx10 field definitions (Mesa src/amd/registers/gfx10.json) and from evidence the capture holds outside the blocks: the pixel program's exports and interpolation, and the .t57 attachment tuple.
  • An offset is reported as located only when every informative variant agrees, at least three variants are informative, its value varies between them, and no other offset survives. A word that is constant across the corpus is never reported as located. Registers resolve in a fixed order, and a located offset is not offered to later rows.
  • Output is offsets and counts only, never captured values or archive names.
  • tests/mesh57_register_scan_check.py (ctest mesh57_register_scan) plants each register in synthetic archives at offsets chosen for the test. Three negative controls: a word moved by one dword in one variant, a corpus whose values never vary, and a corpus without extra bound targets (shader mask and target mask cannot be separated).
  • docs/experiments/native-fixed-mesh57.md gains the section "Locating the remaining mesh-layout registers" with the evidence and result per register.

No runtime code changes. No profile reads the new offsets yet.

Validation

ctest --preset dev --no-tests=error -R '^mesh57_register_scan$'

Passes on Windows (MSVC build tree). The check is source-built and needs no GPU and no capture.

Results so far

Three independent capture corpora, 318 to 330 mesh-layout variants each, default threshold. All three gave the same verdict and the same candidates for every row.

Register Result
CB_COLOR_CONTROL A+0x0D0 in the mesh layout (tag 6, the same base as CB_BLEND at A+0x124): the only offset whose words pass the field test (reserved bits zero, a valid ROP3, CB_NORMAL mode when colour is exported) in all three captures, with three distinct values. A pattern match, not a mutation proof; no field is read yet.
DB_ALPHA_TO_MASK A+0x0B4, provisional: reserved bits only, two distinct words, and the same word also passes the PA_SU_SC_MODE_CNTL predicate
SPI_PS_IN_CONTROL ambiguous, two candidates; A+0x0B0 matched in every informative variant, A+0x00C in about 42 %
CB_SHADER_MASK ambiguous between A+0x0C4 and A+0x0CC
PA_SU_SC_MODE_CNTL ambiguous, five candidates
CB_TARGET_MASK unresolved
SPI_PS_INPUT_ADDR / _ENA unresolved (_ENA depends on _ADDR)
PA_SC_AA_MASK_* unresolved

The evidence is independent of any earlier local measurement: it comes from the public register definitions and from the scan's agreement counts. The repository receives no captured values, no archive names, no keys and no guest data, only the tool, the synthetic check and the offsets above.

Not covered

  • Mesh entry dimensions (threads, vertex and primitive limits, group stride, wave size) are not in these blocks as far as the scan can tell, and the capture holds no independent evidence for them.
  • PA_SC_AA_MASK, PA_SU_SC_MODE_CNTL and DB_ALPHA_TO_MASK have reserved-bit predicates only, so they can stay ambiguous on a real corpus.
  • CB_SHADER_MASK and CB_TARGET_MASK can only be separated by variants that bind more targets than their pixel program exports.
  • Wiring any located offset into the profile tool or the runtime is left to a follow-up, after review of the offsets.

Refs #2413 #3416 #1216

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5614447019 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3889). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-02T20:48:19Z. --- ## Problem A reviewed slot 57 profile needs register fields that no decoder reads yet: the colour write masks, `CB_COLOR_CONTROL`, the pixel input setup (`SPI_PS_INPUT_ADDR` / `_ENA`, `SPI_PS_IN_CONTROL`), the sample masks, `PA_SU_SC_MODE_CNTL` and `DB_ALPHA_TO_MASK`. Their position in the mesh-layout creation blocks is not known. The guest builds state blocks A and B itself, so no source-built pipeline can produce a block with one field changed. The offsets in use today (`DB_*` at A+0x10C, `CB_BLENDn_CONTROL` at A+0x124) were found by reading captured blocks against the gfx10 field layouts (#1216, #3503). This advances the profile work in #3416 (part of #2413), and the open location questions in #1216 (`CB_TARGET_MASK`) and #1999 item B (`PA_SU_SC_MODE_CNTL`). ## Change - `tools/startup/mesh57_register_scan.py <request_dir>` repeats that comparison over a whole capture corpus without assuming a location. For each register it tests every aligned offset of blocks A and B against a predicate built from the gfx10 field definitions (Mesa `src/amd/registers/gfx10.json`) and from evidence the capture holds outside the blocks: the pixel program's exports and interpolation, and the `.t57` attachment tuple. - An offset is reported as located only when every informative variant agrees, at least three variants are informative, its value varies between them, and no other offset survives. A word that is constant across the corpus is never reported as located. Registers resolve in a fixed order, and a located offset is not offered to later rows. - Output is offsets and counts only, never captured values or archive names. - `tests/mesh57_register_scan_check.py` (ctest `mesh57_register_scan`) plants each register in synthetic archives at offsets chosen for the test. Three negative controls: a word moved by one dword in one variant, a corpus whose values never vary, and a corpus without extra bound targets (shader mask and target mask cannot be separated). - `docs/experiments/native-fixed-mesh57.md` gains the section "Locating the remaining mesh-layout registers" with the evidence and result per register. No runtime code changes. No profile reads the new offsets yet. ## Validation ```text ctest --preset dev --no-tests=error -R '^mesh57_register_scan$' ``` Passes on Windows (MSVC build tree). The check is source-built and needs no GPU and no capture. ## Results so far Three independent capture corpora, 318 to 330 mesh-layout variants each, default threshold. All three gave the same verdict and the same candidates for every row. | Register | Result | |---|---| | `CB_COLOR_CONTROL` | A+0x0D0 in the mesh layout (tag 6, the same base as `CB_BLEND` at A+0x124): the only offset whose words pass the field test (reserved bits zero, a valid ROP3, `CB_NORMAL` mode when colour is exported) in all three captures, with three distinct values. A pattern match, not a mutation proof; no field is read yet. | | `DB_ALPHA_TO_MASK` | A+0x0B4, provisional: reserved bits only, two distinct words, and the same word also passes the `PA_SU_SC_MODE_CNTL` predicate | | `SPI_PS_IN_CONTROL` | ambiguous, two candidates; A+0x0B0 matched in every informative variant, A+0x00C in about 42 % | | `CB_SHADER_MASK` | ambiguous between A+0x0C4 and A+0x0CC | | `PA_SU_SC_MODE_CNTL` | ambiguous, five candidates | | `CB_TARGET_MASK` | unresolved | | `SPI_PS_INPUT_ADDR` / `_ENA` | unresolved (`_ENA` depends on `_ADDR`) | | `PA_SC_AA_MASK_*` | unresolved | The evidence is independent of any earlier local measurement: it comes from the public register definitions and from the scan's agreement counts. The repository receives no captured values, no archive names, no keys and no guest data, only the tool, the synthetic check and the offsets above. ## Not covered - Mesh entry dimensions (threads, vertex and primitive limits, group stride, wave size) are not in these blocks as far as the scan can tell, and the capture holds no independent evidence for them. - `PA_SC_AA_MASK`, `PA_SU_SC_MODE_CNTL` and `DB_ALPHA_TO_MASK` have reserved-bit predicates only, so they can stay ambiguous on a real corpus. - `CB_SHADER_MASK` and `CB_TARGET_MASK` can only be separated by variants that bind more targets than their pixel program exports. - Wiring any located offset into the profile tool or the runtime is left to a follow-up, after review of the offsets. Refs #2413 #3416 #1216
R0Y00 commented 2026-12-02 21:08:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T21:08:04Z.

Review: APPROVED


Reviewed 87e3ec18. The scan requires variation, enough informative variants and a unique surviving offset. Its synthetic checks pass for planted locations, a moved word, constant values and coincident shader/target masks. I also reproduced an unreadable .t57 stopping the old scan. The follow-up keeps the variant and other independent facts while excluding that attachment evidence, with a source-built regression control. mesh57_register_scan_check.py, mesh57_profile_draft_check.py and docs_links_check.py passed. I independently checked the source-built corpus; the offsets inferred from captured corpora remain candidates for later validation.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6159037639 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3889#pullrequestreview-6159037639). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T21:08:04Z. **Review:** APPROVED --- Reviewed `87e3ec18`. The scan requires variation, enough informative variants and a unique surviving offset. Its synthetic checks pass for planted locations, a moved word, constant values and coincident shader/target masks. I also reproduced an unreadable `.t57` stopping the old scan. The follow-up keeps the variant and other independent facts while excluding that attachment evidence, with a source-built regression control. `mesh57_register_scan_check.py`, `mesh57_profile_draft_check.py` and `docs_links_check.py` passed. I independently checked the source-built corpus; the offsets inferred from captured corpora remain candidates for later validation.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3889
No description provided.