Skip to content

No Intel SIMD extensions guards #6990

Closed

Description

@Jazzinghen
System information (version)
  • OpenCV => 3.1.0
  • Operating System / Platform => Ubuntu Linux 16.04 - 64bit
  • Compiler => gcc 5.4
  • Processors used => Intel i3-2120 and Intel i7-6700
Detailed description

It is not possible to build OpenCV with multiple Intel SIMD instructions and run it on machines that do not support the latest SIMD set enabled.

This requires multiple versions of OpenCV shared libraries to be built and provided with projects that uses them.

Steps to reproduce

Build OpenCV enabling AVX2 or SSE4.2 and then run it on a machine that does not have these SIMD extensions.

Activity

  1. tomoaki0705 commented on Jul 26, 2016

    @tomoaki0705
    Contributor

    As far as I know, there are many SIMD guards, but not all SIMD.

    I honestly like to know which module/function was causing the trouble by SIMD that you experienced.
    I know there are still some unguarded SIMD part, but it's difficult to search for me, since my laptop supports AVX and SSE4.2.

  2. Jazzinghen commented on Jul 26, 2016

    @Jazzinghen
    Author

    The first problem I have encountered (I did not check further due to my application throwing a SIGILL) was in cv::initInterTab2D. Here is the disassembly dump of the function (sorry for the "press enter to continue" lines). If you check around line 203 you can see a vmovss operation, which should be AVX2 or AVX-512.

  3. alalek commented on Aug 2, 2016

    @alalek
    Member

    Looks like this instruction is generated by compiler.
    Current guard pattern for optimization blocks doesn't work. Using of SIMD instructions should be disabled outside of optimization blocks.

    Related #6466

  4. ilya-lavrenov commented on Aug 11, 2016

    @ilya-lavrenov
    Contributor

    The proper way of doing things is to split optimizations into several source files:

    • AVX - compiled with AVX flags
    • SSE - compiled with SSE flags
    • Common implementation - compiled with "default" flags. This translation unit checks whether the processor has AVX, SSE support and invokes functions from AVX / SSE sources accordingly.
  5. vladimir-dudnik commented on Sep 26, 2019

    @vladimir-dudnik
    Contributor

    is that still actual?

  6. alalek commented on Sep 26, 2019

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions