32 #ifndef REMORA_KERNELS_CLBLAST_TRSV_HPP 33 #define REMORA_KERNELS_CLBLAST_TRSV_HPP 35 #include "../../expression_types.hpp" 36 #include "../../detail/traits.hpp" 38 namespace remora{
namespace kernels{
41 template <
class Triangular,
class S
ide,
typename MatA,
typename VecB>
43 matrix_expression<MatA, gpu_tag>
const& A,
44 vector_expression<VecB, gpu_tag>& b
46 REMORA_SIZE_CHECK(A().size1() == A().size2());
47 REMORA_SIZE_CHECK(A().size1() == b().size());
49 static_assert(std::is_same<typename MatA::value_type, typename VecB::value_type>::value,
"[trsv] Arguments do not have same element type");
50 static_assert(std::is_same<typename MatA::evaluation_category::tag, dense_tag>::value,
"[trsv] A is not dense");
51 static_assert(std::is_base_of<dense_tag, typename VecB::storage_type::storage_tag>::value,
"[trsv] b 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 = Triangular::is_upper? Triangle::kUpper : Triangle::kLower;
61 auto diagonal = Triangular::is_unit? Diagonal::kUnit : Diagonal::kNonUnit;
64 layout = (layout == Layout::kRowMajor) ? Layout::kColMajor : Layout::kRowMajor;
65 triangular = Triangular::is_upper? Triangle::kLower : Triangle::kUpper;
67 std::size_t n = A().size1();
70 auto storageA = Aeval.raw_storage();
71 auto storageb = b().raw_storage();
73 cl_event*
event =
nullptr;
74 auto code = Trsv<typename VecB::value_type>(layout, triangular, Transpose::kNo , diagonal,
76 storageA.buffer.get(), storageA.offset, storageA.leading_dimension,
77 storageb.buffer.get(), storageb.offset, storageb.stride,
78 &b().queue().get(), event
80 assert(code == StatusCode::kSuccess);