Skip to content

Commit

Permalink
Try rewriting val_unrolled_reduce using assignment form
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisYatunin committed Sep 18, 2024
1 parent 930e798 commit 61a4e05
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/generatively_unrolled_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ end
# also causes compilation to hang. Even using the assignment form of the first
# method definition below (as opposed to the function syntax used here) causes
# it to hang. This has not yet been replicated in a minimal working example.
@generated function val_unrolled_reduce(op, ::Val{N}, init) where {N}
return foldl((:init, 1:N...)) do prev_op_expr, item_expr
@generated val_unrolled_reduce(op, ::Val{N}, init) where {N} =
foldl((:init, 1:N...)) do prev_op_expr, item_expr
:(op($prev_op_expr, $item_expr))
end
end
@generated val_unrolled_reduce(op, ::Val{N}, ::NoInit) where {N} = Expr(
:block,
Expr(:meta, :inline),
Expand Down

0 comments on commit 61a4e05

Please sign in to comment.