Skip to content
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

fix some invalidations when loading Static.jl #46553

Merged
merged 4 commits into from
Sep 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ findall(testf::Function, A) = collect(first(p) for p in pairs(A) if testf(last(p

# Broadcasting is much faster for small testf, and computing
# integer indices from logical index using findall has a negligible cost
findall(testf::Function, A::AbstractArray) = findall(testf.(A))
findall(testf::F, A::AbstractArray) where {F<:Function} = findall(testf.(A))
Copy link
Member Author

@ranocha ranocha Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another possibility to fix the invalidations coming from this by specializing on testf since map has also disadvantages, see #46553 (comment). However, always specializing could also have disadvantages in terms of latency, of course. I don't know what's best here 🤷
There are basically four options I see

  • My first suggestion adding a type assertion in mightalias
  • The version with map here, increasing allocations
  • The version with specialization here, possibly increasing compiler workload
  • Just do nothing for now and hope that the compiler will be improved later


"""
findall(A)
Expand Down