JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Support `getproperty`/`setproperty!` in reductions

Offen
#282 1 Kommentar 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

```julia
julia> using LoopVectorization

julia> mutable struct foo
s
end

julia> f = foo(0)
foo(0)

julia> m = rand(Float32, 4,4)
4×4 Matrix{Float32}:
0.925989 0.8695 0.784866 0.0669142
0.258075 0.165664 0.787071 0.697996
0.219509 0.580573 0.298625 0.479805
0.000333428 0.200458 0.858297 0.571481

julia> s = 0
0

julia> @avxt for i in eachindex(m)
s += ifelse(m[i]>0.5, 1, 0)
end

julia> s
8

julia> @avxt for i in eachindex(m)
f.s += ifelse(m[i]>0.5, 1, 0)
end
ERROR: LoadError: LHS not understood; only `:ref`s and `:tuple`s are currently supported.
f.s
Stacktrace:
[1] add_assignment!(ls::LoopVectorization.LoopSet, LHS::Expr, RHS::Expr, elementbytes::Int64, position::Int64)
@ LoopVectorization C:\Users\89639\.julia\packages\LoopVectorization\wL8Qh\src\modeling\graphs.jl:1148
[2] push!(ls::LoopVectorization.LoopSet, ex::Expr, elementbytes::Int64, position::Int64)
@ LoopVectorization C:\Users\89639\.julia\packages\LoopVectorization\wL8Qh\src\modeling\graphs.jl:1165
in expression starting at REPL[8]:1
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Run the shown Julia @avxt reduction with f.s to reproduce the error. Start in src/modeling/graphs.jl at add_assignment! (reported near line 1148) and its push! caller; done means property-based reduction assignments work without regressing the existing ref and tuple cases.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia
Bereich
performance
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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