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.

Reply via email to