python / python/cpython

`_remote_debugging`: `RemoteUnwinder(..., jit=True)`

Open
#149,762 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension-modules topic-JIT topic-profiling type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Proposal:

:)

The idea here is to expose JIT internals a bit more in the Tachyon profiler.

The questions that could be answered trivially:

  • Is JIT actually used? How often?
  • Which executor is hot?
  • What change made the largest difference (diff_flamegraph), in terms of % spent in JIT? Per line?

A bit harder:

  • Which UOPs actually eat time?
  • Which stensils are good?
  • What guards or deopts are bad?
  • What is the trace shape?

The very minimal change that I'm thinking about here is just adding --jit flag (active for --jsonl and maybe for --live but it's a catnip), and adding JitInfo to ThreadInfo.

That's how it could look:

JitInfo(
  executor_id,
  flags
)

This will requires extending debug offsets, obviously.

We could potentially expose native_pc, native_offset, uop_index, exit_index etc. The question would be how to expose metadata for it without balooning JitInfo, and how far we can get without blocking and native unwinding. :)

I'm pretty much open to any other ideas.

There will be definitely some performance impact (more VM reads), but hidden behind the --enable-experimental-jit flag should be bearable, and we could be more playful, going back and forth.

If you think it makes sense, I'd be willing to take a shot, but this will take multiple PRs.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing _remote_debugging, RemoteUnwinder(..., jit=True), and the existing ThreadInfo flow. Compare the proposed --jit behavior for --jsonl and possibly --live, then inspect how debug offsets are handled. Done would require a settled scope for exposing JitInfo and its metadata behind --enable-experimental-jit, with performance impact considered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.