From cd4037c48df8c39dbf25de4280493a1ba114340a Mon Sep 17 00:00:00 2001 From: Zanibar <91260002+taylnos@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:32:20 -0500 Subject: [PATCH] The GL tests hold Mesa's llvmpipe to AVX2 llvmpipe compiles the shaders for the host's CPU. On an AMD Zen 4 (znver4) host, LLVM 21's AVX-512 code for reflectionprobe_gl's one-pass probe shader leaves a NaN in the green of the screen-space reflection, on about a tenth of the opaque marches through sampleReflectionProbes and sampleReflectionProbesWater. That was the Linux test job's intermittent failure: Ubuntu 26.04's Mesa 26.0.8 on LLVM 21.1.8, reproduced bit for bit under Intel SDE with a Zen 4 CPUID. The same code built for AVX2 on that CPU, for Zen 3, or for Intel's AVX-512 CPUs does not, nor does it without LLVM's IR passes. al_add_test_binary runs every GL binary with GALLIUM_OVERRIDE_CPU_CAPS=avx, which clears AVX-512 from what Mesa sees of the CPU, so every runner's llvmpipe compiles the same AVX2 code. A GPU's driver draws nothing differently for it. Co-Authored-By: Claude Opus 5.5 --- doc/TESTING.md | 2 +- indra/cmake/ALAddTestBinary.cmake | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/TESTING.md b/doc/TESTING.md index 1bb1bc8064..ed19fcba79 100644 --- a/doc/TESTING.md +++ b/doc/TESTING.md @@ -105,7 +105,7 @@ A binary is a link set. Its files share their libraries, their fakes and their d - **`UNIT`** compiles the library's own files into the binary in place of linking the library, for a test that stubs what they call. Such a test is a binary of its own. - **`SUPPORT`** names object libraries linked whole: fakes and checks. A case or listener in a static archive would be dropped by the linker. -- **`GL`** labels the entries `gl` and registers them disabled with `-DAL_ENABLE_GL_TESTS=OFF`. **`PYTHON`** gives them the interpreter, and registers them disabled without one that has `llsd`. +- **`GL`** labels the entries `gl`, registers them disabled with `-DAL_ENABLE_GL_TESTS=OFF`, and holds Mesa's llvmpipe to AVX2 (`GALLIUM_OVERRIDE_CPU_CAPS=avx`): llvmpipe compiles the shaders for the host's CPU, and LLVM 21's AVX-512 code for AMD's Zen 4 leaves a NaN in `reflectionprobe_gl`'s screen-space reflection. A GL binary run by hand on llvmpipe wants the same. **`PYTHON`** gives them the interpreter, and registers them disabled without one that has `llsd`. - **`ISA_TIER`** builds the binary at an x86-64 tier, and it skips on a host below it. - **`RERUN`** runs some files a second time with more environment. alscript's SLua tests run again under Luau's new solver, as `alscript_tests_newsolver/`, with `AL_TEST_LUAU_SOLVER=new`. - **`/stray_cases`** fails when a case belongs to no file's entry, such as one written in a header. diff --git a/indra/cmake/ALAddTestBinary.cmake b/indra/cmake/ALAddTestBinary.cmake index 7411811ec6..939080c51b 100644 --- a/indra/cmake/ALAddTestBinary.cmake +++ b/indra/cmake/ALAddTestBinary.cmake @@ -118,9 +118,10 @@ endif() # the environment and labels a file's entry would have. # # ENVIRONMENT sets variables for the runs, VAR=value each. GL, PYTHON and -# ISA_TIER mean what they mean to al_add_test: a GL binary is labelled gl and -# registered disabled without AL_ENABLE_GL_TESTS, a PYTHON binary is given the -# interpreter and registered disabled without one that has llsd, and an +# ISA_TIER mean what they mean to al_add_test: a GL binary is labelled gl, +# registered disabled without AL_ENABLE_GL_TESTS and run with Mesa's llvmpipe +# held to AVX2, a PYTHON binary is given the interpreter and registered +# disabled without one that has llsd, and an # ISA_TIER binary is built at that x86-64 tier, named _, labelled # isa, and skips on a host below it -- or below the tree's own tier, since it # links the tree's libraries, built at that one. RESOURCE_LOCK names what the binary's @@ -283,6 +284,14 @@ function(al_add_test_binary name) if(NOT AL_ENABLE_GL_TESTS) set(disabled TRUE) endif() + # Mesa's llvmpipe, the Linux runners' GL, compiles the shaders for the + # host's CPU, and LLVM 21's AVX-512 code for AMD's Zen 4 (znver4) leaves + # a NaN in the green of reflectionprobe_gl's screen-space reflection. Its + # AVX2 code for the same CPU does not, nor its code for Zen 3 or for + # Intel's AVX-512 CPUs. Clearing AVX-512 from what Mesa sees of the CPU + # holds llvmpipe to AVX2 on every host; a driver that compiles for a GPU + # draws nothing differently. + list(APPEND environment "GALLIUM_OVERRIDE_CPU_CAPS=avx") endif() math(EXPR timeout "${timeout} * ${AL_TEST_TIMEOUT_SCALE}")