From 61a4e058ee8c003d870245e10b33df93fcf726b4 Mon Sep 17 00:00:00 2001 From: Dennis Yatunin Date: Wed, 18 Sep 2024 14:53:46 -0700 Subject: [PATCH] Try rewriting val_unrolled_reduce using assignment form --- src/generatively_unrolled_functions.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/generatively_unrolled_functions.jl b/src/generatively_unrolled_functions.jl index 45cb9fd..d28cd23 100644 --- a/src/generatively_unrolled_functions.jl +++ b/src/generatively_unrolled_functions.jl @@ -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),