You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Michael Yu, Aaron Bernard, Christoph Kappestein, Julio H Morimoto, Igor Varga, amiralibamilo, 熊鑫, Tarık Yılmaz, Mike Powers, Thomas Wuerthinger and 83 more
Reacted by Юрий, efinder2, Evgeny Blokhin, Mase Graye, Sam I, Andrii Oriekhov, Oliver Kopp, Tim Glabisch, Javier Vivanco, WirrorYin and 6 more
Reacted by efinder2, Evgeny Blokhin, Mase Graye, Sam I, XiaoYanBot, kcloze, Tim Glabisch, WirrorYin, Leo Cavalcante, Michał Marcin Brzuchalski and 4 more
@xiongxin"Why PHP is not supported?" is rather a rude question. This is a volunteer effort, there is no entitlement to support of any particular language.
"It would be great if PHP was supported" or "I would like to vote for PHP support" would be a request that developers are more likely to respond positively to.
Reacted by Lucas Werkmeister, Mike Kobit, Iwan Aucamp, Mariell Hoversholm, JamesWang, Klaus Heissler, Hasnat Babur, Dimitar Trifonov, Serak Shiferaw, Miyari and 12 more
It is a legitimate question and thanks for asking it.
We would be happy to collaborate with one of the existing PHP implementors for adding PHP support (e.g., Zend or Facebook). Or maybe adding Hack support, which is a PHP dialect.
Implementing a language on GraalVM is a lot easier than from scratch (because compiler, GC, and other infrastructure pieces are provided for free). For languages with complex semantics (and a large library implemented in native code) like PHP it is still a considerable effort. We can support such an effort, but are ourselves currently focused on JavaScript, R, Ruby, and Python.
We can potentially fund a student thesis project or internship to investigate the topic if there is a talented and motivated candidate for exploring this task.
Reacted by Ayodele, Christian Humer, Mark Penner, Adrian Smith, Cosmin Popescu, Randy Gupta, Andrii Oriekhov, Bálint Molnár-Kaló, Vlad Startsev, Anatolii Papenko and 7 more
The Vulcan Logic Dumper is and php extension that hooks into the Zend Engine and dumps all the opcodes (execution units) of a script. They use Zend Engine parser result.
php function token_get_all from tokenizer extension permit to get ast from php source.
the advantage of this solutions they use original php parser, and à 100% compatible with original PHP.
but with ast generated we need to code a ast interpreter for php opcode....
Quercus dont generate php obcode, but generate java code directly from php parsing... is not a good starting point to implement php ast interepreter... but add many php extension implemented in java that can be usefull to add this extension to the final result...
jvm Bytecode approch:
JPHP parse php code and generate JVM bytecode... not implemente all standard php library but can be a good start point to start beceause they generate bytecode... that are directly usable in graalvm... but not to make a php ast interpreter...
this php extension generate llvm assembly from php source with original parser.
possible C extension in grallvm language
in truffleruby i've seen that implement extension in c also, in that is possible to convert php extension to graalvm, to complement php ast intepreter...
Support for PHP has a promising future, php has a large number of users and open source projects, and the php language itself is flawed without thread and coroutine, if graalvm fully supports php and leads php in a new direction of development, Graalvm will be an advocate of multilingual development in the near future, so support PHP language very important.
Reacted by JamesWang, Юрий, Evgeny Blokhin, Mase Graye, CARBONNEAUX Mathieu, Philipp Keidel, Andrii Oriekhov, unikzforce, Thiago Macedo, Matheus Faustino and 6 more
Reacted by Evgeny Blokhin, Mase Graye, Vlad Startsev and Nikola Petkanski
Grammar probably isn't a big problem. A big problem is finding a suitable (e.g. license compatible) and reliably maintained standard library implementation that could be actively reused in GraalVM (i.e. third party would be responsible for maintaining that standard library). Note that TruffleRuby effort is going for many years but it still is unable to run Ruby on Rails fully, the primary Ruby web framework. If a similar situation happens in PHP case then the effort would be effectively wasted - PHP implementation that can't run web frameworks is essentially useless (I guess).
@kcloze I don't think it has to do anything with C extensions if I understand correctly graalvm is basically a custom implementation of the language not just wrapping compiler/interpreter
Hi everyone, Over the past 6 months I worked on a preliminary peak
performance evaluation of a Truffle-hosted implementation for the PHP
programming language. The language implementation is currently
ca. 4000 LoC and shows promising results in the Computer Language
Benchmark Game benchmarks. We reach speedups of up to 859% compared to
PHP's reference implementation and show competitive to significantly
faster results compared to alternative implementations such as
HHVM (Hack) and JPHP.
More engineering efforts must be put into a feature complete
implementation. If you believe these results are promising I would
love to discuss opportunities to potentially continue the project.
Just to clarify is the reference implementation of PHP you are comparing against PHP 7.4 without OpCache support? As IIRC this is the current set-up for the Benchmark Game, due to OpCache needing a preliminary run.
It would also be interesting how this compares to PHP 8.0 and PHP 8.0 with it's newly implemented JIT.
Reacted by Michał Marcin Brzuchalski and Frank Lemanschik
I'm not here to denigrate this project as I truly believe competition on the VM level is what brings the language forward as can be seen when Facebook released the HipHop VM (HHVM) which made a big push for performance improvements in PHP 7.0 (2x in nearly all use cases compared to PHP 5.6).
However, with the information provided in the talk I have no idea what settings where used.
It is still impressive that @abertschi and his team got a 8.5x performance increase and a ~2.5x performance (napkin maths for that one) increase compared to PHP Zend Engine JIT with their settings. But I just would like to know which settings they ran precisely. :-)
And more information about the hardware setup:
Intel®Xeon®E-2176M CPU clocked at 2.7GHz - 4.4GHz and 16GB DDR4RAM. The device has Hyper-Threading disabled, Turbo Boost disabled, and CPU frequency driver intel pstate is used with governor performance manually set at a fixed clock rate of 2.7 GHz.
Reacted by Gina Peter Banyard, Jacky Chan and Nikola Petkanski
And more information about the hardware setup:
Intel®Xeon®E-2176M CPU clocked at 2.7GHz - 4.4GHz and 16GB DDR4RAM. The device has Hyper-Threading disabled, Turbo Boost disabled, and CPU frequency driver intel pstate is used with governor performance manually set at a fixed clock rate of 2.7 GHz.
Thanks for the info 👍 the only thing I would probably change is to not use the CLI SAPI (Server API) but PHP-CGI as it seems to generate better results (I know I had some issues getting JIT/OpCache to work on the CLI) as stated in the article I linked above:
Do not run your examples in the CLI. Use “php-cgi” with the -T flag for reptitions. This allows Opcache and JIT to optimize on the first request, and then you can see in the following repetitions how the optimized performance is. Just for experimenting it makes sense to have “php-cgi -T 2” for running one warmup and one hot request against the same script.
Clarification: JIT works with the CLI, but I find its harder to make the exact effects visible and comparable and requires more configuration.
As an aside we probably should get back to maintaining the php-spec repo, especially as they have been some changes in how number-to-string comparisons work. But that's more a "us" job. :-)
Can we see an opcache.ini ? its important to enable it in cli mode.
I am happy to give more information about the experimental setup. In order to reduce to noise in this issue I encourage you to file an issue in our github project or ping me on twitter. As I said the benchmark setup can be reproduced with the docker/podman file provided. All settings undertaken for PHP8 are here https://github.com/abertschi/graalphp/blob/2d536e40b77b7f8601ad72dfe878c09cfbc1d4e0/docker/install-php8.sh. I do not know where the "opcache.ini" file is stored. We did not manually create such a file. Opcache was enabled with "opcache.enable" and "opcache.enable_cli" in "php.ini". See docker file for more information.
Activity
brettwooldridge commentedon Jun 10, 2018
@xiongxin "Why PHP is not supported?" is rather a rude question. This is a volunteer effort, there is no entitlement to support of any particular language.
"It would be great if PHP was supported" or "I would like to vote for PHP support" would be a request that developers are more likely to respond positively to.
thomaswue commentedon Jun 10, 2018
It is a legitimate question and thanks for asking it.
We would be happy to collaborate with one of the existing PHP implementors for adding PHP support (e.g., Zend or Facebook). Or maybe adding Hack support, which is a PHP dialect.
Implementing a language on GraalVM is a lot easier than from scratch (because compiler, GC, and other infrastructure pieces are provided for free). For languages with complex semantics (and a large library implemented in native code) like PHP it is still a considerable effort. We can support such an effort, but are ourselves currently focused on JavaScript, R, Ruby, and Python.
We can potentially fund a student thesis project or internship to investigate the topic if there is a talented and motivated candidate for exploring this task.
pabl0rg commentedon Jul 5, 2018
Would it be possible to levrage anything from quercus (a php interpreter and stamdard library written in java)?
https://github.com/am-immanuel/quercus [edited link]
lucaswerkmeister commentedon Jul 5, 2018
I assume that should be this Quercus: https://github.com/CleverCloud/Quercus
pabl0rg commentedon Jul 5, 2018
Sorry, I fixed the link. The CleverCloud repo has been abandoned for a long time. This one has more recent updates: https://github.com/am-immanuel/quercus
inoop commentedon Jul 11, 2018
There appears to be an Antlr gammar here: https://github.com/antlr/grammars-v4/tree/master/php
There's also JPHP: https://github.com/jphp-group/jphp
mcarbonneaux commentedon Aug 20, 2018
My addition to this exchange...
in what i understand about graalvm, they 3 way to do :
AST interpreter approch...
To generate the php ast there already differente solution:
note: this solution make possible bootstraping of php parser in graalvm...
This solution are not 100% original parsing solution...
the advantage of this solutions they use original php parser, and à 100% compatible with original PHP.
but with ast generated we need to code a ast interpreter for php opcode....
Quercus dont generate php obcode, but generate java code directly from php parsing... is not a good starting point to implement php ast interepreter... but add many php extension implemented in java that can be usefull to add this extension to the final result...
jvm Bytecode approch:
JPHP parse php code and generate JVM bytecode... not implemente all standard php library but can be a good start point to start beceause they generate bytecode... that are directly usable in graalvm... but not to make a php ast interpreter...
LLVM bytecode approch:
possible C extension in grallvm language
in truffleruby i've seen that implement extension in c also, in that is possible to convert php extension to graalvm, to complement php ast intepreter...
Zend Engine Opcode list to implemente :
good internal explanation of php zend engine:
the php specification:
final comment...
there a hard work to do all of that !
wjmboss commentedon Nov 12, 2018
Support for PHP has a promising future, php has a large number of users and open source projects, and the php language itself is flawed without thread and coroutine, if graalvm fully supports php and leads php in a new direction of development, Graalvm will be an advocate of multilingual development in the near future, so support PHP language very important.
timglabisch commentedon Dec 2, 2019
any news on this? php has a great ecosystem and is widely adopted.
... and a lot of php developers want a different/better runtime.
tarsa commentedon Dec 4, 2019
Grammar probably isn't a big problem. A big problem is finding a suitable (e.g. license compatible) and reliably maintained standard library implementation that could be actively reused in GraalVM (i.e. third party would be responsible for maintaining that standard library). Note that TruffleRuby effort is going for many years but it still is unable to run Ruby on Rails fully, the primary Ruby web framework. If a similar situation happens in PHP case then the effort would be effectively wasted - PHP implementation that can't run web frameworks is essentially useless (I guess).
xiao-nz commentedon Dec 14, 2019
This extension have no release ...
The code have 8 years old https://github.com/jabez-php/llvm
kcloze commentedon Dec 25, 2019
PHP has many C extension, I think it's a very hard work to do.
aurimasniekis commentedon Jan 16, 2020
I found a php antlr parser for 7.4 syntax looks like it works pretty well
https://github.com/antlr/grammars-v4/tree/master/php
@kcloze I don't think it has to do anything with C extensions if I understand correctly graalvm is basically a custom implementation of the language not just wrapping compiler/interpreter
16 remaining items
abertschi commentedon Sep 22, 2020
I uploaded the presentation I gave at ETH which summarizes the results of our experimental Truffle-hosted language implementation for PHP.
https://twitter.com/andrinbertschi/status/1308495323774550021
Girgias commentedon Sep 23, 2020
Just to clarify is the reference implementation of PHP you are comparing against PHP 7.4 without OpCache support? As IIRC this is the current set-up for the Benchmark Game, due to OpCache needing a preliminary run.
It would also be interesting how this compares to PHP 8.0 and PHP 8.0 with it's newly implemented JIT.
frank-dspeed commentedon Sep 23, 2020
@Girgias that all got covered watch the video linked on twitter from the comment above your comment
Girgias commentedon Sep 23, 2020
Just watched it, so PHP 8 Alpha does refer to the JIT version, however doesn't say which settings are used. This is relevant as in the first Beta release (Tagged 4th of August 2020: https://github.com/php/php-src/releases/tag/php-8.0.0beta) Changed some of default options of the JIT (see: php/php-src@0e1e991), most notably it changed from JITing all functions on first script load (mode xx0x) to a tracing JIT (mode xx3x) while also changing its optimization level from " optimized JIT based on static type inference and inner procedure analyses' (mode xxx5) to " optimized JIT based on static type inference and call tree" (mode xxx4). For reference of the modes please refer to the initial PHP RFC introducing this change (https://wiki.php.net/rfc/jit#phpini_defaults).
Moreover, some other keep parameters are not know, was PHP 7.4 run with OpCache enabled or disabled. Same for PHP 8.0. How much of OpCache's memory cache was allocated to the JIT (i.e. was
opcache.jit_buffer_size=set to something other than 0). A good overview as how to test for the JIT is described in this article by one of the contributors of php-src: https://beberlei.de/2020/07/05/what_to_look_out_for_when_testing_php_jit.htmlI'm not here to denigrate this project as I truly believe competition on the VM level is what brings the language forward as can be seen when Facebook released the HipHop VM (HHVM) which made a big push for performance improvements in PHP 7.0 (2x in nearly all use cases compared to PHP 5.6).
However, with the information provided in the talk I have no idea what settings where used.
It is still impressive that @abertschi and his team got a 8.5x performance increase and a ~2.5x performance (napkin maths for that one) increase compared to PHP Zend Engine JIT with their settings. But I just would like to know which settings they ran precisely. :-)
abertschi commentedon Sep 23, 2020
Thanks a lot for asking! We used the default distribution of PHP 7 available on Ubuntu ubuntu:20.04.
The setup is reproducible in the docker file here:
https://github.com/abertschi/graalphp/tree/master/docker
Please also consider reading the technical report:
https://abertschi.ch/default_public/ethz/graalphp/download.php
The benchmarking infrastructure and timing results are stored in a database and are available here:
https://github.com/abertschi/graalphp/blob/master/benchmarks/scripts-report/bench.py
The presentation was only meant as an introduction.
The exact versions we used were:
With JIT flags:
JPHP
HHVM:
Benchmarks were executed consecutively within a process and across multiple processes. See also report for more description.
See as an example fannkuchredux here:
https://github.com/abertschi/graalphp/blob/master/benchmarks/scripts-report/bench/fannkuchredux/fannkuchredux.php-1.php
And more information about the hardware setup:
Intel®Xeon®E-2176M CPU clocked at 2.7GHz - 4.4GHz and 16GB DDR4RAM. The device has Hyper-Threading disabled, Turbo Boost disabled, and CPU frequency driver intel pstate is used with governor performance manually set at a fixed clock rate of 2.7 GHz.
Girgias commentedon Sep 23, 2020
Sadly my Docker skills are non existent 😓
I'll try to read this when I have some time :-)
Thanks for the info 👍 the only thing I would probably change is to not use the CLI SAPI (Server API) but PHP-CGI as it seems to generate better results (I know I had some issues getting JIT/OpCache to work on the CLI) as stated in the article I linked above:
As an aside we probably should get back to maintaining the php-spec repo, especially as they have been some changes in how number-to-string comparisons work. But that's more a "us" job. :-)
pabl0rg commentedon Sep 23, 2020
Aside from performance, key/huge benefit of phpGraal would be running in a managed memory environment.
ashceo commentedon Sep 23, 2020
Can we see an opcache.ini ? its important to enable it in cli mode.
abertschi commentedon Sep 23, 2020
I am happy to give more information about the experimental setup. In order to reduce to noise in this issue I encourage you to file an issue in our github project or ping me on twitter. As I said the benchmark setup can be reproduced with the docker/podman file provided. All settings undertaken for PHP8 are here https://github.com/abertschi/graalphp/blob/2d536e40b77b7f8601ad72dfe878c09cfbc1d4e0/docker/install-php8.sh. I do not know where the "opcache.ini" file is stored. We did not manually create such a file. Opcache was enabled with "opcache.enable" and "opcache.enable_cli" in "php.ini". See docker file for more information.
aurimasniekis commentedon Nov 23, 2023
PHP Support is now completed?
alina-yur commentedon Nov 23, 2023
hi @aurimasniekis. Sorry for miscommunication, this is not planned at the moment.
Spaceghost commentedon Nov 23, 2023
It hasn't been planned the whole time, what changed in the last part of '23 to close this and end visibility?
thomaswue commentedon Nov 24, 2023
There was a great prototype created by @abertschi at https://github.com/abertschi/graalphp. We are happy to support anybody picking up that work or create a new Truffle language project around it. There are many third party language projects and also experiments out there. We list them at https://www.graalvm.org/latest/graalvm-as-a-platform/language-implementation-framework/Languages/.
sgammon commentedon Aug 10, 2024
@zaunere He didn't say no, he just said that they are accepting contributions. https://github.com/abertschi/graalphp is definitely about PHP.