JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Handle moving operations in reductions

Offen
#151 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
789
Forks
73
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.