mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Make sure that micro-panel-size is smaller than blocking sizes (otherwise we might get a buffer overflow)
This commit is contained in:
parent
5b0a9ee003
commit
aa8c6a251e
@ -126,6 +126,10 @@ EIGEN_DONT_INLINE void product_triangular_matrix_matrix<Scalar,Index,Mode,true,
|
|||||||
|
|
||||||
Index kc = blocking.kc(); // cache block size along the K direction
|
Index kc = blocking.kc(); // cache block size along the K direction
|
||||||
Index mc = (std::min)(rows,blocking.mc()); // cache block size along the M direction
|
Index mc = (std::min)(rows,blocking.mc()); // cache block size along the M direction
|
||||||
|
// The small panel size must not be larger than blocking size.
|
||||||
|
// Usually this should never be the case because SmallPanelWidth^2 is very small
|
||||||
|
// compared to L2 cache size, but let's be safe:
|
||||||
|
Index panelWidth = (std::min)(Index(SmallPanelWidth),(std::min)(kc,mc));
|
||||||
|
|
||||||
std::size_t sizeA = kc*mc;
|
std::size_t sizeA = kc*mc;
|
||||||
std::size_t sizeB = kc*cols;
|
std::size_t sizeB = kc*cols;
|
||||||
@ -169,9 +173,9 @@ EIGEN_DONT_INLINE void product_triangular_matrix_matrix<Scalar,Index,Mode,true,
|
|||||||
if(IsLower || actual_k2<rows)
|
if(IsLower || actual_k2<rows)
|
||||||
{
|
{
|
||||||
// for each small vertical panels of lhs
|
// for each small vertical panels of lhs
|
||||||
for (Index k1=0; k1<actual_kc; k1+=SmallPanelWidth)
|
for (Index k1=0; k1<actual_kc; k1+=panelWidth)
|
||||||
{
|
{
|
||||||
Index actualPanelWidth = std::min<Index>(actual_kc-k1, SmallPanelWidth);
|
Index actualPanelWidth = std::min<Index>(actual_kc-k1, panelWidth);
|
||||||
Index lengthTarget = IsLower ? actual_kc-k1-actualPanelWidth : k1;
|
Index lengthTarget = IsLower ? actual_kc-k1-actualPanelWidth : k1;
|
||||||
Index startBlock = actual_k2+k1;
|
Index startBlock = actual_k2+k1;
|
||||||
Index blockBOffset = k1;
|
Index blockBOffset = k1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user