-
Notifications
You must be signed in to change notification settings - Fork 96
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
jit: Introduce background compilation #457
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmarks
Benchmark suite | Current: 51ce53b | Previous: 6b462c0 | Ratio |
---|---|---|---|
Dhrystone |
5.22 Average DMIPS over 10 runs |
4.88 Average DMIPS over 10 runs |
0.93 |
Coremark |
0.004 Average iterations/sec over 10 runs |
0.004 Average iterations/sec over 10 runs |
1 |
This comment was automatically generated by workflow using github-action-benchmark.
eb20baf
to
2f5e037
Compare
8b87096
to
d03919d
Compare
I defer to @vacantron for confirmation. |
src/riscv.c
Outdated
(uint64_t) ((memory_t *) PRIV(rv)->mem)->mem_base); | ||
free(entry); | ||
} | ||
/* Instead of writing while(rv->quit), placing the code here prevents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does volatile
help for such purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it works.
Given the significant runtime compilation overhead associated with performing aggressive optimizations, we have implemented a background compilation mechanism to mitigate this issue. When the runtime profiler identifies a strong hotspot, it adds a T2C compilation request to the wait queue. A background thread, which continuously monitors this queue, triggers T2C to process the requests and notifies the main thread upon completion by updating a flag.
Finally, T2C is landed! |
Given the significant runtime compilation overhead associated with performing aggressive optimizations, we have implemented a background compilation mechanism to mitigate this issue. When the runtime profiler identifies a strong hotspot, it adds a T2C compilation request to the wait queue. A background thread, which continuously monitors this queue, triggers T2C to process the requests and notifies the main thread upon completion by updating a flag.
This mechanism defers the execution of T2C-generated machine code, leading to more frequent use of T1C-generated code. Despite this, the approach effectively minimizes runtime compilation delays by eliminating the need for the main thread to wait for T2C compilation to complete, thereby improving overall performance.
The workflow of background compilation.
The performance comparison with and without the background compialtion.
Close: #239