Returning single boolean result from kernel - will it work?

Discussion created by Raistmer on Sep 27, 2009
Latest reply on Oct 15, 2009 by Raistmer
I need to do some transformation on 2D array and return another 2D array from kernel and single boolean value that will show if some additional postprocessing needed for this data block or not.
Currently 2D array processed in gather + ordinary streams, not scatter.

Smth like
kernel void kernel_A(float4 input[][], out float4 output<>);

that boolean value will be 1 if any of elements in output array meets some condition.

The question:
can I use such kernel:

kernel void kernel_B(float4[][], out float4 output<>, out int condition[]);
where condition stream defined as
unsigned ssize=1;
brook::Stream< int > condition(1,&ssize);

and do next thing in kernel:


Will I get required behavior in this case? (that is, condition will be zero if nothing in 2D array was above thrreshold and condition will be 1 if any of 2D elements was above threshold) Can I assume that if no writes in scatter array were done it will be zero ?