-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Stop JIT hot spot counting #9343
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
Conversation
ext/opcache/jit/zend_jit_trace.c
Outdated
op_array->opcodes[i].handler = jit_extension->trace_info[i].orig_handler; | ||
SHM_PROTECT(); | ||
} | ||
zend_shared_alloc_unlock(); |
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.
Should this be outside the loop?
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.
Should this be outside the loop?
Yes, I will update
When max_root_trace is reached, JIT in tracing mode will not compile any new code for root trace and side trace, but counting hot code is still going on. This patch stops counting as soon as possible by replacing counter handler with original handler, which increases 1.5% performance. Signed-off-by: Wang, Xue <[email protected]>
fbfa5c0
to
11946e9
Compare
The idea looks great. I'll take a deeper look into implementation on next week, when return back from vacation. |
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.
The idea is good. However, I don't see big benefits against just lazy blacklisting. Please explain, I may miss something.
Anyway, this idea may be used to stop counting after some signal (e.g. after warm up).
} | ||
if (jit_extension->trace_info[i].trace_flags & | ||
(ZEND_JIT_TRACE_START_LOOP | ZEND_JIT_TRACE_START_ENTER | ZEND_JIT_TRACE_START_RETURN)) { | ||
op_array->opcodes[i].handler = jit_extension->trace_info[i].orig_handler; |
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.
identation
if (!func_info) { | ||
return; | ||
} |
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.
identation
Yeah in our workload, all hotspot codes have been jitted in the warmup phase and those counter of JIT tracing is not necessary anymore after warmup. Actually, The JIT tracing counter wrapper functions(hybrid_func_trace_counter, hybrid_ret_trace_counter and hybrid_loop_trace_counter) bring numerous branch mispredictions. The lazy blacklisting is still counting before becoming hot. So it is better to stop counting as soon as possible. |
Right. This is the key feature 👍 |
@dstogov Thanks Dmitry. We will keep investing energy and squeezing performance for PHP... |
When max_root_trace is reached, JIT in tracing mode will not
compile any new code for root trace and side trace, but
counting hot code is still going on. This patch stops counting
as soon as possible by replacing counter handler with
original handler, which increases 1.5% performance.
Signed-off-by: Wang, Xue [email protected]