12 #ifndef PLSSVM_BACKENDS_SYCL_PREDICT_KERNEL_HPP_
13 #define PLSSVM_BACKENDS_SYCL_PREDICT_KERNEL_HPP_
19 #include "sycl/sycl.hpp"
45 w_d_{ w_d }, data_d_{ data_d }, data_last_d_{ data_last_d }, alpha_d_{ alpha_d }, num_data_points_{ num_data_points }, num_features_{ num_features } {}
54 if (index < num_features_) {
58 temp += alpha_d_[num_data_points_ - 1] * data_last_d_[index];
100 device_kernel_predict_polynomial(
real_type *out_d,
const real_type *data_d,
const real_type *data_last_d,
const real_type *alpha_d,
const kernel_index_type num_data_points,
const real_type *points,
const kernel_index_type num_predict_points,
const kernel_index_type num_features,
const int degree,
const real_type gamma,
const real_type coef0) :
101 out_d_{ out_d }, data_d_{ data_d }, data_last_d_{ data_last_d }, alpha_d_{ alpha_d }, num_data_points_{ num_data_points }, points_{ points }, num_predict_points_{ num_predict_points }, num_features_{ num_features }, degree_{ degree }, gamma_{ gamma }, coef0_{ coef0 } {}
112 if (predict_point_index < num_predict_points_) {
113 for (
kernel_index_type feature_index = 0; feature_index < num_features_; ++feature_index) {
114 if (data_point_index == num_data_points_ - 1) {
121 temp = alpha_d_[data_point_index] * ::sycl::pow(gamma_ * temp + coef0_,
static_cast<real_type>(degree_));
148 template <
typename T>
168 out_d_{ out_d }, data_d_{ data_d }, data_last_d_{ data_last_d }, alpha_d_{ alpha_d }, num_data_points_{ num_data_points }, points_{ points }, num_predict_points_{ num_predict_points }, num_features_{ num_features }, gamma_{ gamma } {}
179 if (predict_point_index < num_predict_points_) {
180 for (
kernel_index_type feature_index = 0; feature_index < num_features_; ++feature_index) {
181 if (data_point_index == num_data_points_ - 1) {
188 temp = alpha_d_[data_point_index] * ::sycl::exp(-gamma_ * temp);
Defines an atomic_ref wrapper for the SYCL backend.
Predicts the labels for data points using the polynomial kernel function.
Definition: predict_kernel.hpp:80
device_kernel_predict_polynomial(real_type *out_d, const real_type *data_d, const real_type *data_last_d, const real_type *alpha_d, const kernel_index_type num_data_points, const real_type *points, const kernel_index_type num_predict_points, const kernel_index_type num_features, const int degree, const real_type gamma, const real_type coef0)
Construct a new device kernel to predict the labels for data points using the polynomial kernel funct...
Definition: predict_kernel.hpp:100
void operator()(::sycl::nd_item< 2 > idx) const
Function call operator overload performing the actual calculation.
Definition: predict_kernel.hpp:107
T real_type
The type of the data.
Definition: predict_kernel.hpp:83
Predicts the labels for data points using the radial basis functions kernel function.
Definition: predict_kernel.hpp:149
void operator()(::sycl::nd_item< 2 > idx) const
Function call operator overload performing the actual calculation.
Definition: predict_kernel.hpp:174
T real_type
The type of the data.
Definition: predict_kernel.hpp:152
device_kernel_predict_rbf(real_type *out_d, const real_type *data_d, const real_type *data_last_d, const real_type *alpha_d, const kernel_index_type num_data_points, const real_type *points, const kernel_index_type num_predict_points, const kernel_index_type num_features, const real_type gamma)
Construct a new device kernel to predict the labels for data points using the radial basis function k...
Definition: predict_kernel.hpp:167
Calculate the w vector to speed up the prediction of the labels for data points using the linear kern...
Definition: predict_kernel.hpp:29
void operator()(::sycl::id< 1 > index) const
Function call operator overload performing the actual calculation.
Definition: predict_kernel.hpp:52
device_kernel_w_linear(real_type *w_d, const real_type *data_d, const real_type *data_last_d, const real_type *alpha_d, const kernel_index_type num_data_points, const kernel_index_type num_features)
Construct a new device kernel generating the w vector used to speedup the prediction when using the l...
Definition: predict_kernel.hpp:44
T real_type
The type of the data.
Definition: predict_kernel.hpp:32
Global type definitions and compile-time constants.
Namespace containing the C-SVM using the SYCL backend with the preferred SYCL implementation....
Definition: atomics.hpp:18
::sycl::atomic_ref< T, ::sycl::memory_order::relaxed, ::sycl::memory_scope::device, ::sycl::access::address_space::global_space > atomic_op
Shortcut alias for a sycl::atomic_ref targeting global memory.
Definition: atomics.hpp:25
constexpr kernel_index_type THREAD_BLOCK_SIZE
Global compile-time constant used for internal caching. May be changed during the CMake configuration...
Definition: constants.hpp:25
int kernel_index_type
Integer type used inside kernels.
Definition: constants.hpp:19
constexpr kernel_index_type INTERNAL_BLOCK_SIZE
Global compile-time constant used for internal caching. May be changed during the CMake configuration...
Definition: constants.hpp:32