JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Handle moving operations in reductions

Ouverte
#151 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Julia
Étoiles
789
Forks
73
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start with the @avx reduction and lowering paths, using the doubleadd_loop_avxtest example in the issue to reproduce the failure. Trace how the reduction and hoisted a are transformed; done means the reduction accumulates across iterations and the hoisted value includes the required multiple of length(x) / W.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
julia
Domaine
compilers, performance
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.