JuliaSIMD / JuliaSIMD/LoopVectorization.jl

vmap gives incorrect results for iszero

Abierto
#149 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
789
Forks
73
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

If I run vmap with certain functions i get wrong results in some cases. I noticed this first for an integer array with iszero:
```
a = rand(Int8,200,20)
@test map(iszero,a) == vmap(iszero,a) #fails

```
Repeated evaluations of `vmap(iszero,a)` give different answers each time.
The same happens for some other functions I tested such as:

```
a = rand(200,20) #also for floats
vmap( ==(2.0), a)
vmap( >(0.5), a)
```
As a pattern these all return boolean arrays, functions that return floats seem to be unaffected.

vmapreduce is unaffected:
```
a = rand( Int8,200,20)
@test vmapreduce(iszero,+,a) == mapreduce(iszero,+,a) #passes
@test sum(map(iszero,a)) == sum(vmap(iszero,a)) #fails
```
The inplace version seems affected as well:
```
a = rand( Int8,200,20)
out = rand( Bool,200,20)
vmap!(iszero,out,a)
@test out == map(iszero,a) #fails
```
Interestingly this seems to consistently return the same (wrong) result instead of the always changing values of the out of place version. Here again this seems to only affect functions that return bools.

This is just from some playing around not something I actually need but unless I'm violating some assumptions LoopVectorization makes this seems like a bug.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Reproduce the mismatch with the supplied `vmap(iszero, a)` and `vmap!` examples, comparing each result with `map`; also verify that `vmapreduce` remains correct. Start at the `vmap` and `vmap!` entry points and trace boolean-returning functions, then add regression coverage showing stable results equal to `map` for the reported cases.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
julia
Área
performance
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.