From 655ec30acb00b99f5db3d5be36113ce828bcc534 Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Sat, 30 Nov 2024 19:32:14 -0500 Subject: [PATCH] fixup --- src/analyses/activity.jl | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/analyses/activity.jl b/src/analyses/activity.jl index 10aebb46cd..dc89034352 100644 --- a/src/analyses/activity.jl +++ b/src/analyses/activity.jl @@ -15,7 +15,7 @@ end @inline element(::Val{T}) where {T} = T -@inline function (c::Merger{seen,worldT,justActive,UnionSret,AbstractIsMixed})( +Base.@assume_effects :removable :foldable :nothrow @inline function (c::Merger{seen,worldT,justActive,UnionSret,AbstractIsMixed})( f::Int, ) where {seen,worldT,justActive,UnionSret,AbstractIsMixed} T = element(first(seen)) @@ -60,9 +60,9 @@ end end end -@inline forcefold(::Val{RT}) where {RT} = RT +Base.@assume_effects :removable :foldable :nothrow @inline forcefold(::Val{RT})::ActivityState where {RT} = RT -@inline function forcefold(::Val{ty}, ::Val{sty}, C::Vararg{Any,N}) where {ty,sty,N} +Base.@assume_effects :removable :foldable :nothrow @inline function forcefold(::Val{ty}, ::Val{sty}, C::Vararg{Any,N})::ActivityState where {ty,sty,N} if sty == AnyState || sty == ty return forcefold(Val(ty), C...) end @@ -107,25 +107,25 @@ else @inline is_arrayorvararg_ty(::Type{Memory{T}}) where T = true end -@inline function datatype_fieldcount(t::Type{T}) where {T} +@inline function datatype_fieldcount(t::Type{T})::Int where {T} return Base.datatype_fieldcount(t) end -@inline function staticInTup(::Val{T}, tup::NTuple{N,Val}) where {T,N} +Base.@assume_effects :removable :foldable :nothrow @inline function staticInTup(::Val{T}, tup::NTuple{N,Val})::Bool where {T,N} any(ntuple(Val(N)) do i Base.@_inline_meta Val(T) == tup[i] end) end -@inline function active_reg_recur( +Base.@assume_effects :removable :foldable :nothrow @inline function active_reg_recur( ::Type{ST}, seen::Seen, world, ::Val{justActive}, ::Val{UnionSret}, ::Val{AbstractIsMixed}, -) where {ST,Seen,justActive,UnionSret,AbstractIsMixed} +)::ActivityState where {ST,Seen,justActive,UnionSret,AbstractIsMixed} if ST isa Union return forcefold( Val( @@ -163,7 +163,7 @@ end @inline is_vararg_tup(x) = false @inline is_vararg_tup(::Type{Tuple{Vararg{T2}}}) where {T2} = true -@inline function active_reg_inner( +Base.@assume_effects :removable :foldable :nothrow @inline function active_reg_inner( ::Type{T}, seen::ST, world::Union{Nothing,UInt}, @@ -383,11 +383,11 @@ end return ty end -@inline @generated function active_reg_nothrow(::Type{T}, ::Val{world}) where {T,world} +Base.@assume_effects :removable :foldable :nothrow @inline @generated function active_reg_nothrow(::Type{T}, ::Val{world})::ActivityState where {T,world} return active_reg_inner(T, (), world) end -Base.@pure @inline function active_reg( +Base.@assume_effects :removable :foldable :nothrow @inline function active_reg( ::Type{T}, world::Union{Nothing,UInt} = nothing, )::Bool where {T} @@ -411,13 +411,13 @@ Base.@pure @inline function active_reg( end end -@inline function guaranteed_const(::Type{T}) where {T} +Base.@assume_effects :removable :foldable :nothrow @inline function guaranteed_const(::Type{T})::Bool where {T} rt = active_reg_nothrow(T, Val(nothing)) res = rt == AnyState return res end -@inline function guaranteed_const_nongen(::Type{T}, world) where {T} +Base.@assume_effects :removable :foldable :nothrow @inline function guaranteed_const_nongen(::Type{T}, world)::Bool where {T} rt = active_reg_inner(T, (), world) res = rt == AnyState return res @@ -425,7 +425,7 @@ end # check if a value is guaranteed to be not contain active[register] data # (aka not either mixed or active) -@inline function guaranteed_nonactive(::Type{T}) where {T} +Base.@assume_effects :removable :foldable :nothrow @inline function guaranteed_nonactive(::Type{T})::Bool where {T} rt = Enzyme.Compiler.active_reg_nothrow(T, Val(nothing)) return rt == Enzyme.Compiler.AnyState || rt == Enzyme.Compiler.DupState end @@ -435,10 +435,10 @@ end Try to guess the most appropriate [`Annotation`](@ref) for arguments of type `T` passed to [`autodiff`](@ref) with a given `mode`. """ -@inline Enzyme.guess_activity(::Type{T}, mode::Enzyme.Mode) where {T} = +Base.@assume_effects :removable :foldable :nothrow @inline Enzyme.guess_activity(::Type{T}, mode::Enzyme.Mode) where {T} = guess_activity(T, convert(API.CDerivativeMode, mode)) -@inline function Enzyme.guess_activity(::Type{T}, Mode::API.CDerivativeMode) where {T} +Base.@assume_effects :removable :foldable :nothrow @inline function Enzyme.guess_activity(::Type{T}, Mode::API.CDerivativeMode) where {T} ActReg = active_reg_nothrow(T, Val(nothing)) if ActReg == AnyState return Const{T}