Skip to content

Shaders: lane masks read through a join need the console's wave size; tests skip devices without 32-lane waves (#356) - #377

Open
RenzoWit35 wants to merge 2 commits into
fxceless:mainfrom
RenzoWit35:fix/356-host-wave-size
Open

RenzoWit35 wants to merge 2 commits into
fxceless:mainfrom
RenzoWit35:fix/356-host-wave-size

Conversation

@RenzoWit35

Copy link
Copy Markdown

Addresses two of the three causes behind the six failures in #356. Those failures come from a host whose waves are not 32 lanes wide; the reported numbers point to 16-lane waves.

What changed

1. A lane mask that reaches data through a join now requires the console's wave size (d0602c7)

reads_mask_as_data only counted a value as a mask when that value itself was a known mask. In a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is, s20 holds vcc_lo on one path and 5 on the other. After the join it is a phi, which the check did not count, so the program declared no WaveSize. On a 32-lane host that goes unnoticed. On a 16-lane host the ballot covers 16 lanes, which is the 65535 vs 4294967295 in the report.

The new mask_values (in emit/lower.rs) adds every phi that has a mask among its incoming values, directly or through other phis. reads_mask_as_data takes that set, computed once per program, in both the lowering and own_bits. Instructions whose result is a mask still don't count as data reads.

New GPU-free test: the program above must lower with wave_size == Some(32). It fails with the old check.

2. Shader tests skip, rather than fail, a WaveSize(32) program on a device without 32-lane waves (23b63af)

Host::wave_lanes() reads WaveLaneCountMin/Max (D3D12 OPTIONS1), and Host::runs_waves_of(n) checks n against that range. run_cases_on now skips a refused pipeline only when the device cannot run 32-lane waves; on any other device a refused pipeline still panics. This covers ds_min_max_f32_order_floats_and_return_the_old_value ("compute_pipeline failed: The parameter is incorrect" in #356). on_the_card in wave64_tests already skipped refused pipelines.

New test devices_report_their_wave_sizes checks that each device reports a power-of-two range.

Testing

For reviewers

  • Not measured on title shaders. More programs may now declare WaveSize(32). On NVIDIA (host_max_wave() == 32), some console wave64 programs may move to the exchange path or keep 64-lane waves and be refused. A victory translate run on the title's shaders before and after this branch would show the change; I had no game files configured to run it.
  • Not addressed: the four *_node_test_* failures in 6 tests failed during cargo test --workspace. test result: FAILED. 204 passed; 6 failed; 2 ignored; 0 measured; 0 filtered out; finished in 6.90s #356. They return bvh::MISS for a ray that hits a triangle exactly at a vertex (direction [0, 2, 5]), where two edge cross-products are exactly 0. Contracting p*q - r*s into an FMA would flip that hit to a miss, but our DXIL carries no fast-math flags, so this needs the reporter's GPU and driver to confirm.

🤖 Generated with Claude Code

RenzoWit35 and others added 2 commits November 25, 2026 01:03
…he other is a mask read as data, so the program declares the console's wave size (fxceless#356)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, on a device without 32-lane waves (fxceless#356)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant