From 829504289afe7215746011a1e4eaeb4c20b71078 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 3 Dec 2026 10:45:19 +0100 Subject: [PATCH 1/2] fn naive backend: allocate temporaries without zero-initialization std::make_unique value-initializes, which zero-fills every temporary serially on each call. --- include/gridtools/fn/backend/naive.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/gridtools/fn/backend/naive.hpp b/include/gridtools/fn/backend/naive.hpp index f4cb34bee..b934afe5f 100644 --- a/include/gridtools/fn/backend/naive.hpp +++ b/include/gridtools/fn/backend/naive.hpp @@ -9,6 +9,9 @@ */ #pragma once +#include +#include + #include "../../common/functional.hpp" #include "../../common/hymap.hpp" #include "../../common/tuple_util.hpp" @@ -90,7 +93,8 @@ namespace gridtools::fn::backend { template inline auto tmp_allocator(naive_with_threadpool be) { - return std::make_tuple(be, sid::allocator(&std::make_unique)); + return std::make_tuple( + be, sid::allocator([](std::size_t n) { return std::unique_ptr(new char[n]); })); } template From 47c2a064dc0c2ba4391f83280693ab4fe2bdbfd6 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 3 Dec 2026 10:45:26 +0100 Subject: [PATCH 2/2] fn naive backend: reuse temporaries via sid::cached_allocator --- include/gridtools/fn/backend/naive.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gridtools/fn/backend/naive.hpp b/include/gridtools/fn/backend/naive.hpp index b934afe5f..43b54f79e 100644 --- a/include/gridtools/fn/backend/naive.hpp +++ b/include/gridtools/fn/backend/naive.hpp @@ -94,7 +94,7 @@ namespace gridtools::fn::backend { template inline auto tmp_allocator(naive_with_threadpool be) { return std::make_tuple( - be, sid::allocator([](std::size_t n) { return std::unique_ptr(new char[n]); })); + be, sid::cached_allocator([](std::size_t n) { return std::unique_ptr(new char[n]); })); } template