From 55227a33c3c60db0afef5efc92ba22d70dd07718 Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Sat, 23 May 2026 10:06:44 -0500 Subject: [PATCH] Handle inactive methods --- src/internal_rules/inactive.jl | 6 ++++++ src/typeutils/make_zero.jl | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/internal_rules/inactive.jl b/src/internal_rules/inactive.jl index 93449cf779..fee228511e 100644 --- a/src/internal_rules/inactive.jl +++ b/src/internal_rules/inactive.jl @@ -129,6 +129,12 @@ end function EnzymeRules.inactive_noinl(::typeof(Base.dataids), args...) return nothing end +function EnzymeRules.inactive_noinl(::typeof(Base.signature_type), args...) + return nothing +end +function EnzymeRules.inactive_noinl(::typeof(Base.methods), args...) + return nothing +end @inline EnzymeRules.inactive_type(v::Type{Nothing}) = true @inline EnzymeRules.inactive_type(v::Type{Union{}}) = true diff --git a/src/typeutils/make_zero.jl b/src/typeutils/make_zero.jl index 75c497eb7f..2b82bf8b54 100644 --- a/src/typeutils/make_zero.jl +++ b/src/typeutils/make_zero.jl @@ -197,6 +197,24 @@ end return res end +@inline function EnzymeCore.make_zero( + ::Type{Core.SimpleVector}, + seen::IdDict, + prev::Core.SimpleVector, + ::Val{copy_if_inactive} = Val(false), + )::Core.SimpleVector where {copy_if_inactive} + if haskey(seen, prev) + return seen[prev] + end + data = [] + for v in prev + push!(data, EnzymeCore.make_zero(Core.Typeof(v), seen, v, Val(copy_if_inactive))) + end + newa = Core.svec(data) + seen[prev] = newa + return newa +end + @inline function EnzymeCore.make_zero( ::Type{RT}, seen::IdDict,