Skip to content

callgrind SIGILLs on AVX-512 despite the GLIBC_TUNABLES workaround #154

Description

@Verdenroz

Affected crate(s)

soothfast-measure

Version

0.2.0

Steps to reproduce

  1. On a machine with glibc 2.44, valgrind 3.25.1, and an AVX-512 CPU.
  2. cargo bench --no-run -p soothfast-registry --bench soothfast
  3. Run callgrind the way callgrind.rs does, with the tunable it sets:
GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512F,-AVX512VL,-AVX512BW,-AVX512DQ,-AVX512CD \
  valgrind --tool=callgrind --callgrind-out-file=/dev/null <bench binary> --list

Expected behavior

The tunable disables glibc's AVX-512 routines so callgrind can run the binary. That is what the workaround at soothfast-measure/src/callgrind.rs:16-19 exists for, and its docstring says so: "an AVX-512-compiled glibc loader SIGILLs before main()".

Actual behavior

SIGILL at the same address with and without the tunable, so the workaround no longer suppresses anything on this glibc.

vex amd64->IR: unhandled instruction bytes: 0x62 0xF1 0x7F 0x48 0x7F 0x84 0x24 0x30 0x0 0x0
valgrind: Unrecognised instruction at address 0x40bdecd.
Process terminating with default action of signal 4 (SIGILL)

The leading 0x62 is the EVEX prefix. The bytes decode as a 512-bit store, vmovdqu32 [rsp+0x30], zmm0. Valgrind 3.25.1's VEX frontend does not decode EVEX. The binary runs fine natively, and callgrind runs a trivial C program on the same machine without complaint.

Impact

probe() fails, gating falls back to walltime, and complexity sweeps over sizes(16, 64, 256) become noise. On unmodified master, three consecutive gate -p soothfast-spec runs each failed a different bench: bench_openapi_diff x2.48 then x3.22 then x3.45 against a x2.5 limit, with bench_openapi_document and bench_serialize_yaml swapping pass/fail between runs. On a machine in this state, any local pass or fail on a callgrind-gated claim is walltime noise.

Environment

valgrind 3.25.1, glibc 2.44, rustc 1.98.0, x86_64 with avx512f/bw/cd/dq/vl.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions