The largest refusal on main, "a buffer's stride or swizzle" (723 shaders), is a texture size query through four dwords of an image descriptor #407
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-27T17:00:52Z.
On main
b998bb65the largest refusal reason in my corpus (21,608 shaders: every shader the title registered in a run that reached the world; native host options) is "a view address field the table gives as 0: a buffer's stride or swizzle": 723 shaders (704 compute, 17 pixel, 2 vertex; 187 bound from the first world frame on). All 723 are one shape, and it reads a texture, not a buffer. Before #311, 614 of them were refused as "a descriptor read only as data", the message #386 and #387 are about. #400 reports that 290 of its 305 compute shaders reach this message next; I have not looked at which shape those are.What is refused. A texture size query on a texture the program takes from the heap by index:
v_readfirstlane_b32,v_cmpx_eq_i32,s_lshl_b32by 5);s_load_dwordx4from the resource heap with that shifted index as the offset: the first four dwords of the descriptor, which nothing uses as a resource;s_bfe_u32(the 2 bits at bit 30) and tested withs_cmp_eq_i32against 0, dword 2 bys_and_b32(the low 14 bits) and in 52 shaders also bys_bfe_u32(the 16 bits at bit 14), dword 3 bys_bfe_u32(the 4 bits at bit 12); dword 0 is not read;s_lshl2_add_u32ands_lshr_b32then make the width (or width and height) of the view's first level, ands_cselect_b32makes it 0 when dword 1 is 0.Those bits are an image descriptor's width minus one (2 bits in dword 1, 14 in dword 2), height minus one (dword 2 bits 14-29) and base level (dword 3 bits 12-15). A buffer's record count would be read whole. 757 shaders hold this shape (710 compute, 45 pixel, 2 vertex), every one with exactly these readers: 723 are refused and 34 translate (see the end). No shader of the corpus reads a descriptor of a table or of the resource heap as data through an eight-dword load. So for a size query the compiler loads the half of the image descriptor it needs, not the whole.
Why.
Lower::view_addressestakes the kind of view from the size of the load: eight dwords at a whole descriptor isIMAGE, anything elseBUFFER. So bits 30-31 of dword 1 are taken for a buffer's swizzle, and dwords 2-3 for its record count and format. Read asIMAGE, the size fields are the ones the table holds (descriptor::texture_words). The test is the exception: the table holds an image's dword 1 as the width's low 2 bits only, so a compare with 0 would take a texture of width 4k + 1 (1, 5, 9, 257, 513) for a null view.docs/native-host.md("Descriptor dwords read as data") keeps the shape refused for that reason.Next to #386 and #387. #387's head (
c091cbda, on728845d1) reads dwords 0-3 for every such load (known = 4). Swept on my corpus against its base, by output: 421 newly translated, 0 regressions, 55 changed. 53 of the 421 (52 vertex, 1 compute) are reads of a buffer's record count, as #386 describes. The other 368 (352 compute, 14 pixel, 2 vertex) are this texture shape. They are all 69 of its gains that are bound in the world here, and all 64 of its gains among the shaders refused in a 4-minute run here. They translate there because a texture view's entry already holdstexture_words, with the test inexact as above. On main the rebase meets the same point throughseen_bits. So I suggest a split: #387 keeps the buffer fields, and this issue takes the texture half.Plan.
Lower::view_addresses, a four-dword load at a whole descriptor isIMAGEwhen every reader of its dwords is one of the field reads above (a constants_bfe_u32ors_and_b32inside the size fields the table holds, the test of dword 1 against 0), dword 0 has no reader, no dword reaches a join, and the computed part of the offset is ans_lshl_b32by 5. Any other reader keeps today's refusal.seen_bitsjudges them, with a constants_bfe_u32added (it keeps its field's bits).texture_wordsgives every texture view the identity swizzle there). Only the test against 0 can see bit 0, because the other reader allowed keeps bits 30-31. So a texture of width 4k + 1 is not taken for a null view.docs/native-host.md: a real image descriptor's dword 1 is never 0 on the console (its format field is not 0) and a null view's is 0; an entry read this way holds an image view or nothing.Measured with a throwaway prototype of the rule (on
728845d1, whole corpus, by output): 368 gained, the same 368 shaders #387 gains for this shape; 0 regressed; 34 changed. The other 355 refused holders stop at a later refusal, most of them at lane-mask reasons. Five of the 64 from the run, for anyone with a dump of their own:0161ea22debc4d43,024c838b8e9b5ab6,0841e6b5c06550d4,0905d38ab31453e4,0c7e2e34df0718ea.The 34 changed are the shaders that hold the shape and translate today (6 compute, 28 pixel). All of them reach #256's path with this value: a join that a guarded write un-marked gets 0 on the edge that carries the refused size. With the rule the size exists, so they no longer depend on that.
One limit to know: the table holds zeros for a view whose resource the host does not know, so such a query reads "no texture".
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-27T17:01:03Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T17:01:13Z.
Claimed by @Sandile-0511. Open a draft pull request with
Refs #407in its description within 24 hours, or the claim expires.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T02:40:29Z.
/claim
Working on it locally: a four-dword load at a descriptor index whose readers keep only size fields is lowered as an image size query, with the null test of dword 1 answered through bit 0 of the table's dword 1 (always 0, the width being in bits 30-31) taken from dword 0 / dword 3 of the entry. Draft PR follows with the corpus sweep.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T02:40:39Z.
@Olima34 this is already claimed by @Sandile-0511. Pick another issue, or ask them here.