clMathLibraries / clBLAS

a software library containing BLAS functions written in OpenCL
Apache License 2.0
839 stars 240 forks source link

ixamax errors #292

Open mgates3 opened 7 years ago

mgates3 commented 7 years ago

There seem to be two remaining errors in ixamax.

First, if n == 0, then the result iMax is not updated at all. Per the reference BLAS, it should be updated to 0.

Second, if the vector is all zeros, it sets iMax = 0, when it should set iMax = 1. Simply changing MIN = 0x1.0p-1022 MIN = 0x1.0p-126f to MIN = -1 in iamax.cl and reduction.cl templates seems to solve that issue. I don't know if that would introduce an issue elsewhere as I'm not that familiar with where else the reduction code might be used.

(Tested with clBLAS 2.10, after applying fix from pull request #290)

tingxingdong commented 7 years ago

The first one can be fixed easily without any concern. For the second one, I guess you can make the change. We do not know any other clBLAS function call imax. We will document the change prominently