Skip to content

Commit 657f502

Browse files
authored
[RNG] Make host task parameter be forwarding reference (#664)
1 parent 3f8f4f3 commit 657f502

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/rng/backends/mklcpu/cpu_common.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
3636
template <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

4141
template <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

4848
template <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

5353
template <typename Engine, typename Distr>

0 commit comments

Comments
 (0)