2 Replies Latest reply on Mar 15, 2009 5:21 PM by rick.weber

    reduction kernel causes compilation hanging

    rick.weber

      Is instance() not supported in reduction kernels? I want to sum all the lower triangular elements in a matrix, so I do

      reduce void reduction(float input<>, reduce float output)
      {
      int4 curDomainPt = instance()
      if(curDomainPt.y > curDomainPt.x)
      {
      output += input;

      When I run this in brcc, it hangs indefinitely and doesn't print anything. I'm using SDK version 1.3, as we haven't had time to upgrade yet as we have WIP that we don't want to accidently break.

        • reduction kernel causes compilation hanging
          Ceq

          No, you can't use "instance" neither "indexof" within reduction kernels. However you can use a normal kernel that makes a copy of the original stream but setting the upper elements to 0 and then apply the reduction.

           

          kernel void lowerCopy(float input<>, out float output<> ) {
              int2 pos = instance().xy;
              float tmp = 0.0f;
              if(pos.y > pos.x) tmp = input;
              output = tmp;
          }

           


          From ATI Stream SDK User Guide (v1.4-beta):

          A.6.3.6 Semantic Handling of indexof, instance...
          ...
          instance:
          - Always returns int4
          - Cannot be used in a reduction kernel
          ...