Skip to content
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

Multiple JIT test improvements #12406

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

danog
Copy link
Contributor

@danog danog commented Oct 10, 2023

Had to reduce the trace count because allocations fails, it turns out JIT was actually disabled after all (??, maybe because my GHA workers have less RAM the the ones used by this org...).

@danog
Copy link
Contributor Author

danog commented Oct 11, 2023

Ping @iluuu1994 :)

@iluuu1994
Copy link
Member

@danog Can you apply this just to master? The changes haven't landed in older branches. I've only backported the minimum to fix nightly (because nightly uses the workflow.yml from master, but the action files from the branches).

@danog
Copy link
Contributor Author

danog commented Oct 11, 2023

I've only backported the minimum to fix nightly (because nightly uses the workflow.yml from master, but the action files from the branches).

Actually that's precisely why I can't target this on master, the patch.php file needs to be present on all branches for nightlies to work (plus, this improves JIT testing everywhere).

@iluuu1994
Copy link
Member

I missed how much this changes. Can you split the fixes for jit_max_... and the .github/patch.php file? I'm not sure if checking for opcache limits should be done this way, and I don't think it really matters for most things. Actually, setting jit_max_root_traces and shm being full is what exposed the bug here: #12366. Anyway, that part is more controversial so I'd like to hear what others think, but we can fix jit_max_... in the meantime.

@danog danog changed the base branch from PHP-8.1 to master October 12, 2023 11:20
@danog danog force-pushed the tests_psalm_phpstan_phpseclib branch from 37f4aab to 35c0183 Compare October 12, 2023 11:20
@iluuu1994
Copy link
Member

@danog Btw I just merged the changes for jit_max_....

@danog
Copy link
Contributor Author

danog commented Oct 12, 2023

Done @iluuu1994!
I'm aware that #12366 was actually caused by the shm filling up, but at the same time I'm a bit confused as to how that could have happened, as when running the nightly CI tasks on my fork, the patch.php file actually warned that JIT was completely disabled due to excessive size of the JIT config (maybe it was just the normal opcache cache being filled up?).

Either way, opened #12425 with the improved jit_max settings and the patch.php JIT checker script (which I added just as a sanity check for the tests, to make sure none of them fill up the opcache memory, preventing some JIT traces from being compiled: there is value in testing the edge case of filling up the opcache memory, as proved by #12366, but my intent was more to improve JIT coverage :)

@danog
Copy link
Contributor Author

danog commented Oct 12, 2023

@danog Btw I just merged the changes for jit_max_....

Whoops missed that, thank you!

@danog
Copy link
Contributor Author

danog commented Oct 17, 2023

Ping @iluuu1994

@danog danog mentioned this pull request Oct 22, 2023
@danog
Copy link
Contributor Author

danog commented Oct 23, 2023

Ping @iluuu1994 again? :)

@danog
Copy link
Contributor Author

danog commented Nov 13, 2023

@iluuu1994 @dstogov Should be good to merge!

I've also added a parallelization script for the old community tasks, which makes builds at least 20 minutes faster (when running on a 2-core GHA worker, sometimes GHA will provide a 4-core worker, which approximately halves overall execution times, but manually specifying a parallelism of 4 to the new nightly.php script might yield in further improvements even on 2-core GHA workers):

Example:

Another benefit of the nightly.php script is that nightly tests can now easily be run on other CIs (like for example the ARM one)

Comment on lines 378 to 379
echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini
echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini
Copy link
Member

Choose a reason for hiding this comment

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

It's better to keep the default values.

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I would prefer to split this PR into two.

  1. Change ini setting
  2. Add new apps (this should be merged only after the first passes nightly tests)

I'm not sure if switching from yml tasks description to nightly.php is good or bad, but I can't follow the changes...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dstogov Done! #12662

Switching to the new nightly.php script allows to parallelize the phpunit tests of all the various libraries (this yields considerable speed improvements especially with CI workers with a lot of CPU cores); plus using a simple PHP script instead of a platform-dependent job declaration allows easily running the nightly tests locally and/or on different CIs (like for example, it might be worth running at least the nightly.php script on the ARM CI as well to test arm JIT)

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Honestly, I'm not a big fan of this for two reasons:

  • It adds more complexity than we really need.
  • More importantly, it merges the output of all tested frameworks into a single step in GA. Some steps like Symfony already emit a lot of output that is hard to scan. Merging all steps is going to make this much worse.

I appreciate your effort, but I wonder whether we actually need this build to be faster?

Your PRs also still do way too much. 🙂 Simultaneously moved and refactored code is very hard to review.

.github/workflows/nightly.yml Outdated Show resolved Hide resolved
.github/jit_check.php Outdated Show resolved Hide resolved
Comment on lines 20 to 21
unset($status);
gc_collect_cycles();
Copy link
Member

Choose a reason for hiding this comment

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

Do we need these? The script ends here anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should bypass an issue where the garbage collector is not invoked in forks for some reason (particularly in Psalm).

@danog danog force-pushed the tests_psalm_phpstan_phpseclib branch from de059eb to 90de8b4 Compare November 14, 2023 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants