Skip to content

POWER8 VSX BLAS 1/2 single precision #796

Closed

Description

@edelsohn

Optimize BLAS 1/2 single precision for POWER8 VSX

Activity

  1. seyi commented on May 19, 2016

    @seyi

    Hi,, can I get one of these processors for development?

  2. dzabawa commented on Nov 16, 2016

    @dzabawa

    I'm seeing several power8 implementations of level 1/2 routines. Is there a clarification of what's yet needed, including possible improvements to existing code?

  3. martin-frbg commented on Nov 24, 2016

    @martin-frbg
    Collaborator

    Seeing that none of the original participants appears to be available at the moment, my humble view is
    that (a) wernsaar implemented (most of?) the desired functions in the weeks following edelsohn's request (b) #950 is directly related (c) some followup can be found in various topics on the developer mailing list linked from #795 - including some benchmarks and recent comments on perceived coding issues that apparently went without replies.

  4. barkovv commented on Jan 10, 2018

    @barkovv

    @edelsohn
    What the status of this issue? It seems that many of functions are already implemented (this is already mentioned by @martin-frbg ).

  5. edelsohn commented on Jan 10, 2018

    @edelsohn
    Author

    The initial implementation contained some bugs and performance issues that never were addressed by the original author. The issue never was closed.

    I robust, optimized solution in OpenBLAS would be great. The bounties need to be distributed among all of the people who contributed to the effort.

  6. JulianVolodia commented on Jul 31, 2018

    @JulianVolodia

    @edelsohn @martin-frbg still, any concerns? Is there any other place where discuss happens?

    But... @edelsohn about bounty. Is there any clue how to do it practically? ;)

  7. edelsohn commented on Jul 31, 2018

    @edelsohn
    Author

    What's the specific question?

  8. quickwritereader commented on Aug 1, 2018

    @quickwritereader
    Contributor

    Guys, I'm going to do this task. Actually I took this 2-3 weeks ago, but due to some personal issues I haven't started yet. I forgot to comment here about start.

  9. quickwritereader commented on Jan 16, 2019

    @quickwritereader
    Contributor

    #1963 I decided to provide missing Blas1 kernels implemented with vector builtins .
    {saxpy, caxpy, cdot, crot(refactored version of srot),isamax ,isamin, icamax, icamin}
    Performance is far better than using base c kernels.

    I will focus on sgemv and cgemv pairs which are missing from Blas2.

    And also for some Blas1 I try to do hand written assembly to see if I can improve performance further

  10. quickwritereader commented on Feb 1, 2019

    @quickwritereader
    Contributor

    Blas1 results compared to generic kernels
    I wrote script for plot. Also it can plot in sixel supported terminal emulators bench_plot.py
    export OMP_NUM_THREADS=1
    export OPENBLAS_LOOPS=10
    *_base are generic ones

  11. edelsohn commented on Feb 1, 2019

    @edelsohn
    Author

    Impressive gains. Vector C code means vector intrinsics, not inline assembly?

    Vector intrinsics should leverage instructions at each architecture level without re-writing.

  12. quickwritereader commented on Feb 1, 2019

    @quickwritereader
    Contributor

    yes I used vector codes only. Most times I avoided using even intrinsics. As I noticed gcc did decent job

  13. edelsohn commented on Feb 1, 2019

    @edelsohn
    Author

    C code with Intrinsics should be more than enough for BLAS 1/2. I'm a little concerned about the amount of inline assembly code in the IBMz work.

    The main area that needs focus with each processor revision seems to be BLAS 3.

  14. quickwritereader commented on Feb 1, 2019

    @quickwritereader
    Contributor

    yes there is not any great gain using inline for blas 1/2 .
    Sometime I also noticed that gcc 7.2 did not include some vector intrinsics like this one .
    mergee mergeo
    I tried it for icamax but guess included vec_perm with mask yielded better result so I just ifdef-ed it but keep it for future.

  15. quickwritereader commented on Feb 1, 2019

    @quickwritereader
    Contributor

    Some power blas1 vector codes blas2 gemv easily could be translated for Ibm z series. But under hood there is one difference that z13 has only 32 vector registers, but power8 has 64 vector registers so compiler have many options

  16. quickwritereader commented on Feb 1, 2019

    @quickwritereader
    Contributor

    here are gemv results. please also note that actually it is compared with hand written assemblies prefixed _old ( not generic c code. )
    _

    #1994

  17. quickwritereader commented on Feb 1, 2019

    @quickwritereader
    Contributor

    I think if vector codes considered sufficient then most important kernels are already implemented. and also as @edelsohn said it will easily propagated to new series as no assembly was used.

  18. quickwritereader commented on Feb 2, 2019

    @quickwritereader
    Contributor

    @edelsohn I believe this issue could be closed. Please check and let me know if I need to do anything else
    thanks

  19. edelsohn commented on Feb 3, 2019

    @edelsohn
    Author

    Any idea why sgemv_n drops below the original implementation at large sizes?

    Other than that, it looks great.

  20. quickwritereader commented on Feb 3, 2019

    @quickwritereader
    Contributor

    right recall I should investigate it to see if I can make it a little stable across size.

    • first thing to do is to check NBMAX mem size to solve it.
    • if not I could try for inner 8x8 or 4x4 floats,, currently it is 4x8
      I only used perf to see main usage percentage. It showed that 4x8 kernel was underload for both small and big sizes. afaik I also have ibmsdk tools but I use it rarely
  21. quickwritereader commented on Feb 3, 2019

    @quickwritereader
    Contributor

    So far I noticed that making NBMAX=4096 made it stable:
    here are results for tests from 100 to 16000 stepped 200:

    current 2048 is yellow
    4096 is red
    old assembly is pink
    Scripts:
    bench_plot
    (for command line usage see help. it plots when terminal supports sixel or saves into png)
    within jupyter notebook

    import bench_plot 
    import glob
    a=glob.glob('sgemvn/*')
    print(a)
    bench_plot.plot_files(*a,sixel=False)

    Run from OpenBlas directory
    bash script for running old kernel
    nbmax script

  22. edelsohn commented on Feb 3, 2019

    @edelsohn
    Author

    It looks a lot better at 4096 than 2048.

    The Power files seem to define NBMAX as 2048 and the x86-64 files seem to define NBMAX as 4096. Should the default be bumped for Power?

  23. quickwritereader commented on Feb 3, 2019

    @quickwritereader
    Contributor

    Yes I think we need to increase them. I gonna try 8x8 kernel too to see if there be any improvement. . For transposed I uploaded 8x8 but default is still 4x8.
    What I learnt that sometimes trying to understand the reason behind kernel is hard and you can't come with calculated tuned parameter. So just choosing the winner among tested ones is the way to go unless you have an alternative algorithm or thinking

  24. quickwritereader commented on Feb 4, 2019

    @quickwritereader
    Contributor

    @edelsohn #1996 Ok I increased it to 4096.
    And also added sgemvn with 8x8 blocking. It did not perform good enough so that I could make it default. Plus strangely small reordering inside 8x8 loop made gcc to produce a little clever code. So finally I decided to go with small blocking but uploaded this kernel too. Maybe it be helpful when there be any need to switch to inline assembly to produce the most desired output in future.

  25. edelsohn commented on Feb 4, 2019

    @edelsohn
    Author

    Okay. Thanks for testing the variants and updating NBMAX.
    I think we can declare victory.

  26. quickwritereader commented on Feb 4, 2019

    @quickwritereader
    Contributor

    I'm glad that after long pause I could return and did this work this month.

  27. quickwritereader commented on Feb 5, 2019

    @quickwritereader
    Contributor

    @martin-frbg I believe this issue could be closed as initial support

  28. added this to the 0.3.6 milestone on Feb 5, 2019
  29. martin-frbg commented on Feb 5, 2019

    @martin-frbg
    Collaborator

    Yes, thanks a lot for your work. I had only assumed edelsohn would close it as it was "his" issue ticket.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions