That looks like exactly what I am looking for.  I've scanned that document 
several times and somehow overlooked that section.   Thanks!

On Thursday, August 19, 2021 at 3:15:36 PM UTC-5 Dmitry Babokin wrote:

> Mike,
>
> I'm not sure that I understand your question correctly. Are you trying to 
> pick some lanes of varying computations (i.e. based on should_append(x) 
> selector) 
> and serialize them in an array?
>
> If so, you probably need this: 
> https://ispc.github.io/ispc.html#packed-load-and-store-operations
>
> Dmitry.
>
> PS It's preferred to post questions on 
> https://github.com/ispc/ispc/discussions - it has wider reach and more 
> chances to get answered.
>
> On Thu, Aug 19, 2021 at 1:08 PM [email protected] <[email protected]> 
> wrote:
>
>> I have a case where I want to write something like this:
>>
>> uniform int* uniform array = ...;
>> uniform int offset = 0;
>> foreach(x = ...) {
>>     if ( should_append(x) ) { 
>>         array[offset++] = x;
>>     }
>> }
>>
>> ... but of course, that doesn't compile.  
>>
>> Is there an idiom for doing this in ISPC?  It seems like it would be 
>> possible with some combination of broadcast()-like operations but I can't 
>> quite put my finger on it (and maybe it's simply just not practical).
>>
>> I'm thinking of something like:
>>
>> foreach(x = ...) {
>>     if ( should_append(x) ) { 
>>         int varying_offset = some_incrementing_magic(offset);
>>         array[varying_offset] = x;
>>     }
>> }
>> ... where each lane computes its own (unique) array offset based on the 
>> results of the gang.
>>
>> Thanks in advance,
>> Mike
>>
>> -- 
>> 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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ispc-users/a5338031-900c-4605-90bd-7849a02c2bf0n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ispc-users/a5338031-900c-4605-90bd-7849a02c2bf0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ispc-users/afe7590b-7d17-4073-a28d-63a93f7576den%40googlegroups.com.

Reply via email to