Re: all, any, none rationale

2018-04-17 Thread Brian Green
I tested: 1.4.2, 1.5.0, 1.6.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2.  Got the 
same result with all versions.

Thanks,
-Brian

On Monday, April 16, 2018 at 11:25:12 AM UTC-7, Matt Pharr wrote:
>
> Hm, strange. Here's the implementation of all() from the ispc stdlib:
>
> __declspec(safe)
> static inline uniform bool all(bool v) {
> // As with any(), we need to explicitly mask v with the current 
> program mask
> // so we're only looking at the current lanes
> #if (ISPC_MASK_BITS == 1)
> return __all(v | !__mask);
> #else
> return __all((UIntMaskType)__sext_varying_bool(v) | !__mask);
> #endif
> }
>
> (Yes, grungy for various reasons), but in theory it should be factoring in 
> the current mask. I wonder if a compiler change broke this; any chance you 
> can easily try on an earlier version?
>
> Thanks,
> Matt
>
>
>
> On Mon, Apr 16, 2018 at 11:18 AM, Brian Green  > wrote:
>
>> It looks like all(), any(), and none() examine all lanes regardless if 
>> those lanes are active or not.  For example,
>>
>> if (programIndex < 4) {
>> if (all(programIndex < 4)) {
>> print("all lanes are less than 4\n");
>> } else {
>> print("all lanes are not less than 4\n");
>> }
>> }
>>
>> will output:
>>
>> all lanes are not less than 4
>>
>> This behavior is usually inconvenient.  When using all(), I'm generally 
>> thinking all of my active lanes - the inactive lanes often contain 
>> irrelevant values.  Is there a rationale for all(), any(), or none() to 
>> operate on all lanes, regardless of mask?
>>
>> -brian
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Intel SPMD Program Compiler Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ispc-users+...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ispc-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: all, any, none rationale

2018-04-16 Thread Matt Pharr
Hm, strange. Here's the implementation of all() from the ispc stdlib:

__declspec(safe)
static inline uniform bool all(bool v) {
// As with any(), we need to explicitly mask v with the current program
mask
// so we're only looking at the current lanes
#if (ISPC_MASK_BITS == 1)
return __all(v | !__mask);
#else
return __all((UIntMaskType)__sext_varying_bool(v) | !__mask);
#endif
}

(Yes, grungy for various reasons), but in theory it should be factoring in
the current mask. I wonder if a compiler change broke this; any chance you
can easily try on an earlier version?

Thanks,
Matt



On Mon, Apr 16, 2018 at 11:18 AM, Brian Green 
wrote:

> It looks like all(), any(), and none() examine all lanes regardless if
> those lanes are active or not.  For example,
>
> if (programIndex < 4) {
> if (all(programIndex < 4)) {
> print("all lanes are less than 4\n");
> } else {
> print("all lanes are not less than 4\n");
> }
> }
>
> will output:
>
> all lanes are not less than 4
>
> This behavior is usually inconvenient.  When using all(), I'm generally
> thinking all of my active lanes - the inactive lanes often contain
> irrelevant values.  Is there a rationale for all(), any(), or none() to
> operate on all lanes, regardless of mask?
>
> -brian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Intel SPMD Program Compiler Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ispc-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ispc-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


all, any, none rationale

2018-04-16 Thread Brian Green
It looks like all(), any(), and none() examine all lanes regardless if 
those lanes are active or not.  For example,

if (programIndex < 4) {
if (all(programIndex < 4)) {
print("all lanes are less than 4\n");
} else {
print("all lanes are not less than 4\n");
}
}

will output:

all lanes are not less than 4

This behavior is usually inconvenient.  When using all(), I'm generally 
thinking all of my active lanes - the inactive lanes often contain 
irrelevant values.  Is there a rationale for all(), any(), or none() to 
operate on all lanes, regardless of mask?

-brian

-- 
You received this message because you are subscribed to the Google Groups 
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ispc-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.