Skip to content

[$] PowerPC Power8 VSX SIMD optimizations #7207

Closed

Description

@edelsohn

Architecture: PPC64LE (64 bit PowerPC Little Endian mode with VSX SIMD support, Power8 ISA)
OS: Linux
Compiler: GCC or Clang

OpenCV currently includes SIMD support for Intel x86 SSE and ARM Neon. This issue is a feature request for implementation of PowerPC VSX SIMD optimizations. This would include the creation of

opencv/modules/core/include/opencv2/core/hal/intrin_vsx.hpp
opencv/modules/core/include/opencv2/core/vsx_utils.hpp
opencv/modules/core/src/arithm_simd.hpp support for VSX

and the build infrastructure changes to support Power8 VSX.

Financial bounties in support of this effort are open for discussion.

Activity

  1. kinchungwong commented on Sep 27, 2016

    @kinchungwong
    Contributor

    While adding VSX SIMD implementations to the HAL would benefit matrix elementwise operations, there are some important image processing operations, such as those in "imgwarp.cpp" (resize/resample/interpolation, affine transform, perspective transform, user-defined coordinate remapping), that require platform-specific coding that goes beyond what HAL provides.

  2. mshabunin commented on Sep 27, 2016

    @mshabunin
    Contributor

    @kinchungwong , actually there are several imgproc functions added to HAL, but this number could (and should) be extended. Please, check file imgproc/src/hal_replacement.hpp for the full list.

  3. edelsohn commented on Sep 27, 2016

    @edelsohn
    Author

    @kinchungwong Are you interested in working on the support?

    Proposals of sub-tasks and suggested bounty amounts are welcome. I'm ready open bounties on https://www.bountysource.com/ for reasonable suggestions.

  4. kinchungwong commented on Sep 27, 2016

    @kinchungwong
    Contributor

    @edelsohn Sorry, I'm just pointing out something I thought I knew about imgwarp, though thanks to @mshabunin 's post now I know that there are some new developments in that module.

    I have a day job so I won't have time to work on freelance. More importantly, I do not have access to any POWER8/POWER9 hardware.

    I suspect that access to these hardware might be scarce among OpenCV enthusiasts. If there is one thing you can do to encourage enthusiasts to learn POWER8 SIMD (aside from financial reward), it would be to make the ISA documentations freely available and to allow qualified individuals remote access to some research machines. (I won't have time, but others might be interested.)

  5. changed the title [-]PowerPC Power8 VSX SIMD optimizations[/-] [+][$] PowerPC Power8 VSX SIMD optimizations[/+] on Jan 13, 2017
  6. edelsohn commented on Jan 13, 2017

    @edelsohn
    Author

    Any suggested value will be seriously considered. I welcome responses / replies from any developers in the OpenCV community who are interested to work on the project.

  7. dmiller423 commented on Feb 11, 2017

    @dmiller423

    I have started work on a power8-vsx variant and will have some review code up this week.

  8. yuriy-yarosh commented on Feb 11, 2017

    @yuriy-yarosh

    Well, I've got plenty of free time... and it looks it's not that much hard, just a big bunch of a bit boring stuff... I'll be able to get into it at Monday.

  9. barkovv commented on Feb 25, 2017

    @barkovv

    @dmiller423 @yuriy-yarosh Is anyone working on it?

  10. yuriy-yarosh commented on Feb 25, 2017

    @yuriy-yarosh

    I'm working.
    Done porting the intrinsics interface of the PPC.
    It looks like I'll make it 'till 3rd of March.
    Have to test it on Power9 with the ISA3.0 stuff and debug a bit.
    I'll be pushing few commits for review next week.

    Should I provide some Power 7 backwards compatibility ?

  11. 24 remaining items

  12. dmiller423 commented on Jul 15, 2017

    @dmiller423

    There are multiple bugs in gcc 6.x for Power8/LE, fortunately most are fixed for the gcc7 release.
    @seiko2plus are you interested in working on a solution or an end-user?

  13. seiko2plus commented on Jul 15, 2017

    @seiko2plus
    Contributor

    @dmiller423 somehow interested in working on it in case you didn't ace it.

  14. bookmoons commented on Jan 27, 2018

    @bookmoons

    Hello. I'm considering digging into this, but I see there are 2 merges referencing it. Is that a solution underway?

  15. edelsohn commented on Jan 27, 2018

    @edelsohn
    Author

    @seiko2plus What is the status of all this? It seems that Power/VSX support has been merged -- at leat Power8 VSX.

  16. seiko2plus commented on Jan 27, 2018

    @seiko2plus
    Contributor

    @bookmoons yes, I think so, @edelsohn universal intrinsics has been successfully mapped to VSX (ppc64le).

  17. edelsohn commented on Jan 28, 2018

    @edelsohn
    Author

    @vpisarev A VM can be allocated at OSUOSL Power OpenStack cloud

    http://osuosl.org/services/powerdev/

    to connect to the OpenCV buildbot. You can list me as the IBM Advocate.

  18. edelsohn commented on Jan 29, 2018

    @edelsohn
    Author

    @seiko2plus What are the remaining steps?

  19. seiko2plus commented on Jan 29, 2018

    @seiko2plus
    Contributor

    @edelsohn "Adding direct usage of raw intrinsics in "processing" code is not allowed any more"
    please check out @alalek and @vpisarev comments on #10371 to explain why we needs to remove current raw (sse, avx, neon, etc) intrinsics and replace them with universal intrinsics in order to improve performance on ppc64le instead of using VSX intrinsics directly.

    Now, What are the remaining steps on this issue?
    Nothing and everything, Actually I'm not sure but currently I'm working on remove raw intrinsics from arithmetic operations on #10708 in order to clean up SIMD code and improve performance on ppc64le.

    Also I'm thinking on developing an open optimized library for PowerPC Architecture, something like Intel IPP, Arm Ne10 or Carotene so we can use it later as HAL replacement to heavily improve performance on OpenCV for PowerPC and any other similar libs.

  20. edelsohn commented on Jan 29, 2018

    @edelsohn
    Author

    @seiko2plus Thanks for the great work. I understand that raw intrinsics no longer are allowed, although they never were implemented for VSX. There is no "raw instrinsics" implementation with which to compare the current optimization effort for VSX.

    There are remaining issues open, so I am trying to understand the status with respect to correctness and to optimization, especially in OpenCV 3.4. Is OpenCV now considered fully optimized for VSX? Some universal intrinsics for VSX remain unimplemented? The VSX implementation of the universal intrinsics could benefit from additional tuning? Or the only issue is the remaining is the general issue of remaining uses of raw intrinsics that need to be converted to universal intrinsics.

    Should OpenCV 3.4 users on Power8 VSX expect to see a big performance boost and the remaining patches are cleanups, or the initial patches lay the groundwork and the next phases will ramp up performance?

  21. seiko2plus commented on Jan 30, 2018

    @seiko2plus
    Contributor

    @edelsohn Is OpenCV now considered fully optimized for VSX?

    fully optimized! No,

    Some universal intrinsics for VSX remain unimplemented?

    comparing to sse2 and neon, The answer is No.
    note: half precision support for power9 remain unimplemented.

    the only issue is the remaining is the general issue of remaining uses of raw intrinsics that need to be converted to universal intrinsics.

    maybe that is the reason, I hope @alalek @vpisarev @mshabunin could give us a straight answer .

    Should OpenCV 3.4 users on Power8 VSX expect to see a big performance boost and the remaining patches are cleanups, or the initial patches lay the groundwork and the next phases will ramp up performance?

    There are hundreds of lines in modules (core, imgproc, calib3d, video, features2d, dnn) written by universal intrinsics, so the answer is Yes, OpenCV users starting from 3.3.1 should see a big performance boost, also the initial patches and the next phases will ramp up performance.

  22. noloader commented on Aug 4, 2018

    @noloader

    It looks like the main task has been completed. It also looks like the requirements have changed. There's still an open bounty listed at PowerPC Power8 VSX SIMD optimizations on BountySource.com.

    Perhaps this issue should be closed in favor of a new ticket with a list of actionable items or tasks?

  23. vpisarev commented on Aug 6, 2018

    @vpisarev
    Contributor

    @seiko2plus, @noloader, I agree with you. Currently, the fundamental work to bring optimized OpenCV to PPC64 is done via implementing VSX backend for universal intrinsics. The further work (on-going effort) is to convert all the native intrinsics in OpenCV code to the universal ones.

    Regarding the specialized IPP-like library of primitives for PPC/VSX. Well, I do not think that this is good long-term solution. Such libraries are good for very basic things like arithmetics, filters etc. That is, something that people do use, but those are usually not performance-critical parts of any real pipeline. For complex things, like optical flow, DNN etc., where the performance really matters, the code may vary a lot with time, algorithms improve etc. The IPP team has hard time implementing complex stuff while keeping it compatible with OpenCV. This is big problem. I'd suggest to continue the universal intrinsics direction, introduce more complex ones (e.g. v_bilinear_interp(), v_exp() etc.

    The next step might be to create "dynamic universal intrinsics" (or "runtime universal intrinsics" or "jit universal intrinsics") that can be thought of as a light-weight low-level variant of Halide, or cross-platform variant of Xbyak with embedded register allocation. This way we could generate most of simple kernels on-fly and adopt to the actual hardware on-fly.

  24. vpisarev commented on Aug 6, 2018

    @vpisarev
    Contributor

    I also agree that the issue can be closed as resolved (via #9763 and subsequent PRs). @seiko2plus, thank you very much for your excellent work!

  25. seiko2plus commented on Aug 7, 2018

    @seiko2plus
    Contributor

    @vpisarev, At that time the image wasn't clear enough to me or
    maybe because I extremely impressed by IPP made me thought that POWER should has a similar library.

    In practice, however, flexiblity that universal intrinsics
    could provide is exectly what OpenCV needs and especially when we take it to "the next step" sounds awesome !!.
    So I think You Are Right Again and as you suggest we should continue the universal intrinsics direction.

    I also agree that the issue can be closed as resolved (via #9763 and subsequent PRs). @seiko2plus, thank you very much for your excellent work!

    I couldn't have done it without your help and of course @alalek!, also a special 'thanks' goes to OSU open source lab for providing me Power8 servers, I can't wait for power9.

    Anyway for me the game isn't over yet and there's still a lot of things need to be done not only towards VSX but for other extensions too.

    Thanks!

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