BTAS icon indicating copy to clipboard operation
BTAS copied to clipboard

interfaces of gemm, gemv, etc are not robust

Open shiozaki opened this issue 11 years ago • 4 comments

double gemm with alpha = 1.0 and beta = 2 would not be accepted.

Also types are handled in a very error-prone way because everything is passed around using const reference.

I made a hack to make sure that BAGEL is no slower than direct Lapack call (4f83749e45d6088d259a18314f80ff248b212aee), but this should be a tentative fix. Without these fix, sometimes BAGEL was calling generic function!!

shiozaki avatar Jul 29 '14 19:07 shiozaki

Related to #32

shiozaki avatar Jul 29 '14 19:07 shiozaki

The changes looks OK, but I was wondering why the following (lines 118-120 in axpy_impl.h) doesn't work?

typedef typename __traits_X::value_type __value_X; typedef typename std::conditional<std::is_convertible<_T, __value_X>::value, __value_X, _T>::type __alpha; axpy_impl<std::is_convertible<_T, __value_X>::value>::call(Nsize, static_cast<__alpha>(alpha), itrX, incX, itrY, incY);

I think it might be better if we can fixed that bug at this point.

Naoki

On Wed, Jul 30, 2014 at 4:22 AM, Toru Shiozaki [email protected] wrote:

Related to #32 https://github.com/BTAS/BTAS/issues/32

— Reply to this email directly or view it on GitHub https://github.com/BTAS/BTAS/issues/65#issuecomment-50525063.

naokin avatar Jul 30 '14 01:07 naokin

For efficiency btas/optimize/contract.h directly calls _impl functions (or I could just call CBLAS directly but that's redundant).

On a separate note, there should be a mechanism to detect this sort of bug, in which unoptimized code is used in cases that could be processed by the standard BLAS. This was a critical bug!

shiozaki avatar Jul 30 '14 01:07 shiozaki

I think to close this bug, we need to have an interface in which we do not assume alpha and beta are the same type (but convertible to value_type).

shiozaki avatar Jul 30 '14 01:07 shiozaki