Skip to content

Conversation

@vext01
Copy link
Contributor

@vext01 vext01 commented Dec 3, 2025

Requires: ykjit/ykllvm#291

Decide if we the current thread is tracing inline, in the interpreter, rather than calling off to Rust in every block.

The Rust side now defines the thread local shared with LLVM IR generated by our software tracing pass.

Also many fixes to make this work.

/// What kind of tracing (if any!) is this thread undertaking?
fn tracing_kind() -> IsTracing {
THREAD_IS_TRACING.with(|x| x.load(Ordering::Relaxed))
let raw = &raw mut __yk_thread_tracing_state;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try again (in a follow up PR) to use an atomic here, thus avoiding the need for &raw, but as you can see, this PR is already big enough.

@ltratt ltratt added this pull request to the merge queue Dec 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 3, 2025
@ltratt
Copy link
Contributor

ltratt commented Dec 3, 2025

Looks like a simple Clippy fix.

@vext01
Copy link
Contributor Author

vext01 commented Dec 4, 2025

Force pushed a fix.

@ltratt ltratt added this pull request to the merge queue Dec 4, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@vext01
Copy link
Contributor Author

vext01 commented Dec 4, 2025

Not sure what happened there. Re-synced ykllvm anyway.

@ltratt ltratt added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@vext01
Copy link
Contributor Author

vext01 commented Dec 4, 2025

Force pushed more clippy fixes.

@ltratt ltratt added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@vext01
Copy link
Contributor Author

vext01 commented Dec 4, 2025

Fifth time lucky?

@ltratt ltratt added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 4, 2025
Decide if we the current thread is tracing inline, in the interpreter,
rather than calling off to Rust in every block.

The Rust side now defines the thread local shared with LLVM IR generated
by our software tracing pass.

Also many fixes to make this work, the most important of which allows
traces to retrieve live variables from registers (and not just spill
slots). A large comment explains.
@vext01
Copy link
Contributor Author

vext01 commented Dec 9, 2025

Force pushed the fix for the hanging test.

We were worried about the potential performance hit from saving/restoring those 6 registers.

This is what I measured on b15:

Datum1: baseline
Datum0: lwt-with-reg-fixes

confidence level: 95%

 Benchmark                 Datum1 (ms)  Datum0 (ms)  Ratio  Summary
 bounce/yklua/1500         10641 ± 263  10159 ± 152   0.95  4.53% faster
 deltablue/yklua/12000     10708 ±  47  10313 ±  83   0.96  3.68% faster
 knucleotide/yklua/        15250 ±  87  14795 ±  58   0.97  2.98% faster
 nbody/yklua/250000         5664 ±  65   5505 ±  94   0.97  2.81% faster
 spectralnorm/yklua/1000   15795 ±2953  14297 ±  29   0.91  indistinguishable
 list/yklua/1500            9850 ± 645   8967 ± 268   0.91  indistinguishable
 fannkuchredux/yklua/10    15292 ± 397  14649 ± 406   0.96  indistinguishable
 Heightmap/yklua/2000       9357 ± 786   9052 ±  68   0.97  indistinguishable
 richards/yklua/100        47246 ± 659  46075 ± 757   0.98  indistinguishable
 fasta/yklua/500000         4179 ±  32   4139 ±  16   0.99  indistinguishable
 sieve/yklua/3000           4797 ± 135   4770 ± 143   0.99  indistinguishable
 mandelbrot/yklua/500       1172 ±   6   1167 ±   1   1.00  indistinguishable
 json/yklua/100            13725 ± 218  13670 ± 114   1.00  indistinguishable
 LuLPeg/yklua/             15090 ± 178  15035 ± 119   1.00  indistinguishable
 towers/yklua/600          10903 ± 221  10868 ±  80   1.00  indistinguishable
 bigloop/yklua/1000000000  18231 ±   5  18231 ±   3   1.00  indistinguishable
 havlak/yklua/1500         65663 ±1277  65838 ± 785   1.00  indistinguishable
 revcomp/yklua/             3484 ± 204   3502 ± 210   1.01  indistinguishable
 HashIds/yklua/6000        10259 ±  81  10335 ± 157   1.01  indistinguishable
 storage/yklua/1000        28065 ± 279  28306 ± 189   1.01  indistinguishable
 cd/yklua/250              36284 ± 371  36606 ± 290   1.01  indistinguishable
 binarytrees/yklua/15      11469 ±  93  11646 ± 103   1.02  indistinguishable
 queens/yklua/1000          6431 ± 111   6608 ± 292   1.03  indistinguishable
 permute/yklua/1000         9843 ± 501  10173 ± 300   1.03  indistinguishable

I think that's still a good starting point for the other optimisations we've planned. Would you agree?

@vext01
Copy link
Contributor Author

vext01 commented Dec 9, 2025

(those results are from 5 process executions)

@ltratt
Copy link
Contributor

ltratt commented Dec 9, 2025

LGTM! I take it I can now merge this?

@vext01
Copy link
Contributor Author

vext01 commented Dec 9, 2025

Go ahead!

@ltratt ltratt added this pull request to the merge queue Dec 9, 2025
Merged via the queue into ykjit:master with commit 9ce25bc Dec 9, 2025
2 checks passed
@vext01 vext01 deleted the lightweight-swt branch December 10, 2025 09:34
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