I have a little loop which is either 1, 2 or 4 iterations long.

I want it unrolled by the compiler so its index should be a param.

Its upper and lower limits are all param which are 0 and #size.

        param block = 0 .. #size

where size is a param itself.

Chapel complains in its 3 usages below, namely

        [param b in block]
and
        for b in block

What am I doing wrong?

Yes, I can manually unroll the loop myself and have three instances of the routine but that is messy.

The usage is below.

inline proc vmRot(jk : range, r : int, param size : int, q : [] ?C, u : [] ?R)
{
        const (j, k) = (jk.first, jk.last);
        param block = 0..#size;
        var x = [param b in block] u[r + b, j];

        for i in j+1 .. k do
        {
                const gi = g[i];
                const c = gi.re;
                const s = -gi.im;

                for param b in block do
                {
                        const yi = u[r + b, i];
                        const xi = x[b];
                        const cxi = c * xi;
                        const cyi = c * yi;

                        u[r + s, i - 1] = cxi - s * yi;
                        x[s] = cyi + s * xi;
                }
        }

        [param b in block] u[r + b, k] = x[s];
}

Thanks - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer


_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to