luhenry / netlib

An high-performance, hardware-accelerated implementation of Netlib in Java
Other
60 stars 12 forks source link

Bug in Java BLAS routines #7

Closed adampauls closed 2 years ago

adampauls commented 2 years ago

Escalating this issue, originally found when using Breeze. Executing the offending code snippet arrives in Java11Blas.sgemmTN, so I guessing the bug is somewhere in there.

adampauls commented 2 years ago

Note: the example shown in the but can be slightly further minimized with

val outputDim = 1
val inputDim = 3
adampauls commented 2 years ago

There seems to be more than one place (like https://github.com/luhenry/netlib/blob/master/blas/src/main/java/dev/ludovic/netlib/blas/Java11BLAS.java#L1832-L1833) where

 sum11 = Math.fma(a10, b01, sum11);
 sum11 = Math.fma(a10, b02, sum12);

appears in the s version but the d version has

sum11 = Math.fma(a10, b01, sum11);
sum12 = Math.fma(a10, b02, sum12);
luhenry commented 2 years ago

@adampauls yes, seems like a bug indeed. Let me get a fix to v2.2.1 right away

adampauls commented 2 years ago

Thanks for the quick fix!