1 Reply Latest reply on Aug 9, 2009 7:47 PM by titanius

    Weird Brook+ compiler error

    titanius
      What does this mean?

      I am trying to compile the following kernel but it gives a weird error. Any help most appreciated.

       

      kernel:

      kernel void Calculate_critvar (int aout_full[][], double orig_y[], double v_alt[], out double critvar<>, out double ubestt<>, int ndstart, int ndend,
          double sumnode, double nodecnt )
      {
          int2 ind = instance().xy;
          int kv = ind.x;
          int j;
          double d;
          double suml=0.0, sumr;
          double npopl, npopr;
          double critParent = sumnode*sumnode/nodecnt;
          double crit;
          for(j=ndstart;j<=ndend-1;j++){
              d = orig_y[aout_full[kv][j]];
              suml += d;
              sumr  = sumnode - suml;
              npopl = ((double)j-(double)ndstart)+1.0;
              npopr = nodecnt - npopl;
              if (v_alt[j] < v_alt[j+1]){
                  crit = (suml * suml / npopl) + (sumr * sumr /npopr) - critParent;
                  if (crit > critvar){
                      ubestt = (v_alt[j] + v_alt[j+1])/2.0;
                      critvar = crit;
                  }
              }
          }
      }

       

      Error:

      mkdir -p brookgenfiles
      /usr/local/atibrook//sdk/bin/brcc  -o brookgenfiles/misc_kernels misc_kernels.br
      ERROR: ASSERT(func.NumArgs() == (int)mChildElements.size()) failed
      While processing <buffer>:358
      In compiler at LoadFunctionArgs()[astcontrol.cpp:426]
        func.NumArgs() = 3
        mChildElements.size() = 2
      Message: Invalid function call
      Aborting...
      Problem with compiling brookgenfiles/misc_kernels_Calculate_critvar_addr.hlsl
      Error--:cal back end failed to compile kernel "Calculate_critvar"

        • Weird Brook+ compiler error
          titanius

          Darn, seems that brook+ doesn't like array indices within array indices. I encountered a similar problem that i reported in the bug list, so thought that this might be related.

           

          using

              index = aout_full[kv][j];

              d = orig_y[index];

          instead of

              d = orig_y[aout_full[kv][j]];

          Solved the problem!

           

          Thanks for reading