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 caused by FixedPointNumbers #448

Merged
merged 3 commits into from
Dec 3, 2022

Conversation

ranocha
Copy link
Member

@ranocha ranocha commented Dec 3, 2022

This is based on the following code (on Julia v1.8.3):

julia> using Pkg; Pkg.activate(temp=true); Pkg.add("FixedPointNumbers"); Pkg.develop("LoopVectorization")

julia> using SnoopCompileCore; invalidations = @snoopr(using LoopVectorization, FixedPointNumbers); using SnoopCompile

julia> length(uinvalidated(invalidations))
613

julia> trees = invalidation_trees(invalidations);

julia> trees[end]
inserting reduce_first(::typeof(Base.add_sum), x::FixedPoint) in FixedPointNumbers at ~/.julia/packages/FixedPointNumbers/HAGk2/src/FixedPointNumbers.jl:295 invalidated:
   backedges: 1: superseding reduce_first(::typeof(Base.add_sum), x) in Base at reduce.jl:402 with MethodInstance for Base.reduce_first(::typeof(Base.add_sum), ::Any) (166 children)

julia> ascend(trees[end].backedges[end])

With this PR,

julia> length(uinvalidated(invalidations))
513

The initial number of invalidations coming from this is bigger when loading something doing more precompilation involving LoopVectorization.jl.

@codecov
Copy link

codecov bot commented Dec 3, 2022

Codecov Report

Base: 85.97% // Head: 86.08% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (e01278b) compared to base (0bf0080).
Patch coverage: 66.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
+ Coverage   85.97%   86.08%   +0.10%     
==========================================
  Files          37       37              
  Lines        9379     9379              
==========================================
+ Hits         8064     8074      +10     
+ Misses       1315     1305      -10     
Impacted Files Coverage Δ
src/parse/memory_ops_common.jl 88.94% <0.00%> (ø)
src/modeling/graphs.jl 88.96% <100.00%> (ø)
src/codegen/lower_constant.jl 72.76% <0.00%> (-2.35%) ⬇️
src/codegen/lower_memory_common.jl 86.23% <0.00%> (+0.36%) ⬆️
src/modeling/determinestrategy.jl 93.29% <0.00%> (+0.51%) ⬆️
src/modeling/costs.jl 53.05% <0.00%> (+0.93%) ⬆️
src/simdfunctionals/mapreduce.jl 90.32% <0.00%> (+7.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@chriselrod
Copy link
Member

Would making vals a Number[] instead of an Any[] also help at all?

@chriselrod
Copy link
Member

The test failures are likely related to StrideArraysCore v0.4.0. I pushed it out prematurely.

Neither the DiffEq stack or StrideArrays.jl have releases supporting it yet (for good reason), so it's mostly been unnoticed.

@chriselrod chriselrod enabled auto-merge (squash) December 3, 2022 19:55
@chriselrod chriselrod merged commit 2776b6d into JuliaSIMD:main Dec 3, 2022
@ranocha
Copy link
Member Author

ranocha commented Dec 4, 2022

Would making vals a Number[] instead of an Any[] also help at all?

No, I don't think so. The invalidations come from FixedPointNumbers.jl, which provides new Number types with specializations.

@ranocha ranocha deleted the hr/invalidations branch December 4, 2022 10:54
@ranocha
Copy link
Member Author

ranocha commented Dec 16, 2022

@chriselrod Would you mind making a new release of LoopVectorization.jl including these invalidation fixes?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants