Repository navigation
ci: run lavapipe at the AVX level on every Linux runner - #477
Merged
Merged
Conversation
agc_driver_vopc_compare failed on every Linux runner with an AVX512-FP16 Xeon (Sapphire, Emerald and Granite Rapids) and passed on AMD EPYC and Ice Lake runners. Ubuntu 24.04's lavapipe compiles with LLVM 20.1.2, which on these CPUs merges a masked fcmp ult/uge on half vectors with the same compare of swapped operands, so v_cmp_nle_f16, v_cmp_nlt_f16 and v_cmpx_nle_f16 return the result of their mirror. The recompiler's SPIR-V is the same on every device and correct. GALLIUM_OVERRIDE_CPU_CAPS=avx keeps LLVM off AVX-512, so every runner compiles the tests the same way.
This was referenced Oct 3, 2026
9 tasks done
11 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.
What
agc_driver_vopc_comparefails on some Linux CI runs withthread 1 compare 39 is 0, expected 1. It is not flaky: it depends on which CPU the runner has, and the bug is in the LLVM that Ubuntu 24.04's lavapipe uses, not in the recompiler. #399 changed howv_cmp_nle_f16is lowered to fix it; LLVM receives the same compare either way, so that change neither caused nor fixed the failure.This sets
GALLIUM_OVERRIDE_CPU_CAPS=avxfor the Linuxcteststep, so lavapipe compiles at the same level on every runner and LLVM never emits AVX512-FP16 code.The runner's CPU decides it. On 14 fork CI runners I ran the test 15 times per setting (6 runners), then 3 times per setting (8 runners). Every runner gave the same result on every run:
GALLIUM_OVERRIDE_CPU_CAPS=avx/proc/cpuinfo, but LLVM picks the target from the CPU model)On a failing runner,
GALLIVM_PERF=nopt(no LLVM optimization) also passes.LP_NATIVE_VECTOR_WIDTH=128still fails.Where it goes wrong. With every compare reported (not just the first), the wrong results on those runners are compares 39 (
v_cmp_nle_f16), 40 (v_cmp_nlt_f16) and 48 (v_cmpx_nle_f16), in both directions. Each returns its mirror's result: NLE gives NGE's, NLT gives NGT's.OpFUnordLessThan a b, NLE isOpFUnordLessThan b a.-sprfails;-icxand-hswpass;-spr.-spr. The optimized IR is still correct:fcmp ult <8 x half> %b, %afor NLE next tofcmp ult <8 x half> %a, %bfor NGE, and the same for theugepair. LLVM then targetssapphirerapids, which implies AVX512-FP16.llc -O2 -mcpu=sapphirerapids:LLVM 20.1.2 emits a single masked
vcmpnlephfor both compares, so the second one gets the first one's result. LLVM 22.1.8 emits two with swapped operands. With augepair added, LLVM 20 emits 2 compares for 4 and LLVM 22 emits 4.GALLIUM_OVERRIDE_CPU_CAPS=avxmakes Mesa pass-avx512fand the other AVX-512 features to LLVM, which disables AVX512-FP16 too. The halves are then compared as floats, which is correct. It applies on every runner, so the Vulkan tests compile the same way whatever CPU the job lands on. Nothing in the recompiler or the tests changes.Tested
cteststep took 27.3 s, against 23.8 s for another branch on the same day, so the AVX level costs little.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)