cpp-migration: lower DPP16 row_shl, row_shr and row_ror in the direct C++ compute path #3008

Closed
opened 2026-11-27 04:40:21 +00:00 by Leyukaka · 0 comments
Leyukaka commented 2026-11-27 04:40:21 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T04:40:21Z.


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

Gap. Direct compute lowers DPP16 quad_perm and the two mirrors. The parser refuses every other DPP16 pattern above 255 with "unsupported DPP lane selection" (src/gfx1013_compute_native.cpp). That includes the row shifts and rotates. On main, tools/compute_store_aot.py lowers row_shr for v_or_b32_dpp and v_add_nc_u32_dpp (#1884). The direct path has no equivalent.

Measured on a local capture of 2,689 compute requests (counts and instruction shape only), with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests on cpp-migration e0d83759 plus #3006. The four later commits on cpp-migration do not touch DPP. 80 requests stop first at "unsupported DPP lane selection", in two forms:

Pattern DPP control FI BOUND_CTRL Requests Ops
row_ror:8 0x128 0 1 62 v_min_f32, v_add_f32, v_mov_b32
row_shr:1 0x111 1 0 18 v_add_nc_u32

Both use row_mask:0xf bank_mask:0xf. The requests of one start-up run contain the same 80.

Plan:

  • Accept row_shl:1..15, row_shr:1..15 and row_ror:1..15 (0x101..0x10f, 0x111..0x11f, 0x121..0x12f) in the existing lower_dpp, still with full row and bank masks only.
  • Source lane, inside the lane's 16-lane row:
    • row_shl:N reads row lane r + N;
    • row_shr:N reads r - N;
    • row_ror:N reads (r - N) mod 16.
  • A shift whose source falls outside the row has an invalid source. With BOUND_CTRL the op uses 0; without it the destination keeps its old value. That is the same rule lower_dpp already applies to a disabled source lane, and the one compute_store_aot.py uses for row_shr.
  • FI keeps its current meaning: read from an inactive lane. It does not make an out-of-row source valid. Today lower_dpp applies the disabled-source rule only when FI is clear, so the out-of-row test needs its own path; the 18 row_shr:1 requests set FI.
  • Rows stay inside one physical wave32, so a split guest wave64 needs no exchange.
  • A thread count that is not a multiple of 16 is refused, as the mirrors do for their lane groups.
  • row_share, row_xmask, the pre-GFX10 controls (wave_* and row_bcast, 0x130..0x13c, 0x142, 0x143) and partial masks stay refused.

Tests: a hardware readback against a CPU reference.

  • row_shr:1 (FI, no BOUND_CTRL) on v_add_nc_u32, and row_ror:8 (BOUND_CTRL) on v_add_f32 and v_min_f32.
  • row_shl, row_shr and row_ror with shifts 1 and 15 on v_mov_b32.
  • Inactive lanes in the source rows, for FI and for a disabled source.
  • Controls: row_share:0 (0x150), raw control 0x142, a partial row mask, and a 24-thread group stay refused.
  • Mutants:
    • a wrong rotate direction, caught by the shift 1 and 15 v_mov_b32 cases (row_ror:8 is its own inverse);
    • treating an out-of-row source as valid;
    • ignoring BOUND_CTRL.

Measurement: the census and the run's requests, before and after, counting requests that newly compile and their next refusal.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6640093047 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3008). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-27T04:40:21Z. --- Target branch `cpp-migration`. Part of #2935 (instruction coverage). I am taking this; please say if you already have it locally and I will drop it. **Gap.** Direct compute lowers DPP16 `quad_perm` and the two mirrors. The parser refuses every other DPP16 pattern above 255 with "unsupported DPP lane selection" (`src/gfx1013_compute_native.cpp`). That includes the row shifts and rotates. On `main`, `tools/compute_store_aot.py` lowers `row_shr` for `v_or_b32_dpp` and `v_add_nc_u32_dpp` (#1884). The direct path has no equivalent. **Measured** on a local capture of 2,689 compute requests (counts and instruction shape only), with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests` on `cpp-migration` `e0d83759` plus #3006. The four later commits on `cpp-migration` do not touch DPP. 80 requests stop first at "unsupported DPP lane selection", in two forms: | Pattern | DPP control | FI | BOUND_CTRL | Requests | Ops | |---|---|---|---|---|---| | `row_ror:8` | `0x128` | 0 | 1 | 62 | `v_min_f32`, `v_add_f32`, `v_mov_b32` | | `row_shr:1` | `0x111` | 1 | 0 | 18 | `v_add_nc_u32` | Both use `row_mask:0xf bank_mask:0xf`. The requests of one start-up run contain the same 80. **Plan:** - Accept `row_shl:1..15`, `row_shr:1..15` and `row_ror:1..15` (`0x101..0x10f`, `0x111..0x11f`, `0x121..0x12f`) in the existing `lower_dpp`, still with full row and bank masks only. - Source lane, inside the lane's 16-lane row: - `row_shl:N` reads row lane `r + N`; - `row_shr:N` reads `r - N`; - `row_ror:N` reads `(r - N) mod 16`. - A shift whose source falls outside the row has an invalid source. With BOUND_CTRL the op uses 0; without it the destination keeps its old value. That is the same rule `lower_dpp` already applies to a disabled source lane, and the one `compute_store_aot.py` uses for `row_shr`. - FI keeps its current meaning: read from an inactive lane. It does not make an out-of-row source valid. Today `lower_dpp` applies the disabled-source rule only when FI is clear, so the out-of-row test needs its own path; the 18 `row_shr:1` requests set FI. - Rows stay inside one physical wave32, so a split guest wave64 needs no exchange. - A thread count that is not a multiple of 16 is refused, as the mirrors do for their lane groups. - `row_share`, `row_xmask`, the pre-GFX10 controls (`wave_*` and `row_bcast`, `0x130..0x13c`, `0x142`, `0x143`) and partial masks stay refused. **Tests:** a hardware readback against a CPU reference. - `row_shr:1` (FI, no BOUND_CTRL) on `v_add_nc_u32`, and `row_ror:8` (BOUND_CTRL) on `v_add_f32` and `v_min_f32`. - `row_shl`, `row_shr` and `row_ror` with shifts 1 and 15 on `v_mov_b32`. - Inactive lanes in the source rows, for FI and for a disabled source. - Controls: `row_share:0` (`0x150`), raw control `0x142`, a partial row mask, and a 24-thread group stay refused. - Mutants: - a wrong rotate direction, caught by the shift 1 and 15 `v_mov_b32` cases (`row_ror:8` is its own inverse); - treating an out-of-row source as valid; - ignoring BOUND_CTRL. **Measurement:** the census and the run's requests, before and after, counting requests that newly compile and their next refusal. 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#3008
No description provided.