You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
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.
#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
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
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.
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
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.
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
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
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
@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.
Activity
seyi commentedon May 19, 2016
Hi,, can I get one of these processors for development?
dzabawa commentedon Nov 16, 2016
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?
martin-frbg commentedon Nov 24, 2016
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.
barkovv commentedon Jan 10, 2018
@edelsohn
What the status of this issue? It seems that many of functions are already implemented (this is already mentioned by @martin-frbg ).
edelsohn commentedon Jan 10, 2018
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.
JulianVolodia commentedon Jul 31, 2018
@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? ;)
edelsohn commentedon Jul 31, 2018
What's the specific question?
quickwritereader commentedon Aug 1, 2018
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.
quickwritereader commentedon Jan 16, 2019
#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
quickwritereader commentedon Feb 1, 2019
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
edelsohn commentedon Feb 1, 2019
Impressive gains. Vector C code means vector intrinsics, not inline assembly?
Vector intrinsics should leverage instructions at each architecture level without re-writing.
quickwritereader commentedon Feb 1, 2019
yes I used vector codes only. Most times I avoided using even intrinsics. As I noticed gcc did decent job
edelsohn commentedon Feb 1, 2019
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.
quickwritereader commentedon Feb 1, 2019
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.
quickwritereader commentedon Feb 1, 2019
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
quickwritereader commentedon Feb 1, 2019
here are gemv results. please also note that actually it is compared with hand written assemblies prefixed _old ( not generic c code. )

_
#1994
quickwritereader commentedon Feb 1, 2019
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.
quickwritereader commentedon Feb 2, 2019
@edelsohn I believe this issue could be closed. Please check and let me know if I need to do anything else
thanks
edelsohn commentedon Feb 3, 2019
Any idea why sgemv_n drops below the original implementation at large sizes?
Other than that, it looks great.
quickwritereader commentedon Feb 3, 2019
right recall I should investigate it to see if I can make it a little stable across size.
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
quickwritereader commentedon Feb 3, 2019
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
Run from OpenBlas directory
bash script for running old kernel
nbmax script
edelsohn commentedon Feb 3, 2019
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?
quickwritereader commentedon Feb 3, 2019
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
quickwritereader commentedon Feb 4, 2019
@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.
edelsohn commentedon Feb 4, 2019
Okay. Thanks for testing the variants and updating NBMAX.
I think we can declare victory.
quickwritereader commentedon Feb 4, 2019
I'm glad that after long pause I could return and did this work this month.
quickwritereader commentedon Feb 5, 2019
@martin-frbg I believe this issue could be closed as initial support
martin-frbg commentedon Feb 5, 2019
Yes, thanks a lot for your work. I had only assumed edelsohn would close it as it was "his" issue ticket.