rdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mip (OLD-10022) #1334
Closed
leonida/mandy
ambroseautomation wants to merge 0 commits from
carry/old-10022-image-load-tfe-zero into main
pull from: carry/old-10022-image-load-tfe-zero
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!1334
Loading…
Reference in a new issue
No description provided.
Delete branch "carry/old-10022-image-load-tfe-zero"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
Summary
Coordination item:
OLD-10022(carry-forward ofold-pr/10022, preserving original authorNikita Romanovich).Problem & Root Cause
On RDNA2,
image_loadandimage_load_mipwithtfeorlwewrite a trailing status VGPRvdata[data_vgprs](wheredata_vgprs = (popcount(dmask) + 1) // 2underd16, elsepopcount(dmask)) with0on resident accesses for active lanes while preserving inactive lanes. Previouslytools/rdna2spirv.pydid not zero that trailing status VGPR, leaving stale values in the status register.Implementation
tools/rdna2spirv.pyto write0to the trailingtfe/lwestatus VGPR onimage_loadandimage_load_mip(respectingd16packed register count and activeEXEClanes).Typed image loadsrow indocs/design.md.tests/semantic/test_image_load_tfe.pycoveringtfe,lwe, coherent/mip loads, andd16packed offset calculation.Tests Run
Environment: Windows 11 Pro 64-bit, Python 3.12.10, synthetic fixtures only (no game data).
python -I -m py_compile tools/rdna2spirv.py tests/semantic/test_image_load_tfe.py— PASSpython tests/semantic/test_image_load_tfe.py -v— 3/3 PASSpytest tests/test_docs_links.py -v— 16/16 PASSpython -I scripts/run_semantic_tests.py tests/semantic— 472 files, 6,180 tests, 0 files failed (519 s, 16 jobs)python -I scripts/check_no_game_data.py docs/design.md tests/semantic/test_image_load_tfe.py tools/rdna2spirv.py— PASSDisclosure
AI-assisted: yes (carry-forward, rebase onto current
main, and full semantic suite verification; original implementation by Nikita Romanovich).Independent GPU verification — request changes (AI-assisted, verified by a Devin subagent on real hardware; no game data used).
Tested head
c778ef95f. Runtime test binaries from aorigin/mainbuild (this PR touches onlytools/+ tests, so binaries are unaffected);llvm-mc= WSL LLVM 21.1.8;spirv-as/spirv-valfrom Vulkan SDK 1.4.363.0.Semantic suite (CPU):
python -I scripts/run_semantic_tests.py tests/semantic -p "test_image*.py"→ 13 files, 84 tests, 0 failedpython -I scripts/run_semantic_tests.py tests/semantic(full) → 472 files, 6,180 tests, 0 failed in 361 sGPU —
run_gpu_tests.py --filter img(11 image shaders), both run twice on AMD:VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1exit 1: r32 sint (sint view): 64 bad, texel(5,3) = 2111VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~Baseline
origin/main@51a6074d2, same commands/env:--filter img: 10/10 pass, both tfe tests give0 bad, texel(5,3) = 71--filter imgload: 4/4 passSo the two
cs_imgload*_tfefailures are a regression introduced by this PR on both GPUs, not the known pre-existing issue (#31 does not reproduce on current main with these drivers).Why it fails:
runtime/test/shaders/cs_imgload_tfe.asmdocuments measured RDNA2 behaviour — on a resident texel the TFE/LWE status VGPR is left unchanged, not zeroed. The fixture seedsv8 = 0x3e8/v12 = 0x7d0and verifies they survive the loads. Zeroing the status VGPR makes(v8 ^ 0x3e8) | (v12 ^ 0x7d0)non-zero and shifts every result word (observed2111instead of the71-based values). Unless the fixture's documented hardware behaviour is itself wrong, the premise "resident accesses report 0" needs re-checking against the ISA/GPU before this lands.### Hardware GPU test result: regresses
cs_imgload_tfeandcs_imgload_d16_tfeon currentmainTested this PR (
c778ef95fa48edb489f4e2410b43e7816191f7b1) merged cleanly ontomain(e8fee01cd32d16b689a23aac9b320d6870d3ca4d) on an NVIDIA GeForce RTX 4060 Ti (PCI 10de:2803, subgroup32..32, driver621.14, Vulkan1.4.357, Windows 11 x64,llvm-mc23.1.6 +SPIRV-Tools2026.4,runtime-windowsbuilt frome8fee01cd32d16b689a23aac9b320d6870d3ca4d; no game files).main(e8fee01cd)main+#1334(c778ef95)rdna2spirv.py+spirv-valrun_gpu_tests.py(native)run_gpu_tests.py(LEONIDA_W64_EMULATE=1)Failing tests (both native and
LEONIDA_W64_EMULATE=1)Why
old-pr/10022predates8afbba14b(SHADER-1266,runtime/test/shaders/cs_imgload_tfe.asmandcs_imgload_d16_tfe.asmonmain), which measured on RDNA2 hardware (gfx1036) that a residentimage_loadwithtfeleaves the trailing status VGPR unchanged rather than zeroing it. Both fixtures seedv8 = 0x3e8andv12 = 0x7d0and add(v8 ^ 0x3e8) | (v12 ^ 0x7d0)intov11; zeroingv8andv12adds0x3e8 | 0x7d0 = 0x7f8 = 2040to every texel (71 + 2040 = 2111).(Minor note as well:
python -I tests/semantic/test_image_load_tfe.pyraisesModuleNotFoundError: No module named 'support'because-Iomits the script directory fromsys.path.)(AI-assisted hardware test & review.)
Additional Linux/NVIDIA check: the fixture version explains why this change can look like a fix on the older #939 integration.
AI-assisted. RTX 5090, NVIDIA 620.73.04, Linux 7.3.6-1-cachyos, LLVM 23.1.5, wave64 emulation enabled. Synthetic inputs only.
I tested #939 at
eb6a08cd359d98b5777e70d54d0ae8a75879495a, then appliedc778ef95fseparately, adapting its status argument propagation to #939's descriptor/volume/storage helper signatures. Runtime code and native GPU test executables were unchanged.8afbba14bThe corrected pair was assembled from that commit and supplied with
--disasm-dir ... --filter imgload --require-pass, using separate output directories. The full older-fixture GPU suite changed from 232 pass / 2 fail / 20 skip to 234 pass / 0 fail / 20 skip; those totals alone would therefore give the wrong recommendation. The adapted branch also passes 6,126 semantic tests, which does not resolve the incorrect expectation.This agrees with the existing reviews: keep resident status values as required by the newer fixtures. The native RDNA2 behavior basis is the upstream hardware measurement; this additional check used translated shaders on NVIDIA. I am keeping #1334 out of the title integration and retaining the failed experiment separately. No game files or game-derived data used or attached.
Closing: thank you @whoalin1, @JesusACD, and @ThomasHFWright for the hardware GPU verification. As confirmed, old-pr/10022 predates 8afbba14b (SHADER-1266), where RDNA2 hardware measurement showed resident image_load with tfe leaves the status VGPR unchanged rather than zeroing it. Zeroing it regresses cs_imgload_tfe and cs_imgload_d16_tfe on current main, so this carry-forward is obsoleted.