[Rd] R-devel (r81196) hanging at dchisq(large) (PR#13309)

Avraham Adler @vr@h@m@@d|er @end|ng |rom gm@||@com
Wed Nov 24 18:32:09 CET 2021

On Wed, Nov 24, 2021 at 11:45 AM Martin Maechler
<maechler using stat.math.ethz.ch> wrote:
> >>>>> Avraham Adler  on Thu, 18 Nov 2021 02:18:54 +0000 writes:
>     > Hello.  I have isolated the issue: it is the
>     > fused-multiply-add instruction set (FMA on Intel
>     > processors). Running -march=skylake -mno-fma not only does
>     > not hang, but passes make check-all (using R's native
>     > BLAS).  My intuition remains that something in the new
>     > more precise ebd0 code used in dpois_raw—called by dgamma,
>     > called by dchsq, called by dnchisq—is hanging when the
>     > assembler uses FMA. Unfortunately, I have come across
>     > other cases online where the extra precision and the
>     > different assembler code of FMA vs. non-FMA has caused
>     > bugs, such as [1]. Page 5 of this paper by Dr. William
>     > Kahan sheds some light on why this may be happening [2]
>     > (PDF).
>     > Martin & Morton, having written (PR#15628 [3]) and/or
>     > implemented the ebd0 code that is now being used, can
>     > either of you think of any reason why it would hang if
>     > compiled using FMA?
> I vaguely remember I had a version of ebd0(), either Morton
> Welinder's original, or a slight modification of it that needed some
> mending, because in some border case, there was an out of
> array-boundary indexing... but that's just a vague recollection.
> I had investigated  ebd0()'s behavior quite a bit, also notably
> the version -- together with a pure R code version --
> in my CRAN package DPQ, yesterday updated to version 0.5-0 on CRAN
> {written in Summer, but published to CRAN only yesterday}
> where I have  dpois_raw() optionally using several experimental versions of
> bd0(), and both 'pure R' and a C version of ebd0(),
> as DPQ::ebd0() and DPQ::edb0C()
> each with an option  'verbose' which shows you which branches are chosen
> for the given arguments.
> So, if you install this version (0.5-0 or newer) from the development
> sources, using the *same* FMA configuration,
> I hope you should see the same "hanging" but would be able to see some
> more.. ?
> Can you install it from R-forge
>     install.packages("DPQ", type = "source",
>                      repos="http://R-Forge.R-project.org")
> and then experiment?
> I'd be grateful  {and we maybe can move "off - mailing list"}
> Thank you in advance,
> Martin
> Martin Maechler
> ETH Zurich  and  R Core team

Sure. Responding here simply for closure. Will direct further
questions and output directly to you.

Thank yyou,


More information about the R-devel mailing list