rdna2spirv: form MUBUF byte offsets in 64 bits (SHADER-MUBUF-OFFSET-WRAP) #1068
Closed
github-bot
wants to merge 1 commit from
gh-pr/1068/head into gh-pr/1068/base
pull from: gh-pr/1068/head
merge into: github:gh-pr/1068/base
github:main
github:docs/animation-merge-remnants
github:docs/story-dedup-and-cli
github:docs/restofworld-merge-remnants
github:docs/gamedata-dedup-tables
github:docs/textures-bcpack-tables-and-cli
github:docs/exe-fail-fast-shims-sync
github:fix/address-guard-wraparound-parity
github:fix/cvt-f16-denorm-and-clamp
github:docs/pso-cache-scope-note
github:docs/viewer-readme
github:docs/textures-arrays-dds-preview
github:docs/conformance-readme-status
github:fix/docs-validators-fences-urls
github:claude/loop-total
github:claude/pops-collision-seed
github:claude/dstorage-hold-page-reads
github:claude/host-image-copy-switch
github:feat/gdk-lifecycle-window-hook
github:claude/d16s8-uav-nvidia-fallback
github:feat/mfplat-offline-shim
github:claude/gameinput-slow-reader
github:fix/rt-null-barrier-clear
github:claude/depth-resolve-sample-positions
github:integration/palmetto-parity
github:claude/valu-literal-sext
github:claude/slot74-pool-handle
github:claude/rgb9e5-uint-alias-view
github:claude/fssm-root-layout-tables
github:feat/gdk-speech-display-lifecycle
github:asset-audio-skip-current
github:qemmhd/old-9940-rectangle-quad-lists
github:feat/ws2-offline-shim
github:qemmhd/rt-d16-unorm-uav
github:feat/xs-device-stops-7-9
github:qemmhd/rt-depth-same-base-shapes
github:qemmhd/rt-lazy-attachment-variant
github:feat/acphal-xma2-decoder
github:asset-audio-skip
github:codex/coord-claim-check-20261124-7e48
github:feat/xs-frame-pacing-presentx
github:feat/xs-device-vm-options
github:old-pr/9844
github:old-pr/9978
github:old-pr/9815
github:old-pr/10057
github:old-pr/9874
github:old-pr/9965
github:old-pr/9863
github:old-pr/10068
github:old-pr/10066
github:old-pr/10067
github:old-pr/10007
github:old-pr/10061
github:old-pr/10065
github:old-pr/10059
github:old-pr/10063
github:old-pr/10055
github:old-pr/10062
github:old-pr/10042
github:old-pr/10041
github:old-pr/10049
github:old-pr/10047
github:old-pr/10046
github:old-pr/10045
github:old-pr/10056
github:old-pr/10043
github:old-pr/10036
github:old-pr/10034
github:old-pr/9984
github:old-pr/10052
github:old-pr/10038
github:old-pr/10033
github:old-pr/10028
github:old-pr/10050
github:old-pr/9891
github:old-pr/9889
github:old-pr/10051
github:old-pr/10019
github:old-pr/10027
github:old-pr/10029
github:old-pr/10031
github:old-pr/10026
github:old-pr/9941
github:old-pr/10030
github:old-pr/10040
github:old-pr/9990
github:old-pr/10021
github:old-pr/9962
github:old-pr/10022
github:old-pr/10020
github:old-pr/10015
github:old-pr/10025
github:old-pr/9886
github:old-pr/10048
github:old-pr/10014
github:old-pr/10011
github:old-pr/9861
github:old-pr/10010
github:old-pr/10008
github:old-pr/9860
github:old-pr/10006
github:old-pr/9920
github:old-pr/9995
github:old-pr/10000
github:old-pr/10016
github:old-pr/10004
github:old-pr/10023
github:old-pr/9982
github:old-pr/9981
github:old-pr/9983
github:old-pr/9970
github:old-pr/9969
github:old-pr/9968
github:old-pr/9971
github:old-pr/9972
github:old-pr/9942
github:old-pr/9963
github:old-pr/9960
github:old-pr/9964
github:old-pr/9985
github:old-pr/9973
github:old-pr/9862
github:old-pr/9953
github:old-pr/10017
github:old-pr/9952
github:old-pr/9955
github:old-pr/9946
github:old-pr/9954
github:old-pr/9938
github:old-pr/9956
github:old-pr/9856
github:old-pr/9947
github:old-pr/9924
github:old-pr/9961
github:old-pr/9927
github:old-pr/9979
github:old-pr/10032
github:old-pr/9926
github:old-pr/5237
github:old-pr/9951
github:old-pr/9931
github:old-pr/9902
github:old-pr/9921
github:old-pr/9994
github:old-pr/9775
github:old-pr/9768
github:old-pr/9905
github:old-pr/9936
github:old-pr/9901
github:old-pr/9904
github:old-pr/9906
github:old-pr/9988
github:old-pr/9908
github:old-pr/9909
github:old-pr/9911
github:old-pr/9912
github:old-pr/9913
github:old-pr/9887
github:old-pr/9916
github:old-pr/9919
github:old-pr/9925
github:old-pr/9933
github:old-pr/9935
github:old-pr/9918
github:old-pr/9879
github:old-pr/9880
github:old-pr/9881
github:old-pr/9996
github:old-pr/9876
github:old-pr/9892
github:old-pr/9899
github:old-pr/9915
github:old-pr/9914
github:old-pr/9872
github:old-pr/9869
github:old-pr/9866
github:old-pr/9819
github:old-pr/10012
github:old-pr/9857
github:old-pr/9893
github:old-pr/9897
github:old-pr/9928
github:old-pr/9868
github:old-pr/9917
github:old-pr/9940
github:old-pr/9873
github:old-pr/9816
github:old-pr/10009
github:old-pr/9900
github:old-pr/9966
github:old-pr/9859
github:old-pr/9843
github:old-pr/9991
github:old-pr/10058
github:old-pr/9883
github:old-pr/9838
github:old-pr/9835
github:old-pr/9959
github:old-pr/9895
github:old-pr/9837
github:old-pr/9858
github:old-pr/9865
github:old-pr/9864
github:old-pr/9840
github:old-pr/9820
github:old-pr/4669
github:old-pr/9848
github:old-pr/9850
github:old-pr/9810
github:old-pr/9799
github:old-pr/9853
github:old-pr/9875
github:old-pr/9831
github:old-pr/9796
github:old-pr/9801
github:old-pr/9813
github:old-pr/9794
github:old-pr/7417
github:old-pr/9781
github:old-pr/9806
github:old-pr/9958
github:old-pr/9809
github:old-pr/9791
github:old-pr/9792
github:old-pr/10053
github:old-pr/9784
github:old-pr/9789
github:old-pr/9849
github:old-pr/9846
github:old-pr/9773
github:old-pr/9785
github:old-pr/9803
github:old-pr/9826
github:old-pr/9839
github:old-pr/9922
github:old-pr/9948
github:old-pr/7189
github:old-pr/9957
github:old-pr/9823
github:old-pr/9807
github:old-pr/9851
github:old-pr/9774
github:old-pr/9830
github:old-pr/9836
github:old-pr/9822
github:old-pr/9783
github:old-pr/9833
github:old-pr/9890
github:old-pr/9770
github:old-pr/9769
github:old-pr/9772
github:old-pr/9787
github:old-pr/9852
github:old-pr/9834
github:old-pr/9845
github:old-pr/9871
github:old-pr/9771
github:old-pr/9776
github:old-pr/10005
github:old-pr/9949
github:old-pr/9923
github:old-pr/9805
github:old-pr/9829
github:old-pr/9790
github:old-pr/9827
github:old-pr/9929
github:old-pr/9855
github:old-pr/9934
github:old-pr/9907
github:old-pr/9910
github:old-pr/9779
github:old-pr/9780
github:old-pr/9885
github:old-pr/9882
github:old-pr/9877
github:old-pr/9998
github:old-pr/4251
github:old-pr/9987
github:old-pr/9989
github:old-pr/9950
github:old-pr/9777
github:old-pr/10044
github:old-pr/9884
github:old-pr/2906
github:old-pr/5076
github:old-pr/9937
github:old-pr/9986
github:old-pr/3014
github:old-pr/9943
github:old-pr/9939
github:old-pr/4682
github:old-pr/4765
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
question
Further information is requested
wontfix
This will not be worked on
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1068
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1068/head"
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?
@Moriz82 on GitHub · 2026-11-24 17:40 UTC · original
split/shader-mubuf-offset-wrap→main· +212 −26 · 4 files · 1 commits · closed without mergingClaimed in the coordination issue as: SHADER-MUBUF-OFFSET-WRAP (claim).
Part of the split of #984 (first child). Depends on: none. Overlaps: none found (searched open and merged pull requests for
buffer_address, stride, index and offset wrap; #513 changes the CBV's V# stride in the runtime, not the translator's address arithmetic; #1021 editsdocs/design.mdnear the swizzled-buffer row).What and why
Gen.buffer_addressintools/rdna2spirv.pyforms the byte offset of every MUBUF/MTBUF access,off + soffset + index * stride(and the swizzled form), in 32 bits and adds it to the 48-bit V# base. The hardware does not wrap there: the RDNA2 ISA (8.1.5) gives the address as base + stride * index + offset with a 48-bit base, and onlyoff(vaddr + inst_offset) wraps at 32 bits. So an index of0xFFFFFFFFwith a 20-byte stride addresses base + 0x13_FFFF_FFEC on the console, while the translated shader turns it into base − 20:OOB_SELECT 3(raw) checksoffset + soffsetagainstNUM_RECORDSand does not look at the index;OOB_SELECT 2(disabled) checks only that the buffer is not empty.Both let the wrapped access through, so a store writes 20 bytes below the buffer and a load reads them. When the view is one slice of a larger pool that is mapped as a whole, that is a silent write into a neighbour's records.
The change forms the linear and the swizzled offset as a 64-bit value and adds that to the base. Nothing else changes: each mode checks exactly what it checked before, and a literal V# and a run-time V# take the same path.
What changed since the first version
The first version also treated every offset above
0xFFFFFFFFas out of range. The reviews showed two faults in that, and both are fixed by removing the bound instead of patching it:What this does not do
docs/d3d12_vulkan.md), so there an offset of 4 GiB or more always leaves the arena. Whether the runtime should refuse an address outside the arena is a separate decision, with the arena size as the bound and not 2^32. It is not part of this pull request.b9b57e2), credited in the source. It was not measured by us on AMD hardware; the contract row anddocs/buffer_bounds.mdsay so. Someone with thetools/hw_oraclesetup could pin it with one probe (raw view, stride 20, index −1).Cost: two or three 64-bit conversions and adds and one 64-bit multiply per access, now for every access including folded structured views (the first version left those alone). On a sample of 200 compute programs of a retail library (translated locally with
--wave64-emulate, not included) 114 modules change and the 200 grow by 0.45 % together; all 200 passspirv-valbefore and after.Tested
Linux (CachyOS, kernel 7.3.5), Python 3.14, LLVM
llvm-mc23.1.5 and SPIRV-Tools v2026.4 from the distribution. GPU suite on an NVIDIA GeForce RTX 4070, driver 620.73.04.python3 -I tests/semantic/test_buffer_offset_wrap.py: 8 tests pass. With the translator of the base commit the same file has 13 failing subtests: index −1 in raw and disabled mode with a literal and a run-time V# (4), the mapped 5 GiB offset in disabled mode (2), a structured index belowNUM_RECORDSwhose product passes 4 GiB in modes 0 and 1 (4), a swizzled offset past 4 GiB with a literal and a run-time V# (2), andoff 0xFFFFFFF0 + soffset 0x20(1). The swizzled control below 4 GiB passes on both. The swizzled cases were added after a review noted that the swizzled path had moved to 64 bits without a case above 4 GiB.python3 -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6,176 tests, 0 files failed.tests/the wayci.ymlruns them: 520 files, 519 pass.tests/test_imhex_patterns.pyfails (6 of its 9 tests) and fails the same way on the base commit, so it is not from this change.python3 -I scripts/check_no_game_data.py: passes.python3 -I scripts/run_gpu_tests.py(run on the head before the swizzled tests were added; the translator has not changed since): 261 shaders translate and passspirv-val; 202 of 252 tests pass, 49 are skipped and 1 fails (cs_imgstore_cube). The run with the base commit's translator gives the same 202, 49 and 1, test for test. The harness programs came from an older native build on this machine (2026-11-23) and were not rebuilt for this, which is the likely reason for that one failure; it is not a result of this change.Not run by us: native Windows, macOS, an AMD GPU, the
tools/hw_oracleprobe. A reviewer ran the GPU suite on an AMD RX 9070 XT (236 of 252 pass, 16 skipped, 0 failed) one01626be9, which has the same translator as this head.GPUs tested: NVIDIA GeForce RTX 4070 (translation only; see above for what is not measured on hardware).
AI-assisted: yes (Claude Code). The numbers above come from runs on the machine named.
Checklist
32950551eand merges cleanly into currentmain.docs/design.md("Buffer bounds checking"), with how it was confirmed and what is not measured.🤖 Generated with Claude Code
@KernelSmoker on GitHub · 2026-11-24 18:10 UTC · original · requested changes
The new
fits <= 0xFFFFFFFFpredicate is applied in every OOB mode, which appears to reject valid mapped addresses above 4 GiB. The AMD RDNA2 ISA describes a 48-bit resource base and linear addressing asstride * index + offset; forOOB_SELECT=2it specifies onlyNumRecords == 0as the bounds check (“do not check bounds”). It does not define a 32-bit ceiling for the computed byte offset: https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf (section 8.1.5, pp. 59–62).I reproduced the regression with this PR’s translator and interpreter: mode 2,
NumRecords=1, stride 20, index0x10000000gives byte offset0x1_40000000(5 GiB), but the store is suppressed. If that address is backed by the allocation, mode 2’s documented check should not reject it. The external observation cited here establishes that one much larger offset does not wrap back into the pool; it does not establish that every offset above0xFFFFFFFFis out of range.Please add a >32-bit but mapped-address case and limit the guard to the actual hardware address/range condition established by evidence. The new tests in this PR pass (4/4); existing
test_buffer_oob_select.py(36/36) andtest_vector_mem_mubuf.py(53/53) also pass locally, so this is a missing semantic boundary case rather than a test failure.@kawaii-shakal on GitHub · 2026-11-24 18:21 UTC · original
Review of #1068 (SHADER-MUBUF-OFFSET-WRAP)
Head: ff94bdd72ec46c6009129c5c832c8767e180aeae (one commit on
32950551e). Claim: #14 comment 7139398473 by the author, 17:34 UTC, six minutes before the PR was opened; it matches the scope.Environment: Windows 11, native Python 3 (
-I), LLVM llvm-mc (Windows build), no GPU used (the change has no GPU test, and no AMD GPU is available here).Commands and results
python -I tests/semantic/test_buffer_offset_wrap.py: 4 tests, OK.tests/semantic/test_*matching buffer / tbuffer / mubuf / bounds / oob / swizzle, 26 files) run one by one;test_buffer_formats_all.pyandtest_buffer_swizzle.pythroughscripts/run_semantic_tests.py tests/semantic -p <file> -j 1because they importsupport: all pass (about 300 tests). The full suite was not run.git restore --source=HEAD~1 --worktree -- tools/rdna2spirv.py(the pre-PR translator), new test: FAILED (failures=5), the same five subtests the description names (index -1 in raw, raw literal, disabled, disabled literal;off 0xFFFFFFF0 + soffset 0x20). Restored withgit checkout -- tools/rdna2spirv.py, tree clean.git merge-tree --write-tree origin/main rv/1068(origin/main3aa975421): clean. No commit on main since the base touchestools/rdna2spirv.pyordocs/buffer_bounds.md.tools/rdna2spirv.py(16 of them): none editsGen.buffer_addressordocs/buffer_bounds.md. #1021 editsdocs/design.mdnear the swizzled-buffer row; a pairwisemerge-treeof #1021 and #1068 is clean.idxenaccess (about 448kidxenlines). About 955 also have a non-zerosoffset(a rough text match). 22 files with[in their names were skipped by the search, so these counts are slightly low. Mostidxenaccesses through a run-time V# get the new check, so most translated compute and graphics modules change (the 2 % size estimate in the description is plausible). I did not translate the corpus to compare SPIR-V.Findings
The skip for literal modes 0 and 1 is not exact (tools/rdna2spirv.py:4148, docs/design.md:501, comment at tools/rdna2spirv.py:4133-4134). The skip assumes that
idx < NUM_RECORDSboundsidx * strideto 32 bits. That holds only whenNUM_RECORDS * stride <= 2^32, and NUM_RECORDS is a run-time word even when word3 is literal. A probe (not part of the PR; F:\recomp\tmp\rv1068-probe.py, using the PR's own helpers): mode 1, stride 20, NUM_RECORDS 0xFFFFFFFF, index 0x0CCCCCCD, soidx * stride= 0x1_0000_0004:s_mov_b32literals: 77 is stored at base + 4 and read back.So the same descriptor gives different results depending on whether the translator folded word3. That needs a very large NUM_RECORDS (0xFFFFFFFF "unbounded" descriptors do occur), so it is a corner case, but the docs state the opposite. Either emit
fitsfor literal modes 0/1 too, skip it only when a literal word2 and stride proveNUM_RECORDS * stride <= 2^32, or say in the row and the comment that the folded path does not check it. A literal structured case belongs in the test as well:test_structured_modes_already_refuse_the_index(tests/semantic/test_buffer_offset_wrap.py:96) covers only the run-time V#, which always takes the new check.How the rule was confirmed (docs/design.md:501, docs/buffer_bounds.md:22-26). AGENTS.md:33-35 asks for a GPU test, a Mesa/LLVM reference, or a count over the corpus. The row cites another project's commit and says it was "not measured by us". It is honest, but it is none of the three. Part of the rule is already backed here: the RX 6800 and gfx1036 measurements in the same row show that
soffsetis added before the mode 3 check without truncation. The new parts are not backed: the full 64-bitindex * strideproduct, the "no effect" outcome in mode 2, and the swizzled offset in 64 bits. Also, "lands tens of GiB past the base and has no effect" is an inference. On hardware an address 80 GiB past the base is either a page fault or another mapping, not a guaranteed no-op. Dropping the access is a reasonable choice for a translator, but the docs and test name present it as hardware behaviour. Suggest saying "treated as out of range (the hardware address is far outside the buffer; what the console does there is not measured)", and asking someone withtools/hw_oraclefor the one probe the description proposes before merging, or recording it as a follow-up.AGENTS.md:21 asks for a hand-written
.asmfixture intests/semantic/. The test writes its assembly inline in Python (tests/semantic/test_buffer_offset_wrap.py:36-65). This is common in the suite (29.asmfixtures against 471 test files), so it is a nit.Minor cost: with a literal mode 3, linear addressing, no index and non-zero soffset,
fitsis emitted although the raw check (off + soffset + end <= NUM_RECORDS, 64-bit, at most 0xFFFFFFFF) already implies it (tools/rdna2spirv.py:4148). It is redundant, not wrong.What I checked and found correct: the 64-bit linear form
off + soffset + idx * stride(tools/rdna2spirv.py:4149-4163), whereoff(vaddr + inst_offset) still wraps at 32 bits, as the existing measured docstring says; the 64-bit swizzled form (4151-4157), which matches the 32-bit formula term by term and with L = 0 reduces toidx * stride + off;fitsis ANDed into every per-dword, typed and atomic check throughcheck_end(4256-4264), and it is computed before any branch, so it dominates its uses; and by reading the code, the folded literal-structured path without soffset emits the same SPIR-V as before (nothing new is emitted, and themodeline only moved).Verdict: the main change is correct for the case it targets (raw and disabled, run-time and literal), the test is real (5 failures without the change), and the PR merges cleanly with no overlapping open PR. Request changes on two points before merging: fix or document finding 1, and reword the "hardware observation / no effect" claim in finding 2, or measure it. Findings 3 and 4 are optional.
AI-assisted.
@KernelSmoker on GitHub · 2026-11-24 18:27 UTC · original · requested changes
Follow-up on the updated head
0c3c8d166dcd1319f90598054f5cb26916eb1baf: I reran the added test file (4/4 pass) and independently reproduced the literal structured-mode boundary issue.With a literal
OOB_SELECT=1V#,NUM_RECORDS=0xFFFFFFFF, stride 20, and index0x0CCCCCCD, the index is in range butindex * stride = 0x1_0000_0004. The translator's literal-mode shortcut omitsfits; the local interpreter writes and reads 77 at wrappedbase+4(0x4004) instead of addressingbase+0x1_0000_0004(0x100004004). The same runtime V# takes thefitspath, so descriptor-folding changes the result. This is a valid structured index by the documented mode-1 check, not an out-of-range index.Please fix the literal mode-0/1 shortcut and add matched literal/runtime tests for a >32-bit product with
index < NUM_RECORDS. My earlier concern also remains: the guard suppresses all runtime mode-2 offsets above 4 GiB even though that mode performs no bounds check. Tests passing on the current head do not cover either mapped-address case; no AMD hardware result is claimed here.@whoalin1 on GitHub · 2026-11-24 18:57 UTC · original
AI-assisted independent GPU verification (overnight shift, worker w4).
Environment: Windows, Git Bash; runtime built RelWithDebInfo (Ninja, VS2022 BuildTools, SDK 10.0.26100, Vulkan SDK 1.4.363.0).
llvm-mcvia WSL Ubuntu llvm-21; spirv-val on PATH.AMD Radeon iGPU (RDNA2 gfx1035, driver 24.10.24, Vulkan 1.3.280, 128B push constants):
VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1 py -3.14 -I scripts/run_gpu_tests.py --work <dir>ms_clip,ms_wave_info_s3: known AMD Windows LLPC 0xC0000005 mesh-shader crashes (SHADER-167; fixes in open PRs #802/#808, not in this base).ms_v5_workgroup: first run lacked spirv-val on PATH; re-run withVulkanSDK/1.4.363.0/Binon PATH → PASS (24/24 workgroup coordinates exact).NVIDIA RTX 4070 SUPER (driver 610.88):
VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~ py -3.14 -I scripts/run_gpu_tests.py --work <dir>Translator tests:
py -3.14 -I -m unittest discover -s tests/semantic -p test_buffer_offset_wrap.py→ 4/4 OK.py -3.14 -I scripts/run_semantic_tests.py tests/semantic→ 471 files, 6172 tests, 0 failed.Verdict: verified. The 32-bit buffer-offset wrap change breaks nothing on either GPU; the only AMD failures are the known mesh-shader driver crashes unrelated to this PR.
@Moriz82 on GitHub · 2026-11-24 19:26 UTC · original
Thank you both for the reviews. You were right on the main point, so the branch is reworked instead of patched: the
fits <= 0xFFFFFFFFbound is gone. The byte offset is now a 64-bit value added to the 48-bit base, in every mode and for a literal and a run-time V# alike, and each mode checks exactly what it checked before. The title and the description are rewritten to match.@KernelSmoker
NumRecords1, stride 20, index0x10000000) is a test with a literal and a run-time V#: the store lands 5 GiB past the base and the load reads it back.NUM_RECORDS0xFFFFFFFF, stride 20, index0x0CCCCCCD) is a test for modes 0 and 1, literal and run-time: all four store and read at base +0x1_0000_0004.@kawaii-shakal
tools/hw_oracleprobe is still wanted and is not done.One consequence is the opposite of the first version, so I want it to be explicit. Index −1 in mode 2 or 3 is now neither base − 20 nor dropped: it is an access tens of GiB past the base. The runtime's arena is at most 4095 MiB, so that address is always outside it, and on Vulkan that is undefined. If the project wants such an access refused, I think the bound should be the arena size and it should live where the arena is known, as a follow-up. If you would rather have it in this pull request, say so.
Run on the new head (CachyOS, Python 3.14, llvm-mc 23.1.5, SPIRV-Tools v2026.4):
tests/semantic/test_buffer_offset_wrap.pypasses 6 tests, and 11 subtests fail with the base commit's translator and with the previous head's. Full semantic suite: 471 files, 6,174 tests, 0 files failed.scripts/run_gpu_tests.pyon an RTX 4070 (620.73.04): 202 of 252 pass, 49 skipped, 1 fails (cs_imgstore_cube), test for test the same as with the base commit's translator; the harness programs were an older local build, not rebuilt. Not run here: native Windows and AMD. Your runs on the previous head do not carry over, since every indexed access now changes its SPIR-V.🤖 Generated with Claude Code
@iFeyz on GitHub · 2026-11-24 19:51 UTC · original
AMD run (the gap the description lists): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 11, MSVC 2022 RelWithDebInfo.
Head
e01626be9:scripts/run_gpu_tests.pywith this translator: 261 of 261 shaders translated andspirv-val-clean, 236 of 252 pass, 16 skipped, 0 failed (native, subgroup 64).tests/semantic/test_buffer_offset_wrap.py(6): OK.@thesubtleties on GitHub · 2026-11-24 20:07 UTC · original
CPU check of
e01626be9merged onto main3aa97542(CachyOS, Python 3.14).test_buffer_offset_wrap.py: 6 pass; 11 failures with main'srdna2spirv.py.run_semantic_tests.py tests/semantic: 471 files / 6,174 tests, 0 failed.mem_diff.py(2,000 programs, seed 661001) is clean on both, so it doesn't reach this case.One gap: the new tests only use the linear path. The swizzled path also moved to 64 bits and has no case above 4 GiB.
Not tested here: GPU, game corpus, what hardware does at such an address. AI-assisted (Claude Code)
@Moriz82 on GitHub · 2026-11-24 21:08 UTC · original
@thesubtleties thank you, that gap was real: the swizzled path moved to 64 bits and had no case above 4 GiB. Added to
tests/semantic/test_buffer_offset_wrap.py, with a literal and a run-time V# each:IS8, stride 20, index0x0CCCCCD5(group0x0199999A, element 5): the store and the load are at base +0x1_0000_0054; modulo 2^32 that would be base +0x54;The file now has 8 tests. With the base commit's translator 13 subtests fail (the two swizzled cases above 4 GiB are new among them; the control passes on both). Full semantic suite on the new head: 471 files, 6,176 tests, 0 files failed. The translator itself is unchanged since
e01626be9; only the test and the count in thedocs/design.mdrow changed.@iFeyz thank you for the RX 9070 XT run; the description now cites it.
🤖 Generated with Claude Code
@Moriz82 on GitHub · 2026-11-25 03:41 UTC · original
@KernelSmoker I rebased this onto main at
bfef489cand reran the full semantic suite ona656d4f0. All 6,287 tests passed across 488 files. The eight focused cases cover mapped offsets above 4 GiB in mode 2, structured modes 0 and 1, and swizzled addressing, with both literal and runtime descriptors. Could you re-review the current head? The console behavior for an unmapped address remains unmeasured.AI-assisted.
@tiguan26 on GitHub · 2026-11-25 19:01 UTC · original · approved these changes
Approving. Merged into current main (
9f9a7c5) with no conflicts.test_buffer_offset_wrap.pypasses, and the full translator suite gives 491 files / 6,300 tests with onlytest_int32_to_f64failing, the same baseline failure as main here (Linux, Python 3.13).I checked that no 32-bit offset survives in the address path. Both the linear and the swizzled forms now build
wideas a%ulong. That covers index·stride as a full 64-bit product, soffset added in 64 bits, and the swizzledmsb·stride + om4shifted in 64 bits. The finalbase + widetakes it directly. Onlyvaddr + inst_offsetstill wraps at 32 bits, as the comment says, and the bound checks are untouched.AI-assisted (Claude).
Pull request closed