JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Support `getproperty`/`setproperty!` in reductions

Open
#282 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
789
Forks
73
PR merge metrics
No merged PRs in 30d

Description

```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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.