You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[z|c]gemv assume no inf or nan in buffer on x86_64 #746
cgemv_t.S and zgemv_t.S return wrong results when the buffer contains NaN or Inf values. I guess that somewhere it assume that 0 * buffer[i] = 0 without initializing buffer[i]. The buffer may contains NaN or Inf values because of previous OpenBLAS functions calls.
Any easy workaround would be to memset the buffer in zgemv.c but IMHO it should be fixed in the assembler code (which I'm not able to do). Here is a simple program which reproduce the issue.
#include<math.h>#include<assert.h>#include<stdlib.h>// OpenBLAS private API used to simulate a previous function call which add a NaN to the buffervoid*blas_memory_alloc(int);
voidblas_memory_free(void*);
intmain(void) {
intsize=59;
intsize2=50;
floatv=1;
intone=1;
float*buffer= (float*)blas_memory_alloc(1);
for(inti=0; i<256; i++)
// also work with buffer[i] = 1./0;buffer[i] =sqrt(-1);
blas_memory_free(buffer);
float*A=calloc(size*size, 2*4);
float*y=calloc(size, 2*4);
float*x=calloc(size, 2*4);
for(inti=0; i<2*size*size; i++)
A[i] =i;
for(inti=0; i<2*size; i++) {
y[i] =i;
x[i] =i;
}
cgemv_("T", &size, &size2, &v, A, &size, x, &one, &v, y, &one);
for(inti=0; i<2*size; i++)
assert(!isnan(y[i]));
}
Possibly related to #695
Hmm. Apparently not, at least copying that memset into gemv.c and zgemv.c did not change the outcome of the testcase from 695 (while substituting the C implementation of cgemv_t did). Sorry for the noise here.
Activity
martin-frbg commentedon Jan 20, 2016
Possibly related to #695Hmm. Apparently not, at least copying that memset into gemv.c and zgemv.c did not change the outcome of the testcase from 695 (while substituting the C implementation of cgemv_t did). Sorry for the noise here.
zgemv: Add a workaround for OpenMathLib#746
zgemv: Add a workaround for OpenMathLib#746
zgemv: Add a workaround for OpenMathLib#746
zgemv: Add a workaround for #746