Skip to content

Commit e148d24

Browse files
authored
Merge branch 'master' into fix-temme-iop2-and-iop3-wide
2 parents 0c44e79 + 172df8d commit e148d24

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ChainRulesCore = "0.9.44, 0.10, 1"
2121
ChainRulesTestUtils = "0.6.8, 0.7, 1"
2222
ExplicitImports = "1.13.2"
2323
IrrationalConstants = "0.1, 0.2"
24-
JET = "0.9, 0.10"
24+
JET = "0.9, 0.12"
2525
LogExpFunctions = "0.3.2, 1"
2626
OpenLibm_jll = "0.7, 0.8"
2727
OpenSpecFun_jll = "0.5"

test/gamma_inc.jl

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ end
364364
@test_throws DomainError loggamma(6, -3.2)
365365
end
366366

367+
# Run `f(args...)` twice and return only the result of the second call, so that
368+
# one-time costs of the first execution of a freshly compiled callsite are not
369+
# measured. On Julia >= 1.13 OpenLibm is a `Libdl.LazyLibrary`, so resolving the
370+
# target of a `ccall` into it allocates 16 bytes on that callsite's first
371+
# execution. Warming up with a separate call does not help, because the binding
372+
# is cached per callsite and not per callee.
373+
run_twice(f, args...) = (f(args...); f(args...))
374+
367375
@testset "GPU compatibility ($FT)" for FT in (Float64, Float32, Float16)
368376
# Note: This test is a proxy for GPU compatibility by checking that the functions
369377
# are type stable and do not allocate memory. It does not launch any GPU kernels.
@@ -378,38 +386,38 @@ end
378386
# `@allocated` checks for allocations for specific code paths
379387
## a >= 1
380388
### gamma_inc_temme_1: simplified Temme expansion
381-
@test iszero((FT -> @allocated(gamma_inc(FT(30.0), FT(29.99999), 0)))(FT))
389+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(30.0), FT(29.99999), 0)), FT))
382390
### gamma_inc_minimax: minimax approximation
383-
@test iszero((FT -> @allocated(gamma_inc(FT(100.0), FT(80.0), 0)))(FT))
391+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(100.0), FT(80.0), 0)), FT))
384392
### gamma_inc_temme: Temme expansion
385-
@test iszero((FT -> @allocated(gamma_inc(FT(100.0), FT(80.0), 1)))(FT))
393+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(100.0), FT(80.0), 1)), FT))
386394
### gamma_inc_cf: Continued fraction
387-
@test iszero((FT -> @allocated(gamma_inc(FT(1.7), FT(2.5))))(FT))
395+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(1.7), FT(2.5))), FT))
388396
### gamma_inc_taylor: Taylor series
389-
@test iszero((FT -> @allocated(gamma_inc(FT(11.1), FT(0.001))))(FT))
397+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(11.1), FT(0.001))), FT))
390398
### gamma_inc_asym: Asymptotic expansion
391-
@test iszero((FT -> @allocated(gamma_inc(FT(10.0), FT(35.0))))(FT))
399+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(10.0), FT(35.0))), FT))
392400
### gamma_inc_fsum: Finite sums
393-
@test iszero((FT -> @allocated(gamma_inc(FT(24.0), FT(25))))(FT))
401+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(24.0), FT(25))), FT))
394402
## a==0.5
395403
### erfc
396-
@test iszero((FT -> @allocated(gamma_inc(FT(0.5), FT(0.5))))(FT))
404+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(0.5), FT(0.5))), FT))
397405
## x < 1.1
398406
### gamma_inc_taylor_x
399-
@test iszero((FT -> @allocated(gamma_inc(FT(0.9), FT(0.8))))(FT))
407+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(0.9), FT(0.8))), FT))
400408
## else
401409
### gamma_inc_cf
402-
@test iszero((FT -> @allocated(gamma_inc(FT(0.7), FT(2.5))))(FT))
410+
@test iszero(run_twice(FT -> @allocated(gamma_inc(FT(0.7), FT(2.5))), FT))
403411
end
404412

405413
@testset "gamma_inc_inv allocations" begin
406414
# `@allocated` checks for allocations for specific code paths
407415
## x0 approximation paths
408416
### gamma_inc_inv_psmall
409-
@test iszero((FT -> @allocated(gamma_inc_inv(FT(1.0), FT(0.01), FT(0.99))))(FT))
417+
@test iszero(run_twice(FT -> @allocated(gamma_inc_inv(FT(1.0), FT(0.01), FT(0.99))), FT))
410418
### gamma_inc_inv_qsmall
411-
@test iszero((FT -> @allocated(gamma_inc_inv(FT(5.0), FT(0.99), FT(0.01))))(FT))
419+
@test iszero(run_twice(FT -> @allocated(gamma_inc_inv(FT(5.0), FT(0.99), FT(0.01))), FT))
412420
### gamma_inc_inv_alarge
413-
@test iszero((FT -> @allocated(gamma_inc_inv(FT(50.0), FT(0.3), FT(0.7))))(FT))
421+
@test iszero(run_twice(FT -> @allocated(gamma_inc_inv(FT(50.0), FT(0.3), FT(0.7))), FT))
414422
end
415423
end

test/qa.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ end
5454
@test ExplicitImports.check_no_self_qualified_accesses(SpecialFunctions) === nothing
5555
end
5656

57-
@testset "JET" begin
58-
# Check that there are no undefined global references and undefined field accesses
59-
JET.test_package(SpecialFunctions; target_defined_modules = true, mode = :typo)
57+
if VERSION < v"1.12" || JET.JET_AVAILABLE
58+
@testset "JET" begin
59+
# Check that there are no undefined global references and undefined field accesses
60+
JET.test_package(SpecialFunctions; target_modules = (SpecialFunctions,), mode = :typo)
6061

61-
# Analyze methods based on their declared signature
62-
JET.report_package(SpecialFunctions; target_defined_modules = true)
62+
# Analyze methods based on their declared signature
63+
JET.report_package(SpecialFunctions; target_modules = (SpecialFunctions,))
64+
end
6365
end

0 commit comments

Comments
 (0)