JuliaArrays / JuliaArrays/StructsOfArrays.jl
StructsOfArrays on Julia 0.7 doesn't elide boundschecks
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 49
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
Running the example from the readme on 0.7.0-DEV.2484
using BenchmarkTools
using StructsofArrays
regular = complex(randn(1000000), randn(1000000))
soa = convert(StructOfArrays, regular)
function f(x, a)
s = zero(eltype(x))
@simd for i in 1:length(x)
@inbounds s += x[i] * a
end
s
end
@benchmark f(regular, 0.5+0.5im)
@benchmark f(soa, 0.5+0.5im)
Leads to the disappointing result of:
julia> @benchmark f(regular, 0.5+0.5im)
BenchmarkTools.Trial:
memory estimate: 64 bytes
allocs estimate: 2
--------------
minimum time: 786.494 μs (0.00% GC)
median time: 817.898 μs (0.00% GC)
mean time: 864.446 μs (0.00% GC)
maximum time: 4.601 ms (0.00% GC)
--------------
samples: 5757
evals/sample: 1
julia> @benchmark f(soa, 0.5+0.5im)
BenchmarkTools.Trial:
memory estimate: 64 bytes
allocs estimate: 2
--------------
minimum time: 1.091 ms (0.00% GC)
median time: 1.261 ms (0.00% GC)
mean time: 1.359 ms (0.00% GC)
maximum time: 7.935 ms (0.00% GC)
--------------
samples: 3661
evals/sample: 1
and inspection of the @code_llvm shows that there are still oob blocks visible and no vectorization is happening.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the README example on Julia 0.7.0-DEV.2484 and compare the two @benchmark results. Inspect @code_llvm output for the remaining oob blocks and missing vectorization; done means establishing why StructOfArrays retains these bounds checks and confirming improved generated code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100