cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

titanius
Adept II

Weird Brook+ compiler error

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]];
        suml += d;
        sumr  = sumnode - suml;
        npopl = ((double)j-(double)ndstart)+1.0;
        npopr = nodecnt - npopl;
        if (v_alt < v_alt[j+1]){
            crit = (suml * suml / npopl) + (sumr * sumr /npopr) - critParent;
            if (crit > critvar){
                ubestt = (v_alt + 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"

0 Likes
1 Reply
titanius
Adept II

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];

    d = orig_y[index];

instead of

    d = orig_y[aout_full[kv]];

Solved the problem!

 

Thanks for reading

0 Likes