@@ -192,6 +192,18 @@ launch_policy(dim3, dim3, Ts...) -> launch_policy<
192192 detail::has_type<local_mem_size, std::tuple<Ts...>>::value>;
193193
194194namespace detail {
195+ // Custom std::apply helpers to enable inlining
196+ template <class F , class Tuple , size_t ... Is>
197+ __syclcompat_inline__ constexpr void
198+ apply_expand (F f, Tuple t, std::index_sequence<Is...>) {
199+ [[clang::always_inline]] f (get<Is>(t)...);
200+ }
201+
202+ template <class F , class Tuple >
203+ __syclcompat_inline__ constexpr void
204+ apply_helper (F f, Tuple t) {
205+ apply_expand (f, t, std::make_index_sequence<std::tuple_size<Tuple>{}>{});
206+ }
195207
196208template <auto F, typename Range, typename KProps, bool HasLocalMem,
197209 typename ... Args>
@@ -212,11 +224,11 @@ struct KernelFunctor {
212224 if constexpr (HasLocalMem) {
213225 char *local_mem_ptr = static_cast <char *>(
214226 _local_acc.template get_multi_ptr <sycl::access::decorated::no>().get ());
215- std::apply (
216- [lmem_ptr = local_mem_ptr](auto &&...args ) { F (args..., lmem_ptr); },
217- _argument_tuple);
227+ apply_helper (
228+ [lmem_ptr = local_mem_ptr](auto &&...args ) { [[clang::always_inline]] F (args..., lmem_ptr); },
229+ _argument_tuple);
218230 } else {
219- std::apply ([](auto &&...args ) { F (args...); }, _argument_tuple);
231+ apply_helper ([](auto &&...args ) { [[clang::always_inline]] F (args...); }, _argument_tuple);
220232 }
221233 }
222234
0 commit comments