startup: lower explicit-LOD image_sample_l to SampleLevel in gfx2hlsl #1251
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1258"
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 R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:44:47Z.
Change
Lowers the gfx1013
image_sample_lform (explicit level of detail) intools/startup/gfx2hlsl.pytotex.SampleLevel(smp, uv, level)for 2D and 3D textures. The level is the last address register (third for contiguous 2D, fourth for 3D, last element of an NSA list). Offset (_o), compare, gather, cube andunormforms are refused with anUnsupportedmessage. Previously the translator refused everyimage_sample_l. No related open issue or PR found (checkedsample/gfx2hlslin open PRs).AI-assisted.
Verification
python3 -B tests/startup_image_sample_l_check.py: passes with the change; on origin/main it fails (Unsupported: image_sample_l).python3 -B tests/startup_image_sample_l_check.py binary llvm-mc-19: fixture words match (CI runs it with llvm-mc-15).Sampleinstead ofSampleLevel; level taken from the third register in every form (fails on the NSA and 3D fixtures).python3 -B tests/startup_sampler_heap_check.py,tests/startup_uniform_lane_check.py,tests/docs_links_check.py: pass.PR fuori preset pr:
ctest -R "^startup_image_sample_l$"on the Windows node (pure Python translation check, no GPU).Evidence and follow-up
offscreen_checkmode with a coloured-mip texture).docs/experiments.md,docs/startup-runtime.md.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:52:27Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
5275bb337eℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:54:12Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:58:31Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
544a0cb6f6ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:59:47Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:03:15Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:54:15Z.
Fixed in
544a0cb6: the MIMG decoder now prints a16 (word 1 bit 30), and image_sample_l refuses it. New fixture check fails on the old decoder, passes now. @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:54:21Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44) at commit
5275bb337ea25e177c0548133e4b3703d7a5603c:cmake --preset dev+ctest --preset dev -R "^startup_image_sample_l$": 1/1 passed (0.16s)cmake --preset release+ctest --preset release -R "^startup_image_sample_l$": 1/1 passed (0.15s)python -B tests/startup_image_sample_l_check.py: exit 0Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:59:49Z.
Fixed in
30fa57b4: the MIMG decoder now prints tfe (word 0 bit 16) and image_sample_l refuses it; new fixture fails on the old decoder. @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:03:17Z.
AI-assisted update (
7fb2c893): image_sample_l now refuses every MIMG bit and form the lowering does not model, and the disassembler decodes lwe from its real bit 17. Merged current main (SDWA and image-3d entries kept). Local checks: startup_image_sample_l_check.py (controls and llvm-mc-19 fixture words) and startup_gfx2hlsl_sdwa_check.py pass; the new negative fixtures fail on the previous code. @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T06:07:57Z.
Codex Review: Didn't find any major issues. 🚀
Reviewed commit:
7fb2c8938bℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:47:10Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
7fb2c89ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:08:33Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44, D3D12 WARP) at
7fb2c893:cmake --preset dev+ctest --preset dev -R "^(startup_image_sample_l|startup_gfx2hlsl_sdwa)$"— 2/2 PASS (startup_image_sample_l0.16s,startup_gfx2hlsl_sdwa0.39s)cmake --preset release(/O2) +ctest --preset release -R "^(startup_image_sample_l|startup_gfx2hlsl_sdwa)$"— 2/2 PASS (startup_image_sample_l0.17s,startup_gfx2hlsl_sdwa0.41s)python -B tests/startup_image_sample_l_check.py— exit 0python -B tests/startup_gfx2hlsl_sdwa_check.py— exit 0 (PASS)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:52:28Z.
Code review location:
tools/startup/gfx2hlsl.py; line 619For a valid gfx1013
image_sample_l ... a16instruction, the MIMG decoder intools/disasm_rdna2.pycurrently omits thea16modifier and reports a full-float address range, so this guard accepts the unsupported encoding. I reproduced a source address ofv[0:1] ... a16producingSampleLevel(q0, float2(F(v0), F(v1)), F(v2)): the packed FP16 coordinates are interpreted as FP32, and an unrelated register supplies the LOD. The parent commit rejects this instruction, whereas the new handler silently generates incorrect sampling code. Expose and reject the A16 modifier, or check its encoding bit before accepting this lowering, until packed addresses are implemented.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:54:12Z.
Code review location:
tools/startup/gfx2hlsl.py; line 619Fixed in
544a0cb6Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:58:31Z.
Code review location:
tools/startup/gfx2hlsl.py; line 619For a valid
image_sample_l ... dmask:0x1 ... tfe, the decoder still omits TFE (word 0 bit 16), so this modifier whitelist accepts an encoding whose extra status result is not modeled. A source-built gfx1013 sample with destinationv[4:5]translates to an assignment tov4only; a subsequent check of the status inv5therefore reads its previous value instead of the sample status. The parent rejected this instruction. Expose and rejecttfe, or inspect its encoding bit, until the extra result is lowered.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:59:46Z.
Code review location:
tools/startup/gfx2hlsl.py; line 619Fixed in
30fa57b4Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:03:15Z.
Code review location:
tools/startup/gfx2hlsl.py; line 619Fixed in
7fb2c893(tfe plus every other unmodelled MIMG bit: lwe, d16, r128, unorm, reserved bits, non-2D/3D dims; one llvm-mc-built negative fixture each).