New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_fabs fails on arm64 #612
Comments
Sorry, but we lack an Arm maintainer. Interested? |
Well, from your description, it's not the ilogb() that needs fixing, but rather the test_fabs to accept both values as valid ? |
Conceptually yes, but I don't think changing the test is the right fix. test_fabs doesn't explicitly use
The difference is in the value of |
@pjaaskel - sounds interesting but can you elaborate on what you're expecting - both in terms of time and responsibilities? I'll be doing this in my free time and will take sometime to become familiar with pocl (but also OpenCL in general). |
OK, i think i see the problem. SLEEF is using math.h which defines |
The ilogb() test is a lot happier with your change. Changes to misc.h aligns the values of For the changes to _kernel.h, I got lost trying to understand which of the various #ifdefs apply. So can't confirm if it's really needed. Now to understand why the other bits of test_fabs fail. Aside - I think it might be worth splitting up the multiple math function checks into separate tests of their own. It'll help identify quicker when something breaks |
Looks like I spoke too soon in the above comment. On further testing I've found that the fix works with all lengths of vector of floats but doesn't work with a vector of doubles with more than one element. |
The pocl debian package is failing to build due to test_fabs failing on arm64. Following is the result of my findings when investigating the failure.
test_fabs checks for correctness of a number of math related functions. Of the ones tested
ilogb
andldexp
fail on arm64.ilogb
ilogb(x)
returnsFP_ILOGB0
when x = 0, andFP_ILOGBNAN
when x = NaNAccording to OpenCL 1.2, the valid values for
FP_ILOGB0
are eitherINT_MIN
or-INT_MAX
(note the '-' sign). Similarly the valid value forFP_ILOGBNAN
are eitherINT_MIN
orINT_MAX
. ISO C has a similar specification ofilogb()
so it's not that unusual to have two differing return values.Looking at glibc, it looks like the choice of value for
FP_ILOGB0
andFP_ILOGBNAN
is architecture dependent, e.g.,FP_ILOGB0
isINT_MIN
on x86 but-INT_MAX
on arm64.The check in "test_fabs" fails because the value returned by the underlying implementation of
ilogb()
doesn't match on0
andNAN
. The implementation ofilogb(0)
returns-INT_MAX
whileFP_ILOGB0
is defined asINT_MIN
in pocl. Similarly,ilogb(NaN)
returnsINT_MAX
whileFP_ILOGBNAN
is defined asINT_MIN
in pocl.This is my first poke at pocl and could be missing something obvious. AIUI, on arm64 sleef provides the implementation of
ilogb()
(viaSleef_ilogb()
) but I couldn't find an obvious way to fix the failure.Hints/suggestion welcome!
The text was updated successfully, but these errors were encountered: