32 #ifndef REMORA_KERNELS_CLBLAST_TRMV_HPP 33 #define REMORA_KERNELS_CLBLAST_TRMV_HPP 35 #include "../../expression_types.hpp" 36 #include "../../detail/traits.hpp" 38 namespace remora{
namespace kernels{
41 template <
bool Upper,
bool Unit,
typename MatA,
typename VecV>
43 matrix_expression<MatA, gpu_tag>
const& A,
44 vector_expression<VecV, gpu_tag>& v
46 REMORA_SIZE_CHECK(A().size1() == A().size2());
47 REMORA_SIZE_CHECK(A().size2() == v().size());
49 static_assert(std::is_same<typename MatA::value_type, typename VecV::value_type>::value,
"[trmv] Arguments do not have same element type");
50 static_assert(std::is_same<typename MatA::evaluation_category::tag, dense_tag>::value,
"[trmv] A is not dense");
51 static_assert(std::is_base_of<dense_tag, typename VecV::storage_type::storage_tag>::value,
"[trmv] v does not have dense storage layout");
54 auto const& Aeval = eval_expression(A);
56 using namespace clblast;
59 auto layout = std::is_same<typename MatA::orientation::orientation, row_major>::value? Layout::kRowMajor : Layout::kColMajor;
60 auto triangular = Upper? Triangle::kUpper : Triangle::kLower;
61 auto diagonal = Unit? Diagonal::kUnit : Diagonal::kNonUnit;
62 std::size_t n = A().size1();
65 auto storageA = Aeval.raw_storage();
66 auto storagev = v().raw_storage();
68 cl_event*
event =
nullptr;
69 auto code = Trmv<typename VecV::value_type>(layout, triangular, Transpose::kNo, diagonal,
71 storageA.buffer.get(), storageA.offset, storageA.leading_dimension,
72 storagev.buffer.get(), storagev.offset, storagev.stride,
73 &v().queue().get(), event
75 assert(code == StatusCode::kSuccess);