Repository navigation
Conversation
…)) wrong) amdxc64 on RDNA4 folds Bfrev(Countbits(K)) for a constant K to Bfrev(n) | n (0x80000001 for K = 2). Fold Countbits of constants in bit_count so the driver never sees that pattern. Fixes fuzz seed 1599 on the RX 9070 XT (xcl-dev#2115). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the RX 9070 XT (RDNA4), the AMD driver (amdxc64) folds
Bfrev(Countbits(K))wrong whenKis a constant. It givesbfrev(n) | n(n = countbits(K)): for K = 2 that is 0x80000001 instead of 0x80000000. This is the cause of fuzz seed 1599 (62 mismatches) and offuzz_validate_and_gpu_3failing on this card.Shader::bit_countnow foldsCountbitsof a constant itself, so the driver never sees that pattern. The reduced HLSL repro and the analysis are in #2115 (comment).Part of #2115
What is in it
crates/xcl/src/gpu/dxil/module.rs:Module::int_const, which reads the value of an integer constant.crates/xcl/src/gpu/dxil/ops.rs:Shader::bit_countfoldsCountbitsof a constant, masked to the operand's width.crates/xcl/src/gpu/dxil/ops_tests.rs: new testbfrev_of_countbits_of_a_constant_matches_cpu, which compares the GPU result with the CPU.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4:3cf8ef7, onmain4d44186): 1182 passed, 3 failed, 46 ignored.main4d44186on the same machine: 1180 passed, 4 failed, 46 ignored.fuzz_validate_and_gpu_3now passes, and the new test is counted.mainand are not touched here:fuzz_validate_and_gpu_1: seed 722,res[30] = 0x1, CPU 0x7fffffff. Shaders: preserve first active lane reads across divergent switches #2192 covers it.gpu_image_get_resinfo_past_last_level:2D mip 0x1: [4, 2, 0, 1], RDNA2 gives [0, 0, 0, 1].pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa:format 85 kept.bfrev_of_countbits_of_a_constant_matches_cpu: passes.heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).pso_measurement_compiles_an_exact_synthetic_record(Developer Mode is off).f16_programs_on_the_gpu/f32_programs_on_the_gpuper-lane cases (refused ops).Regression run
main:This PR:
The title is The Matrix Awakens. On
mainand on this PR it dies the same way, about 1.5 to 3.5 s in: the title'sCreateCommandSignature(DispatchIndirectMesh) fails, then it reads a null pointer (0xc0000005). That is fixed only in #1887. So this run shows no new crash and no device removal, but it never reaches a shader that this change affects.Not tested
Countbits(zext((in & 0) | 2)). The translator does not see those as constants.AI use
🤖 Generated with Claude Code