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

Better tracing #18

Open
2 tasks
chc4 opened this issue Sep 13, 2021 · 2 comments
Open
2 tasks

Better tracing #18

chc4 opened this issue Sep 13, 2021 · 2 comments

Comments

@chc4
Copy link
Owner

chc4 commented Sep 13, 2021

Right now we just println a bunch, which sucks.

  • Switch to tracing so we have introspection into how long specific parts of the program are taking
  • Save cranelift_codegen::cfg_printer::CFGPrinter to disk so we can visualize the JIT'd program CFG better (and maybe build our own graphviz printout for JitValues?)
@nbp
Copy link

nbp commented Feb 17, 2022

Intel CPUs have a feature which allow recording the traces of taken branches in the form of a record with a from & to pointer. Look for "branch trace" in the intel documentation.

I never used it, but this could potentially be used to record traces of execution of any code, even the one generated by the Rust compiler. Thus removing the need for instrumenting the code to recompile it later.

@chc4
Copy link
Owner Author

chc4 commented Feb 17, 2022

The tracing in this issue is actually about switching to use the tracing crate for diagnostics, not collecting JIT traces :)

Intel BTS and PT are both very cool technologies, and would be a good fit if we needed to. Currently Lineiform is designed as a method based JIT, not a tracing JIT, so we never record execution traces, only inline and constant fold closed environment members in the closure inputs. There are some tradeoffs between method and tracing JIT, where tracing is really good at optimizing hot loops and deep call stacks, but I don't think there is a consensus on which is definitively better, so I'm just going to stick to method-based for now.

There is another meta-JIT project I know of (https://github.com/ykjit/yk) that is planning on using Intel PT to collect JIT traces, and I'm curious to see how it turns out.

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

No branches or pull requests

2 participants