Skip to content

Conversation

@vext01
Copy link

@vext01 vext01 commented Dec 3, 2025

This changes the software tracing pass so that we do the "is the thread tracing?" check inline in the interpreter AOT code, instead of calling out to Rust every time to do the check.

The AOT IR serialiser is then modified so as to give the JIT runtime the IR as though the checks didn't exist. This is because:

  • a) we don't ever want to trace the checks, so they are just IR bloat.

  • b) it would be laborious to filter out the checks when building the trace, and the more we can do statically the better.

Measurement suggests small speedups in the order of a few percent points for a handful of benchmarks, but this is (hopefully) only the beginning of what can be done. There are many optimisations we plan to do which should compound.

// tracing_check:
// %t <- load the "is this thread tracing?" thread local
// %dont_record <- t == 0
// condbr %t, record, done
Copy link
Author

Choose a reason for hiding this comment

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

Just realised that the arguments on this are wrong.

This changes the software tracing pass so that we do the "is the thread
tracing?" check inline in the interpreter AOT code, instead of calling
out to Rust every time to do the check.

The AOT IR serialiser is then modified so as to give the JIT runtime the
IR as though the checks didn't exist. This is because:

 - a) we don't ever want to trace the checks, so they are just IR bloat.

 - b) it would be laborious to filter out the checks when building the
      trace, and the more we can do statically the better.

Measurement suggests small speedups in the order of a few percent points
for a handful of benchmarks, but this is (hopefully) only the beginning
of what can be done. There are many optimisations we plan to do which
*should* compound.
@vext01
Copy link
Author

vext01 commented Dec 3, 2025

Force pushed a fix

@ltratt ltratt added this pull request to the merge queue Dec 3, 2025
Merged via the queue into ykjit:main with commit 8d5a4c6 Dec 3, 2025
2 checks passed
@vext01 vext01 deleted the lightweight-swt branch December 4, 2025 09:33
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