Skip to content

Commit

Permalink
Ensure accurate invalidation logging data (#48982)
Browse files Browse the repository at this point in the history
* Ensure accurate invalidation logging data

This modifies #48841 to restore the required logging data.
By collecting at least one additional match, we retain the possibility
of identifying at least one trigger of invalidation.

* Bump number of invalidation causes

* Update src/staticdata_utils.c

Co-authored-by: Jameson Nash <vtjnash@gmail.com>

---------

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
  • Loading branch information
timholy and vtjnash authored Mar 17, 2023
1 parent abae35c commit 5e4669c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/staticdata_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,10 @@ static jl_array_t *jl_verify_edges(jl_array_t *targets, size_t minworld)
assert(jl_is_array(expected));
int ambig = 0;
// TODO: possibly need to included ambiguities too (for the optimizer correctness)?
// len + 1 is to allow us to log causes of invalidation (SnoopCompile's @snoopr)
matches = jl_matching_methods((jl_tupletype_t*)sig, jl_nothing,
jl_array_len(expected), 0, minworld, &min_valid, &max_valid, &ambig);
_jl_debug_method_invalidation ? INT32_MAX : jl_array_len(expected),
0, minworld, &min_valid, &max_valid, &ambig);
if (matches == jl_nothing) {
max_valid = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ precompile_test_harness("code caching") do dir
mi = m.specializations[1]
@test hasvalid(mi, world) # was compiled with the new method

# Reporting test
# Reporting test (ensure SnoopCompile works)
@test all(i -> isassigned(invalidations, i), eachindex(invalidations))
m = only(methods(MB.call_nbits))
for mi in m.specializations
Expand All @@ -936,7 +936,7 @@ precompile_test_harness("code caching") do dir
j = findfirst(==(tagbad), invalidations)
@test invalidations[j-1] == "insert_backedges_callee"
@test isa(invalidations[j-2], Type)
@test invalidations[j+1] === nothing || isa(invalidations[j+1], Vector{Any}) # [nbits(::UInt8)]
@test isa(invalidations[j+1], Vector{Any}) # [nbits(::UInt8)]

m = only(methods(MB.map_nbits))
@test !hasvalid(m.specializations[1], world+1) # insert_backedges invalidations also trigger their backedges
Expand Down

2 comments on commit 5e4669c

@vtjnash
Copy link
Member

Choose a reason for hiding this comment

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

@nanosoldier runbenchmarks("inference", vs="@fd5b5e38e014c9bc3a37d51b489990d09f7b8e84")

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

Please sign in to comment.