Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121085 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31424 invoked from network); 18 Sep 2023 06:09:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Sep 2023 06:09:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CD9B3180089 for ; Sun, 17 Sep 2023 23:09:12 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 17 Sep 2023 23:09:12 -0700 (PDT) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5308430052fso3323728a12.1 for ; Sun, 17 Sep 2023 23:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695017351; x=1695622151; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yFB6yuxD8LvPopStKzqCKTj6l+qGbq6vLQ6YzYFQu9g=; b=mDQsOJiWvWL+Z6EOPOflOw/b0nJyB4buKOMlWrPAH0i4/C20cxZ11+6fvCZlG7EHFP RGzKtFCXzemXcdt2877eP1U+CbaaQekeLbkuA9+DVtU5uhTw5eUYo34gOrJ2mAp4Yzz1 YUVs6qPy73vTowsvC3Mn35tUuRjPSGdYZF0UiwC0606GScdT+rXZj9vqqjdUsWY2kftO vhCS8QjnJT97GLr3h2817uyqixHUrt5MMD0F+lnQlc40w0Bq36vNTd2H3kUofBBpqy2g R1idB7KDnOlwBTJwxXiJtNp6FyUQa3KSomhnIaytT9wzmtbu4Hi5pbmkf9LLfXNwjZ7r PM6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695017351; x=1695622151; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yFB6yuxD8LvPopStKzqCKTj6l+qGbq6vLQ6YzYFQu9g=; b=B6KeepxU1RT0kZ4OnBKY16VRH5WmPOyOPBJj8KijGRYprwiDbDDpbagZTsEiFUEhvG SE4/fA8t3Wp9ig6dW3xFN0w02OI6v3F/QOhRyb62UdONaX1QJQqD8wjLVocZ4VF1TB3v pFO3Wat7JOdWh7D74ebK5zKXg0xUpgcggaE5Ru8BtZMKYhPrRdiZ3NqsIiBOq6gSGouo pxZIUBP2rKiP167M/w8LWcW5d1qDhVxCJo9A79wxq/ay4RlRUQ6QqtFm53mMAy9LTZU5 AkrZP99tdikg7uMAKsPg7cGyEDD4KjcopLwoiPMt6lsfXJ4TZ/v+NTLy117FWhWVT8ig 06/g== X-Gm-Message-State: AOJu0Yyn37myE/UJJgsXpQUL0exxRDVpRKEf0kqoTcYQWS+LQrk2QpsZ jSzg5K/YA3TkmtZSWA7ikqdHb81M4KzkaZNCRZcvJrY3PGo= X-Google-Smtp-Source: AGHT+IFsLRt4IFHIpR8MazjjE5/bg4IUcfWrrGgoM27ssZ8u+auNPNuDlaYYEkDk1QUFqDgDpCEGe+vFpS4LnaKAOec= X-Received: by 2002:a05:6402:28ac:b0:530:8d55:9c69 with SMTP id eg44-20020a05640228ac00b005308d559c69mr7022809edb.11.1695017351047; Sun, 17 Sep 2023 23:09:11 -0700 (PDT) MIME-Version: 1.0 References: <8b9a1aae-5aec-91a8-5377-27f6f53581cd@php.net> In-Reply-To: <8b9a1aae-5aec-91a8-5377-27f6f53581cd@php.net> Date: Mon, 18 Sep 2023 09:08:59 +0300 Message-ID: To: Derick Rethans Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000018ed0606059bfbf2" Subject: Re: [PHP-DEV] A new JIT engine for PHP-8.4/9 From: dmitrystogov@gmail.com (Dmitry Stogov) --00000000000018ed0606059bfbf2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Derick, On Fri, Sep 15, 2023 at 5:35=E2=80=AFPM Derick Rethans wro= te: > I think this is great work. It looks like the new JIT-IR approach is > more suitable. I have however concerns with a few things here. > > This is a lot of new code, that very few other people understand in > great detail. > > I think it is unwise if we have another large part of the engine that > does not have enough people understanding enough of it, to be able to > debug issues, and contribute to its continued development. > The IR Framework project is going to be developed separately from PHP. Ideally this project will involve compiler experts from different areas. I'm doing my best in this direction. > As such, I don't think this should just be merged, without a > comprehensive document explaining what it is, how it works, what pitfalls > there are, etc. In the mid of October I'll speak about IR at a Java related conference. Then I'll make available a presentation that explains many internals of the IR Framework. > The natural process that we have for PHP would be to > create an RFC. > I'm not sure. The PR just adds a different way to generate native code. Instead of existing ``zend_jit_x86.dasc`` and ``zend_jit_arm64.dasc`` where we had to write assembler code manually, now we have a single ``zend_jit_ir.c`` where we have to construct the IR graph. Disassembler, Linux perf interface and other low-level JIT details were also moved to JIT framework. So, actually the PHP part becomes even simple. > An RFC should also include a user-facing API on how to configure, and > enable, the JIT and its optimisations, as our current implementation > it is not the most convenient for users. > Nothing has changed. The new JIT is a completely self-containing replacement. Only few new ``opcache.jit_debug`` options that may show the IR. I understand that working on an RFC for such a complex issue is going to > take time, but that also gives to opportunity to pair with somebody, > who, while writing it, will also learn how it works. That would also > ready improve the debugging/contributing issues. > IR documentation could be a good addition and it's going to be created soon or later. I don't think it's a blocker, because the IR APIs are quite simple and intuitive. Just two public C headers https://github.com/dstogov/ir/blob/master/ir.h and https://github.com/dstogov/ir/blob/master/ir_builder.h Separately, I am not sure why your PR couldn't just replace the JIT that > we already have? It would IMO not make sense to have two different ones > at the same time. > This is a question. I decided to keep the old JIT to have an ability to quickly switch back in case of big problems. On the other hand we will be able to revert to PHP-8.3. > Furthermore, I am curious as if you have already done some benchmarks. I > am curious to learn how well it makes non-benchmark code run faster. > This doesn't improve the speed of the real apps yet. bench.php is 5-10% faster. Thanks. Dmitry. --00000000000018ed0606059bfbf2--