From abdc6e37bf25c944c868cd7567f2cf56a5efa86f Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Thu, 14 May 2026 12:28:52 -0700 Subject: [PATCH] Don't wrap lambdas pointlessly repeat_edge(imageparam) has *two* wrapper Funcs around it. The imageparam comes with one (accessible via its implicit cast to Func operator), and then because it's not exactly a Func, the boundary condition helper adds another one. This commit changes the boundary condition helper to use a class's existing implicit conversion to a Func if there is one, avoiding the pointless extra Func. The else case is still necessary because a Halide::Buffer can be accessed like a Func, but not implicitly cast to a Func. --- src/BoundaryConditions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BoundaryConditions.h b/src/BoundaryConditions.h index 2b3d2a26855b..7f29a4c911e3 100644 --- a/src/BoundaryConditions.h +++ b/src/BoundaryConditions.h @@ -64,7 +64,7 @@ inline HALIDE_NO_USER_CODE_INLINE void collect_region(Region &collected_args, template Func func_like_to_func(T &&func_like) { - if constexpr (std::is_same_v, Func>) { + if constexpr (std::is_convertible_v) { return std::forward(func_like); } else { return lambda(_, func_like(_));