JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Handle moving operations in reductions

Aperta
#151 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
789
Fork
73
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This either `UndefVarError`s or (with a reordering in lowering) produces the wrong answer:
```julia
function doubleadd_loop_avxtest(x,a)
s = zero(eltype(x))
@avx for i in 1:length(x)
s += 2*x[i] + a
end
return s
end
```
because it transforms this into something like
```julia
stemp = s + a
for i in ...
sreduct = 2*x[i] + stemp
end
```
Where
1. `sreduct` isn't being accumulated across the loop's iterations.
2. `a` (after being hoisted out) is missing a constant multiple of `length(x) / W` where `W` is the SIMD vector width.

I should address both of these issues.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.