Skip to content

ISPC 1.31 AVX-512 miscompile: masked load sunk below masked store #3891

Closed

Description

@johguenther

OSPRay uses insertion sort of ray hits for clipping, which breaks for AVX512 with ISPC v1.31 (v1.30 is fine).

Minimal reproducer

https://godbolt.org/z/sWcEMKnh3 (at line 191 of asm, created with AI assistance)

More details

A masked load that reads an array element into a temporary is sunk below the masked store that overwrites that same element, so the temporary receives the value that was just written. In a classic swap

const float tmp = hits[i];
hits[i] = cur;
cur = tmp;          // <-- ends up as cur = cur

cur never changes and the array is filled with copies of a single element.

Affected

Broken ISPC 1.31.0 (build commit c6adb4f86f5678ce, LLVM 23.0.0)
OK ISPC 1.30.0 (build commit 3fc6d50cf24dc8b4, LLVM 21.1.8)
Targets all AVX-512 targets: avx512skx-x8, avx512skx-x16, avx512icl-x16, avx512spr-x16
Not affected avx2-i32x8, avx2-i32x16, and all targets at -O0
Opt level -O1 and -O2
OS / arch Windows x86-64 (observed); the same failure shows up on Linux x86-64 in CI

Activity

  1. self-assigned this
    on Aug 10, 2026
  2. added theissue type on Aug 10, 2026
  3. aneshlya commented on Aug 11, 2026

    @aneshlya
    Collaborator

    Hi @johguenther,

    Thanks a lot for reporting this issue. It's a regression in LLVM (22.1, 23, trunk): llvm/llvm-project#215453. I'll apply LLVM patch to ISPC as soon as it lands in the upstream.

  4. added
    Codegen
    on Sep 29, 2026
  5. added a commit that references this issue on Oct 8, 2026
    efe3124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CodegenLLVM bug

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions