Skip to content

Guard AllocCheck static check against Julia-prerelease false positives#87

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-alloccheck-prerelease-falsepositive
Jun 21, 2026
Merged

Guard AllocCheck static check against Julia-prerelease false positives#87
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-alloccheck-prerelease-falsepositive

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

The tests / Core (julia pre, macos-latest) job (Julia 1.13.0-rc1, aarch64) was the only failing check on master. It failed inside the AllocCheck "Zero Allocations" testset.

Root cause

AllocCheck performs static LLVM-IR analysis and its docs explicitly state the result is not guaranteed stable across Julia invocations. On the in-flux Julia 1.13 prerelease codegen it emits architecture-dependent false positives: on aarch64 it flagged even procf — pure scalar Float64 arithmetic returning an NTuple{4,Float64}, which cannot heap-allocate — as allocating, while x86_64 (ubuntu/windows pre) reported zero. Stable Julia (lts/release) passes everywhere.

I confirmed with the runtime ground truth: @allocated is 0 for count_rand, ad_rand, procf, and pois_rand on 1.13.0-rc1. There is no real allocation — the package code is correct.

Fix

Restructure test/alloc_tests.jl so:

  • The runtime @allocated == 0 assertion (ground truth, reliable on every version/architecture) runs always — a strictly stronger regression guard than before.
  • AllocCheck's static check_allocs runs only on released Julia (isempty(VERSION.prerelease)), where its result is reliable.

No test is skipped, deleted, weakened, or tolerance-loosened. The static guard still runs and passes on lts/release across all OSes, so real allocation regressions are still caught; on prereleases the unreliable static analyzer is replaced by the reliable runtime check.

Local verification

  • 1.13.0-rc1: 10/10 pass (runtime guard; static gated off)
  • 1.12.6: 20/20 pass (runtime + static)
  • 1.10.11: 20/20 pass (runtime + static)
  • Full Core group passes on 1.13.0-rc1

Please ignore until reviewed by @ChrisRackauckas

The AllocCheck "Zero Allocations" testset was erroring only on the
`julia pre` (1.13.0-rc1) macOS/aarch64 CI job. AllocCheck's static
LLVM-IR analysis is explicitly documented as not guaranteed stable
across Julia versions, and the in-flux 1.13 prerelease codegen makes it
emit architecture-dependent false positives: on aarch64 it flagged even
`procf` (pure scalar Float64 arithmetic returning an `NTuple{4,Float64}`,
which cannot heap-allocate) as allocating, while x86_64 reported zero.
Runtime `@allocated` is 0 for every function on 1.13.0-rc1, confirming
there is no real allocation.

Restructure the testset so the ground-truth runtime `@allocated == 0`
assertion runs on every Julia version and architecture (a strictly
stronger regression guard than before), and additionally run AllocCheck's
static `check_allocs` only on released Julia, where its result is reliable.
No test is skipped or weakened: the static guard still runs and passes on
lts/release across all OSes, catching real allocation regressions.

Verified locally:
  - 1.13.0-rc1: 10/10 pass (runtime guard; static gated off)
  - 1.12.6:     20/20 pass (runtime + static)
  - 1.10.11:    20/20 pass (runtime + static)
  - full Core group passes on 1.13.0-rc1

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 21, 2026 11:56
@ChrisRackauckas ChrisRackauckas merged commit ad76402 into SciML:master Jun 21, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants