shader: specify raw MUBUF binding contract #711

Merged
lambirou merged 1 commit from upstream-pr/717 into main 2026-11-22 23:02:43 +00:00
lambirou commented 2026-11-22 22:19:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-22T22:19:48Z.


Change

Refs #319.

Document a bounded first contract for lowering one raw buffer_load_dword with
offen in pixel_aot. The proposal keeps the pixel path on ps_6_0 and adds a
visible, bounded space1 descriptor table for the title range table and alias
buffers.

It records the four SGPR words that form a gfx1013 V# with separate masks.
DW0 carries address[31:0], DW1[15:0] carries address[47:32], DW1[29:16] is
the 14-bit byte stride and DW1[31:30] holds the cache-swizzle flags. The
address uses DW0 and DW1[15:0] only, with the descriptor layout cited from the
AMD RDNA 2 instruction-set reference. The first case remains stride zero, no
idxen, zero scalar offset and OOB_SELECT=3. The proposed whole-DWORD bound is:

offen + soffset + 4 <= NUM_RECORDS

The document includes first-word, last-word, complete out-of-range and aligned
partial-tail draws. The aligned partial tail uses NUM_RECORDS = 14 at offset 12
and stays separate from the rejected non-aligned offsets 13 to 15. A guest
bound miss returns zero. A title address inside the guest bound but outside
every published range must surface as a separately observable host binding
failure, not as a successful zero read. An address-extraction control varies
the DW1 stride or flag bits without changing DW1[15:0], so the two descriptors
must produce the same 48-bit base.

Negative controls cover dropped guest bounds, byte/DWORD scaling, the two base
words, a wholesale DW1 shift, the wrong bounds mode, a host mapping miss counted
as zero, an unaligned partial tail, range crossing and unproven descriptor
provenance.

Issue #319 remains open. Its single reply is a contributor preference, not a
maintainer decision. This patch deliberately adds no vector-memory lowering.

Verification

The local commit is 5bf70ce310, rebased onto
origin/main 6f48648e. GitHub still reports the branch as mergeable after main
advanced to 787ace7.

python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py

Both checks passed. docs_links_check.py checked 11 Markdown files and 135
links. The bidirectional-control scan checked 601 tracked files.

The Leonida reference at 4eb6155d reports a 732-case hardware measurement on
gfx1036. It includes soffset in mode-3 raw bounds, but does not establish the
gfx1013 rule.

Evidence and follow-up

The proposal asks the maintainer to confirm four points:

  1. the ps_6_0 binding and the visible alias/range bound;
  2. the failure channel for an address that cannot be placed by TitleLookup.
    It must be distinct from a guest bound miss and must not count zero as data;
  3. the initial restriction to mode 3, stride zero, no idxen and zero soffset;
  4. the gfx1013 raw-bounds rule, since the available measurement is gfx1036.

AI-assisted: yes.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • The proposed fixture includes failure cases.
  • I updated the relevant experiment documentation.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6548544001 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/717). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-22T22:19:48Z. --- ## Change Refs #319. Document a bounded first contract for lowering one raw buffer_load_dword with offen in pixel_aot. The proposal keeps the pixel path on ps_6_0 and adds a visible, bounded space1 descriptor table for the title range table and alias buffers. It records the four SGPR words that form a gfx1013 V# with separate masks. DW0 carries address[31:0], DW1[15:0] carries address[47:32], DW1[29:16] is the 14-bit byte stride and DW1[31:30] holds the cache-swizzle flags. The address uses DW0 and DW1[15:0] only, with the descriptor layout cited from the AMD RDNA 2 instruction-set reference. The first case remains stride zero, no idxen, zero scalar offset and OOB_SELECT=3. The proposed whole-DWORD bound is: ~~~text offen + soffset + 4 <= NUM_RECORDS ~~~ The document includes first-word, last-word, complete out-of-range and aligned partial-tail draws. The aligned partial tail uses NUM_RECORDS = 14 at offset 12 and stays separate from the rejected non-aligned offsets 13 to 15. A guest bound miss returns zero. A title address inside the guest bound but outside every published range must surface as a separately observable host binding failure, not as a successful zero read. An address-extraction control varies the DW1 stride or flag bits without changing DW1[15:0], so the two descriptors must produce the same 48-bit base. Negative controls cover dropped guest bounds, byte/DWORD scaling, the two base words, a wholesale DW1 shift, the wrong bounds mode, a host mapping miss counted as zero, an unaligned partial tail, range crossing and unproven descriptor provenance. Issue #319 remains open. Its single reply is a contributor preference, not a maintainer decision. This patch deliberately adds no vector-memory lowering. ## Verification The local commit is 5bf70ce31045e6ca0e1208099ee894edf8054cf8, rebased onto origin/main 6f48648e. GitHub still reports the branch as mergeable after main advanced to 787ace7. ~~~text python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py ~~~ Both checks passed. docs_links_check.py checked 11 Markdown files and 135 links. The bidirectional-control scan checked 601 tracked files. The Leonida reference at 4eb6155d reports a 732-case hardware measurement on gfx1036. It includes soffset in mode-3 raw bounds, but does not establish the gfx1013 rule. ## Evidence and follow-up The proposal asks the maintainer to confirm four points: 1. the ps_6_0 binding and the visible alias/range bound; 2. the failure channel for an address that cannot be placed by TitleLookup. It must be distinct from a guest bound miss and must not count zero as data; 3. the initial restriction to mode 3, stride zero, no idxen and zero soffset; 4. the gfx1013 raw-bounds rule, since the available measurement is gfx1036. AI-assisted: yes. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] The proposed fixture includes failure cases. - [x] I updated the relevant experiment documentation. - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:44:29 +00:00
R0Y00 commented 2026-11-24 06:44:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T23:02:22Z.

Review: COMMENTED


Re-reviewed 5bf70ce as a design-only document. The three requested changes are present. V_BASE_HI_MASK=0x0000ffff now keeps DW1[29:16] stride and DW1[31:30] flags out of the address, with a same-address/different-descriptor-bits control. The test plan requires a separately observable host range failure even when the guest V# bound passes. NUM_RECORDS=14 at aligned offset 12 is a separate partial-tail case, and offsets 13–15 are excluded as unaligned. The proposal explicitly leaves hardware validation on gfx1013 and the final binding decisions open. Both Windows and Linux checks passed at this SHA. My docs-review requests are satisfied.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6014996790 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/717#pullrequestreview-6014996790). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T23:02:22Z. **Review:** COMMENTED --- Re-reviewed `5bf70ce` as a design-only document. The three requested changes are present. `V_BASE_HI_MASK=0x0000ffff` now keeps DW1[29:16] stride and DW1[31:30] flags out of the address, with a same-address/different-descriptor-bits control. The test plan requires a separately observable host range failure even when the guest V# bound passes. NUM_RECORDS=14 at aligned offset 12 is a separate partial-tail case, and offsets 13–15 are excluded as unaligned. The proposal explicitly leaves hardware validation on gfx1013 and the final binding decisions open. Both Windows and Linux checks passed at this SHA. My docs-review requests are satisfied.
R0Y00 commented 2026-11-24 06:48:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T22:36:08Z.


Please fix an ambiguity in the proposed V# layout before this serves as an implementation contract. Word 1 cannot be copied wholesale into the high half of a 64-bit address while bits [29:16] of that word also carry stride. Name the address and flag masks separately, cite the encoding, and give a control that changes descriptor bits without changing the address. Keep a guest bounds miss distinct from a missing host title-range mapping. The latter should produce a separately observable binding failure in the fixture rather than count a zero result as a successful read. Please also separate aligned partial-bound controls (for example, an aligned offset with fewer than four bytes left in NUM_RECORDS) from rejected non-aligned inputs. The gfx1036 measurements help select the tests, while the gfx1013 behavior remains an open question.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7086939513 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/717#issuecomment-7086939513). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T22:36:08Z. --- Please fix an ambiguity in the proposed V# layout before this serves as an implementation contract. Word 1 cannot be copied wholesale into the high half of a 64-bit address while bits [29:16] of that word also carry stride. Name the address and flag masks separately, cite the encoding, and give a control that changes descriptor bits without changing the address. Keep a guest bounds miss distinct from a missing host title-range mapping. The latter should produce a separately observable binding failure in the fixture rather than count a zero result as a successful read. Please also separate aligned partial-bound controls (for example, an aligned offset with fewer than four bytes left in NUM_RECORDS) from rejected non-aligned inputs. The gfx1036 measurements help select the tests, while the gfx1013 behavior remains an open question.
lambirou commented 2026-11-24 06:48:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-22T22:53:13Z.


I rewrote the V# section and the test plan.

  • The address is now formed from DW0[31:0] and DW1[15:0] only. The document
    names DW1[29:16] as the 14-bit stride and DW1[31:30] as cache-swizzle flags,
    cites the RDNA 2 Buffer Resource Descriptor layout, and adds a control that
    varies those bits without changing the 48-bit base.
  • A guest bound miss still returns zero. An in-bound title address with no
    published range is now specified as a separately observable host binding
    failure, not a successful zero read.
  • The aligned partial tail (NUM_RECORDS = 14, offset 12) is a distinct case
    from the rejected unaligned offsets 13 to 15.
  • The gfx1036 measurements remain the basis for selecting cases, and the
    gfx1013 rule is still called out as open.

The branch is at 5bf70ce31045e6ca0e1208099ee894edf8054cf8 and remains
mergeable against current main. docs_links_check.py and
bidi_controls_check.py pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7087152053 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/717#issuecomment-7087152053). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-22T22:53:13Z. --- I rewrote the V# section and the test plan. - The address is now formed from DW0[31:0] and DW1[15:0] only. The document names DW1[29:16] as the 14-bit stride and DW1[31:30] as cache-swizzle flags, cites the RDNA 2 Buffer Resource Descriptor layout, and adds a control that varies those bits without changing the 48-bit base. - A guest bound miss still returns zero. An in-bound title address with no published range is now specified as a separately observable host binding failure, not a successful zero read. - The aligned partial tail (`NUM_RECORDS = 14`, offset 12) is a distinct case from the rejected unaligned offsets 13 to 15. - The gfx1036 measurements remain the basis for selecting cases, and the gfx1013 rule is still called out as open. The branch is at `5bf70ce31045e6ca0e1208099ee894edf8054cf8` and remains mergeable against current main. `docs_links_check.py` and `bidi_controls_check.py` pass.
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!711
No description provided.