Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ZJIT: Create more ergonomic type profiling API #13339

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

tekknolagi
Copy link
Contributor

@tekknolagi tekknolagi commented May 14, 2025

Instead of trying to (potentially incorrectly) map the FrameState stack at any
random instruction back to the profiled types, record the profiled type
of an HIR instruction at the safepoint and expose an API to query that.

@matzbot matzbot requested a review from a team May 14, 2025 18:34
@tekknolagi tekknolagi marked this pull request as draft May 14, 2025 18:41
@tekknolagi
Copy link
Contributor Author

Eugh, going to fix some tests...

This comment has been minimized.

@tekknolagi tekknolagi force-pushed the mb-profile-oracle branch from 4a7d775 to 5b4e3fe Compare May 15, 2025 15:02
@tekknolagi tekknolagi marked this pull request as ready for review May 15, 2025 19:26
@tekknolagi
Copy link
Contributor Author

(It would probably be ideal if this got squashed)

@tekknolagi
Copy link
Contributor Author

Come to think of it, @k0kubun should I just have it profile at the top of every instruction? It'll only allocate if we actually recorded anything in the interpreter

@k0kubun
Copy link
Member

k0kubun commented May 15, 2025

should I just have it profile at the top of every instruction?

You mean adding a zjit_ variant to every YARV instruction? Also, what made you think of it?

It'll only allocate if we actually recorded anything in the interpreter

My assumption is that just calling a C (Rust) function and retrieving profiling metadata could be non-zero overhead for profiled runs. Remember we weren't even allowed to increment a global counter vm_insns_count on the interpreter on the default build, for example. It's somewhat mitigated by rewriting them back after num-profile cycles, but profiled runs do get slower. At least I don't want to run a profiler on nop instruction (or anything that doesn't need to record anything).

@tekknolagi
Copy link
Contributor Author

Oh, no, sorry, I mean just in ISEQ->HIR translation. That will cause a read from IseqPayload in HIR creation but no other work (and, in particular, no other work in the interpreter).

@tekknolagi
Copy link
Contributor Author

Like lift the profile_stack so that it happens once per opcode.

@k0kubun
Copy link
Member

k0kubun commented May 15, 2025

sounds good then :)

@tekknolagi tekknolagi force-pushed the mb-profile-oracle branch from df4c70c to 3188dc5 Compare May 15, 2025 22:08
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.

2 participants