compute: accept vcc_hi as the wave32 mask of SDWA compares #3159
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3159
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3157"
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?
@Leyukaka on GitHub · 2026-11-27 19:04 UTC · original
Leyukaka:sdwa-vcchi→main· +73 −4 · 5 files · 2 commits · merged 2026-11-27 21:13 UTCPart of #2935. Target branch
main.Change (
src/gfx1013_compute_native.cpp, one line indocs/experiments/native-sdwa-f16.md): in the direct wave32 compute path, an SDWA VOPC compare orv_cmp_class_f32may write its lane mask tovcc_hi(s107). Readingvcc_hias a scalar source was already accepted; the new test covers it.vcc_lo.vcc_hidestination in a wave64 container stage, where the mask is an SGPR pair. Slot 67 requests are all compiled as wave32 onmain, so for them this refusal applies once #3006 (#2999) lands;v_cmpxwith an SGPR destination;Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
main80668b97plus this commit.native_sdwa_vcc_hi_hardware(new) runs two 32-thread groups of a wave32 request (.sabit 20 set).v_cmp_class_f32_sdwawithsrc1_sel:BYTE_3writesvcc_hi.v_cmp_ne_i32_sdwa vcc_hi, vcc_hi, v6withsrc1_sel:BYTE_0reads it back as its scalar source.native_direct_containernow also checks that these are refused:vcc_hidestination in a wave64 container stage, for both forms;v_cmpxwithvcc_hi.native_sdwa_f16_irandnative_sdwa_f16_hardwarepass.vcc_hion wave64 failsnative_direct_container;native_sdwa_vcc_hi_hardware.Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requestsonmain80668b97.vcc_hias the destination: 29v_cmp_class_f32_sdwaand 13v_cmp_ne_i32_sdwa.AI-assisted.
github-bot referenced this pull request2026-11-27 21:04:57 +00:00
@tedin7 on GitHub · 2026-11-27 21:13 UTC · original · reviewed
Review of
d3bc25a724(updated with main). Comment only.The SDWA compare destination limit becomes 107 (
vcc_hi) only for direct wave32 compute (direct && !graphics && !wave64), and stays 106 for graphics and wave64, in both the compare-mask check and the class-modifier check.decodegets the wave size from its one direct caller, and the defaultwave64=falsekeeps the other callers as they were. The new refusal cases innative_direct_container_check.pycovervcc_hiunder wave64, sdst 108 andv_cmpxwithvcc_hi. They run without a GPU and pass here. The positive readback (native_sdwa_vcc_hi_hardware, wave32) skips on WARP and rests on the RTX 5080 run in the description, which also shows that the old limit fails it.src/gfx1013_compute_native.cppandtests/native_direct_container_check.pyare also touched bycpp-migration. The change merges cleanly there; the native sweep on that merge is in the comment below.Commands:
git diff origin/main...pull/3157/head(read),git merge-tree --write-tree origin/cpp-migration pull/3157/head, plus the Windows commands in the comment below.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-27 21:13 UTC · original
Windows Server 2025 verification of
d3bc25a724ff6a6b66be77d79c916453a67f2fbf(D3D12 WARP, MSVC 14.44.35207):cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump;ctest --preset dev -R <native sweep>: 100% tests passed out of 146 (84 passed, 62 skipped), includingnative_direct_containerandnative_sdwa_f16_ir--preset release;ctest --preset release -R <native sweep>: 100% tests passed out of 146 (84 passed, 62 skipped)cpp-migration(a0f67731): 100% tests passed out of 146 in both presets. A first attempt of that release leg stopped in the build when the remote ssh session was refused; the rerun passed.<native sweep>= everynative_*test exceptnative_startup_request_cache_hardware, which fails on WARP-only hosts with or without this PR.AI-assisted; commands listed were executed locally.
@KelboLive on GitHub · 2026-11-27 21:25 UTC · original
Review of src/gfx1013_direct_compute.inl and src/gfx1013_compute_native.cpp changes:
Image instruction mask change (i.b & 0x3e000000u → 0x3c000000u) ✓
This tightens the rejection mask by removing bit 25 from the forbidden set. The gather_lod path already has its own stricter check at line 747 (
i.b & 0xc0000000u), so this change only affects non-gather-lod image ops. Bit 25 of i.b in RDNA2 corresponds to the "unnormalized coordinates" flag for image instructions — allowing it is correct since unnormalized coords are valid for general image operations (just not for gather_lod which requires normalized).SDWA mask limit variable (wave64-aware) ✓
The change from hardcoded
106/107to a computedsdwa_mask_limit:This correctly reflects that register 107 is only a valid scalar mask destination when running in wave32 compute mode. The decoder now properly rejects invalid SDWA destinations based on the actual execution context.
Emit::image() mask change ✓
Same
0x3e→0x3cchange applied to the native pipeline's image validation, keeping both paths consistent.Summary: Looks correct. Both changes are narrow and well-scoped — one fixes an overly restrictive mask for unnormalized coordinate image ops, the other makes SDWA destination validation wave-mode-aware. No issues found.