2 Replies Latest reply on May 10, 2009 1:25 PM by gaurav.garg

    Illegal to call scatter kernel from any kernel

    fandango

      Hello again,

      What does this error mean?

      I have two kernel function.

      kernel void motion_estimation(unsigned char src[], unsigned char ref[], int width, int height, out double sad[])

      kernel int estimate_macroblock_4x4(unsigned char mbs[],
                                         unsigned char mbr[],
                                         int i,
                                         int j,
                                         int width,
                                         int height, 
                                         out double sad[])


      The first calls the second one.

      The streams defenition is

          brook::Stream<unsigned char> srcStream(rank, streamSize);
          brook::Stream<unsigned char> refStream(rank, streamSize);

          // copying data from input buffer to input stream
          srcStream.read(src);
          refStream.read(ref);

          // creating the output stream
          streamSize[0] = width / 16 * height / 16;

          rank = 1;

          // creating the output stream
          streamSize[0] = width;
          streamSize[1] = height;
          rank = 1;

          brook::Stream<double> sad(rank, streamSize);

      As you can see I don't fully understand you stream conception, because of poor documentation.


      Can you advice me something?

        • Illegal to call scatter kernel from any kernel
          fandango

          kernel int estimate_macroblock_16x16(unsigned char mbs[],
                                             unsigned char mbr[],
                                             int i,
                                             int j,
                                             int width,
                                             int height, 
                                             out double sad[])
          {
              int x, y;
              int index = i / 16 + (j / 16 * width);
             
              for (y = 0; y < 16; y++)
              {
                  for (x = 0; x < 16; x++)
                  {
                      int index = i + x + ((j + y) * width);
                     
                      sad[index] += (double)(mbs[index] - mbr[index]);
                  }
             
              }
             
              return 0;
          }

          kernel void motion_estimation(unsigned char src[],
                                        unsigned char ref[],
                                        int width,
                                        int height,
                                        out double sad[])
          {
              // Output position
              int2 vPos = instance().xy;
             
              int i = vPos.x; // width
              int j = vPos.y; // height
             
              if ((j % 16 == 0 && i % 16 == 0) && (j != height - 1 && i != width - 1))
              {
                  estimate_macroblock_16x16(src, ref, i, j, width, height, sad);
              }
          }