Skip to content

"Illegal instruction" error on HaikuPorts buildbot #1916

Closed

Description

@extrowerk

According to the logs the build fails on the x86_64 bots while it works ok on x86 bots.

As you can see we are targeting Northwood for x86 and Prescott for x86_64 arch:
https://github.com/haikuports/haikuports/blob/master/sci-libs/openblas/openblas-0.3.4.recipe

Here are the builder logs:
x86 : https://build.haiku-os.org/buildmaster/master/x86_gcc2/logviewer.html?buildruns/2437/builds/31495.log
x86_64 : https://build.haiku-os.org/buildmaster/master/x86_64/logviewer.html?buildruns/2558/builds/12604.log

Note, we call x86 as x86_gcc2, as it got 2 compiler toolchain, the primary is gcc2 and the secondary is gcc7. The x86_64 platform have only gcc7. Blas was built on both arch with gcc7.
Sadly i have currently no information about the buildbots hw, but i can ask the admins.

I built openblas on x86_64 locally with the same recipe, works fine.

Activity

  1. martin-frbg commented on Dec 14, 2018

    @martin-frbg
    Collaborator

    Yes please find out what the actual hardware is, if it works locally it looks like some problem with your buildbot. (Can you get it working with a different TARGET ?)

  2. brada4 commented on Dec 14, 2018

    @brada4
    Contributor

    You make tests with different parameters than build
    You should either patch Makefile.rule or copy over all parameters to all invocations of make.
    https://github.com/haikuports/haikuports/blob/662967332f95a4c5e0f44f8fefcb3fcd7e652564/sci-libs/openblas/openblas-0.3.4.recipe#L87

  3. martin-frbg commented on Dec 14, 2018

    @martin-frbg
    Collaborator

    Not sure I see where make is invoked with different parameters ? To me this looks like one contiguous build and not separate invocations, what am i missing ?

  4. brada4 commented on Dec 14, 2018

    @brada4
    Contributor

    If it helps repeating TARGET and OPENMP option....

  5. extrowerk commented on Dec 15, 2018

    @extrowerk
    ContributorAuthor

    Oh, that could be the culprit, lemme fix it then.

  6. martin-frbg commented on Dec 15, 2018

    @martin-frbg
    Collaborator

    Hmm. I still do not see the different parameters (or separate invocation of make test). Given that this is a DYNAMIC_ARCH build, runtime failure would still be a bug (unless the buildbot runs on some virtual setup that happens to lack x86 fpu features from ten years ago). Given that it happens with the provided tests, at least it seems unlikely that this could be another case of unaligned data access.

  7. brada4 commented on Dec 16, 2018

    @brada4
    Contributor

    If it would be possible to somehow get backtrace text, and disassembly of the instruction generating the exception....

  8. martin-frbg commented on Dec 23, 2018

    @martin-frbg
    Collaborator

    Any progress on this ? (One option could be to inspect config.h and Makefile.conf , or better yet dump /proc/cpuinfo somewhere early in the build process)

  9. brada4 commented on Dec 23, 2018

    @brada4
    Contributor

    You have to set NO_AVX512=1 since haiku "sysinfo" does not have bits to decode AVX512 ISA-s, thus permitting me to deduce that XSAVE and stuff ignores respective register file too (though GCC7 would try to use it)
    I mean I looked here , might be also NO_AVX2 is needed:
    https://git.haiku-os.org/haiku/tree/src/bin/sysinfo.cpp

  10. martin-frbg commented on Dec 23, 2018

    @martin-frbg
    Collaborator

    Not sure if that would really preclude running AVX512 code if that is what the buildbot hardware is. (Any word on that ?) Another option would be to set OPENBLAS_CORETYPE explicitly on the make test to override whatever cpu is detected by the DYNAMIC_ARCH library at runtime. (I assume the idea here is to get the tests to pass and have SkylakeX AVX512 support available as an option in the library)

  11. brada4 commented on Dec 23, 2018

    @brada4
    Contributor

    actually context switch uses fxsaveq , i.e NO_AVX=1 NO_AVX512=1 is needed, though running single AVX-512 thread may go unpunished on 1-cpu system.

  12. martin-frbg commented on Dec 23, 2018

    @martin-frbg
    Collaborator

    I am not sure I understand what you are getting at, do you suggest that Haiku OS itself does not support AVX512 (or even AVX, which would be all the more unlikely) ? If it is just the buildbot that is incapable, I do not think they would want to cripple their binaries to match.

  13. brada4 commented on Dec 23, 2018

    @brada4
    Contributor

    No support whatsoever of AVX, unconditionally:
    https://git.haiku-os.org/haiku/tree/src/system/kernel/arch/x86/64/interrupts.S#n226
    In addition webkit gets SIGILL at times, apparently very faraway relative ffmpeg is better at CPUID stuff.
    EDIT: compiler(s) are good enough, once context switch handles AVX* it is good to go.

  14. martin-frbg commented on Dec 23, 2018

    @martin-frbg
    Collaborator

    Weird. How would that mesh with e.g. existing Eigen port to Haiku ?

  15. brada4 commented on Dec 24, 2018

    @brada4
    Contributor

    Eigen is with minimal patch, changing some file IO
    I will run its self-tests, probably GSL ones too.

  16. extrowerk commented on Dec 24, 2018

    @extrowerk
    ContributorAuthor

    Bugticket on the Haiku issue tracker: https://dev.haiku-os.org/ticket/14775

  17. martin-frbg commented on Dec 24, 2018

    @martin-frbg
    Collaborator

    Was your successful local build test also under Haiku ?

  18. brada4 commented on Dec 24, 2018

    @brada4
    Contributor

    Eigen 'make check' (piledriver VM with CXXFLAGS=-march=native) finished without any breakage (i applied the only distro patch in existence over 3.3.7)

    I set a virtualbox VM for haiku exactly according to doc recipe , it has slow ide disk, gets significantly faster attaching VDI to SATA disk emulation EDIT: proably guide can be updated a little.
    I changed hardware type to linux to no success - (openblas build under) Linux says Piledriver is Piledriver, Haiku says Piledriver is Barcelona
    Forcing target to Piledriver or Sandybridge goes into SIGILL in R DGEMM benchmark. Quicker if running many parallel threads(it is processes under R foreach, more than cores)
    I would speculate that Haiku does not move threads between CPUs until last chance, so this problem is somewhat less visible as in effect 2 AVX+ threads rarely meet on same CPU

    EDIT2 there is no problem for 32bit, no matter gcc2 gcc7 clang7, AVX is only available in 64bit mode.

    I think as a temporary measure you set port to exclude AVX - this is not video decoder where one survives short glitch, we do care about numeric accuracy in the end. It needs two parameters added.
    btw while building eigen I saw sigill-s in smpeg library and sdl

    Would be unfair to record it here "upstream" that Haiku had limited AVX support before beginning 2019, and quite impractical to try to detect it for short moment before Haiku shines EDIT3 it is not like simple thing to just copy/paste that breaks nothing, it will take time to implement.

    Merry Christmas everyone,

  19. brada4 commented on Dec 24, 2018

    @brada4
    Contributor

    In sysinfo in the bug report:
    family 6, model 85, stepping 4
    It is SKYLAKE-X series "Scalable Xeon", not showing a problem as long as tests run in same (Linux,BSD) system as built, just that by pure (un)luck it hit context from previous AVX512 use during tests.
    To make result library universally usable - an old target without -march flags like TARGET=CORE2 needs to be added to make.
    They say it was deduced from sysinfo alone, actually looking further after seeing no display of any AVX-512 bits in outout - core assembly implementing context switcher that has no chance to get around AVX(1) was located.
    (not)glad to see numpy joining the party. It is actually OpenBLAS skylake-X code that triggers SIGILL, also context dump shows only xmm aka SSE registers.

  20. martin-frbg commented on Jan 5, 2019

    @martin-frbg
    Collaborator

    As a side effect of #1947 this may get mitigated by #1949 assuming that HaikuOS does not advertise the availability of the unsupported AVX* features in the cpuid bits. Up to this point, it was simply assumed that AVX2 and/or AVX512 was available if the model number of the cpu matched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions