Skip to content

startup: lower 1D image_load, image_load_mip, image_sample_lz and image_sample_l - #1724

Closed
tedin7 wants to merge 2 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-gfx-img1d
Closed

tedin7 wants to merge 2 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-gfx-img1d

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Part of the refusal triage in #870 (the image dimension SQ_RSRC_IMG_1D refusals, 2 of the 29 shaders in the GTX 1660 SUPER cache). No open pull request covers the remaining 1D forms: #1630 (merged) lowered only the implicit image_sample with one coordinate.

Change

A 1D image takes one address component, x. In image() of tools/startup/gfx2hlsl.py:

image_load        -> Texture1D.Load(int2(x, 0))
image_load_mip    -> Texture1D.Load(int2(x, mip))          address [x, mip]
image_sample_lz   -> Texture1D.SampleLevel(smp, x, 0)
image_sample_l    -> Texture1D.SampleLevel(smp, x, level)  address [x, level]

The mip and the level are the last address register, so an NSA list such as [v3, v1] reads x from v3. The 1D sample check now accepts glc, slc and dlc next to dim and dmask (they do not change the value); every other modifier, an empty dmask and a wrong address count are refused with unverified 1D image address or modifiers (the message no longer says "sample"). Compare, gather and offset forms on a 1D image are unchanged and refused. The axes count is now defined once for all dimensions.

I did not touch the runtime: tex1d binding and upload come from #1630.

Test

New tests/startup_image_1d_check.py (CTest startup_image_1d, also in the Windows pixel-binary job with llvm-mc-15): 14 source-built fixtures with words checked against llvm-mc-19. It requires the exact call for each form, the Texture1D<float4> declaration and the tex1d manifest line, and the refusals. tests/startup_image_sample_l_check.py no longer expects 1D to be refused.

python3 -B tests/startup_image_1d_check.py                       PASS
python3 -B tests/startup_image_1d_check.py binary llvm-mc-19     fixture words match llvm-mc

Four local mutations of the lowering each make the check fail, and the tree was restored after each: the mip read as 0, the level taken from the first register, unorm accepted on 1D, the texture bound as tex2d. Also run and passing: startup_image_sample_l_check, _sample_c_check, _3d_check, _2d_array_check, _load_mip_check, startup_translator_check, startup_gfx2hlsl_smem_offset_check, docs_links_check, bidi_controls_check and git diff --check. A merge against the heads of #1711, #1707 and #1699 has no conflicts (the docs note is placed so it does not touch the lines #1711 edits).

What this does not establish

  • No draw runs a 1D load, mip load or explicit-level sample, and I have no Windows, DXC or GPU here: the forms are checked on the generated HLSL text only, and the HLSL was not compiled with DXC or FXC.
  • The wrong-address-count refusal for load, image_sample and image_sample_lz cannot be reached from assembled code (llvm-mc rejects such addresses), so removing that clause is not caught; the same refusal is kept for the l and load_mip forms by their own checks.
  • Which opcodes the two refused shaders on P0: main executable startup progress #870 use is not stated there, so whether this clears them is unknown; their refusal text (image dimension SQ_RSRC_IMG_1D) is the pre-Support one-dimensional textures in translated startup draws #1630 one and may come from a stale cache.

AI-assisted. Commands listed were executed locally.

…ge_sample_l

A 1D image takes one address component, x. image_load becomes Texture1D.Load(int2(x, 0)), image_load_mip Load(int2(x, mip)), image_sample_lz SampleLevel(smp, x, 0) and image_sample_l SampleLevel(smp, x, level), the mip and the level being the last address register. Only glc, slc and dlc are accepted next to dim and dmask. These forms were refused with unverified 1D image sample address or modifiers; the implicit image_sample was already lowered. tests/startup_image_1d_check.py translates source-built fixtures (words checked against llvm-mc 19) and requires the exact call. No draw runs these forms: not measured on WARP or hardware.
@tedin7

tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this draft: #1722 already covers 1D image_sample_lz / image_sample_l from #1721. Will only revisit non-overlapping 1D image_load / image_load_mip after #1722 lands if still needed. AI-assisted.

@tedin7 tedin7 closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant