reactorlabs / rir

GNU General Public License v2.0
62 stars 18 forks source link

Increasing the tresholds fails pir.check #1258

Closed fikovnik closed 8 months ago

fikovnik commented 8 months ago

Increasing the pir::Parameter::PIR_OPT_BC_SIZE from 20 to 200 which controls when the OSR from callee-caller is triggered, things start to fail (cf. test_features_1 and the encapsulating pipeline).

Among them:

$ PIR_DEOPT_CHAOS=100000 PIR_DEOPT_CHAOS_NO_RETRIGGER=1 bin/R -q -f ../../rir/tests/pir_check.R
...
> # TODO: FIXXXXX
> stopifnot(
+   pir.check(mandelbrot, NoExternalCalls, NoPromise, warmup=function(f) {f(13);f(27)})
+ )
R: /opt/rir/rir/src/compiler/native/builtins.cpp:2236: bool rir::pir::deoptChaosTriggerImpl(bool): Assertion `Parameter::DEOPT_CHAOS' failed.

The pir.check calls pirCheckWarmupBegin which sets the PIR_DEOPT_CHAOS=0. Any code that was compiled before was compiled with PIR_DEOPT_CHAOS=100000 therefore with deoptChaosTriggerImpl builtin in every branch. If such compiled code is run in the context of PIR_DEOPT_CHAOS=0, the assert fails.

fikovnik commented 8 months ago

Fixed in #1245