Skip to content

Commit

Permalink
fix dispatching
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Razdoburdin committed Nov 21, 2023
1 parent 49ddce9 commit 0196219
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/xgboost/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,16 @@ struct Context : public XGBoostParameter<Context> {
*/
template <typename CPUFn, typename CUDAFn, typename SYCLFn>
decltype(auto) DispatchDevice(CPUFn&& cpu_fn, CUDAFn&& cuda_fn, SYCLFn&& sycl_fn) const {
static_assert(std::is_same_v<std::invoke_result_t<CPUFn>, std::invoke_result_t<CUDAFn>>);
#if defined(XGBOOST_USE_SYCL)
static_assert(std::is_same_v<std::invoke_result_t<CPUFn>, std::invoke_result_t<SYCLFn>>);
#endif // defined(XGBOOST_USE_SYCL)
if (this->Device().IsSycl()) {
return sycl_fn();
} else {
return DispatchDevice(cpu_fn, cuda_fn);
}
#else
return DispatchDevice(cpu_fn, cuda_fn);
#endif // defined(XGBOOST_USE_SYCL)
}

// declare parameters
Expand Down

0 comments on commit 0196219

Please sign in to comment.