Shader: a descriptor spilled to VGPR lanes and spilled again in a loop is refused as "neither loaded nor built" (309 shaders) #400

Closed
opened 2026-11-27 16:49:28 +00:00 by lautarocherro · 6 comments
lautarocherro commented 2026-11-27 16:49:28 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by lautarocherro on 2026-11-27T16:49:28Z.


What happens

309 shaders in my corpus are refused as "a descriptor neither loaded nor built": 305 compute and 4 vertex. 117 of them were bound in a world run here.

In all 309, every dword of the descriptor is a v_readlane_b32 of a constant lane. The compiler spilled the descriptor's SGPRs to VGPR lanes with v_writelane_b32 and reads them back. The tracer already follows spills (Tracer::restored). It fails here because the VGPR is a loop phi: the program restores the descriptor in the loop and spills it again, so the phi's two edges spill different values that hold the same dwords. Tracer::spilled compares the values themselves, finds two, and gives up.

Proposed change

Compare the phi's edges by their origin in the copy propagation, as propagate_copies already does for SGPR phis. A copy keeps every bit, so two values with one origin hold the same descriptor.

Measured offline

Corpus of 21,556 shaders from one run (M5 Pro, 48 GB), main b998bb65 against the change, tools/corpus/compare.sh:

  • 8 vertex shaders newly translate (4 from this class, 4 that were "a descriptor outside the heaps"). 0 regressions, 0 changed outputs.
  • The 305 compute shaders get past the descriptor and stop at the next refusal: 290 "a view address field the table gives as 0: a buffer's stride or swizzle", 14 "a descriptor's address or format read as data: an image's dwords", 1 other.
  • With #387's translator side roughly applied on top, the 305 stop instead at: 123 "an image's dwords read as data", 114 "a lane mask holding lanes elsewhere read as data: a program input", 65 "a buffer's dword 1 read as data", 3 other.

So this is the first of several steps for these compute shaders. I'll open a PR for this step with a test.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6650830134 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400). Originally posted by [lautarocherro](https://github.com/lautarocherro) on 2026-11-27T16:49:28Z. --- ## What happens 309 shaders in my corpus are refused as "a descriptor neither loaded nor built": 305 compute and 4 vertex. 117 of them were bound in a world run here. In all 309, every dword of the descriptor is a `v_readlane_b32` of a constant lane. The compiler spilled the descriptor's SGPRs to VGPR lanes with `v_writelane_b32` and reads them back. The tracer already follows spills (`Tracer::restored`). It fails here because the VGPR is a loop phi: the program restores the descriptor in the loop and spills it again, so the phi's two edges spill different values that hold the same dwords. `Tracer::spilled` compares the values themselves, finds two, and gives up. ## Proposed change Compare the phi's edges by their origin in the copy propagation, as `propagate_copies` already does for SGPR phis. A copy keeps every bit, so two values with one origin hold the same descriptor. ## Measured offline Corpus of 21,556 shaders from one run (M5 Pro, 48 GB), main `b998bb65` against the change, `tools/corpus/compare.sh`: - 8 vertex shaders newly translate (4 from this class, 4 that were "a descriptor outside the heaps"). 0 regressions, 0 changed outputs. - The 305 compute shaders get past the descriptor and stop at the next refusal: 290 "a view address field the table gives as 0: a buffer's stride or swizzle", 14 "a descriptor's address or format read as data: an image's dwords", 1 other. - With #387's translator side roughly applied on top, the 305 stop instead at: 123 "an image's dwords read as data", 114 "a lane mask holding lanes elsewhere read as data: a program input", 65 "a buffer's dword 1 read as data", 3 other. So this is the first of several steps for these compute shaders. I'll open a PR for this step with a test.
lautarocherro commented 2026-11-27 16:49:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by lautarocherro on 2026-11-27T16:49:29Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7223711996 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400#issuecomment-7223711996). Originally posted by [lautarocherro](https://github.com/lautarocherro) on 2026-11-27T16:49:29Z. --- /claim
github-actions[bot] commented 2026-11-27 16:49:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T16:49:41Z.


Claimed by @lautarocherro. Open a draft pull request with Refs #400 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7223715531 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400#issuecomment-7223715531). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T16:49:41Z. --- Claimed by @lautarocherro. Open a draft pull request with `Refs #400` in its description within 24 hours, or the claim expires.
gagarinyury commented 2026-11-27 20:07:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by gagarinyury on 2026-11-27T20:07:23Z.


Data from a run of preview/graphics-2026-11-28 (b3c1a1b0) on a base M5 (32 GB, Series S, headless): 28 world compute programs are refused as "a descriptor's address or format read as data: an image's dwords 5 to 7". A local probe of Lower::descriptor_data (not committed) shows that those dwords are read by the image instructions themselves (image_sample_lz, image_sample_l, image_load, image_store and others) and by v_writelane_b32, so the descriptor is spilled to VGPR lanes, as in this issue. With #418 (75c5b97a) cherry-picked onto the same preview commit, all 28 are still refused for the same reason, so this looks like a spill form #418 does not cover.

Hashes: 0773bcf7de0c2997 0e117205dde09753 15120460b1c6f21f 298d1554f2d4bf85 3907b6685fb84910 3ea378b7dc709d53 419eb951e8537e34 425bc81ad7a027ff 509799cdba3d218f 64cdd17cf0656202 6ac3b1f42aaeb188 6bbb2ad7b3bf1e85 7327c76efb33252d 797314080ff19b66 7bc776ad7536135c a0b1a5cab583622d a45ddc5bf29fa1ed a732bebdfdd99a92 aaae8623ea233691 acdc4c1be303610f bf7f7f6c81b53d25 c9fa549201bccd2f ca60999fc1d0ac9b cd4e49742135ce3b dcd8aac5399e2230 e487768c1c93ecf7 f8a6001b812d76b0 ff52f621d7f3d942

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7227196243 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400#issuecomment-7227196243). Originally posted by [gagarinyury](https://github.com/gagarinyury) on 2026-11-27T20:07:23Z. --- Data from a run of `preview/graphics-2026-11-28` (`b3c1a1b0`) on a base M5 (32 GB, Series S, headless): 28 world compute programs are refused as "a descriptor's address or format read as data: an image's dwords 5 to 7". A local probe of `Lower::descriptor_data` (not committed) shows that those dwords are read by the image instructions themselves (`image_sample_lz`, `image_sample_l`, `image_load`, `image_store` and others) and by `v_writelane_b32`, so the descriptor is spilled to VGPR lanes, as in this issue. With #418 (`75c5b97a`) cherry-picked onto the same preview commit, all 28 are still refused for the same reason, so this looks like a spill form #418 does not cover. Hashes: 0773bcf7de0c2997 0e117205dde09753 15120460b1c6f21f 298d1554f2d4bf85 3907b6685fb84910 3ea378b7dc709d53 419eb951e8537e34 425bc81ad7a027ff 509799cdba3d218f 64cdd17cf0656202 6ac3b1f42aaeb188 6bbb2ad7b3bf1e85 7327c76efb33252d 797314080ff19b66 7bc776ad7536135c a0b1a5cab583622d a45ddc5bf29fa1ed a732bebdfdd99a92 aaae8623ea233691 acdc4c1be303610f bf7f7f6c81b53d25 c9fa549201bccd2f ca60999fc1d0ac9b cd4e49742135ce3b dcd8aac5399e2230 e487768c1c93ecf7 f8a6001b812d76b0 ff52f621d7f3d942
github-actions[bot] commented 2026-11-28 18:59:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T18:59:17Z.


The claim by @lautarocherro has expired: no pull request referenced it within 24 hours. This issue is free to claim.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7244203310 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400#issuecomment-7244203310). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T18:59:17Z. --- The claim by @lautarocherro has expired: no pull request referenced it within 24 hours. This issue is free to claim.
lautarocherro commented 2026-11-28 19:50:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by lautarocherro on 2026-11-28T19:50:40Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7244846048 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400#issuecomment-7244846048). Originally posted by [lautarocherro](https://github.com/lautarocherro) on 2026-11-28T19:50:40Z. --- /claim
github-actions[bot] commented 2026-11-28 19:50:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T19:50:50Z.


Claimed by @lautarocherro. Open a draft pull request with Refs #400 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7244848023 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/400#issuecomment-7244848023). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T19:50:50Z. --- Claimed by @lautarocherro. Open a draft pull request with `Refs #400` in its description within 24 hours, or the claim expires.
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
LakshanSivakumar/Native-Victory-macOS#400
No description provided.