@@ -506,60 +506,35 @@ function autodiff_thunk end
506506function autodiff_deferred_thunk end
507507
508508"""
509- make_zero(
510- prev::T, ::Val{copy_if_inactive}=Val(false), ::Val{runtime_inactive}=Val(false)
511- )::T
512- make_zero(
513- ::Type{T},
514- seen::IdDict,
515- prev::T,
516- ::Val{copy_if_inactive}=Val(false),
517- ::Val{runtime_inactive}=Val(false),
518- )::T
509+ make_zero(prev::T, ::Val{copy_if_inactive}=Val(false))::T
510+ make_zero(::Type{T}, seen::IdDict, prev::T, ::Val{copy_if_inactive}=Val(false))::T
519511
520512Recursively make a copy of the value `prev::T` in which all differentiable values are
521513zeroed. The argument `copy_if_inactive` specifies what to do if the type `T` or any
522514of its constituent parts is guaranteed to be inactive (non-differentiable): reuse `prev`s
523515instance (the default) or make a copy.
524516
525- The argument `runtime_inactive` specifies whether each constituent type is checked for being
526- guaranteed inactive at runtime for every call to `make_zero`, or if this can be checked once
527- at compile-time and reused across multiple calls to `make_zero` and related functions (the
528- default). Runtime checks are necessary to pick up recently added methods to
529- `EnzymeRules.inactive_type`, but may incur a significant performance penalty and is usually
530- not needed unless `EnzymeRules.inactive_type` is extended interactively for types that have
531- previously been passed to `make_zero` or related functions.
532-
533517Extending this method for custom types is rarely needed. If you implement a new type, such
534- as a GPU array type, for which `make_zero` should directly invoke `zero` rather than
535- iterate/broadcast when the eltype is scalar, it is sufficient to implement `Base.zero` and
536- make sure your type subtypes `DenseArray`. (If subtyping `DenseArray` is not appropriate,
537- extend [`EnzymeCore.isvectortype`](@ref) directly instead.)
518+ as a GPU array type, on which `make_zero` should directly invoke `zero` when the eltype is
519+ scalar, it is sufficient to implement `Base.zero` and make sure your type subtypes
520+ `DenseArray`. (If subtyping `DenseArray` is not appropriate, extend
521+ [`EnzymeCore.isvectortype`](@ref) instead.)
538522"""
539523function make_zero end
540524
541525"""
542- make_zero!(val::T, [seen::IdDict], ::Val{runtime_inactive}=Val(false) )::Nothing
526+ make_zero!(val::T, [seen::IdDict])::Nothing
543527
544528Recursively set a variable's differentiable values to zero. Only applicable for types `T`
545529that are mutable or hold all differentiable values in mutable storage (e.g.,
546530`Tuple{Vector{Float64}}` qualifies but `Tuple{Float64}` does not). The recursion skips over
547531parts of `val` that are guaranteed to be inactive.
548532
549- The argument `runtime_inactive` specifies whether each constituent type is checked for being
550- guaranteed inactive at runtime for every call to `make_zero!`, or if this can be checked once
551- at compile-time and reused across multiple calls to `make_zero!` and related functions (the
552- default). Runtime checks are necessary to pick up recently added methods to
553- `EnzymeRules.inactive_type`, but may incur a significant performance penalty and is usually
554- not needed unless `EnzymeRules.inactive_type` is extended interactively for types that have
555- previously been passed to `make_zero!` or related functions.
556-
557533Extending this method for custom types is rarely needed. If you implement a new mutable
558- type, such as a GPU array type, for which `make_zero!` should directly invoke
559- `fill!(x, false)` rather than iterate/broadcast when the eltype is scalar, it is sufficient
560- to implement `Base.zero`, `Base.fill!`, and make sure your type subtypes `DenseArray`. (If
561- subtyping `DenseArray` is not appropriate, extend [`EnzymeCore.isvectortype`](@ref) directly
562- instead.)
534+ type, such as a GPU array type, on which `make_zero!` should directly invoke
535+ `fill!(x, false)` when the eltype is scalar, it is sufficient to implement `Base.zero`,
536+ `Base.fill!`, and make sure your type subtypes `DenseArray`. (If subtyping `DenseArray` is
537+ not appropriate, extend [`EnzymeCore.isvectortype`](@ref) instead.)
563538"""
564539function make_zero! end
565540
@@ -569,7 +544,7 @@ function make_zero! end
569544Trait defining types whose values should be considered leaf nodes when [`make_zero`](@ref)
570545and [`make_zero!`](@ref) recurse through an object.
571546
572- By default, `isvectortype(T) == true` for `T` such that ` isscalartype(T) == true` or
547+ By default, `isvectortype(T) == true` when ` isscalartype(T) == true` or when
573548`T <: DenseArray{U}` where `U` is a bitstype and `isscalartype(U) == true`.
574549
575550A new vector type, such as a GPU array type, should normally subtype `DenseArray` and
@@ -607,7 +582,7 @@ in-place mutation through any Julia API; `isscalartype(BigFloat) == true` ensure
607582`make_zero!` will not try to mutate `BigFloat` values.[^BigFloat]
608583
609584By default, `isscalartype(T) == true` and `isscalartype(Complex{T}) == true` for concrete
610- `T <: AbstractFloat`.
585+ types `T <: AbstractFloat`.
611586
612587A hypothetical new real number type with Enzyme support should usually subtype
613588`AbstractFloat` and inherit the `isscalartype` trait that way. If this is not appropriate,
0 commit comments