Note that there are some explanatory texts on larger screens.

plurals
  1. POAMD APP SDK v2.9 compiler bug
    primarykey
    data
    text
    <p>I'm trying to build a simple program in OpenCL to calculate the value of pi using a Monte Carlo method, I'm using AMD's APP SDK on Intel CPU and AMD GPU, this is the kernel source:</p> <pre><code>#define RAND_MAX 4294967295 float rand(uint *seed) { *seed = *seed * 1103515245 + 12345; float res= *seed % ( RAND_MAX + 1); res/=RAND_MAX; return res; } __kernel void pi(__global uint *seed, __global uint *res) { int idx = get_global_id(0); uint loc_seed= seed[0] + idx; res[idx]=0; float x,y; uint i; for(i=0; i&lt;100000; i++) { x=rand(&amp;loc_seed); y=rand(&amp;loc_seed); if( (x*x+y*y)&gt;1 ) { res[idx] += 1; } } } </code></pre> <p>which does not compile, giving the following output, immediately when calling clBuildProgram causing the whole process to crash:</p> <pre><code>LLVM ERROR: Cannot select: 0x15b01a0: i64 = setcc 0x15aed90, 0x15b02a0, 0x15b2b80 [ORD=16] [ID=34] 0x15aed90: i32 = add 0x15afda0, 0x15af6a0 [ORD=14] [ID=31] 0x15afda0: i32 = mul 0x15af4a0, 0x15afba0 [ORD=13] [ID=28] 0x15af4a0: i32 = add 0x15afaa0, 0x15af6a0 [ORD=9] [ID=26] 0x15afaa0: i32 = mul 0x15aeb90, 0x15afba0 [ORD=8] [ID=25] 0x15aeb90: i32,ch = CopyFromReg 0x1660540, 0x15ae890 [ORD=8] [ID=24] 0x15ae890: i32 = Register %vreg2 [ORD=8] [ID=1] 0x15afba0: i32 = Constant&lt;1103515245&gt; [ORD=8] [ID=2] 0x15af6a0: i32 = Constant&lt;12345&gt; [ORD=9] [ID=3] 0x15afba0: i32 = Constant&lt;1103515245&gt; [ORD=8] [ID=2] 0x15af6a0: i32 = Constant&lt;12345&gt; [ORD=9] [ID=3] 0x15b02a0: i32 = Constant&lt;0&gt; [ORD=16] [ID=10] </code></pre> <p>What's that? I'm sure the problem is somewhere in the kernel source because switching to another kernel file everithing runs just fine..</p> <p>Thanks in advance</p> <p>EDIT: it seems the problem lies in the number 4294967295, which is the largest unsigned int with 32 bits, but the compiler, for some reason, seems not to like it..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload