Repository navigation
shader: compile the log2 pixel fixtures with -denorm any - #851
Merged
Merged
Conversation
An NVIDIA GeForce RTX 5080 (drivers 32.0.16.2101 and 32.0.16.2124) refuses CreateGraphicsPipelineState with E_OUTOFMEMORY for any pixel shader that uses log2 under -denorm preserve, so pixel_aot_e64_approx_hardware and pixel_aot_sdwa_unary_hardware failed on every case. WARP and an AMD Radeon integrated GPU accept the same pipelines. Pick the mode per translated program: any when its HLSL contains log2, preserve otherwise. Before choosing any, assert that no input, intermediate result, expected value or wrong reference of the fixture is a binary32 subnormal, so the mode cannot change what it computes or exports. This applies to e64_approx and sdwa_unary_exp; sdwa_unary_root and sdwa_unary_exact keep preserve, which an assertion pins. All wrong-reference controls are kept. Fixes R0Y00#828
2 tasks done
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.
Change
pixel_aot_e64_approx_hardwareandpixel_aot_sdwa_unary_hardwarefail on an NVIDIA GeForce RTX 5080 because the driver refusesCreateGraphicsPipelineState(E_OUTOFMEMORY) for any pixel shader that useslog2under-denorm preserve(#828). As agreed in the issue, this switches the denormal mode per fixture, only for the approximate programs that containlog2.tests/pixel_aot_check.py:log2_denorm_mode()returnsanywhen the translated HLSL containslog2(andpreserve(F32_DENORM_MODE) otherwise. Before returningany, it asserts that no value the fixture depends on is a binary32 subnormal: the inputs, the intermediate results (the unrounded exp, log and rcp results and their+ 0.5, the rounded-A * |B|product andD * Dsquare of the mac channels, the accumulator), the expected values and every wrong reference.e64_approxandsdwa_unary_exp.sdwa_unary_rootandsdwa_unary_exactkeeppreserve, and an assertion pins that onlysdwa_unary_expswitches.docs/experiments.md: the denormal-mode paragraph records the exception next to the existingcurveone, with the measured adapters.The minimal
preservereproduction stays in #828 for a later driver retest.Fixes #828
This change was AI-assisted (Claude Code); I reviewed the diff and the test results.
Verification
Commit
c0f4d9c(rebased one97090a),devpreset, DXC 1.9.2602.17 (Windows SDK 10.0.26100).Both modes on the same adapter and driver, one batch per program (10 cases each: 2 right references and 8 wrong references):
e64_approx,sdwa_unary_expunderpreserveanystatus=error,Translated pixel pipeline failed (HRESULT 0x8007000e)pass, 8mismatchfor each programpass, 8mismatchfor each programpass, 8mismatchfor each programOn the RTX 5080 under the new code,
sdwa_unary_root(2pass, 8mismatch) andsdwa_unary_exact(2pass, 10mismatch) still compile withpreserveand pass.Focused tests:
ctest --preset dev --no-tests=error -R '^pixel_aot_(e64_approx|sdwa_unary)_(hardware|warp)$' -Vc3db335, the previousmain):pixel_aot_e64_approx_hardwareandpixel_aot_sdwa_unary_hardwarefail withcase=N status=erroron every case; both_warptests pass.ctest --preset dev --no-tests=error -R '^pixel_aot_' -j 482 of 82 passed on
c0f4d9c.Negative control for the new assertion:
log2_denorm_mode()with the least subnormal0x00000001among the values, ande64_approxwith that value in place of C in a row, both raiseAssertionErrorbefore any compile. A program withoutlog2returnspreserveregardless of the values.Other checks:
.github/workflows/windows.yml: all exit 0 onc0f4d9c.tests/pixel_aot_check.py binarywith LLVM 15llvm-mc(gfx1013): exit 0 onc0f4d9c.c3db335):ctest --preset dev --no-tests=error -j 4andctest --preset release --no-tests=error -j 4each give 415 passed, 0 failed of 422.bvh_wave64_hardware,bvh_wave64_warp,wave_shuffle_warp,spirv_minlod_hardware,spirv_minlod_levels_hardware,spirv_minlod_warp,spirv_minlod_levels_warp.Environment: Windows 11 build 26300.9974, VS Build Tools 2026 18.12 (MSVC 14.52.37025), Windows SDK 10.0.26100. The debug layer is unavailable (Graphics Tools not installed).
Evidence and follow-up
No new fixture. The fixtures' inputs and references are unchanged; only the recorded denormal mode of two programs changes.
Assumption: with no binary32 subnormal among the inputs, intermediates and expected values,
anyandpreserveproduce the same exported bits for these programs. The assertions check that for every value the fixtures use; they do not measure the shader's internal precision.Not established: whether older NVIDIA architectures or a later driver accept these pipelines under
preserve, and what the console computes. The AMD Radeon integrated GPU that acceptspreserve(#828) was not rerun with this change.Checklist