Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/QuadGKEnzymeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ function Enzyme.EnzymeRules.augmented_primal(config, ofunc::Const{typeof(quadgk)
dres = if !Enzyme.EnzymeRules.needs_shadow(config)
nothing
elseif EnzymeRules.width(config) == 1
zero.(res...)
zero(eltype(RT))
else
ntuple(Val(EnzymeRules.width(config))) do i
Base.@_inline_meta
zero.(res...)
zero(eltype(RT))
end
end

Expand Down Expand Up @@ -63,7 +63,7 @@ struct ClosureVector{F}
end

@inline function guaranteed_nonactive(::Type{T}) where T
rt = Enzyme.Compiler.active_reg_inner(T, (), nothing)
rt = Enzyme.Compiler.active_reg_nothrow(T)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is giving a MethodError in CI:

Enzyme: Error During Test at /Users/runner/work/QuadGK.jl/QuadGK.jl/test/runtests.jl:475
  Test threw exception
  Expression: (0.3 * cos(0.3) - sin(0.3)) / (0.3 * 0.3)  ((Enzyme.autodiff(Reverse, f3_count, Active(0.3)))[1])[1]
  MethodError: no method matching active_reg_nothrow(::Type{QuadGKEnzymeExt.ClosureVector{QuadGK.Counter{var"#121#124"{Float64}}}})
  
  Closest candidates are:
    active_reg_nothrow(::Type{T}, ::Val{world}) where {T, world}
     @ Enzyme none:0
  
  Stacktrace:
    [1] guaranteed_nonactive(#unused#::Type{QuadGKEnzymeExt.ClosureVector{QuadGK.Counter{var"#121#124"{Float64}}}})
      @ QuadGKEnzymeExt ~/work/QuadGK.jl/QuadGK.jl/ext/QuadGKEnzymeExt.jl:66
    [2] recursive_add
      @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6704 [inlined]
    [3] *(a::Float64, b::QuadGKEnzymeExt.ClosureVector{QuadGK.Counter{var"#121#124"{Float64}}})
      @ QuadGKEnzymeExt ~/work/QuadGK.jl/QuadGK.jl/ext/QuadGKEnzymeExt.jl:80
    [4] *(a::QuadGKEnzymeExt.ClosureVector{QuadGK.Counter{var"#121#124"{Float64}}}, b::Float64)
      @ QuadGKEnzymeExt ~/work/QuadGK.jl/QuadGK.jl/ext/QuadGKEnzymeExt.jl:84
    [5] evalrule(f::QuadGKEnzymeExt.var"#11#15"{Active{Tuple{Float64, Float64}}, Active{QuadGK.Counter{var"#121#124"{Float64}}}, 

Do we need to require a newer version of Enzyme?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is a funky one, GPUCompiler has dropped support for Julia < 1.10 [cc @maleadt @vchuravy], this makes downstream packages [e.g. Enzyme] have to drop 1.9 and below. It's fine to just not test on 1.9, but there's a problem where there is no way to resolve a compat for 1.9 at all here

@stevengj stevengj Jun 25, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we need to bump the minimum version to 1.10 that is fine. But can't we just test the extension on 1.10+?

return rt == Enzyme.Compiler.AnyState || rt == Enzyme.Compiler.DupState
end

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ quadgk_segbuf_printnull(args...; kws...) = quadgk_segbuf_print(devnull, args...;
end
end

# Extension package only supported in 1.9+, but Enzyme doesn't yet support Julia 1.12
@static if v"1.9" <= VERSION < v"1.12"
# Extension package only supported in 1.9+
@static if v"1.9" <= VERSION

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be bumped?

Suggested change
@static if v"1.9" <= VERSION
@static if v"1.10" <= VERSION

using Enzyme
f1(x) = quadgk(cos, 0., x)[1]
f2(x) = quadgk(cos, x, 1)[1]
Expand Down
Loading