shader: lower vec4 float loads and stores in the address window #1371
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1378"
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-24T09:53:31Z.
What
The SPIR-V address-window adapter now lowers four-float (
%v4float) physical accesses:OpConvertUToPtr %_ptr_PSB_v4float,OpAccessChaininto a%rt_v4floatarray (%_ptr_PSB_arrv4f,ArrayStride 16), andOpLoad/OpStorewithAligned 16.OpBitcast %floatand oneOpCompositeConstruct. A store is fourOpCompositeExtract, fourOpBitcast %uintand four word stores.0xfffffffc(the guard compares against0xfffffff0), and, for an indexed address, a base plus index that does not wrap. The last valid vector starts at0xffffffe0; one at0xfffffff0straddles the end and is refused whole.%v2float,%v3float,%v4uintand%v4intpointers are still refused withunhandled physical pointer operation; they are not part of this PR.tests/spirv_window/address_vec4.{spvasm,py}, a CPU model and two modes inreadback.cpp/offscreen_check.cpp, and the bridge entryaddress_window_vec4:address_vec4.Why
The scalar float form was the template. A vector load or store is the next common shape, and a guard that checked only the first word would let a vector that crosses the window end move partly. The fixture and negative controls pin the all-or-nothing rule.
Tested
Windows (needs the SPIR-V tools; DXC and WARP):
(
spirv_address_window_vec4_hardwareis the same test on a physical GPU.) It runs 18 production cases and 5 cases in a second build whose window ends at byte 44, then seven negative controls, each of which must first diverge at its predicted case and word.Run on Linux (SPIRV-Tools and Debian spirv-cross, no DXC or WARP):
python3 -B tests/spirv_window/address_vec4.py spirv-as spirv-val spirv-cross: model, guard-versus-edge-model at every DWORD address near the window end, shape, HLSL (twelve DWORD stores, noInterlocked), 15 rejections, a mixed uint, float and vec4 module, 7 shape-caught mutations that still validate. Also run with the old-release wrapper (it only simulates the missing gather-compare form).address_float.py,address_signed.pyandcheck.pywith the same tools: pass. The lowered output of every other SPIR-V fixture in the repository, and every module the three tests above lower, is identical before and after the change; only the new fixture changes (before:unhandled physical pointer operation).readback.cppcompiled on its own with g++ agrees with the Python model word for word on all 23 cases.readback.cppalso passesx86_64-w64-mingw32-g++ -fsyntax-only.offscreen_check.cppcould not be syntax-checked on Linux (it needs generated headers); its edits mirror the existing qword entries.docs_links_check.py,bidi_controls_check.py,py_compile,git diff --check.Not run: DXC, WARP, any GPU.
Open doubts
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:57:15Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
7ea035ce295a359bbee412241df65e5629ced6e9:--preset dev):offscreen_checkbuild23.96s;ctest --preset dev -R '^spirv_address_window_vec4_warp$' --no-tests=error --output-on-failure: 1/1 passed (1.62s)/O2(--preset release):offscreen_checkbuild35.67s;ctest --preset release -R '^spirv_address_window_vec4_warp$' --no-tests=error --output-on-failure: 1/1 passed (1.53s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T09:57:28Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
7ea035cℹ️ 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.