@@ -34,20 +34,20 @@ namespace mklcpu {
3434// host_task automatically uses run_on_host_intel if it is supported by the
3535// compiler. Otherwise, it falls back to single_task.
3636template <typename K, typename H, typename F>
37- static inline auto host_task_internal (H& cgh, F f, int ) -> decltype(cgh.host_task(f) ) {
38- return cgh.host_task (f );
37+ static inline auto host_task_internal (H& cgh, F&& f, int ) {
38+ return cgh.host_task (std::forward<F>(f) );
3939}
4040
4141template <typename K, typename H, typename F>
42- static inline void host_task_internal (H& cgh, F f, long ) {
42+ static inline void host_task_internal (H& cgh, F&& f, long ) {
4343#ifndef __SYCL_DEVICE_ONLY__
44- cgh.template single_task <K>(f );
44+ cgh.template single_task <K>(std::forward<F>(f) );
4545#endif
4646}
4747
4848template <typename K, typename H, typename F>
49- static inline void host_task (H& cgh, F f) {
50- (void )host_task_internal<K>(cgh, f , 0 );
49+ static inline void host_task (H& cgh, F&& f) {
50+ (void )host_task_internal<K>(cgh, std::forward<F>(f) , 0 );
5151}
5252
5353template <typename Engine, typename Distr>
0 commit comments