-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SYCL. Unify calculations for objectives reg:absoluteerror, reg:quantileerror, binary:hinge #10993
base: master
Are you sure you want to change the base?
Conversation
template<typename Fn, typename TupleType, size_t ... I> | ||
auto call(Fn&& fn, TupleType t, std::index_sequence<I ...>) { | ||
return fn(std::get<I>(t) ...); | ||
} | ||
|
||
template<typename Fn, typename TupleType> | ||
auto call(Fn&& fn, TupleType t) { | ||
static constexpr auto size = std::tuple_size<TupleType>::value; | ||
return call(fn, t, std::make_index_sequence<size>{}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just std::apply
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but std::apply
can not be executed in sycl-kernel.
src/objective/objective.cc
Outdated
@@ -48,7 +48,7 @@ std::string ObjFunction::GetSyclImplementationName(const std::string& name) { | |||
return name + sycl_postfix; | |||
} else { | |||
// Function hasn't specific sycl implementation | |||
LOG(FATAL) << "`" << name << "` doesn't have sycl implementation yet\n"; | |||
// LOG(FATAL) << "`" << name << "` doesn't have sycl implementation yet\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the commented code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/common/linalg_op.h
Outdated
@@ -49,6 +49,7 @@ void ElementWiseKernelHost(linalg::TensorView<T, D> t, std::int32_t n_threads, F | |||
} | |||
|
|||
#if !defined(XGBOOST_USE_CUDA) | |||
#if !defined(XGBOOST_USE_SYCL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if !(use_cuda or use_sycl)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -45,7 +45,7 @@ namespace { | |||
template <typename Fn> | |||
PackedReduceResult Reduce(Context const* ctx, MetaInfo const& info, Fn&& loss) { | |||
PackedReduceResult result; | |||
auto labels = info.labels.View(ctx->Device()); | |||
auto labels = info.labels.View(ctx->Device().IsSycl() ? DeviceOrd::CPU() : ctx->Device()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you want to use IsCPU
instead of IsSycl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This function doesn't have sycl-specific implementation yet. So for the proper execution on cpu
the data should be transferred back to host.
I plan to add sycl-implementation for it in the future. Didn't do it by single PR just to avoid unreadable PR size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will merge once the CI is green.
Hi, I work on unification of sycl-plugin with the main part of the framework.
This PR unify calculations for some objective functions:
reg:absoluteerror
,reg:quantileerror
andbinary:hinge
The procedure of unification occurs in the following way:
linalg::ElementWiseKernel
the sycl realisation is used.