WTrei

Strange Brook behavior

Discussion created by WTrei on Aug 11, 2009
Latest reply on Aug 18, 2009 by WTrei
Returned value from subkernel behave in a very strage way (caused by if clauses)

To make a long storry short: I am sick of brook!

The longer version:

I tried to write a modular multiplikation function for 124 Bit unsigned. (I use 4 32 bit integers to emulate them, but leaving out the highest bit).

 

Now I wanted to test my function an became some errors, so i started testig:

kernel uint4 multMod(uint4 input1, uint4 input2, uint4 modulus, int mode) {

   ...
   /* some not importand calculations here */
   ...
    //return doublePres0;                                                   <-- 1

    if (compare(doublePres1,myNull) == 0)  {
        // return doublePres0;                                              <-- 2
        if (compare(doublePres0,modulus) == -1)  {
            // return doublePres0;                                          <-- 3
        }
    }

    //return doublePres0;                                                   <-- 4

 

In this code you can see 4 positions where values could be returned. The "compare" operation is just something like "(input1.w > input2.w){ return -1 }" and so on, so it doesn't change its inputs.

Position 1 and 4 are working fine, the results seem to be correct (input ist 0 0 0 2, output is 0 0 0 4). At position 2 some thrash is returned (3f800000 xxxxxxxx 0 4 )  with the z-part (xxxx....) changing!!!! (with all threads becomming the same input) and last but not least at position 3 just zeros are returned!

I don't know what happens here but I hope there is a immidiate way to fix, because this stuff makes stream computing impossible to use

Ps: I hope you're able to understand the problem - my english is very poor. If nesesary i would send the whole code.

Outcomes