I'm running a simple test case that makes me question my understanding of 
how varying types are created when varying pointers to varying types are 
dereferenced.  My understanding was that each pointer would be dereferenced 
with the appropriate lane.  But this appears to not be the case.

Consider:

export void
run()
{
    varying int p[programCount];
    for (uniform int i = 0; i < programCount; ++i) {
        p[i] = i * programCount + programIndex;
        print("%\n", p[i]);
    }

    varying int * uniform a = &p[0];
    print("%\n", a);
    varying int * varying av = a;
    print("%\n", av);
    varying int aDeref = *a;
    varying int avDeref = *av;
    print("%\n", aDeref);
    print("%\n", avDeref);
}


Compiled with ispc-1.9.2 as:
ispc test.ispc --target=sse2-i32x4 -o test_ispc.o -h test_ispc.h

The following output is produced:
[0,1,2,3]
[4,5,6,7]
[8,9,10,11]
[12,13,14,15]
0x7ffd8568d240
[0x7ffd8568d240,0x7ffd8568d240,0x7ffd8568d240,0x7ffd8568d240]
[0,1,2,3]
[0,0,0,0]

The avDeref value suprises me.  I was expecting [0,1,2,3].  In other words, 
the pointer in lane 0 would be dereferenced for lane 0, the pointer in lane 
1 would be dereferenced at lane 1, etc...  But instead all of them seem to 
be dereferenced for lane 0.  I've tested this with avx1-i32x8 and 
avx2-i32x8 and seen similar results.  So, what am I misunderstanding about 
varying pointers to varying types?

Thanks,
-Brian

-- 
You received this message because you are subscribed to the Google Groups 
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ispc-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to