[GH #979] Shaders: a scalar memory read as data (771 programs) - scalar use points infer the descriptor view, +231 DXIL offline #979

Open
opened 2026-11-24 15:03:38 +00:00 by bittertea0323 · 8 comments
bittertea0323 commented 2026-11-24 15:03:38 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-24T14:37:08Z.

Upstream labels: bug, triage: needs info, area: shader


What

a scalar memory read as data is the largest single translation failure class in the corpus — 771 of 26,084 programs offline. I diagnosed which of its three return points produces them and found a fix that clears the class and raises DXIL emission by 231 programs.

Diagnosis

Splitting the three returns (descriptor_data: non-register operand / unusual load width / use-instruction kind) into distinct messages and re-running the batch puts all 771 on the third one. A second split of that branch by instruction prefix shows the use instruction is always an s_ operation — never an image or buffer access, and never another s_load or s_buffer_load.

So these programs read a descriptor's words as data (dimension or address arithmetic) and never sample or store through it. The lowering insisted on an image/buffer use point to learn the view's kind, and refused the program when the only use was scalar.

Fix

That branch now infers the view from the used-resource entry the load falls in — the same way the "no use point at all" path already does:

  • 8-dword descriptor → 2D image (properties 0x409, kind 4)
  • 4-dword descriptor → structured buffer when the stride is known and a multiple of 4, raw otherwise
  • constant-buffer descriptors stay refused (a CBV's words are not a view)

Sizes are rebuilt through getDimensions and written back as the descriptor's dwords.

Measured offline

victory translate over the title's shader container dump (26,503 containers / 26,084 programs), release build, same host, both runs:

metric before after
emit: a scalar memory read as data 771 0
vertex+pixel programs emitting DXIL 12252 / 14027 12309 / 14027
compute programs emitting DXIL 1443 / 2582 1451 / 2582
mesh programs emitting DXIL 8214 / 8713 8380 / 8713
emit: a descriptor's address or format read as data 92 589

+231 programs (mesh +166, vertex/pixel +57, compute +8).

The last row is the next failure being exposed, not a regression: those programs now translate further and reach the address/format class, which is a different problem — those dwords genuinely have no host value. It becomes the second largest class at 589.

Not measured

  • Runtime behaviour: offline translation only. Whether the inferred views sample correctly in the world is untested (this host freezes on device removal during world load).
  • The 3D/cube-image minority of that class is taken as 2D, which is a guess.

Patch is on our fork (try/pr89, commit 0691fdb); happy to open a PR on request.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584244354 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979). Originally posted by [bittertea0323](https://github.com/bittertea0323) on 2026-11-24T14:37:08Z. **Upstream labels:** bug, triage: needs info, area: shader --- ## What `a scalar memory read as data` is the largest single translation failure class in the corpus — 771 of 26,084 programs offline. I diagnosed which of its three return points produces them and found a fix that clears the class and raises DXIL emission by 231 programs. ## Diagnosis Splitting the three returns (`descriptor_data`: non-register operand / unusual load width / use-instruction kind) into distinct messages and re-running the batch puts **all 771** on the third one. A second split of that branch by instruction prefix shows the use instruction is always an `s_` operation — never an image or buffer access, and never another `s_load` or `s_buffer_load`. So these programs read a descriptor's words as data (dimension or address arithmetic) and never sample or store through it. The lowering insisted on an image/buffer use point to learn the view's kind, and refused the program when the only use was scalar. ## Fix That branch now infers the view from the used-resource entry the load falls in — the same way the "no use point at all" path already does: - 8-dword descriptor → 2D image (properties `0x409`, kind 4) - 4-dword descriptor → structured buffer when the stride is known and a multiple of 4, raw otherwise - constant-buffer descriptors stay refused (a CBV's words are not a view) Sizes are rebuilt through `getDimensions` and written back as the descriptor's dwords. ## Measured offline `victory translate` over the title's shader container dump (26,503 containers / 26,084 programs), release build, same host, both runs: | metric | before | after | |---|---|---| | `emit: a scalar memory read as data` | 771 | **0** | | vertex+pixel programs emitting DXIL | 12252 / 14027 | **12309 / 14027** | | compute programs emitting DXIL | 1443 / 2582 | **1451 / 2582** | | mesh programs emitting DXIL | 8214 / 8713 | **8380 / 8713** | | `emit: a descriptor's address or format read as data` | 92 | 589 | +231 programs (mesh +166, vertex/pixel +57, compute +8). The last row is the next failure being exposed, not a regression: those programs now translate further and reach the address/format class, which is a different problem — those dwords genuinely have no host value. It becomes the second largest class at 589. ## Not measured - Runtime behaviour: offline translation only. Whether the inferred views sample correctly in the world is untested (this host freezes on device removal during world load). - The 3D/cube-image minority of that class is taken as 2D, which is a guess. Patch is on our fork (`try/pr89`, commit `0691fdb`); happy to open a PR on request.
Machad3x commented 2026-11-24 15:04:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Machad3x on 2026-11-24T14:48:53Z.


Offline measurement (fork github.com/Machad3x/VIctory branch claude/gta6-shader-translation-crashes-705550, tip 9018be9) over 78 console shader containers dumped from an RTX 3080 Ti world run (victory translate --list --validate): MESH programs emitted 0 of 21 on the branch without these changes; 4 of 21 after cherry-picking MartinIndra02's c42cbb0 (PR #953: a descriptor whose only use is s_buffer_load is a raw buffer; 'a scalar memory read as data' 25 -> 0); 19 of 21 (18 validated) after one more change: when the console reuses a dead descriptor's SGPRs for loaded data, a join of that descriptor's address/format dword with a data edge no longer refuses the program (the join reads undefined on that edge, like the lane-mask join already does; commit 9018be9, assumption: the value is only read on paths from the data edge). One of the newly emitted mesh programs (mesh f841ad74ec6e7367) fails DXIL validation: "Container part 'Program Output Signature' does not match expected for module". Remaining mesh failures: structured buffer of unknown stride (2), descriptor read from the first lane of computed VGPRs (4 by group count), descriptor partly joined by control flow (1). In the game (4-minute runs, wave64 mesh allowed by a diagnostics switch) the world still shows only the background plus the loading artwork; one run ended with a title fault writing to a reserved never-committed address.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134991402 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7134991402). Originally posted by [Machad3x](https://github.com/Machad3x) on 2026-11-24T14:48:53Z. --- Offline measurement (fork github.com/Machad3x/VIctory branch claude/gta6-shader-translation-crashes-705550, tip 9018be9) over 78 console shader containers dumped from an RTX 3080 Ti world run (victory translate --list --validate): MESH programs emitted 0 of 21 on the branch without these changes; 4 of 21 after cherry-picking MartinIndra02's c42cbb0 (PR #953: a descriptor whose only use is s_buffer_load is a raw buffer; 'a scalar memory read as data' 25 -> 0); 19 of 21 (18 validated) after one more change: when the console reuses a dead descriptor's SGPRs for loaded data, a join of that descriptor's address/format dword with a data edge no longer refuses the program (the join reads undefined on that edge, like the lane-mask join already does; commit 9018be9, assumption: the value is only read on paths from the data edge). One of the newly emitted mesh programs (mesh f841ad74ec6e7367) fails DXIL validation: "Container part 'Program Output Signature' does not match expected for module". Remaining mesh failures: structured buffer of unknown stride (2), descriptor read from the first lane of computed VGPRs (4 by group count), descriptor partly joined by control flow (1). In the game (4-minute runs, wave64 mesh allowed by a diagnostics switch) the world still shows only the background plus the loading artwork; one run ended with a title fault writing to a reserved never-committed address.
bittertea0323 commented 2026-11-24 15:04:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-24T14:56:36Z.


Thanks for the independent measurement — and especially for the 0 → 4 → 19 of 21 on mesh programs, which is
further than we got.

Two notes on how our 771 → 0 relates to your path, so the two are not confused:

  • Our change does not special-case s_buffer_load. It infers the view from the used-resource entry the load
    falls in
    (8-dword descriptor → 2D image, 4-dword → structured buffer when the stride is known, raw
    otherwise) and rebuilds the sizes through getDimensions, applied at both the "no use point" and "scalar use
    point" branches. The class went 771 → 0 over 26,084 programs and DXIL emission rose by 231 (mesh +166,
    vertex/pixel +57, compute +8). So it likely overlaps your #953 result rather than stacking with it — worth
    knowing before someone adds both.
  • What neither our change nor #953 covers is what you describe as the second one: the console reusing a dead
    descriptor's SGPRs for loaded data
    , so a "join" of that descriptor is reached with data the translator no
    longer tracks. That is very likely the remaining gap between 4/21 and 19/21, and it is not something our
    branch attempts.

If you can say which function that second change touches, I can try it on our corpus (26,503 containers,
NVIDIA 4070 SUPER, offline) to see whether it clears an existing class or adds a new one, and post the numbers
on your branch. That would give the two of us a clean A/B across two different corpora.

Also worth flagging for whoever reads this later: our runs show #189 (wave64 emulation) adds 26 new failures
(14 "LDS accesses without a uniform LDS fence in split wave64", 12 "a cross-lane wave operation in divergent
control flow") — so a mesh-emission count measured on a tree with #189 is not directly comparable to one
without it unless both are stated.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135201414 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7135201414). Originally posted by [bittertea0323](https://github.com/bittertea0323) on 2026-11-24T14:56:36Z. --- Thanks for the independent measurement — and especially for the 0 → 4 → 19 of 21 on mesh programs, which is further than we got. Two notes on how our 771 → 0 relates to your path, so the two are not confused: - Our change does not special-case `s_buffer_load`. It infers the view from the **used-resource entry the load falls in** (8-dword descriptor → 2D image, 4-dword → structured buffer when the stride is known, raw otherwise) and rebuilds the sizes through `getDimensions`, applied at both the "no use point" and "scalar use point" branches. The class went 771 → 0 over 26,084 programs and DXIL emission rose by 231 (mesh +166, vertex/pixel +57, compute +8). So it likely overlaps your #953 result rather than stacking with it — worth knowing before someone adds both. - What neither our change nor #953 covers is what you describe as the second one: **the console reusing a dead descriptor's SGPRs for loaded data**, so a "join" of that descriptor is reached with data the translator no longer tracks. That is very likely the remaining gap between 4/21 and 19/21, and it is not something our branch attempts. If you can say which function that second change touches, I can try it on our corpus (26,503 containers, NVIDIA 4070 SUPER, offline) to see whether it clears an existing class or adds a new one, and post the numbers on your branch. That would give the two of us a clean A/B across two different corpora. Also worth flagging for whoever reads this later: our runs show #189 (wave64 emulation) adds 26 new failures (14 "LDS accesses without a uniform LDS fence in split wave64", 12 "a cross-lane wave operation in divergent control flow") — so a mesh-emission count measured on a tree with #189 is not directly comparable to one without it unless both are stated.
Machad3x commented 2026-11-24 16:05:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Machad3x on 2026-11-24T15:25:03Z.


Offline measurement over 78 console shader containers dumped from an RTX 3080 Ti world run (fork github.com/Machad3x/VIctory branch claude/gta6-shader-translation-crashes-705550): validated programs went from 30 to 48 of 78 with: #621 (packed input padding), #563 (cube gradients, 3 hunks resolved), #683 (zero the unavailable FMA half), plus three changes of ours: (1) a resource-heap descriptor read only for its size gets a type (2D SRV for 8 dwords, raw buffer for 4; a shortcut that reads garbage if the real view is another kind), 14 'descriptor read only as data' failures mostly gone; (2) signature rows keep the module's metadata order instead of sorting by register (the validator rebuilds ISG1/OSG1 from metadata order; fixed 3 validator errors 'Container part Program Output Signature does not match', unit test added); (3) sub-dword buffer loads and stores (byte/ubyte/sbyte/short/ushort/sshort): loads read the aligned dword and shift, stores clear and set the field with two atomics (two lanes writing halves of one dword at once can lose a half). Mesh 19 of 21 emitted and validated, compute 4 of 4. Still failing: compute address groups (12 + 8; need #667/#710-style root views, which conflict with #294), 6 sampler-heap descriptor dwords read as numbers, 4 mesh descriptors computed by v_sub_f32/v_fmac_f32, 2 unknown stride, 2 other.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135990693 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7135990693). Originally posted by [Machad3x](https://github.com/Machad3x) on 2026-11-24T15:25:03Z. --- Offline measurement over 78 console shader containers dumped from an RTX 3080 Ti world run (fork github.com/Machad3x/VIctory branch claude/gta6-shader-translation-crashes-705550): validated programs went from 30 to 48 of 78 with: #621 (packed input padding), #563 (cube gradients, 3 hunks resolved), #683 (zero the unavailable FMA half), plus three changes of ours: (1) a resource-heap descriptor read only for its size gets a type (2D SRV for 8 dwords, raw buffer for 4; a shortcut that reads garbage if the real view is another kind), 14 'descriptor read only as data' failures mostly gone; (2) signature rows keep the module's metadata order instead of sorting by register (the validator rebuilds ISG1/OSG1 from metadata order; fixed 3 validator errors 'Container part Program Output Signature does not match', unit test added); (3) sub-dword buffer loads and stores (byte/ubyte/sbyte/short/ushort/sshort): loads read the aligned dword and shift, stores clear and set the field with two atomics (two lanes writing halves of one dword at once can lose a half). Mesh 19 of 21 emitted and validated, compute 4 of 4. Still failing: compute address groups (12 + 8; need #667/#710-style root views, which conflict with #294), 6 sampler-heap descriptor dwords read as numbers, 4 mesh descriptors computed by v_sub_f32/v_fmac_f32, 2 unknown stride, 2 other.
fuzeofficlal commented 2026-11-24 18:05:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T17:18:53Z.


Cross-checked all three Lower::descriptor_data failure slices raised here (s_buffer_load* Fields::Smem + dword 2 size read, twin s_load_dword* to the same 32-byte heap slot, and pure s_load_dwordx4/x8/x1 size queries backed only by UsedResource) against #953, #1067, and #1130, and verified a combined branch on NVIDIA GeForce RTX 5090, D3D12 WARP, and dxil.dll: fuzeofficlal/VIctory@66a9fde (fix/descriptor-data-infer-view-979).

Key subtleties uncovered during GPU + dxil.dll verification:

  • Fields::Smem (s_buffer_load*): Lower::smem only emits a raw SRV (11, 0) when used.is_some_and(|u| u.kind == ResourceType::Srv), and declares CBV (13, 0x1_0000) when used is Some(Cbv) or None — so descriptor_data must require Some(Srv) (and keep uav = false) to avoid emitting conflicting CBV + SRV handles on the same slot.
  • Twin-entry lookup before UsedResource fallback: Matching b.offset + 4 * other_first == (a.offset & !31) preserves exact 1D/2D/3D/Array/Typed dimensions when another load accesses the same 32-byte entry, while keeping site's own first = 0 and in_slot = (a.offset & 31) / 4.
  • Pure-data UsedResource fallback: Checking in_slot + count <= u32::from(used.dwords) and restricting 4-dword raw buffers to used.stride == 0 supports narrowed +0x08 single-dword NUM_RECORDS loads while preventing non-multiple-of-4 structured strides from silently returning byte counts instead of element counts.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7139007767 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7139007767). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T17:18:53Z. --- Cross-checked all three `Lower::descriptor_data` failure slices raised here (`s_buffer_load*` `Fields::Smem` + `dword 2` size read, twin `s_load_dword*` to the same 32-byte heap slot, and pure `s_load_dwordx4/x8/x1` size queries backed only by `UsedResource`) against `#953`, `#1067`, and `#1130`, and verified a combined branch on **NVIDIA GeForce RTX 5090**, **D3D12 WARP**, and **`dxil.dll`**: [`fuzeofficlal/VIctory@66a9fde`](https://github.com/fuzeofficlal/VIctory/commit/66a9fde8f8c1c163f460c81d7eef9b49f52af519) (`fix/descriptor-data-infer-view-979`). Key subtleties uncovered during GPU + `dxil.dll` verification: - **`Fields::Smem` (`s_buffer_load*`)**: `Lower::smem` only emits a raw SRV `(11, 0)` when `used.is_some_and(|u| u.kind == ResourceType::Srv)`, and declares CBV `(13, 0x1_0000)` when `used` is `Some(Cbv)` **or `None`** — so `descriptor_data` must require `Some(Srv)` (and keep `uav = false`) to avoid emitting conflicting CBV + SRV handles on the same slot. - **Twin-entry lookup before `UsedResource` fallback**: Matching `b.offset + 4 * other_first == (a.offset & !31)` preserves exact 1D/2D/3D/Array/Typed dimensions when another load accesses the same 32-byte entry, while keeping `site`'s own `first = 0` and `in_slot = (a.offset & 31) / 4`. - **Pure-data `UsedResource` fallback**: Checking `in_slot + count <= u32::from(used.dwords)` and restricting 4-dword raw buffers to `used.stride == 0` supports narrowed `+0x08` single-dword `NUM_RECORDS` loads while preventing non-multiple-of-4 structured strides from silently returning byte counts instead of element counts.
EduAzevedo commented 2026-11-24 18:05:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by EduAzevedo on 2026-11-24T17:32:47Z.


finding: "a descriptor's address or format read as data" can't be fixed from host view dimensions. Programs read real V# fields that a host view doesn't have.

Where: crates/victory-shader/src/emit/lower.rs, descriptor_data, the None => arm that stores Val::Missing(OTHER). That function rebuilds only the size fields (image dwords 1–4, buffer dword 2) from getDimensions.

How it was measured: I ran victory translate --jobs 8 offline on all 26,148 programs of a retail dump, twice:

  • on main (ffe310e);
  • on main with only Machad3x's bc2b1b5 (#979) cherry-picked. 0691fdb from the issue body is no longer on try/pr89.

A local, uncommitted census renamed each OTHER refusal by dword index and by the first instruction consuming that dword. Only counts are given here.

On main: 92 programs

Dword Programs
image dword 0 39
buffer dword 1 22
buffer dword 3 17
image dwords 5–7 14
  • Buffer dword 1: all 22 are raw buffers. They do s_cmp_lt_u32 dword1, 0x1000000, i.e. "is the stride below 256?".
  • Buffer dword 3: these are copied whole with v_writelane_b32.

With #979: about 600 programs, matching the issue's 92 → 589. Almost all are raw buffers (kind 11, which #979 gives s_buffer_load sites).

Dword Programs (approx.) First consumer
buffer dword 1 ~250 stride bits 16–23: s_bfe_u32 …, 0x80010, s_and_b32 …, 0xff0000, s_cmp_eq_u32 …, 0x80, s_cmp_lt_u32 …, 0x1000000; a few test bit 8 or bit 20
buffer dword 0 ~145 s_and_b32 …, 0x100000: bit 20 of the base address; a few test bit 8
buffer dword 3 ~110 s_and_b32 …, 0x100: bit 8, inside dst_sel_z; or the whole dword via v_writelane_b32
image dwords 0, 5–7 ~50 address shifts, layout fields, v_writelane_b32

Why it matters: these bits pick the program's path, and a ByteAddressBuffer view has no stride, address or dst_sel. Synthesising them, for example stride << 16 with a made-up stride, would be a guess. Rebuilding more fields from the host view can't fix this class.

The fix that looks correct is to give the program the descriptor's real dwords: the runtime already reads them from title memory to build the views, so they could be passed to the program. That changes the root signature and how the translator and runtime hand off descriptors, so it needs a maintainer's call before anyone writes code.

Needs: game files for the census; any GPU, since the census is offline. AI-assisted measurement, run on my own dump.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139355607 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7139355607). Originally posted by [EduAzevedo](https://github.com/EduAzevedo) on 2026-11-24T17:32:47Z. --- finding: "a descriptor's address or format read as data" can't be fixed from host view dimensions. Programs read real V# fields that a host view doesn't have. **Where:** `crates/victory-shader/src/emit/lower.rs`, `descriptor_data`, the `None =>` arm that stores `Val::Missing(OTHER)`. That function rebuilds only the size fields (image dwords 1–4, buffer dword 2) from `getDimensions`. **How it was measured:** I ran `victory translate --jobs 8` offline on all 26,148 programs of a retail dump, twice: - on `main` (ffe310e); - on `main` with only Machad3x's `bc2b1b5` (#979) cherry-picked. `0691fdb` from the issue body is no longer on `try/pr89`. A local, uncommitted census renamed each `OTHER` refusal by dword index and by the first instruction consuming that dword. Only counts are given here. **On main: 92 programs** | Dword | Programs | |---|---| | image dword 0 | 39 | | buffer dword 1 | 22 | | buffer dword 3 | 17 | | image dwords 5–7 | 14 | - Buffer dword 1: all 22 are raw buffers. They do `s_cmp_lt_u32 dword1, 0x1000000`, i.e. "is the stride below 256?". - Buffer dword 3: these are copied whole with `v_writelane_b32`. **With #979: about 600 programs, matching the issue's 92 → 589.** Almost all are raw buffers (kind 11, which #979 gives `s_buffer_load` sites). | Dword | Programs (approx.) | First consumer | |---|---|---| | buffer dword 1 | ~250 | stride bits 16–23: `s_bfe_u32 …, 0x80010`, `s_and_b32 …, 0xff0000`, `s_cmp_eq_u32 …, 0x80`, `s_cmp_lt_u32 …, 0x1000000`; a few test bit 8 or bit 20 | | buffer dword 0 | ~145 | `s_and_b32 …, 0x100000`: bit 20 of the base address; a few test bit 8 | | buffer dword 3 | ~110 | `s_and_b32 …, 0x100`: bit 8, inside dst_sel_z; or the whole dword via `v_writelane_b32` | | image dwords 0, 5–7 | ~50 | address shifts, layout fields, `v_writelane_b32` | **Why it matters:** these bits pick the program's path, and a ByteAddressBuffer view has no stride, address or dst_sel. Synthesising them, for example `stride << 16` with a made-up stride, would be a guess. Rebuilding more fields from the host view can't fix this class. The fix that looks correct is to give the program the descriptor's real dwords: the runtime already reads them from title memory to build the views, so they could be passed to the program. That changes the root signature and how the translator and runtime hand off descriptors, so it needs a maintainer's call before anyone writes code. **Needs:** game files for the census; any GPU, since the census is offline. AI-assisted measurement, run on my own dump.
Marvisak commented 2026-11-25 07:03:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T07:00:18Z.


Automated triage for the maintainers.

The 2026-11-25 13:04 correction is right about main (da82e44). In crates/victory-shader/src/emit/lower.rs, descriptor_data reaches its use-point match only through use_of, which keeps descriptors with Role::Resource. In crates/victory-shader/src/resource.rs, that role is given only to image instructions, buffer instructions (except _inv) and s_buffer_* loads. The Fields::Image, Fields::Buffer and Fields::Smem arms cover all three, so the final _ => Err("a scalar memory read as data") cannot be reached. A descriptor that is used only by scalar ALU instructions goes to view_addresses instead, which reports "a descriptor read only as data".

So the branch this issue diagnosed (from ffe310e) no longer exists in that form. On current main, "a scalar memory read as data" can only come from the first two returns of descriptor_data: no SGPR data operand, or a scalar memory instruction other than s_load_dword/x2/x4/x8/x16. The commit in the body is also gone from the fork.

To settle what is left, run victory translate over the corpus on current main and post the counts for "a scalar memory read as data", "a descriptor read only as data" and "a descriptor's address or format read as data". Counts only, nothing from the title. The open PR #1083 names each scalar read and would show which return is hit. If a gap remains, a PR rebased on main is welcome; pull requests are open to everyone.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155384022 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7155384022). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T07:00:18Z. --- <!-- victory-issue-triage v1 verdict=needs-info seen=2026-11-25T13:04:08Z at=2026-11-25T15:59:00Z --> Automated triage for the maintainers. The 2026-11-25 13:04 correction is right about `main` (da82e44). In `crates/victory-shader/src/emit/lower.rs`, `descriptor_data` reaches its use-point `match` only through `use_of`, which keeps descriptors with `Role::Resource`. In `crates/victory-shader/src/resource.rs`, that role is given only to image instructions, buffer instructions (except `_inv`) and `s_buffer_*` loads. The `Fields::Image`, `Fields::Buffer` and `Fields::Smem` arms cover all three, so the final `_ => Err("a scalar memory read as data")` cannot be reached. A descriptor that is used only by scalar ALU instructions goes to `view_addresses` instead, which reports "a descriptor read only as data". So the branch this issue diagnosed (from `ffe310e`) no longer exists in that form. On current `main`, "a scalar memory read as data" can only come from the first two returns of `descriptor_data`: no SGPR `data` operand, or a scalar memory instruction other than `s_load_dword`/`x2`/`x4`/`x8`/`x16`. The commit in the body is also gone from the fork. To settle what is left, run `victory translate` over the corpus on current `main` and post the counts for "a scalar memory read as data", "a descriptor read only as data" and "a descriptor's address or format read as data". Counts only, nothing from the title. The open PR #1083 names each scalar read and would show which return is hit. If a gap remains, a PR rebased on `main` is welcome; pull requests are open to everyone. --- _Generated by [Claude Code](https://claude.ai/code)_
Dathinel commented 2026-11-25 13:03:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T13:02:57Z.


@bittertea0323 are you planning to open the PR Marvisak asked for above? 0691fdb is no longer on your fork, so nobody else can pick it up from there.

If you would rather not, I can rebuild the remaining case on current main (940d32f): in descriptor_data, when the descriptor's use is a scalar ALU instruction, take the view's kind from the used-resource entry the way the Fields::Smem arm and view_addresses already do (constant buffers still refused). Your diagnosis would be credited in the PR, and it would come with a synthetic regression test for a size read through scalar arithmetic. I cannot rerun your corpus numbers; the PR would say so and leave both rows (this class and "a descriptor's address or format read as data") to someone who can.

I'll wait for your answer before opening anything. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163218213 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7163218213). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T13:02:57Z. --- @bittertea0323 are you planning to open the PR Marvisak asked for above? `0691fdb` is no longer on your fork, so nobody else can pick it up from there. If you would rather not, I can rebuild the remaining case on current `main` (`940d32f`): in `descriptor_data`, when the descriptor's use is a scalar ALU instruction, take the view's kind from the used-resource entry the way the `Fields::Smem` arm and `view_addresses` already do (constant buffers still refused). Your diagnosis would be credited in the PR, and it would come with a synthetic regression test for a size read through scalar arithmetic. I cannot rerun your corpus numbers; the PR would say so and leave both rows (this class and "a descriptor's address or format read as data") to someone who can. I'll wait for your answer before opening anything. AI-assisted (Claude Code).
Dathinel commented 2026-11-25 14:07:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T13:04:08Z.


Correction to my offer above, after reading main (940d32f) more closely: the case I offered to rebuild cannot occur there.

  • In descriptor_data (crates/victory-shader/src/emit/lower.rs), the arm that takes the kind from the use point is reached only through use_of, which keeps descriptors with Role::Resource. resource.rs gives that role only to image instructions, to buffer instructions (except the _inv ones) and to s_buffer_*. The match &ui.fields covers exactly Fields::Image, Fields::Buffer and Fields::Smem, so its final _ => Err("a scalar memory read as data") (line 4113) is unreachable today. A use that is only scalar ALU never becomes a use_at: it goes to view_addresses, which reports "a descriptor read only as data".
  • smem sends every scalar memory instruction that is not s_buffer_load_dword*, and does not come from the code, user data or memory, into descriptor_data. So any "a scalar memory read as data" left on current main comes from one of its first two returns: line 4005, where the instruction has no SGPR data operand, or line 4013, where the name is not s_load_dword, x2, x4, x8 or x16 (for example an s_scratch_load_*, s_atomic_* or s_store_* reaching this path).

Which of the two the remaining programs hit needs a corpus run on current main; #1083's per-read names would show it directly. I don't have the corpus, so I'm not opening a PR for this. bittertea0323's inference from the used-resource entry may still be the right fix for whatever is left, but only once the run shows which return it is. Code reading only, nothing executed. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163245717 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/979#issuecomment-7163245717). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T13:04:08Z. --- Correction to my offer above, after reading `main` (`940d32f`) more closely: the case I offered to rebuild cannot occur there. - In `descriptor_data` (`crates/victory-shader/src/emit/lower.rs`), the arm that takes the kind from the use point is reached only through `use_of`, which keeps descriptors with `Role::Resource`. `resource.rs` gives that role only to image instructions, to buffer instructions (except the `_inv` ones) and to `s_buffer_*`. The `match &ui.fields` covers exactly `Fields::Image`, `Fields::Buffer` and `Fields::Smem`, so its final `_ => Err("a scalar memory read as data")` (line 4113) is unreachable today. A use that is only scalar ALU never becomes a `use_at`: it goes to `view_addresses`, which reports "a descriptor read only as data". - `smem` sends every scalar memory instruction that is not `s_buffer_load_dword*`, and does not come from the code, user data or memory, into `descriptor_data`. So any "a scalar memory read as data" left on current `main` comes from one of its first two returns: line 4005, where the instruction has no SGPR `data` operand, or line 4013, where the name is not `s_load_dword`, `x2`, `x4`, `x8` or `x16` (for example an `s_scratch_load_*`, `s_atomic_*` or `s_store_*` reaching this path). Which of the two the remaining programs hit needs a corpus run on current `main`; #1083's per-read names would show it directly. I don't have the corpus, so I'm not opening a PR for this. bittertea0323's inference from the used-resource entry may still be the right fix for whatever is left, but only once the run shows which return it is. Code reading only, nothing executed. AI-assisted (Claude Code).
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
Marvisak/VIctory#979
No description provided.