Hi,
I'm debugging a problem with the shuffle() and shuffle2() functions on MIPS. I
think I've found (part of) the problem but if I'm correct, then I don't see how
it can be working for other targets.
Starting with test/kernel/test_shuffle.cc, I've reduced the testcase down to
n=2 and m=16 and changed stimuli in testcase() so that it only contains 13's.
My testcase produces this output:
Error in shuffle short 16 => short 2 :[1, 1] = shuffle( [0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15], [13, 13]);
element 0 should be 13 (mask 13), got 1
element 1 should be 13 (mask 13), got 1
Error in shuffle2 short 16 => short 2 :[1, 1] = shuffle2( [0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31], [13, 13]);
As you can see, the mask is selecting element 1 instead of the 13 that was
expected.
lib/kernel/shuffle.cl contains the following code:
#define _CL_IMPLEMENT_SHUFFLE(ELTYPE, MTYPE, N, M) \
ELTYPE##N __attribute__ ((overloadable)) \
shuffle(ELTYPE##M in, MTYPE##N mask) \
{ \
MTYPE msize = M==3 ? 4 : M; \
ELTYPE##N out; \
for (int i=0; i<N; ++i) { \
MTYPE m = mask[i] & (msize-1); \
out[i] = in[m]; \
} \
return out; \
}
#define _CL_IMPLEMENT_SHUFFLE_M(ELTYPE, MTYPE, M) \
_CL_IMPLEMENT_SHUFFLE(ELTYPE, MTYPE, M, 2) \
...
Hasn't this swapped M and N so that the mask is being limited to 0-N (0-1)
instead of 0-M (0-15)?
Daniel Sanders
Leading Software Design Engineer, MIPS Processor IP
Imagination Technologies Limited
www.imgtec.com<http://www.imgtec.com/>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel