diff --git a/docs/src/api.md b/docs/src/api.md index b4f007fea8..7bd78fe826 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -14,6 +14,10 @@ Modules = [Enzyme, EnzymeCore, EnzymeCore.EnzymeRules, EnzymeTestUtils, Enzyme.A Order = [:macro, :function] ``` +```@docs +Enzyme.Compiler.recursive_accumulate +``` + ## Documentation ```@autodocs diff --git a/src/compiler.jl b/src/compiler.jl index 32dd293ece..5825c8a6ab 100644 --- a/src/compiler.jl +++ b/src/compiler.jl @@ -8732,8 +8732,13 @@ end end end +""" + recursive_accumulate(x, y, f=identity) + +Recursive in-place accumulation that generalizes `x .+= f(y)` beyond arrays. +""" +function recursive_accumulate end -# Recursively In-place accumulate(aka +=). E.g. generalization of x .+= f(y) @inline function recursive_accumulate(x::Core.Box, y::Core.Box, f::F = identity) where {F} recursive_accumulate(x.contents, y.contents, seen, f) end