docs: record how EXEC written as a value is read on narrow subgroups #800

Merged
Celegans12 merged 1 commit from upstream-pr/800 into main 2026-10-06 09:29:53 +00:00
Celegans12 commented 2026-10-06 03:34:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T03:34:23Z.


What

Adds a TechnicalDebt line for a main limitation found on #751, as suggested there.

  • On a host subgroup narrower than 32 lanes (llvmpipe has 8), a wave64 runs one guest lane per invocation (laneCount 1 in SpirvEmitter::Emit), and LaneId lowers to gl_SubgroupInvocationID.
  • TranslationContext::threadBit (ExecMask.cpp) then reads an EXEC written as a value (s_mov_b32/s_mov_b64) at bit LaneId & 31 of EXEC_LO, so every lane at or above the host subgroup size (lanes 8..63 on llvmpipe, in wave32 and wave64) reads the bit of a lower lane. An EXEC from a compare stays consistent because its ballot is subgroup-local too.
  • Tests that write a partial EXEC_HI already skip below 32 lanes (agc_driver_image_sample_derivatives, and #751's broadcast check).

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 481c85e7: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 358/358 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 357/357 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • Documentation only. The behaviour was reproduced on #751 with a plain v_mov_b32 probe on the Intel UHD iGPU with compute subgroups forced to 8 and 16 lanes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4753777462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/800). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T03:34:23Z. --- ### What Adds a TechnicalDebt line for a `main` limitation found on #751, as suggested there. - On a host subgroup narrower than 32 lanes (llvmpipe has 8), a wave64 runs one guest lane per invocation (`laneCount` 1 in `SpirvEmitter::Emit`), and `LaneId` lowers to `gl_SubgroupInvocationID`. - `TranslationContext::threadBit` (ExecMask.cpp) then reads an EXEC written as a value (`s_mov_b32`/`s_mov_b64`) at bit `LaneId & 31` of EXEC_LO, so every lane at or above the host subgroup size (lanes 8..63 on llvmpipe, in wave32 and wave64) reads the bit of a lower lane. An EXEC from a compare stays consistent because its ballot is subgroup-local too. - Tests that write a partial EXEC_HI already skip below 32 lanes (`agc_driver_image_sample_derivatives`, and #751's broadcast check). ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` 481c85e7: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 358/358 tests pass (`ctest --output-on-failure`) - Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, `VK_DRIVER_FILES`): 357/357 pass; `agc_driver_flat_store` is left out there because it takes several minutes on Windows llvmpipe - Documentation only. The behaviour was reproduced on #751 with a plain `v_mov_b32` probe on the Intel UHD iGPU with compute subgroups forced to 8 and 16 lanes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-06 05:34:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T05:34:01Z.


Thanks for writing this down. One wording check, if I'm reading threadBit right: the bit index is LaneId & 31, and LaneId is the host SubgroupLocalInvocationId. On an 8-wide subgroup that means guest lane 12 would read bit 4 of EXEC_LO rather than bit 12, so lanes 8..31 would be affected too, not only 32..63. If that matches what you saw, maybe "lanes at or above the host subgroup size read bit (invocation id) of EXEC_LO" would describe it more exactly. If narrow subgroups map guest lanes some other way that I've missed, the line is fine as it is.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6010062655 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/800#issuecomment-6010062655). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T05:34:01Z. --- Thanks for writing this down. One wording check, if I'm reading `threadBit` right: the bit index is `LaneId & 31`, and `LaneId` is the host `SubgroupLocalInvocationId`. On an 8-wide subgroup that means guest lane 12 would read bit 4 of EXEC_LO rather than bit 12, so lanes 8..31 would be affected too, not only 32..63. If that matches what you saw, maybe "lanes at or above the host subgroup size read bit (invocation id) of EXEC_LO" would describe it more exactly. If narrow subgroups map guest lanes some other way that I've missed, the line is fine as it is.
Celegans12 commented 2026-10-06 05:43:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T05:43:57Z.


You read it right. LaneId is the subgroup invocation id, so on an 8-wide subgroup guest lane 12 reads bit 4 of EXEC_LO, and every lane from the subgroup size up is affected, in wave32 as well as wave64. That matches the #751 probe: a wave32 EXEC of 0x3c3ca5a5 wrote lanes 0xa5a5a5a5. The line now reads "at bit (subgroup invocation id) of EXEC_LO, so lanes at or above the subgroup size read a lower lane's bit". The commit message and description are updated, and the branch is rebased onto main 481c85e7.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6010169250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/800#issuecomment-6010169250). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T05:43:57Z. --- You read it right. `LaneId` is the subgroup invocation id, so on an 8-wide subgroup guest lane 12 reads bit 4 of EXEC_LO, and every lane from the subgroup size up is affected, in wave32 as well as wave64. That matches the #751 probe: a wave32 EXEC of 0x3c3ca5a5 wrote lanes 0xa5a5a5a5. The line now reads "at bit (subgroup invocation id) of EXEC_LO, so lanes at or above the subgroup size read a lower lane's bit". The commit message and description are updated, and the branch is rebased onto `main` 481c85e7.
Sign in to join this conversation.
No reviewers
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
boykopovar/AnyPS5!800
No description provided.