Skip to content

Conversation

@ranocha
Copy link
Member

@ranocha ranocha commented Dec 30, 2022

I found quite a few invalidations using the following code with Julia v1.8.3:

julia> using Pkg; Pkg.activate(temp=true); Pkg.develop("ComponentArrays"); Pkg.add("Trixi")

julia> using SnoopCompileCore; invalidations = @snoopr(using Trixi); using SnoopCompile

julia> length(uinvalidated(invalidations))
1655

julia> trees = invalidation_trees(invalidations)
...
 inserting CartesianIndices(ax::Tuple{Vararg{ComponentArrays.CombinedAxis}}) in ComponentArrays at /home/hendrik/.julia/dev/ComponentArrays/src/axis.jl:205 invalidated:
   backedges: 1: superseding CartesianIndices(indices::R) where {N, R<:Tuple{Vararg{OrdinalRange{Int64, Int64}, N}}} in Base.IteratorsMD at multidimensional.jl:249 with MethodInstance for CartesianIndices(::Tuple{Vararg{Base.OneTo{Int64}}}) (180 children)
   37 mt_cache
...

julia> ascend(trees[end-2].backedges[end])
Choose a call for analysis (q to quit):
^      #vreduce#128(::Int64, ::typeof(LoopVectorization.vreduce), ::typeof(min), ::Array{Int64, 3})
         (::LoopVectorization.var"#vreduce##kw")(::NamedTuple{(:dims,), Tuple{Int64}}, ::typeof(LoopVectorization
           _vminimum(::Array{Int64, 3}, ::Int64)
...

The problem is that ComponentArrays.jl overwrites an existing method of CartesianIndices for an empty tuple. I fixed that, resulting in

julia> using Pkg; Pkg.activate(temp=true); Pkg.develop("ComponentArrays"); Pkg.add("Trixi")

julia> using SnoopCompileCore; invalidations = @snoopr(using Trixi); using SnoopCompile

julia> length(uinvalidated(invalidations))
1507

julia> trees = invalidation_trees(invalidations)

and the invalidations reported above are gone.

Copy link
Collaborator

@jonniedie jonniedie left a comment

Choose a reason for hiding this comment

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

Cool, thanks a lot for doing this!

@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2022

Codecov Report

Merging #181 (9d10e15) into master (cbb24ef) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #181   +/-   ##
=======================================
  Coverage   73.49%   73.49%           
=======================================
  Files          20       20           
  Lines         679      679           
=======================================
  Hits          499      499           
  Misses        180      180           
Impacted Files Coverage Δ
src/axis.jl 85.71% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jonniedie jonniedie merged commit e761377 into SciML:master Dec 30, 2022
@ranocha ranocha deleted the hr/invalidations branch December 30, 2022 18:45
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.

3 participants