Skip to content

3D engine that AI agents drive

Hold lavapipe's JIT to AVX in the Cook addon job (#1760)

Nguyen Xuan And41fd6c443b5
diff --git a/.github/workflows/cook-addon.yml b/.github/workflows/cook-addon.yml
index 178f4e62..3470b15b 100644
--- a/.github/workflows/cook-addon.yml
+++ b/.github/workflows/cook-addon.yml
@@ -427,8 +427,14 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
env:
- # Six tests failed on Intel AVX-512 runners and passed on AMD (#1760). Keep lavapipe's JIT on 256-bit vectors so every runner
- # compiles the Cook kernel the same way, as the AVX-512 path miscompiled it before (cook#45).
+ # Tests failed on Intel and AMD runners with AVX2 and AVX-512 and passed on others (#1760). lavapipe's JIT gives a different
+ # result for the Cook kernel on a CPU with AVX2 (a magnified mip read off by 8 to 80, the albedo sum 0.9 percent low, the light
+ # tree mean 0.7044 against 0.6905), and the same kernel is right with LLVM's optimisation passes off and right when the JIT
+ # is held to AVX. Limit lavapipe to AVX so every runner compiles the kernel the same way (cook#42 found it first on the flat
+ # light pick). On Xeon 6975P-C and EPYC 9V45, GALLIUM_OVERRIDE_CPU_CAPS=avx passed all 74 tests of the seven files that
+ # failed in the default JIT, and GALLIUM_OVERRIDE_CPU_CAPS=avx2 failed the same two tests as the default. Drop this once
+ # Mesa's LLVM stops doing that.
+ GALLIUM_OVERRIDE_CPU_CAPS: avx
LP_NATIVE_VECTOR_WIDTH: '256'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -482,7 +488,7 @@ jobs:
echo '### Vulkan adapter'
echo '```'
grep -m1 'model name' /proc/cpuinfo || true
- echo "avx512f: $(grep -o -m1 avx512f /proc/cpuinfo | head -1 | grep . || echo no), LP_NATIVE_VECTOR_WIDTH=$LP_NATIVE_VECTOR_WIDTH"
+ echo "avx2: $(grep -o -m1 avx2 /proc/cpuinfo | head -1 | grep . || echo no), avx512f: $(grep -o -m1 avx512f /proc/cpuinfo | head -1 | grep . || echo no), GALLIUM_OVERRIDE_CPU_CAPS=$GALLIUM_OVERRIDE_CPU_CAPS, LP_NATIVE_VECTOR_WIDTH=$LP_NATIVE_VECTOR_WIDTH"
vulkaninfo --summary 2>&1 | grep -E 'deviceName|driverInfo|apiVersion|deviceType' || true
echo
vulkaninfo 2>&1 | grep -E 'VK_KHR_(ray_query|acceleration_structure)' | sort -u || echo 'no VK_KHR_ray_query or VK_KHR_acceleration_structure'
@@ -509,22 +515,9 @@ jobs:
# and with the default concurrency the light-tree file crashed (SIGSEGV) and byte-for-byte tests differed, while each
# passed alone and two runs of one render were byte-identical on lavapipe (#1717).
set +e
- # With the vector width pinned, two files still failed on AMD EPYC 9V74 and 9V45 and on Intel Xeon 6975P-C and 8573C (#1760):
- # the mip level 0 read (difference 8.6 to 80, expected 0) and the light tree mean. With LLVM's optimisation passes off
- # (GALLIVM_PERF=nopt) both passed on 5 of 5 runners across those CPUs, and with them on both failed on 4 of 5 (a different
- # CPU on each run), so an optimisation pass in lavapipe's JIT changes the kernel's result. Switching the passes off for
- # every file made the first native job run past its 10 minute cap, so only these files run that way. The albedo reference
- # (#1911) joined them: its sum matches an RTX 3060 within 0.1 percent with the passes off and is 0.9 percent low with them on.
- # Drop the split once Mesa's LLVM stops doing that.
- jit_sensitive_tests="tests/native-texture-mips.test.js tests/native-light-tree-kernel.test.js tests/native-albedo-reference.test.js"
- other_tests=$(git grep -l "support/cook.js" -- tests | grep -vxF -e tests/native-texture-mips.test.js -e tests/native-light-tree-kernel.test.js -e tests/native-albedo-reference.test.js)
test_options="--test-concurrency=2 --import ./scripts/test-hang-guard.mjs --test-timeout=300000 --test-reporter=tap"
- node --test $test_options --test-reporter-destination=addon-tests.tap $other_tests
+ node --test $test_options --test-reporter-destination=addon-tests.tap $(git grep -l "support/cook.js" -- tests)
status=$?
- GALLIVM_PERF=nopt node --test $test_options --test-reporter-destination=addon-tests-jit-sensitive.tap $jit_sensitive_tests
- sensitive_status=$?
- cat addon-tests-jit-sensitive.tap >> addon-tests.tap
- if [ "$sensitive_status" -ne 0 ]; then status=$sensitive_status; fi
echo "test_seconds=$(( $(date +%s) - start ))" >> "$GITHUB_ENV"
echo "node --test exit code $status"
- name: Write ran and skipped counts to the job summary, fail on a real failure
diff --git a/.github/workflows/probe-1760.yml b/.github/workflows/probe-1760.yml
deleted file mode 100644
index 0f6445a3..00000000
--- a/.github/workflows/probe-1760.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-name: Probe 1760
-on:
- push:
- branches: [1760-avx512-override]
-permissions:
- contents: read
-jobs:
- probe:
- runs-on: ubuntu-latest
- timeout-minutes: 60
- strategy:
- fail-fast: false
- matrix:
- runner: [1, 2, 3, 4, 5, 6, 7, 8]
- env:
- LP_NATIVE_VECTOR_WIDTH: '256'
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - uses: ./.github/actions/setup
- - name: Work out the addon cache key
- id: addon-key
- run: |
- rustc_line=$(cd node_modules/@codepawlhq/cook && rustc --version)
- node scripts/cook-addon-cache-key.mjs "$RUNNER_OS" "$RUNNER_ARCH" "$rustc_line" | tee -a "$GITHUB_OUTPUT"
- - id: addon-cache
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
- with:
- path: node_modules/@codepawlhq/cook/build
- key: ${{ steps.addon-key.outputs.key }}
- - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- if: steps.addon-cache.outputs.cache-hit != 'true'
- with:
- workspaces: node_modules/@codepawlhq/cook
- - if: steps.addon-cache.outputs.cache-hit != 'true'
- run: npm run cook:build
- - run: |
- sudo apt-get update -qq
- sudo apt-get install -y -qq mesa-vulkan-drivers vulkan-tools ffmpeg
- grep -m1 'model name' /proc/cpuinfo
- grep -o -m1 'avx512[a-z]*' /proc/cpuinfo | sort -u | tr '\n' ' ' || true
- npm run build
- node scripts/build-mcp.mjs
- - name: Variants
- run: |
- set +e
- files="tests/native-texture-mips.test.js tests/native-light-tree-kernel.test.js tests/native-albedo-reference.test.js tests/native-instancing-equivalence.test.js tests/native-job-materials.test.js tests/native-camera-environment.test.js tests/native-texture-sampler.test.js"
- opts="--test-concurrency=2 --import ./scripts/test-hang-guard.mjs --test-timeout=300000"
- run_variant() {
- name="$1"; shift
- echo "=== variant $name"
- timeout 1200 env "$@" node --test $opts $files > "variant-$name.log" 2>&1
- echo "exit $? at $SECONDS s"
- grep -E "^. (pass|fail) |✖|not ok" "variant-$name.log" | head -20 || true
- }
- run_variant default A=1
- run_variant avx2 GALLIUM_OVERRIDE_CPU_CAPS=avx2
- run_variant avx GALLIUM_OVERRIDE_CPU_CAPS=avx
- run_variant nopt GALLIVM_PERF=nopt
- - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
- if: always()
- with:
- name: variants-${{ matrix.runner }}
- path: variant-*.log