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

Ensure accurate invalidation logging data #48982

Merged
merged 3 commits into from
Mar 17, 2023
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Mar 12, 2023

This modifies #48841 to restore the required logging data. When logging is on, it recalculates the method-match as needed, casting a wider net to ensure that we identify the trigger of the invalidation.

Closes #48980
Fixes #48967

Comment on lines 910 to 915
if (matches == jl_nothing) {
assert(sig);
int ambig = 0;
matches = jl_matching_methods((jl_tupletype_t*)sig, jl_nothing,
-1, 0, minworld, &min_valid, &max_valid, &ambig);
}
Copy link
Member

Choose a reason for hiding this comment

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

this seems to calculate an entirely different thing from the original (which did a setdiff on the result computed with a length limit of +INT32_MAX not -1)

Copy link
Member Author

Choose a reason for hiding this comment

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

This only gets triggered from matches == jl_nothing which comes from

matches = jl_matching_methods((jl_tupletype_t*)sig, jl_nothing,
jl_array_len(expected), 0, minworld, &min_valid, &max_valid, &ambig);
if (matches == jl_nothing) {
max_valid = 0;
}

It basically restores the version that was used before the efficiency-improvement in #48841. If this isn't correct, let's put the correct thing here, but it seemed to pass muster before the efficiency-improvement.

Copy link
Member

Choose a reason for hiding this comment

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

The change in #48841 alters the algorithm selection from the -1 algorithm to the positive limit algorithm. What you probably want is to make the jl_array_len(expected) parameter selectable based on how many conflicts you want returned. E.g. up to INT32_MAX conflicts, or just +4 or such until it gives us and returns "too many"

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I added just one extra space. I think we only need to identify one cause; if there turn out to be multiples, folks can re-run the analysis after fixing the one that got identified. I pushed this change.

However, then I tried modifying the test to add a second invalidating method. Then I got nothing in that slot again 😢. Big bummer.

I haven't delved into how jl_matching_methods works in a while, but I am surprised it returned nothing rather than a partial list. Is there anything "safe" short of re-running the analysis with -1? While I'm OK with only returning a single source of invalidation, returning nothing is simply unacceptable. As you point out above, we might have to re-run the setdiff. But I think I'd rather do that than miss causes of invalidation. What are your thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

We can either do +1 to get the list if there was only 1 cause, or +N to get up to N causes (before declaring "a lot") or INT32_MAX to get all causes.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, and INT32_MAX would be acceptable? Or does that cause a performance hit?

Copy link
Member Author

Choose a reason for hiding this comment

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

I went ahead and just changed it in the original computation. But if instead you meant that I should use INT32_MAX to recompute the matches when logging, just LMK.

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.
src/staticdata_utils.c Outdated Show resolved Hide resolved
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
@timholy timholy added the merge me PR is reviewed. Merge when all tests are passing label Mar 16, 2023
@oscardssmith oscardssmith merged commit 5e4669c into master Mar 17, 2023
@oscardssmith oscardssmith deleted the teh/repair_48841 branch March 17, 2023 05:07
@vtjnash
Copy link
Member

vtjnash commented Mar 17, 2023

Please try to make commit messages accurate when merging.

oscardssmith pushed a commit to oscardssmith/julia that referenced this pull request Mar 20, 2023
* Ensure accurate invalidation logging data

This modifies JuliaLang#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>
@giordano giordano removed the merge me PR is reviewed. Merge when all tests are passing label Mar 21, 2023
@timholy timholy mentioned this pull request Mar 24, 2023
52 tasks
Xnartharax pushed a commit to Xnartharax/julia that referenced this pull request Apr 19, 2023
* Ensure accurate invalidation logging data

This modifies JuliaLang#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>
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.

Loss of invalidation-logging on master
4 participants