33#include <pybind11/pybind11.h>
35#include "dot_common.hpp"
37namespace dpnp::extensions::blas
39namespace mkl_blas = oneapi::mkl::blas;
40namespace type_utils = dpnp::tensor::type_utils;
41namespace py = pybind11;
44static sycl::event dot_impl(sycl::queue &exec_q,
47 const std::int64_t incx,
49 const std::int64_t incy,
51 const std::vector<sycl::event> &depends)
53 type_utils::validate_type_for_device<T>(exec_q);
55 const T *x =
reinterpret_cast<const T *
>(vectorX);
56 const T *y =
reinterpret_cast<const T *
>(vectorY);
57 T *res =
reinterpret_cast<T *
>(result);
59 std::stringstream error_msg;
60 bool is_exception_caught =
false;
62 sycl::event dot_event;
66 py::gil_scoped_release lock{};
68 dot_event = mkl_blas::column_major::dot(exec_q,
76 }
catch (oneapi::mkl::exception
const &e) {
78 <<
"Unexpected MKL exception caught during dot() call:\nreason: "
80 is_exception_caught =
true;
81 }
catch (sycl::exception
const &e) {
82 error_msg <<
"Unexpected SYCL exception caught during dot() call:\n"
84 is_exception_caught =
true;
87 if (is_exception_caught)
89 throw std::runtime_error(error_msg.str());
95template <
typename fnT,
typename varT>
101 return dot_impl<varT>;
A factory to define pairs of supported types for which MKL BLAS library provides support in oneapi::m...