mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Make GEMM fallback to GEMV for runtime vectors.
This is a more general and simpler version of changeset 4c0fa6ce0f81ce67dd6723528ddf72f66ae92ba2
This commit is contained in:
parent
fa2fcb4895
commit
013cc3a6b3
@ -469,6 +469,20 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemmProduct>
|
|||||||
if(a_lhs.cols()==0 || a_lhs.rows()==0 || a_rhs.cols()==0)
|
if(a_lhs.cols()==0 || a_lhs.rows()==0 || a_rhs.cols()==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Fallback to GEMV if either the lhs or rhs is a runtime vector
|
||||||
|
if (dst.cols() == 1)
|
||||||
|
{
|
||||||
|
typename Dest::ColXpr dst_vec(dst.col(0));
|
||||||
|
return internal::generic_product_impl<Lhs,typename Rhs::ConstColXpr,DenseShape,DenseShape,GemvProduct>
|
||||||
|
::scaleAndAddTo(dst_vec, a_lhs, a_rhs.col(0), alpha);
|
||||||
|
}
|
||||||
|
else if (dst.rows() == 1)
|
||||||
|
{
|
||||||
|
typename Dest::RowXpr dst_vec(dst.row(0));
|
||||||
|
return internal::generic_product_impl<typename Lhs::ConstRowXpr,Rhs,DenseShape,DenseShape,GemvProduct>
|
||||||
|
::scaleAndAddTo(dst_vec, a_lhs.row(0), a_rhs, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(a_lhs);
|
typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(a_lhs);
|
||||||
typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(a_rhs);
|
typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(a_rhs);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user