ykjit / yk

yk packages
https://ykjit.github.io/yk/
Other
32 stars 7 forks source link

Can we retire the yk-no-fallthrough ykllvm hack? #969

Open vext01 opened 9 months ago

vext01 commented 9 months ago

This hack is slowing AOT code down:

+----+-------------------------------------------------------------------------------+----------------+---------+
| #  | flags turned off (O2 passes are set)                                          | execution time | 95% CI  |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 1  | baseline (all flags are turned on)                                            | 89.9ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 2  | —yk-no-fallthrough                                                            | 76.1ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 3  | —yk-block-disambiguate                                                        | 78.7ms         | 0.00189 |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 4  | —yk-patch-control-point                                                       | 84.4ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 5  | —yk-insert-stackmaps                                                          | 85.8ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 6  | —yk-split-blocks-after-calls                                                  | 82ms           | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 7  | —yk-no-fallthrough + —yk-block-disambiguate                                   | 68.4ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 8  | —yk-no-fallthrough + —yk-block-disambiguate + —yk-patch-control-point         | 63.9ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 9  | —yk-no-fallthrough + —yk-block-disambiguate + —yk-insert-stackmaps            | 58.4ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 10 | —yk-no-fallthrough + —yk-block-disambiguate + —yk-split-blocks-after-calls    | 66.8ms         | 0.00189 |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 11 | —yk-no-fallthrough + —yk-block-disambiguate + —yk-patch-control-point +       |                |         |
|    | —yk-insert-stackmaps                                                          | 55.1ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 12 | —yk-no-fallthrough + —yk-block-disambiguate + —yk-patch-control-point +       |                |         |
|    | —yk-split-blocks-after-calls                                                  | 64.2ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 13 | —yk-no-fallthrough + —yk-block-disambiguate + —yk-insert-stackmaps +          |                |         |
|    | —yk-split-blocks-after-calls                                                  | 58.2ms         | 0.002   |
+----+-------------------------------------------------------------------------------+----------------+---------+
| 14 | —yk-no-fallthrough + —yk-block-disambiguate + —yk-patch-control-point +       |                |         |
|    | —yk-insert-stackmaps + —yk-split-blocks-after-calls                           | 54.5ms         | 0.003   |
+----+-------------------------------------------------------------------------------+----------------+

(Data collected by @nmdis1999)

The pass also seems to compound with some of our other passes making even worse AOT performance.

As far as I can see, this hack stops consecutive blocks from falling through (by keeping jump terminators around). This seems to be because PT would see fallthrough as one large block instead of two (or small) smaller blocks and that might break the mapper.

Questions:

ltratt commented 7 months ago

@nmdis1999 Has there been any movement on this?