-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try implementing N-dimensional indexing for fast linear SubArrays #30266
Conversation
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan |
Well that's interesting. I'll have to dig into this a bit more — that improved a few benchmarks but it didn't improve the ones I was targeting. |
Win? |
Just to expand on this a little bit: this PR only changes things for views of arrays with fast linear indexing:
Now, the complexity of re-indexing into our indices ( But here's the kicker: that's all a red herring. The thing that is foiling LLVM's vectorization is computing the offset and stride at construction time. That's why this PR didn't solve the issue. |
There was a 2x regression in LinAlg — not sure if real or not. @nanosoldier Assuming that comes back clean, I think we should merge this. I think we'll have to eat the synthetic benchmark regression from #29895, though — it ends up being an improvement for the usage of 0-d subarrays, but it's the construction of them that ends up foiling vectorization in these particular cases. |
Try again? @nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. cc @ararslan |
@@ -222,13 +222,14 @@ end | |||
|
|||
# In general, we simply re-index the parent indices by the provided ones | |||
SlowSubArray{T,N,P,I} = SubArray{T,N,P,I,false} | |||
function getindex(V::SlowSubArray{T,N}, I::Vararg{Int,N}) where {T,N} | |||
function getindex(V::SubArray{T,N}, I::Vararg{Int,N}) where {T,N} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant optimization --- just remove the word "slow"! 😄
I assume this is intended to fix a regression for 1.1? |
Yeah, that was the goal but I missed and improved performance elsewhere instead. I suppose we could still target it for 1.1 as a mitigating perf improvement. |
Ref:
#30218 (comment).
This is largely a test balloon to see what Nanosoldier thinks.
@nanosoldier
runbenchmarks(ALL, vs = ":master")