shader: raw buffer loads with an SGPR offset or without a VGPR address in the direct compute path #3143

Closed
opened 2026-11-27 18:17:34 +00:00 by JB2WIN · 1 comment
JB2WIN commented 2026-11-27 18:17:34 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-27T18:17:34Z.


Part of #2935 (instruction coverage of the direct compute path).

Problem. The direct C++ compute frontend accepts raw MUBUF loads (buffer_load_dword, _dwordx2, _dwordx3, _dwordx4) only with offen and a zero SOFFSET (src/gfx1013_compute_native.cpp, "raw buffer load needs offen with zero scalar offset and no modifiers"). Loads addressed by the scalar offset alone (off) or with a nonzero SOFFSET are refused, although the direct lowering already adds inst_offset and SOFFSET (and the VGPR offset when offen is set), as it does for raw stores, which the decoder already accepts in that form.

On a local start-up capture (counts only, compile_dxil --refusals, 2,689 slot 67 requests), this refusal is the first one for 80 requests; most are off or nonzero-SOFFSET loads without cache modifiers.

Semantics. RDNA 2 ISA (30.11.2020), 8.1.5 Buffer Addressing and Range Checking (PDF page 61): address = base + SGPR offset + (inst_offset + VGPR offset); for raw buffers (OOB_SELECT 3) num_records is reduced by the SGPR offset, so a byte address of SGPR offset + offset checked against the view's size gives the same result while the SGPR offset does not exceed num_records.

Plan. In the direct path only, accept raw loads with off or offen and any numeric SOFFSET (an SGPR, M0 or an inline constant), under the same addressing rules as raw stores. idxen, glc, dlc, slc, lds and tfe stay refused, and so does the HLSL path. Test: source-built requests through native_store_replay on hardware (off with an SGPR offset, offen with an SGPR offset, dwordx2/x4), plus refusal controls.

I'm taking it; a PR follows. Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6652258991 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3143). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-27T18:17:34Z. --- Part of #2935 (instruction coverage of the direct compute path). **Problem.** The direct C++ compute frontend accepts raw MUBUF loads (`buffer_load_dword`, `_dwordx2`, `_dwordx3`, `_dwordx4`) only with `offen` and a zero `SOFFSET` (`src/gfx1013_compute_native.cpp`, "raw buffer load needs offen with zero scalar offset and no modifiers"). Loads addressed by the scalar offset alone (`off`) or with a nonzero `SOFFSET` are refused, although the direct lowering already adds `inst_offset` and `SOFFSET` (and the VGPR offset when `offen` is set), as it does for raw stores, which the decoder already accepts in that form. On a local start-up capture (counts only, `compile_dxil --refusals`, 2,689 slot 67 requests), this refusal is the first one for 80 requests; most are `off` or nonzero-`SOFFSET` loads without cache modifiers. **Semantics.** RDNA 2 ISA (30.11.2020), 8.1.5 Buffer Addressing and Range Checking (PDF page 61): address = base + SGPR offset + (inst_offset + VGPR offset); for raw buffers (OOB_SELECT 3) `num_records` is reduced by the SGPR offset, so a byte address of SGPR offset + offset checked against the view's size gives the same result while the SGPR offset does not exceed `num_records`. **Plan.** In the direct path only, accept raw loads with `off` or `offen` and any numeric `SOFFSET` (an SGPR, M0 or an inline constant), under the same addressing rules as raw stores. `idxen`, `glc`, `dlc`, `slc`, `lds` and `tfe` stay refused, and so does the HLSL path. Test: source-built requests through `native_store_replay` on hardware (`off` with an SGPR offset, `offen` with an SGPR offset, `dwordx2`/`x4`), plus refusal controls. I'm taking it; a PR follows. Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080. AI-assisted.
Leyukaka commented 2026-11-27 20:17:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T20:17:51Z.


Taking this over since there has been no activity for 2 h; will hand back if you resume. Credit to @JB2WIN for the issue and the plan.

The PR keeps m0 refused as soffset, as well as glc/dlc, slc, idxen and inline floats. The direct emitter already adds offen, the immediate offset and soffset, so the change is in the shared decoder, for direct compute only. On a local capture of 2,689 compute requests on main a5dad843, 403 compile before and 409 after, with none lost. PR to follow.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7227366022 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3143#issuecomment-7227366022). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-27T20:17:51Z. --- Taking this over since there has been no activity for 2 h; will hand back if you resume. Credit to @JB2WIN for the issue and the plan. The PR keeps `m0` refused as `soffset`, as well as `glc`/`dlc`, `slc`, `idxen` and inline floats. The direct emitter already adds `offen`, the immediate offset and `soffset`, so the change is in the shared decoder, for direct compute only. On a local capture of 2,689 compute requests on `main` `a5dad843`, 403 compile before and 409 after, with none lost. PR to follow. 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#3143
No description provided.