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

Closed
opened 2026-11-26 22:15:02 +00:00 by github-bot · 3 comments
Owner

@⁠MoonYueya on GitHub · 2026-11-22 23:51 UTC · original

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** on GitHub · 2026-11-22 23:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/733) ### 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:15:02 +00:00
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-22 23:52 UTC · original

Refs #584 (the S2 tracking issue).

Fix proposed in #734.

**@⁠MoonYueya** on GitHub · 2026-11-22 23:52 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/733#issuecomment-7087890808) Refs #584 (the S2 tracking issue). Fix proposed in https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/734.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 23:55 UTC · original

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** on GitHub · 2026-11-22 23:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/733#issuecomment-7087928327) 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.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 03:11 UTC · original

#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.

**@⁠R0Y00** on GitHub · 2026-11-23 03:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/733#issuecomment-7090543023) #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.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#733
No description provided.