cpp-migration: lower root-pointer global_load_dword in the direct C++ compute path #2962

Closed
opened 2026-11-26 23:39:56 +00:00 by legacy-code-archaeologist · 1 comment
legacy-code-archaeologist commented 2026-11-26 23:39:56 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-26T23:39:56Z.


Target branch cpp-migration. Part of #2935 (instruction coverage: "global loads"). I am taking this; please say if you already have it locally and I will drop it.

Gap: the direct compute path refuses every GLOBAL instruction. gfx2hlsl.py lowers the compute one-dword load in the saddr form, op_global_load_dword: ADDR = SADDR + zext(VADDR) + sext(OFFSET), with SADDR a proven root buffer pointer pair. A source-built request with a root SRV(t0) address in s[8:9] and global_load_dword v1, v0, s[8:9] (0xdc308000 0x01080000, LLVM 15) fails with:

native compute +0x0: unsupported instruction global_load_dword 0xdc308000u

The run used compile_dxil ... gfx1013-direct-cs@0 built from cpp-migration e97c5c7c. The direct path already binds such a pointer as root_buffer_srv for scalar loads (memory, Symbol::Type::root_address).

Plan: follow the rules gfx2hlsl.py applies.

  • Compute stage only, the saddr form, one dword. The SADDR pair is a root address with the matching high half, as for the scalar root loads.
  • The immediate offset is in [-2048, 2047]. The pointer offset, the immediate and the VADDR must be proven 4-byte aligned; that rule exists because RDNA 2's low-bit alignment mode is unmeasured.
  • The load is a raw buffer load from the same root_buffer_srv binding. The signed 64-bit byte offset is guarded to [0, 2^32) before it becomes a 32-bit address, so an overflow does not wrap into the view.
  • Refused by name: off (no SADDR), a non-root or advanced pointer, unaligned offsets, the wider and sub-dword forms, lds, glc/slc/dlc other than the cache-policy pass-through gfx2hlsl accepts, and non-compute stages.
  • Fixture: a source-built request translated by compile_dxil, with refusals checked by message. A WARP/hardware dispatch reads known words from a root SRV, with a negative control (offset dropped).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6636914822 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2962). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-26T23:39:56Z. --- Target branch `cpp-migration`. Part of #2935 (instruction coverage: "global loads"). I am taking this; please say if you already have it locally and I will drop it. **Gap:** the direct compute path refuses every GLOBAL instruction. `gfx2hlsl.py` lowers the compute one-dword load in the `saddr` form, `op_global_load_dword`: ADDR = SADDR + zext(VADDR) + sext(OFFSET), with SADDR a proven root buffer pointer pair. A source-built request with a root `SRV(t0)` address in `s[8:9]` and `global_load_dword v1, v0, s[8:9]` (`0xdc308000 0x01080000`, LLVM 15) fails with: ```text native compute +0x0: unsupported instruction global_load_dword 0xdc308000u ``` The run used `compile_dxil ... gfx1013-direct-cs@0` built from `cpp-migration` `e97c5c7c`. The direct path already binds such a pointer as `root_buffer_srv` for scalar loads (`memory`, `Symbol::Type::root_address`). **Plan:** follow the rules `gfx2hlsl.py` applies. - Compute stage only, the `saddr` form, one dword. The SADDR pair is a root address with the matching high half, as for the scalar root loads. - The immediate offset is in [-2048, 2047]. The pointer offset, the immediate and the VADDR must be proven 4-byte aligned; that rule exists because RDNA 2's low-bit alignment mode is unmeasured. - The load is a raw buffer load from the same `root_buffer_srv` binding. The signed 64-bit byte offset is guarded to [0, 2^32) before it becomes a 32-bit address, so an overflow does not wrap into the view. - Refused by name: `off` (no SADDR), a non-root or advanced pointer, unaligned offsets, the wider and sub-dword forms, `lds`, `glc`/`slc`/`dlc` other than the cache-policy pass-through gfx2hlsl accepts, and non-compute stages. - Fixture: a source-built request translated by `compile_dxil`, with refusals checked by message. A WARP/hardware dispatch reads known words from a root SRV, with a negative control (offset dropped). AI-assisted.
legacy-code-archaeologist commented 2026-11-27 03:12:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-27T03:12:08Z.


Done by #2966 (merged into cpp-migration; MasterDomino ran the dispatch readback on an SM 6.6 wave32 adapter).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7208789919 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2962#issuecomment-7208789919). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T03:12:08Z. --- Done by #2966 (merged into `cpp-migration`; MasterDomino ran the dispatch readback on an SM 6.6 wave32 adapter). AI-assisted.
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#2962
No description provided.