cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Raistmer
Adept II

Returning single boolean result from kernel - will it work?

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:

if(result.x>threshold){
condition[0]=1;
}
output.x=result.x;


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 ?
0 Likes
11 Replies