Re: Check mask all ones / all zeros


Guy Lemieux
 

yeeesh glad i don’t have to stare at that code too long.

i know it’s not your code ...

i think it could use a abs followed by a max reduction, then do the rest as scalar ops?

these macros appear to be targeted towards fixed-width simd. in particular i think they are making an assumption of very short vectors. in this snippet, it appears to want to compute all elements of the vector the same way ... with longer vectors, i would expect to use masks to separate the different computation types so it can be individualized for each element.

i haven’t studied the code in depth, but on the surface the all-mask-ones case seems to be not very useful here, nor does it really help with performance.

guy



On Thu, May 20, 2021 at 4:02 AM Roger Ferrer Ibanez <roger.ferrer@...> wrote:
Hi Guy,



On 20/5/21 12:09, Guy Lemieux wrote:

> so, what exactly do you plan to do after knowing the result is all-0

> or all-1 ?  do you want to initiate a branch or something else? does a

> precise (synchronized) result matter, or can you tolerate decoupling

> delays?



The code I've been looking at, uses this for a branch.



FWIW: this is the SLEEF library (vector math library). An example of how

it uses the check can be found at

https://github.com/shibatch/sleef/blob/master/src/libm/sleefsimddp.c#L340



(Not claiming that this specific library as written is a good or bad fit

for RVV, just looking at the code to get an idea of what are its

expectations)



Kind regards,



--

Roger Ferrer Ibáñez - roger.ferrer@...

Barcelona Supercomputing Center - Centro Nacional de Supercomputación





http://bsc.es/disclaimer

Join tech-vector-ext@lists.riscv.org to automatically receive all group messages.