DXIL: lower v_bfe_u32 and v_bfe_i32 to Ubfe and Ibfe #2171
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2171
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2171"
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?
@O5-7 on GitHub · 2026-11-25 07:03 UTC · original
O5-7:dxil/bfe-intrinsic→main· +81 −21 · 3 files · 1 commits · openLower RDNA2
v_bfe_u32andv_bfe_i32in the direct DXIL translator directly todx.op.tertiary(Tertiary::Ubfe, op 52, andTertiary::Ibfe, op 51) instead of emitting an 10–11 op shift/mask/select expansion.s_bfe_u32ands_bfe_i32(Lw::sbfe_u/Lw::sbfe_i) are left unchanged because scalar BFE maskswidthto 7 bits (0x7F) wherewidth >= 32extracts all remaining bits, whereas DXILUbfe/Ibfemaskswidthandoffsetto 5 bits (0..=31).Part of #1269
What is in it
crates/xcl/src/gpu/dxil/lower.rs: replaceLw::bfe_uandLw::bfe_ibodies withself.s.tertiary(Tertiary::Ubfe, w, o, v)andself.s.tertiary(Tertiary::Ibfe, w, o, v)(+2/-21 lines).crates/xcl/src/gpu/dxil/core_tests.rs: addbfe_lowers_to_dxil_intrinsicschecking DXIL validation and disassembly fordx.op.tertiary.i32opcodes 52 (Ubfe) and 51 (Ibfe).crates/xcl/src/gpu/recomp/tests.rs: addgpu_v_bfe_edge_casestesting 24 edge cases (w = 0,w = 1,w = 31, unmaskedw = 32/w = 0x104/o = 32/o = 0x104,o + w == 32,o + w > 32, sign-extension boundaries) against an exact CPU reference.(V_BFE_U32, V_BFE_I32)pairs, wave32):n = 1changes2332→2352bytes (firstdx.op.tertiary.i32declaration);n = 64drops5940→5548bytes (-392bytes).Tested
32.0.15.9579, wave32), AMD Ryzen 7 9700X, Windows 11 Pro10.0.26100,rustc 1.100.0, DXC1.8.2502.11(XCL_DXC_DIR=D:\Windows Kits\10\bin\10.0.26100.0\x64), debug & release builds.cargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored (24 SKIPPEDhardware-capability / policy checks: native wave64 unavailable on RTX 5080 and rejected direct-pathf16arithmetic), includingbfe_lowers_to_dxil_intrinsicsandgpu_v_bfe_edge_cases.XCL_DIRECT_DXIL=1targeted GPU parity runs on RTX 5080 (gpu_v_bfe_edge_cases,gpu_signed_bfe_arithmetic_shift,gpu_valu_float_and_int): all 3 passed; confirms NVIDIA's D3D12 compiler masks DXILUbfe/Ibfewidth and offset to 5 bits cleanly even for unmasked32and0x104.Regression run
main:
PR:
Not tested
XCL_DIRECT_DXIL=1in thesmoke.ps1launch (because on unmergedmainwithout PR #2101,D:\Windows Kits\...inXCL_DXC_DIRis intercepted by the{game}D-drive VFS mount inside the host process;XCL_DIRECT_DXIL=1was verified in unit/GPU tests).AI use
Lw::bfe_uandLw::bfe_itoTertiary::Ubfe/Tertiary::Ibfe, wrote the disassembly and GPU edge-case tests, and ran the test suite andscripts/smoke.ps1regression checks.@luckyteagirl on GitHub · 2026-11-25 07:11 UTC · original
Independent native Windows AMD check of exact PR head
cd6764952e46276a8ff65d2a95c91ec81a0c76a2. The PR description lists native wave64 as untested.Tested
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5; debug tests.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64,XCL_DIRECT_DXIL=1;cargo test --locked -p xcl --lib -j 2 gpu_v_bfe_edge_cases -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, 0 SKIPPED. The fixture runs both wave64 and wave32 and compares 24 signed/unsigned BFE edge cases against its CPU reference per lane.XCL_DIRECT_DXIL=0: 1 passed, 0 failed, 0 ignored, 0 SKIPPED.bfe_lowers_to_dxil_intrinsicson this head: 1 passed, 0 failed, 0 ignored (DXIL intrinsic validation/disassembly unit test).This checks the focused GPU and DXIL tests. I did not run the full workspace suite or a paired title smoke on this PR. No claim about speed or title shader use follows from these tests.
AI-assisted checkout, testing, log verification, and report drafting with OpenAI Codex (GPT-6). No game data was used.
@DavidM1911 on GitHub · 2026-11-25 07:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@SzczepanGrela on GitHub · 2026-11-25 11:03 UTC · original
Linux/RADV + Wine GPU test report on PR
#2171headcd67649(cd6764952e46276a8ff65d2a95c91ec81a0c76a2, local merge75aee93dd43dc8a8fd5afbe283dcbd2b6407a957ontoorigin/main568e7db7729c8fa6c8f0f4b32d798faaf11462bb).Setup
7.3.0-5-cachyos)AMD Radeon RX 9070 (RADV GFX1201, native wave64)(device0x7550, Vulkan1.4.354, Mesa RADV26.2.5-arch3.1)GE-Proton11-12(wine-11.0 (Staging)),vkd3d-proton v3.1, DXVKdxgi.dll, DXC1.9.2602.17(21d28f72)rustc 1.97.1,cargo test --target x86_64-pc-windows-gnu --release --workspace --no-run(43.96s, exit0, zero compiler warnings),XCL_REQUIRE_GPU=wave64 XCL_NETWORK=0Results
New tests (
cargo test --target x86_64-pc-windows-gnu --release -p xcl --lib ... -- --exact --nocapture):gpu::dxil::core_tests::bfe_lowers_to_dxil_intrinsics: 1 passed, 0 failed, 0 ignored in both default env (0.01s, exit0) andXCL_DIRECT_DXIL=1(0.01s, exit0).gpu::recomp::tests::gpu_v_bfe_edge_cases: 1 passed, 0 failed, 0 ignored (exit0) across all 5 tested modes: default (0.11s),XCL_DIRECT_DXIL=1(0.09s),XCL_DIRECT_DXIL=all(0.09s),XCL_SPLIT_WAVE64=1(0.11s), andXCL_DIRECT_DXIL=1 XCL_SPLIT_WAVE64=1(0.09s).Affected suites (
cargo test --target x86_64-pc-windows-gnu --release -p xcl --lib ...):gpu::dxil::core_tests: 16 passed, 0 failed, 1 ignored in default env (0.16s, exit0) andXCL_DIRECT_DXIL=1(0.13s, exit0;dump_dxc_loweringignored), vs baseline568e7db15 passed, 0 failed, 1 ignored (0.12s each, exit0; +1 passed, 0 regressions).gpu::dxil -- --skip ops_tests::integer_ops_match_cpu --skip ops_tests::uaddc_and_usubb_match_cpu:101), vs baseline568e7db119 passed, 1 failed, 3 ignored (1.11s, exit101).XCL_DIRECT_DXIL=1: 120 passed, 1 failed, 3 ignored (0.96s, exit101), vs baseline568e7db119 passed, 1 failed, 3 ignored (0.88s, exit101).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2(crates/xcl/src/gpu/dxil/fuzz_tests.rs:1171:21,seed 1003: res[713] = 0x1, CPU 0x0).gpu::recomp::tests::gpu_ -- --skip gpu_sparse_vram_descriptors_buffers_and_xmem --skip gpu_uma_import_check_at_init --skip gpu_unified_memory_arena:101), vs baseline568e7db99 passed, 1 failed, 1 ignored (0.89s, exit101; identical failuregpu_nonfused_mad_and_mac_prevent_fma_contraction, ignoredgpu_arena_partial_commit_probe).XCL_DIRECT_DXIL=1: 97 passed, 4 failed, 1 ignored (0.69s, exit101), vs baseline568e7db96 passed, 4 failed, 1 ignored (0.65s, exit101; identical 4 failures:gpu_f64_math_random,gpu_f64_roots,gpu_image_get_resinfo_1d_array,gpu_nonfused_mad_and_mac_prevent_fma_contraction).XCL_DIRECT_DXIL=all: 97 passed, 4 failed, 1 ignored (0.61s, exit101), vs baseline568e7db96 passed, 4 failed, 1 ignored (0.60s, exit101; identical 4 failures).XCL_SPLIT_WAVE64=1: 90 passed, 11 failed, 1 ignored (1.54s, exit101), vs baseline568e7db89 passed, 11 failed, 1 ignored (1.49s, exit101; identical 11 failures).Not tested
scripts/smoke.ps1, no integration test binaries, and no--libmodules outsidegpu::dxilandgpu::recomp::tests::gpu_.gpu::dxil::ops_tests::integer_ops_match_cpuandops_tests::uaddc_and_usubb_match_cpu(excluded via--skipin both baseline568e7dband PR#2171runs due to knownvkd3d-proton v3.1/libvulkan_radeon.soexit3crash).gpu_sparse_vram_descriptors_buffers_and_xmem,gpu_uma_import_check_at_init, andgpu_unified_memory_arena(excluded via--skipin the mode sweeps; baseline568e7dbunskippedgpu::recomp::tests::gpu_ -- --test-threads=1passed83, failed20, ignored1, with 19HRESULT(0x80070057)failures aftergpu_sparse_vram_descriptors_buffers_and_xmemwhilegpu_uma_import_check_at_initandgpu_unified_memory_arenapassed in isolation).AI use
@Toons29 on GitHub · 2026-11-25 12:07 UTC · original
Regression run of
457db25don the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@raylitebull on GitHub · 2026-11-25 18:24 UTC · original
Code review on 457db25 (fe_u/fe_i -> Tertiary::Ubfe/Ibfe in lower.rs + fe_lowers_to_dxil_intrinsics + gpu_v_bfe_edge_cases): diff is clean and CI is green. Only item needed before merge: an exact-head 457db25 AMD GPU pass of gpu_v_bfe_edge_cases with XCL_DIRECT_DXIL=1 (previous AMD/RADV runs were on cd67649, and the RX 9070 smoke run leaves XCL_DIRECT_DXIL unset).
@O5-7 on GitHub · 2026-11-26 02:51 UTC · original · reviewed
Rebased onto main (
b49be18) to resolve the trailing conflict in core_tests.rs (now at628df6d), and re-verified bfe (default + XCL_DIRECT_DXIL=1), workspace suite, and 60s smoke. Ready for an AMD XCL_DIRECT_DXIL=1 check on628df6d.@DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.