tooling: handle comments and 64-bit indices in address-window lowering #1603
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1610"
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-24T15:01:22Z.
What
tools/spirv_address_window.py:lowerdrops trailing;comments (preserving any;inside quoted string literals) before matching instructions, viastrip_comment.word_pointerhandles 64-bitOpAccessChainindices (index_kind"u64"/"s64") without re-widening them withOpUConvert, bit-casts signed 64-bit indices (OpTypeInt 64 1) to%ulong, and guards the left shift with(delta >> scale) == index(OpShiftRightLogical+OpIEqual) so an out-of-window 64-bit index cannot drop high bits and alias an in-window address. 32-bit indices are still widened withOpUConvert.tests/spirv_window/check.py:OpEntryPoint, a comment mentioningPushConstant, and a;inside a quotedOpNamestring literal with a trailing comment).OpAccessChainindices, verifyingspirv-as+spirv-valacceptance, absence of duplicateOpUConvert,OpBitcast %ulongfor signed 64-bit, and emission of the shift-wrap guard.Why
spirv_address_window.pyusesfullmatch, so a line carrying a trailing;comment was skipped and emitted unchanged, leaving dangling IDs, appending generated interface IDs inside comments, or failing on comments mentioningPushConstant.OpAccessChainindex is valid input, but re-applyingOpUConvert %ulongis rejected byspirv-val(Expected input to have different bit width from Result Type: UConvert). Moreover, unlike a 32-bit index, shifting a 64-bit index left by 2, 3, or 4 bits can silently drop high bits and wrap to an in-window offset unless the shift itself is checked against overflow; signed 64-bit indices also needOpBitcast %ulongsoOpIEqualoperands share the same type.Tested
Run on Linux (
spirv-as,spirv-val,spirv-crosswith--target-env vulkan1.2):All pass.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
669985cba0f0ede5ceb030f5ae0c35ae56bca813:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6):3.28s(configure1.72s)ctest --preset dev -R '^spirv_address_window_' --parallel 4 --no-tests=error --output-on-failure): 12/12 passed (5.64s:spirv_address_window_warp,spirv_address_window_atomic_warp,spirv_address_window_signed_warp,spirv_address_window_float_warp,spirv_address_window_vec4_warp,spirv_address_window_qword_warpand corresponding hardware/WARP variants)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6):0.85s(configure1.73s)ctest --preset release -R '^spirv_address_window_' --parallel 4 --no-tests=error --output-on-failure): 12/12 passed (5.51s)Audited, nothing found
tools/spirv_ballot_extract.py,tools/spirv_sampler_views.py: no defect found.tools/spirv_address_window.py: the 64-bit wrap guard (addition + shift), end constants, alignment masks, atomic failure-semantics bits, compare-exchange loops and phi-parent renaming hold.tools/spirv_sampler_split.py: only exotic spellings are refused (hexadecimal or octal literals,OpDecorateString);spirv-disdoes not emit them, so nothing is changed.tools/x87_lower.py: stack-depth tracking, FIST/FISTP rounding, FRNDINT and FBSTP matched an independent exact model on about 3,000 edge cases.AI-assisted; commands listed were executed locally.
[PR #1610] tooling: keep address-window lowering valid for commented lines and 64-bit indicesto [PR #1610] tooling: handle comments and 64-bit indices in address-window loweringImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T15:17:06Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
669985cba0ℹ️ 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-24T15:27:45Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T15:13:24Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
669985cℹ️ 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 chatgpt-codex-connector[bot] on 2026-11-24T15:17:06Z.
Code review location:
tools/spirv_address_window.py; line 330For a valid multiline
OpString/OpSourceliteral whose continuation contains;, resetting this state for each line interprets the literal's semicolon as a comment. Adding%text = OpString "first line\nint tmp = 0; }"to the atomic fixture preserves the full string on the parent commit, but here the continuation is truncated toint tmp = 0, deleting the closing quote and making the lowered assembly invalid. Carry quote/escape state across the entire module, or reusespirv_sampler_views.strip_comments, which already handles multiline literals.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:27:45Z.
Code review location:
tools/spirv_address_window.py; line 330Addressed in
008558b3d08ac4dbaf744de3e6c93b2f7f315b6c: replaced per-linestrip_commentwithlogical_lines()intools/spirv_address_window.pyso quote and backslash-escape state carries across lines and multiline string literals keep their inner newlines, spacing, and semicolons intact while stripping trailing;comments. Added a multilineOpStringregression test (%text = OpString "first line\n int tmp = 0; }" ; note) intests/spirv_window/check.py.Verified locally:
python3 tests/spirv_window/check.py(pass)python3 tests/docs_links_check.py(pass)python3 tests/bidi_controls_check.py(pass)--preset dev) and Release/O2(--preset release)ctest -R '^spirv_address_window_': 12/12 passed in both configurations.AI-assisted; commands listed were executed locally.