input_output.br test

Discussion created by Ceq on Oct 1, 2008
Latest reply on Oct 10, 2008 by udeepta@amd
In the SDK's samples folder there is a test called input_output.

This file says in the descripcion:

multiple_inputs tests that both the input and output variables can be the same,
that both input variables can be the same, and that all variables can be the same.

But then it doesn't test these features, it just performs
"d = a * b + c;" with different streams, so looks like it's a mistake.
(The same test in BrookGPU project is ok)

In the SDK v1.2 if you try tu run any code where input and output variables
are the same you get a runtime error. In the release notes you say that this
is part of the language spec. There is an environment variable to allow this,
however there is a warning stating that the results could be unpredictable.

I understand that using the same stream as a gather stream and an output
could result in undefined behavior, example:

kernel void dontdothisathome(float a[ ], out float b<> );
dontdothisathome(s, s);

But using the same stream as input and output in a simple kernel shouldn't
be a problem, example:

kernel void inc(float a<>, out float b<> ) { b = a + 1; }
inc(a, a);

Reading Brook language spec 0.2 (the latest I could find in Merrimac site)
doesn't disallow this, furthermore it says that the input value is passed by
value, and the output stream variable is a new stream, so according to
specs it should be ok, shouldn't it?

Either way, don't forget to fix the example, please.

Is already reported a bug in SDK 1.2 reductions that aborts program execution
if you execute twice the same reduction kernel? (With nothing between them)

It doesn't always happen, depends on the code, for example:
Open samples/tests/reduction/reduction.br and duplicate line 211:

matrix_mult(result1, quadresult);
sum(matrices, sum_res[0]); // line 211
sum(matrices, sum_res[0]); // duplicated line
sum(quadresult, sum_res[1]);