remove ei_ prefix of public global functions, and s/cpu/l1

This commit is contained in:
Gael Guennebaud 2010-06-07 19:05:30 +02:00
parent 727376b5f4
commit f3a568c81d
2 changed files with 24 additions and 10 deletions

View File

@ -80,8 +80,9 @@ inline void ei_manage_caching_sizes(Action action, std::ptrdiff_t* a=0, std::ptr
}
}
/** \returns the currently set cpu cache size (in bytes) used to estimate the ideal blocking size parameters */
std::ptrdiff_t ei_cpuCacheSize()
/** \returns the currently set cpu cache size (in bytes) used to estimate the ideal blocking size parameters.
* \sa setL1CacheSize */
std::ptrdiff_t l1CacheSize()
{
std::ptrdiff_t ret;
ei_manage_caching_sizes(GetAction, &ret);
@ -89,28 +90,41 @@ std::ptrdiff_t ei_cpuCacheSize()
}
/** Set the cpu cache size (in bytes) for blocking.
* This function also automatically set the blocking size parameters for each scalar type using the following formula:
* This function also automatically set the blocking size parameters
* for each scalar type using the following formula:
* \code
* max_k = 4 * sqrt(cache_size/(64*sizeof(Scalar)));
* max_m = 2 * k;
* \endcode
* overwriting custom values set using the ei_setBlockingSizes function.
*
* \b Explanations: \n
* Let A * B be a m x k times k x n matrix product. Then Eigen's product yield
* L2 blocking on B with panels of size max_k x n, and L1 blocking on A,
* with blocks of size max_m x max_k.
*
* \sa ei_setBlockingSizes */
void ei_setCpuCacheSize(std::ptrdiff_t cache_size) { ei_manage_caching_sizes(SetAction,&cache_size); }
void setL1CacheSize(std::ptrdiff_t cache_size) { ei_manage_caching_sizes(SetAction,&cache_size); }
/** Set the blocking size parameters \a maxK and \a maxM for the scalar type \a Scalar.
* Note that in practice there is no distinction between scalar types of same size.
* \sa ei_setCpuCacheSize */
*
* See ei_setCpuCacheSize for an explanation about the meaning of maxK and maxM.
*
* \sa setL1CacheSize */
template<typename Scalar>
void ei_setBlockingSizes(std::ptrdiff_t maxK, std::ptrdiff_t maxM)
void setBlockingSizes(std::ptrdiff_t maxK, std::ptrdiff_t maxM)
{
ei_manage_caching_sizes(SetAction,&maxK,&maxM,sizeof(Scalar));
}
/** \returns in \a makK, \a maxM the blocking size parameters for the scalar type \a Scalar.
* \sa ei_setBlockingSizes */
*
* See ei_setCpuCacheSize for an explanation about the meaning of maxK and maxM.
*
* \sa setL1CacheSize */
template<typename Scalar>
void ei_getBlockingSizes(std::ptrdiff_t& maxK, std::ptrdiff_t& maxM)
void getBlockingSizes(std::ptrdiff_t& maxK, std::ptrdiff_t& maxM)
{
ei_manage_caching_sizes(GetAction,&maxK,&maxM,sizeof(Scalar));
}

View File

@ -77,7 +77,7 @@ static void run(Index rows, Index cols, Index depth,
Index kc; // cache block size along the K direction
Index mc; // cache block size along the M direction
ei_getBlockingSizes<Scalar>(kc, mc);
getBlockingSizes<Scalar>(kc, mc);
kc = std::min<Index>(kc,depth);
mc = std::min<Index>(mc,rows);
@ -239,7 +239,7 @@ struct ei_gemm_functor
Index sharedBlockBSize() const
{
int maxKc, maxMc;
ei_getBlockingSizes<Scalar>(maxKc,maxMc);
getBlockingSizes<Scalar>(maxKc,maxMc);
return std::min<Index>(maxKc,m_rhs.rows()) * m_rhs.cols();
}