Skip to content

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commented Jan 16, 2024

Only works for boolean guards, not type guards, for now. And _EXIT_TRACE now.

Needs to be carefully documented, there's some subtlety here.

Exits are implemented as an array of records attached to the executors, and a fixed set of cold exit executors.
We can shrink the _PyExitData further, by moving the counters into a global table, but that's for another PR.

See faster-cpython/ideas#644 for a rough sketch of the design.

@bedevere-appbedevere-appbot mentioned this pull request Jan 16, 2024
@brandtbucherbrandtbucher self-requested a review January 16, 2024 21:26
@markshannon
Copy link
MemberAuthor

@markshannonmarkshannon marked this pull request as ready for review January 17, 2024 15:55
@brandtbucher
Copy link
Member

Sorry, didn't get to a proper review of this today. I've been trying (and failing) to merge the JIT branch into this one without crashing.

Maybe we can chat "in person" later?

@brandtbucher
Copy link
Member

Okay, I was able to get it working-ish... but it's not pretty. We can go over it when we meet.

@markshannon
Copy link
MemberAuthor

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

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

Here's a first, partial pass. I've tried to focus on things that confused me. I haven't fully reviewed optimizer.c yet, nor the _COLD_EXIT uop definition, so I'll focus on those when I find some time.

Maybe it would be useful to add TODO comments indicating things you're planning to tackle in the near future (subsequent PRs)? Like the counters.

@markshannon
Copy link
MemberAuthor

Or better, executor_blah, matching e.g. executor_clear.

I'd prefer to save that for another PR. Maybe the one that removes the CounterExecutor.

@markshannon
Copy link
MemberAuthor

FTR, the thresholds are likely to get completely changed soon.

We probably want to change the fixed thresholds to some sort of adaptive thresholds, and consider the T1 and T2 thresholds together so that specialization works correctly.

@gvanrossum
Copy link
Member

If you look at GitHub there’s still a missing cast somewhere.

Copy link
Member

@brandtbucherbrandtbucher left a comment

Choose a reason for hiding this comment

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

Didn't look too closely at the cases generator or optimizer (I'm assuming there are other eyes on that).

  • I appreciate the writeup!
  • I like that the interpreter/JIT interfaces are a lot more unified on this iteration. I know you're not crazy about conditional macro stuff but I think it makes things a lot easier to follow in this case. Thanks.
  • Suggestions to remove bit of tricky code duplication in template.c.
  • A couple of questions about setting tstate->previous_executor.
  • A few other random questions/suggestions I had while reading through.
  • One thing I find sort of tricky to keep track of is the nuances of the first couple of instructions in the trace (when/where _START_EXECUTOR is added, when/where pointers to optimizers/executors are smuggled in as operands, etc). This might be worth cleaning up now or in the future, or at least writing up. Not sure.

@bedevere-app
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@encukou
Copy link
Member

The refleaks buildbot failed on test.test_capi.test_opt.TestUops.test_confidence_score. Likely causes: GH-114142, GH-115558, or GH-115688
I'll investigate later if it's not fixed; you probably have more context.

@markshannon
Copy link
MemberAuthor

I don't think there is a new bug here, but this PR exposes it. #115727

woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
@markshannonmarkshannon deleted the cold-exits branch August 6, 2024 10:17
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this pull request Jan 22, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@markshannon@brandtbucher@gvanrossum@encukou@mdboom@iritkatriel