Skip to content

The GL tests hold Mesa's llvmpipe to AVX2: LLVM 21's Zen 4 code puts NaN in the probe test - #566

Merged
RyeMutt merged 1 commit into
developfrom
zanibar/llvmpipe-avx2-gl-tests
Oct 24, 2026
Merged

RyeMutt merged 1 commit into
developfrom
zanibar/llvmpipe-avx2-gl-tests

Conversation

@taylnos

@taylnos taylnos commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

reflectionprobe_gl_test failed once on the Linux x64 test job (#554's first attempt) and passed on the re-run, on the same commit, image and Mesa. It failed only in the screen-space reflection and hero probe case, with the classic sky off, through sampleReflectionProbes (2,136 pixels) and sampleReflectionProbesWater (2,840). The one-pass build's gloss had a NaN green where red and blue matched the list build exactly, e.g. at 23,0: 0.670816, -nan, 0.530254 against 0.670816, 0.700022, 0.530254.

Cause

llvmpipe compiles the shaders for the CPU it runs on, and the runners are not all the same CPU. On an AMD Zen 4 host (-mcpu=znver4), Ubuntu 26.04's Mesa 26.0.8 with LLVM 21.1.8 compiles the one-pass probe shader to AVX-512 code that leaves a NaN in the green of the screen-space reflection. It hits about a tenth of the opaque marches. The failing attempt ran in Azure eastus and the passing re-run in centralus.

The failure reproduces exactly: the Linux test binary at the failing commit (996d100), on Ubuntu 26.04's own Mesa in WSL, under Intel SDE with a Zen 4 CPUID. It gives the same 2,136 and 2,840 pixels and the same values as CI. These all pass:

  • Zen 4 with AVX-512 cleared from Mesa's CPU caps (AVX2 code, still tuned for znver4).
  • Zen 4 with LLVM's IR passes off (GALLIVM_PERF=nopt), or with 128-bit vectors.
  • Zen 3 (no AVX-512), and Intel's AVX-512 CPUs under SDE (Sapphire Rapids, Ice Lake server, Skylake-X, Granite Rapids).
  • An i7-14700K natively.
  • Every Windows build of Mesa tried (26.0.8 on LLVM 22, 26.0.6 on LLVM 21.1.8), under every one of those profiles, Zen 4 included.

The shader is not at fault. Its NIR has no undefined float values, and red, green and blue go through the same code. Giving traceScreenRay's out hitDepth a variable of its own, rather than depth, changes nothing.

Change

al_add_test_binary runs every GL binary with GALLIUM_OVERRIDE_CPU_CAPS=avx, Mesa's documented llvmpipe override. It clears AVX-512 from what Mesa sees of the CPU, so every runner's llvmpipe compiles the same AVX2 code. The variable reaches every entry, combined and per-case runs included, in both the build and sanitizer workflows and in a local ctest. A GPU's driver draws nothing differently for it. doc/TESTING.md's GL bullet says so, for a binary run by hand.

Develop does not trip it today. With #553's change to the probe shader, develop's whole alrender_gl_tests suite passes under the Zen 4 profile without the override. The shader's new code happens to dodge the bad code. This holds it off for the next edit to the probe or reflection shaders.

Testing

Under SDE with a Zen 4 CPUID, on Ubuntu 26.04's Mesa:

  • At 996d100, the whole alrender_gl_tests suite: without the override, only this case fails (52 cases); with it, all 52 pass.
  • At this branch, ctest's entry for reflectionprobe_gl_test carries GALLIUM_OVERRIDE_CPU_CAPS=avx and passes.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ddfb4a90-446c-477f-b195-1e5399f03b97
📥 Commits

Reviewing files that changed from the base of the PR and between 2ef26ff and cd4037c.

📒 Files selected for processing: 2
  • doc/TESTING.md
  • indra/cmake/ALAddTestBinary.cmake
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the cmake label Oct 23, 2026
@RyeMutt
RyeMutt merged commit 65c39b7 into develop Oct 24, 2026
17 checks passed
@RyeMutt
RyeMutt deleted the zanibar/llvmpipe-avx2-gl-tests branch October 24, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants