ROCm / ROCm-Device-Libs

ROCm Device Libraries
97 stars 60 forks source link

j1 (both double and float) return NaN for "large" negative numbers #72

Closed VinInn closed 1 year ago

VinInn commented 3 years ago

I suspect this is due to the use of "x" instead of "ax" in this portion of the code https://github.com/RadeonOpenCompute/ROCm-Device-Libs/blob/a1f82f37cf105f0091e0f9e850a0a75aabde6eb7/ocml/src/j1F.cl#L81

b-sumner commented 3 years ago

Thanks, we'll take a look.

b-sumner commented 3 years ago

Thanks again for reporting this. It will be fixed in a future release.

b-sumner commented 3 years ago

@VinInn, if you don't mind my asking, how did you run across this and the previous issue you raised?

VinInn commented 3 years ago

@b-summer: by running an exhaustive search: see https://gitlab.inria.fr/zimmerma/math_accuracy/-/tree/master/ in particular https://gitlab.inria.fr/zimmerma/math_accuracy/-/blob/master/binary32_exhaustive/check_exhaustiveGPU.cc (it can be trivially hippified) and https://gitlab.inria.fr/zimmerma/math_accuracy/-/blob/master/latex/glibc234.tex We plan to publish this soon and to update it with ROCm/ocml results as soon as the new fixed versions will be released (We will of course send you the new version for comments before publishing)

b-sumner commented 3 years ago

Thanks. We have exhaustive tests as well, or rather tests that can be made as exhaustive as desired using command line arguments, but those arguments hadn't been set up properly for some functions. We appreciate the chance to view your work prior to publication.

b-sumner commented 3 years ago

@VinInn I noticed the paper mentions large errors for double precision acosh, atanh, and log1p, but for the inputs listed, I am seeing the library producing results with error below 1 ulp, e.g.

double log1p: Samples: 1......... 0.28 ulp at (0x1.10730dfffffffp-4): *0x1.07c565cc10592484p-4 vs 0x1.07c565cc10592p-4

I'm thinking you may be seeing a compiler problem in ROCm 3.7, and/or that the default optimization for HIP negatively affected the accuracy. Can you try with a more recent version of ROCm? Or perhaps try with low optimization?

VinInn commented 3 years ago

@b-sumner , the paper does not include results for ROCm yet. Which of the libraires are you referring too? I can anticipate that our results for ROCm for double log1p is 1.0 ulp @ -0x1.5efad5491a79bp-1022

I am using ROCm 4.3.1

VinInn commented 3 years ago

@b-summer : We have updated https://gitlab.inria.fr/zimmerma/math_accuracy/-/blob/master/latex/glibc234.tex to include ROCm results. We will wait a new release of ROCm that includes the new version to update it and officially published.

Any feedback is welcome.

BTW is there any paper or conference contribution that we can use as reference besides the README.md in git?

VinInn commented 2 years ago

we have published a new version of our comparison of the accuracy of mathematical libraries that includes ROCm results. https://members.loria.fr/PZimmermann/papers/accuracy.pdf

b-sumner commented 1 year ago

This has been fixed.