diff options
| author | timbot103 <306940367+timbot103@users.noreply.github.com> | 2026-11-27 17:53:39 +1000 |
|---|---|---|
| committer | timbot103 <306940367+timbot103@users.noreply.github.com> | 2026-11-30 09:09:38 +1000 |
| commit | f0703cdef4b5d2551ff6c974dd7a32350486ba57 (patch) | |
| tree | 8fd824e9a80c6cff3cd4d7281e781e2cdafbd1c9 /docs/lua-modding.md | |
| parent | 452d1d1b68aa2da94d5f0eff43ad0a6a83bbbadf (diff) | |
rdna2spirv: check high 32 bits for buffer offset fit to avoid NVVM crash
In Gen.buffer_address (tools/rdna2spirv.py), emit
`OpShiftRightLogical %ulong wide %c64_32` followed by
`OpIEqual %bool hi_w %cl0` instead of
`OpULessThanEqual %bool wide %clffffffff`.
NVIDIA 580.82.07 NVVM aborts pipeline creation (`NVVM compilation failed: 3`,
VkResult -13) on the unsigned 64-bit compare when a literal V# folds `wide`
to `0 + idx * stride` (reported and A/B-tested on L4 by @kevincommits in
ubiquitarianism/leonida#1608#issuecomment-7208330785). Over uint64,
`(wide >> 32) == 0` is mathematically identical to `wide <= 0xFFFFFFFF`.
Since lower_addr64 (SHADER-423), the 64-bit compare still reaches the driver
with --int64-addresses, and by default in any module the lowering leaves in
its Int64 form (a 64-bit scalar op such as s_lshl_b64 elsewhere in the
shader). Where the lowering does apply, the new form lowers to a high-word
`== 0` test, without the pair compare's redundant low-word
`<= 0xFFFFFFFF` term.
tests/semantic/test_buffer_offset_wrap.py runs every access (including the
exact 32-bit boundary cases: `0xFFFFFFFC` dword, `0xFFFFFFFF` byte vs
`0x1_0000_0000`) three ways: lowered (default), --int64-addresses, and
default with Int64 kept. It checks that no compare with the 32-bit limit is
emitted in any of them (raw and after spirv_opt.optimize), that the Int64
forms test `(wide >> 32) == 0`, and that the modules pass spirv-val when it
is on PATH.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/lua-modding.md')
0 files changed, 0 insertions, 0 deletions