Stream domains implementation in Brook+ ??

Discussion created by jean-claude on Oct 3, 2008
Latest reply on Oct 10, 2008 by udeepta@amd
How to access/refer to substreams

Hi ,

I'm looking for a way to access to a stream's sub-streams (1D and 2D) in order to

consider them as independant streams for further processing.

simple example:

float a<100,100>;

// then having  b as the sub-stream of 10 elements a<20,30>  for further processing.

Googling on the net, I found that Brook domain stream operator should be highly relevant for this purpose as described here :

" The domain operator is meant to be applied to streams as they are being passed to a kernel function, as in:

kernel void copy( float input<>, out float output<> ) { output = input; }
float a<100>;
float b<20>;
copy( b.domain( 5, 15 ), a.domain( 20, 30 ) ); // a[i+20] = b[i+5] for 0 <= i < 10

Domains of streams can be passed to kernel functions as input stream arguments, output stream arguments and gather stream arguments. The operator can be applied to 1, 2, 3, and 4 dimensional streams, using int, int2, int3, and int4 input arguments.

While domains were originally intended to only work at a kernel call site, they can actually be copied to other stream references (often using the brook C++ runtime API) to create persistent 'views' of a stream:

brook::stream a = brook::stream::create<float>( 100 );
brook::stream b = a.domain( 20, 30 );
copy( data, b ); // writes to both b and a

The issue is that in ATI Brook+ this feature seems to be left unimplemented.
The compiler is not dealing with it...

Anyway digging into Brook runtime interface (brt.hpp) , it does appear that "domain" is part of Brook stream class.

Is there a practical way get access to it and use it ????