[clblas] 09/67: Simplified the calculation of the memory used for matrices
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Oct 27 08:02:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository clblas.
commit d1148448ffc432b680307daa13d0192276dd3491
Author: CNugteren <web at cedricnugteren.nl>
Date: Tue Aug 4 08:37:10 2015 +0200
Simplified the calculation of the memory used for matrices
---
src/library/blas/generic/common.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/library/blas/generic/common.c b/src/library/blas/generic/common.c
index f39be3e..b5f7e31 100644
--- a/src/library/blas/generic/common.c
+++ b/src/library/blas/generic/common.c
@@ -664,10 +664,10 @@ checkMatrixSizes(
}
}
- // It is possible to allocate a buffer, and set up lda & ldb such that it looks like it will access outside of the allocated buffer, but if
- // M & N are kept small enough, no out of bounds access will occur. Compensate for the offset values and the unused tail memory caused by lda & ldb.
- // Ex: BuffSize=6 floats, M=1, N=2, lda=ldb=3, offA = 0, offB = 2 : |A[0,0]|unused|B[0,0]|A[0,1]|unused|B[0,1]|
- memUsed = (( offA + matrSize ) > unusedTail) ? offA + matrSize - unusedTail : offA + matrSize;
+ // Calculates the memory required. Note that 'matrSize' already takes into account the fact that
+ // there might be an unused tail, i.e. the elements between lda and M in the last column if
+ // column major is used or between lda and N in the last row if row major is used.
+ memUsed = offA + matrSize;
if (( memUsed > memSize ) || (offA + matrSize < offA)) {
switch( err )
{
@@ -753,10 +753,10 @@ checkBandedMatrixSizes(
}
}
- // It is possible to allocate a buffer, and set up lda & ldb such that it looks like it will access outside of the allocated buffer, but if
- // M & N are kept small, no out of bounds access will occur. Compensate for the offset values and the unused tail memory caused by lda & ldb.
- // Ex: BuffSize=6 floats, M=1, N=2, lda=ldb=3, offA = 0, offB = 2 : |A[0,0]|unused|B[0,0]|A[0,1]|unused|B[0,1]|
- memUsed = (( offA + matrSize ) > unusedTail) ? offA + matrSize - unusedTail : offA + matrSize;
+ // Calculates the memory required. Note that 'matrSize' already takes into account the fact that
+ // there might be an unused tail, i.e. the elements between lda and M in the last column if
+ // column major is used or between lda and N in the last row if row major is used.
+ memUsed = offA + matrSize;
if (memUsed > memSize) {
switch( err )
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clblas.git
More information about the debian-science-commits
mailing list