Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions plugin/sycl/common/linalg_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ void SmallHistogram(Context const* ctx, xgboost::linalg::MatrixView<float const>
}).wait();
}

void VecScaMul(Context const* ctx, xgboost::linalg::VectorView<float> x, double mul) {
sycl::DeviceManager device_manager;
auto* qu = device_manager.GetQueue(ctx->Device());

template <typename T>
void VecScaMul(::sycl::queue* qu, xgboost::linalg::VectorView<float> x, T mul) {
qu->submit([&](::sycl::handler& cgh) {
cgh.parallel_for<>(::sycl::range<1>(x.Size()),
[=](::sycl::id<1> pid) {
Expand All @@ -47,6 +45,15 @@ void VecScaMul(Context const* ctx, xgboost::linalg::VectorView<float> x, double

namespace xgboost::linalg::sycl_impl {
void VecScaMul(Context const* ctx, xgboost::linalg::VectorView<float> x, double mul) {
xgboost::sycl::linalg::VecScaMul(ctx, x, mul);
sycl::DeviceManager device_manager;
auto* qu = device_manager.GetQueue(ctx->Device());

bool has_fp64_support = qu->get_device().has(::sycl::aspect::fp64);
if (has_fp64_support) {
xgboost::sycl::linalg::VecScaMul(qu, x, mul);
} else {
float mul_fp32 = mul;
xgboost::sycl::linalg::VecScaMul(qu, x, mul_fp32);
}
}
} // namespace xgboost::linalg::sycl_impl
Loading