shader: the #690 gate admits aliases, stores and bitcast-spelled calls #727

Closed
opened 2026-11-22 23:51:17 +00:00 by MoonYueya · 3 comments
MoonYueya commented 2026-11-22 23:51:17 +00:00 (Migrated from github.com)
Contributor

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


What shipped in #690

#690 refuses to submit a module while it still executes an xbox.* builtin, and refuses to submit without the module's inventory at all. The scan behind it takes a call's callee as the first @ symbol on an instruction line: the callee name followed by (, with the operand list after it.

The gap

Six forms reach the same builtin without matching that shape, so the gate admits them. Each line below is source-built synthetic IR; none of them is a direct call to a symbol spelled @xbox.X(.

# Form Synthetic IR #690 verdict Expected
1 aliased symbol @alias_bfi = alias i32 (i32), ptr @xbox.BFI then call i32 @alias_bfi(i32 1) submitted refused, (alias)
2 stored pointer store ptr @xbox.global_store_dword_with_cache, ptr %slot submitted refused, (store)
3 indirect call through a bitcast %fp = bitcast ptr @xbox.foo to ptr then call void %fp(i32 1) submitted refused, (bitcast)
4 function pointer in a global initializer @table = global ptr @xbox.Med3_F32 submitted refused, (global-initializer)
5 call operand call void @llvm.dbg.value(metadata ptr @xbox.foo, i64 0) submitted refused, (call-operand)
6 direct call spelled with an inline bitcast call void bitcast (void (i32)* @xbox.foo to void (i64)*)(i64 5) submitted — the scan wants ( right after the name refused as a call

Forms 1–5 keep the builtin reachable through an alias, a pointer or an operand, and #690 only counted callee positions. Form 6 is a genuine direct call that the callee pattern misses because the symbol is followed by to instead of (.

Expected behaviour

  • A module is refused while any of those six forms reaches an xbox.* symbol, and the refusal names the form, so a report says how the module still reaches the builtin (calls ∪ references).
  • The archive filter --only-without-xbox-calls keeps one meaning: no form reaches an xbox.* symbol.
  • Declarations, names that only metadata mentions and ordinary modules still submit exactly once.
  • A symbol that a form holds is no longer reported as metadata-only.
  • No lowering claim from an adapter can clear a form that the transformed module still holds; a lowering has to remove it.

Acceptance

  • ctest --preset dev --no-tests=error -R 'dxil_retarget|shader_metadata|dxcontainer_part_offsets' -V green with no skip, and the new cases visible in dxil_retarget_controls.
  • python -B tests/docs_links_check.py, python -B tests/bidi_controls_check.py and python -B tests/hardware_reports_check.py green.
  • docs/experiments.md describes the wider rule, including what each group means and what the archive filter selects.
  • Source-built synthetic IR only: no game files, container bytes or shader names.

Drafted with AI assistance; the forms above were checked against the merged scan in #690.

Refs #690
Refs #584

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6549423809 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/733). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-22T23:51:17Z. --- ### What shipped in #690 #690 refuses to submit a module while it still executes an `xbox.*` builtin, and refuses to submit without the module's inventory at all. The scan behind it takes a call's callee as the first `@` symbol on an instruction line: the callee name followed by `(`, with the operand list after it. ### The gap Six forms reach the same builtin without matching that shape, so the gate admits them. Each line below is source-built synthetic IR; none of them is a direct call to a symbol spelled `@xbox.X(`. | # | Form | Synthetic IR | #690 verdict | Expected | | --- | --- | --- | --- | --- | | 1 | aliased symbol | `@alias_bfi = alias i32 (i32), ptr @xbox.BFI` then `call i32 @alias_bfi(i32 1)` | submitted | refused, `(alias)` | | 2 | stored pointer | `store ptr @xbox.global_store_dword_with_cache, ptr %slot` | submitted | refused, `(store)` | | 3 | indirect call through a bitcast | `%fp = bitcast ptr @xbox.foo to ptr` then `call void %fp(i32 1)` | submitted | refused, `(bitcast)` | | 4 | function pointer in a global initializer | `@table = global ptr @xbox.Med3_F32` | submitted | refused, `(global-initializer)` | | 5 | call operand | `call void @llvm.dbg.value(metadata ptr @xbox.foo, i64 0)` | submitted | refused, `(call-operand)` | | 6 | direct call spelled with an inline bitcast | `call void bitcast (void (i32)* @xbox.foo to void (i64)*)(i64 5)` | submitted — the scan wants `(` right after the name | refused as a **call** | Forms 1–5 keep the builtin reachable through an alias, a pointer or an operand, and #690 only counted callee positions. Form 6 is a genuine direct call that the callee pattern misses because the symbol is followed by ` to ` instead of `(`. ### Expected behaviour - A module is refused while any of those six forms reaches an `xbox.*` symbol, and the refusal names the form, so a report says how the module still reaches the builtin (`calls ∪ references`). - The archive filter `--only-without-xbox-calls` keeps one meaning: no form reaches an `xbox.*` symbol. - Declarations, names that only metadata mentions and ordinary modules still submit exactly once. - A symbol that a form holds is no longer reported as metadata-only. - No lowering claim from an adapter can clear a form that the transformed module still holds; a lowering has to remove it. ### Acceptance - `ctest --preset dev --no-tests=error -R 'dxil_retarget|shader_metadata|dxcontainer_part_offsets' -V` green with no skip, and the new cases visible in `dxil_retarget_controls`. - `python -B tests/docs_links_check.py`, `python -B tests/bidi_controls_check.py` and `python -B tests/hardware_reports_check.py` green. - `docs/experiments.md` describes the wider rule, including what each group means and what the archive filter selects. - Source-built synthetic IR only: no game files, container bytes or shader names. Drafted with AI assistance; the forms above were checked against the merged scan in #690. Refs #690 Refs #584
MoonYueya commented 2026-11-24 06:48:51 +00:00 (Migrated from github.com)
Author
Contributor

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


Refs #584 (the S2 tracking issue).

Fix proposed in https://github.com/R0Y00/Xbox2Windows/pull/734.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7087890808 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/733#issuecomment-7087890808). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-22T23:52:01Z. --- Refs #584 (the S2 tracking issue). Fix proposed in https://github.com/R0Y00/Xbox2Windows/pull/734.
R0Y00 commented 2026-11-24 06:48:51 +00:00 (Migrated from github.com)
Author
Contributor

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


Thanks for the report. The final-module gate should fail closed whenever the inventory cannot account for executable references to an Xbox intrinsic. Please keep calls and other executable references separate in the diagnostic, and keep declarations and metadata-only references allowed when they have no executable use. Use synthetic IR and a recording submission stub to verify zero backend invocations on refusal and one invocation for allowed modules. An advisory lowering status must never clear a reference still present in the final module.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7087928327 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/733#issuecomment-7087928327). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T23:55:09Z. --- Thanks for the report. The final-module gate should fail closed whenever the inventory cannot account for executable references to an Xbox intrinsic. Please keep calls and other executable references separate in the diagnostic, and keep declarations and metadata-only references allowed when they have no executable use. Use synthetic IR and a recording submission stub to verify zero backend invocations on refusal and one invocation for allowed modules. An advisory lowering status must never clear a reference still present in the final module.
R0Y00 commented 2026-11-24 06:48:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T03:11:47Z.


#734 merged as 81cf1e3. Its source-built controls confirm that executable calls and references stop submission, declarations and debug-only metadata remain separate, and a reported lowering cannot override a reference still present in the final module. The reported Windows run passed 7/7 with no skips, and the exact head passed both Windows and both Linux CI jobs. This completes the scoped gate update. The broader retargeting work remains in #584.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7090543023 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/733#issuecomment-7090543023). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T03:11:47Z. --- #734 merged as `81cf1e3`. Its source-built controls confirm that executable calls and references stop submission, declarations and debug-only metadata remain separate, and a reported lowering cannot override a reference still present in the final module. The reported Windows run passed 7/7 with no skips, and the exact head passed both Windows and both Linux CI jobs. This completes the scoped gate update. The broader retargeting work remains in #584.
Sign in to join this conversation.
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#727
No description provided.