Repository navigation
Conversation
|
Thanks - it is a little more complicated, the P5600 GEMM kernels do provide code paths for TRMM, but only in the MSA version. Apparently your build uses NO_MSA=1 for some reason, falling back to the generic kernels where indeed the TRMMKERNEL lines were removed when the MSA kernels got added in 57df795 ten years ago. Apparently putting them back for the NO_MSA branch was forgotten when the NO_MSA conditional was introduced two years ago. So I think the ?TRMMKERNEL entries need to go on the respective NO_MSA branch in KERNEL.P5600 rather than being added as a common definition block. |
|
Thanks for pointing that out... the little system we are testing on doesn't even have an FPU, so no MSA either. (Why test a machine learning library on a system that doesn't even have an FPU?, you ask. It was cheap and readily available!, I answer.) Anyway, just pushed a commit that should fix the behavior on MSA MIPS systems. Sorry about the oversight there. |
It seems that
kernel/mips/KERNEL.genericandkernel/mips/KERNEL.P5600specify the use of the generic GEMM kernelkernel/generic/gemmkernel_2x2.casDGEMMKERNEL, but don't specify any TRMM kernel. To my understanding, this means that OpenBLAS will compile and use the GEMM kernel withTRMMKERNELdefined so that it acts like a TRMM operation---but, the generic GEMM kernel actually does not return correct results withTRMMKERNELdefined! Instead, it seems likekernel/generic/trmmkernel_2x2.cshould be used in these cases.So, my fix simply adds TRMM kernel definitions to the mips kernel definitions, and then specifies that on the mips architecture, separate TRMM kernels are to be used. I think but am not sure that this is the right way to handle the problem. (Well, I think it is a problem, but I am also not 100% sure of that, given that this would mean a whole lot of higher-level LAPACK functionality is broken for any mipsel build. But perhaps there are not hordes of people out there computing SVDs on tiny devices...)
I checked other architectures that use the generic GEMM kernels, and all of those also explicitly specify generic TRMM kernels.
This is my first contribution to OpenBLAS despite building software on it for well over a decade (p.s. thanks for OpenBLAS!), so, please let me know if I overlooked or misunderstood something and I'm happy to provide a PR with a different approach.
(1) mlpack, a machine learning library, tests its algorithms on all kinds of hardware, including a VoCore, which is a mips32 system. A test for kernel principal components analysis was failing... only on that system. The failure appeared to come from Armadillo's svd() function, and upon further digging, Armadillo appeared to not be the cause of the bad results. This led me on a trace through OpenBLAS's
dgesdd_()implementation where I discovered that a call todtrmm_()was returning incorrect results. It was a long and fun adventure. At least, I am telling myself it was fun. 😄