From b37f7ebf4c9a2f23050eafefceede92f42363d6c Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Wed, 7 Oct 2026 09:55:21 -0400 Subject: [PATCH 1/2] Wire allocation tests into the CPU group test/alloc_tests.jl was added gated behind GROUP == "all" || "nopre", but neither group exists in test_groups.toml or any workflow, so the tests have never run in CI. Include them in the CPU group, where they pass, and drop the dead gate. Co-Authored-By: Chris Rackauckas Co-Authored-By: Devin Agent-Harness: Devin CLI 3000.11.3 Agent-Model: swe-2-high Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/qa-hygiene/jobs/gpu-fixes/log.txt on amdci2 --- test/runtests.jl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index e26fe6b0..ac7e777f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -136,6 +136,9 @@ if GROUP == "CPU" @time @safetestset "Adaptive endpoint termination" begin include("gpu_kernel_de/adaptive_endpoint.jl") end + @time @safetestset "Allocation Tests" begin + include("alloc_tests.jl") + end end if GROUP == "JLArrays" @@ -168,10 +171,3 @@ if GROUP == "CUDA" include("enzyme_environment.jl") end end - -# Allocation tests run separately to avoid precompilation interference -if GROUP == "all" || GROUP == "nopre" - @time @safetestset "Allocation Tests" begin - include("alloc_tests.jl") - end -end From ce94736660e38b8245ee590dfe16cd8d9352d3fb Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Wed, 7 Oct 2026 15:20:34 -0400 Subject: [PATCH 2/2] Measure alloc_tests inside functions so they pass on Julia lts On Julia <= 1.10, @allocated evaluated directly in a @testset body also counts boxing the measured call's result, so the three == 0 checks fail on lts (32 == 0 for lorenz, 16 == 0 for diffeqgpunorm) even though the code under test does not allocate. The same calls measured inside a function report 0 on 1.10 and 1.13, and an escaping-allocation control still reports > 0 through the wrapper. No VERSION gate and no loosened thresholds. Co-Authored-By: Chris Rackauckas Co-Authored-By: Devin Agent-Harness: Devin CLI 3000.11.3 Agent-Model: swe-2-high Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/qa-hygiene/jobs/gpu-fixes/log.txt on amdci2 --- test/alloc_tests.jl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/alloc_tests.jl b/test/alloc_tests.jl index 50d09b54..d67a1691 100644 --- a/test/alloc_tests.jl +++ b/test/alloc_tests.jl @@ -7,6 +7,8 @@ using DiffEqGPU # Note: AllocCheck.@check_allocs is not compatible with GPU kernels and complex # dispatch, so we use @allocated instead for testing allocation counts. +# @allocated must be evaluated inside a function: measured at top-level scope, +# older Julia versions also count boxing the measured call's result. # Test Lorenz system for allocation tests function lorenz(u, p, t) @@ -26,11 +28,11 @@ end t = 0.0f0 # Warmup - lorenz(u, p, t) + measure() = @allocated lorenz(u, p, t) + measure() # Test allocations - allocs = @allocated lorenz(u, p, t) - @test allocs == 0 + @test measure() == 0 end @testset "make_prob_compatible should be low allocation" begin @@ -42,12 +44,12 @@ end prob = ODEProblem{false}(lorenz, u0, tspan, p) # Warmup - DiffEqGPU.make_prob_compatible(prob) + measure() = @allocated DiffEqGPU.make_prob_compatible(prob) + measure() # Test - some allocations are expected for problem conversion - allocs = @allocated DiffEqGPU.make_prob_compatible(prob) # Should be reasonably low (less than 1KB) - @test allocs < 1024 + @test measure() < 1024 end @testset "diffeqgpunorm should not allocate for SVector" begin @@ -55,11 +57,11 @@ end t = 0.0f0 # Warmup - DiffEqGPU.diffeqgpunorm(u, t) + measure() = @allocated DiffEqGPU.diffeqgpunorm(u, t) + measure() # Test allocations - allocs = @allocated DiffEqGPU.diffeqgpunorm(u, t) - @test allocs == 0 + @test measure() == 0 end @testset "diffeqgpunorm should not allocate for scalars" begin @@ -67,10 +69,10 @@ end t = 0.0f0 # Warmup - DiffEqGPU.diffeqgpunorm(u, t) + measure() = @allocated DiffEqGPU.diffeqgpunorm(u, t) + measure() # Test allocations - allocs = @allocated DiffEqGPU.diffeqgpunorm(u, t) - @test allocs == 0 + @test measure() == 0 end end