-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Trigger JIT tracing&compilation more often in tests #12250
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.
Thanks for investigating! In terms of the specific flags, @dstogov should judge whether they make sense.
I've also considered adding Psalm and PHPUnit to the nightly tests, would you be OK with that?
We already have PHPUnit in the COMMUNITY job. Adding Psalm is ok if it doesn't unreasonably increase build-time. Although adding PHPStan would likely make more sense given its popularity.
Sorry, meant to say phpseclib instead of phpunit :) |
Also, would you be OK with adding https://github.com/amphp/ext-uv to the amphp tests? |
.github/workflows/nightly.yml
Outdated
-d opcache.jit_max_root_traces=10000000 | ||
-d opcache.jit_max_side_traces=10000000 | ||
-d opcache.jit_max_exit_counters=1000000 | ||
-d opcache.jit_hot_loop=1 | ||
-d opcache.jit_hot_func=1 | ||
-d opcache.jit_hot_return=1 | ||
-d opcache.jit_hot_side_exit=1 |
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.
These are probably not the best settings, because they will trigger JIT compilation on the first function entry or loop iteration and this sometime may lead to very unnatural traces that will never executed.
Anyway, I think it make sense to start with these settings and then change them to a bit less aggressive. (e.g. 2 or 3).
Note, that these settings may increase the tests time.
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.
I am aware they increase test times, JIT compilation on first function entry/loop iteration is precisely why I chose those values, any other value (even 2) already breaks reproduction of bugs like #12249
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.
Looks fine. Just remove jit_prof_threshold
.
.github/workflows/nightly.yml
Outdated
@@ -198,7 +205,14 @@ jobs: | |||
${{ matrix.run_tests_parameters }} | |||
-d zend_extension=opcache.so | |||
-d opcache.enable_cli=1 | |||
-d opcache.jit_buffer_size=16M | |||
-d opcache.jit_buffer_size=64M |
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.
We should probably move this to a common place, e.g. directly in .github/actions/test-linux/action.yml
and enable it via parameter.
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.
Actually, all JIT parameters can directly be moved unconditionally in .github/actions/test-linux/action.yml
, and here we can just provide the -d zend_extension=opcache.so
, let me do that...
@danog Can you please also make the changes in push.yml? I'd like to see how much this adds to the build time. I'm also worried it will make the COMMUNITY job much slower. It may even be counterproductive if too many things fill the cache quickly. |
Done! |
@iluuu1994 Seems the build times are OK, they're somehow even better than on master? https://github.com/danog/php-src/actions/runs/6253638654/job/16979522694 |
Added phpseclib, psalm and phpstan JIT nightly tests, and added ext-uv to the AMP tests since that's generally the best driver for AMP. Also changed the JIT config in all other CIs. |
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.
Thanks @danog!
.github/workflows/nightly.yml
Outdated
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini | ||
echo memory_limit=-1 >> /etc/php.d/opcache.ini | ||
php -v | ||
- name: Test PHPSeclib |
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.
Can you please split this into a separate PR? Can you also temporarily copy this to push.yml to show that the tests are succeeding? It would be great if we could trigger this on-demand, but we don't have that currently...
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.
Will split this to a separate PR, actually most of the new nightly tests are failing under JIT, might be worth pinging @dstogov about this:
- PHPStan is triggering a JIT assertion on master (https://github.com/danog/php-src/actions/runs/6262586495/job/17005155671), opened issue Tracing JIT assertion crash when using phpstan #12262
- Amphp with JIT and ext-uv is hanging on master (https://github.com/danog/php-src/actions/runs/6261267298/job/17001045071), opened issue Hang when using amphp and tracing JIT #12249
- Psalm on 8.2 is triggering a tracing JIT bug (can't run the nightly 8.2 tests on my fork so don't have a link), opened issue Tracing JIT triggers wrong Array to string conversion in Psalm #12255
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.
Split to #12270
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.
Will split this to a separate PR, actually most of the new nightly tests are failing under JIT, might be worth pinging @dstogov about this:
Thanks. I've assigned these three issues to myself.
.github/workflows/push.yml
Outdated
@@ -129,7 +129,7 @@ jobs: | |||
runTestsParameters: >- | |||
-d zend_extension=opcache.so | |||
-d opcache.enable_cli=1 | |||
${{ !matrix.asan && '-d opcache.jit_buffer_size=16M' || '' }} | |||
${{ matrix.asan && '-d opcache.jit=disable' || '-d opcache.jit=tracing' }} |
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.
This would result in opcache.jit=tracing
twice for non-asan, as it's already added in the test action.
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.
Hmm, where? I see only two instances of opcache.jit=tracing in this workflow, one here and the other in the mac OS tests...
btw @iluuu1994 what do you think about #12263, do you think I could add the new workflow files for RISC-V tests directly in this PR? |
Ping @iluuu1994, is this OK to merge? :) |
@danog I'm on vacation, I'll check next week. |
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.
@danog The changes look good to me, thank you! However, I would prefer merging this after the JIT issues have been fixed. A failing build is annoying, but can also hide new problems.
Thank you @iluuu1994! |
@danog From what I understand this causes the COMMUNITY build to fail at least for Psalm and amp-parallel, is that not correct? |
@iluuu1994 Nope, amp-parallel only fails if the uv extension is installed with JIT (and I don't install it in this PR anymore), and I didn't add Psalm this this PR. |
@danog For some reason I misremembered and thought we already had Psalm in CI ^^ Thanks, I will merge this then. |
In my understanding, this should catch more issues (actually, running the amphp/parallel tests with this JIT config locally already causes a hang...).
I've also considered adding Psalm and PHPUnit to the nightly tests, would you be OK with that?