c++ - openCL glGetProgramInfo causing Core Foundation crash -


i writing c++ command line program in xcode (6.4) on osx yosemite (10.10.4). using apple's opencl framework , trying save opencl binaries disk.

first create program source , build follows:

cl_int err; cl_program result = clcreateprogramwithsource(context, numfiles, (const char **)sourcestrings, null, &err); errormanager::checkerror(err, "failed create compute program");  err = clbuildprogram(result, devicecount, devices, null, null, null); errormanager::checkerror(err, "failed build program"); 

the above code works fine , can launch kernels without error.

then try access binary sizes...

size_t *programbinarysizes = new size_t[devicecount]; err = clgetprograminfo(result, cl_program_binary_sizes, sizeof(size_t) * devicecount, programbinarysizes, null); 

however call clgetprograminfo causes xcode throw exc_breakpoint has following output:

corefoundation`__cftypecollectionretain: 0x7fff8e2c2480 <+0>:   pushq  %rbp 0x7fff8e2c2481 <+1>:   movq   %rsp, %rbp 0x7fff8e2c2484 <+4>:   pushq  %r14 0x7fff8e2c2486 <+6>:   pushq  %rbx 0x7fff8e2c2487 <+7>:   movq   %rsi, %rbx 0x7fff8e2c248a <+10>:  testq  %rbx, %rbx 0x7fff8e2c248d <+13>:  je     0x7fff8e2c25ae            ; <+302> 0x7fff8e2c2493 <+19>:  cmpb   $0x0, -0x17f41f28(%rip)   ; __cfdeallocatezombies 0x7fff8e2c249a <+26>:  je     0x7fff8e2c257c            ; <+252> 0x7fff8e2c24a0 <+32>:  testq  %rdi, %rdi 0x7fff8e2c24a3 <+35>:  je     0x7fff8e2c24b5            ; <+53> 0x7fff8e2c24a5 <+37>:  leaq   -0x17f917cc(%rip), %rax   ; kcfallocatorsystemdefault 0x7fff8e2c24ac <+44>:  cmpq   %rdi, (%rax) 0x7fff8e2c24af <+47>:  jne    0x7fff8e2c257c            ; <+252> 0x7fff8e2c24b5 <+53>:  testb  $0x1, %bl 0x7fff8e2c24b8 <+56>:  je     0x7fff8e2c24e4            ; <+100> 0x7fff8e2c24ba <+58>:  movl   %ebx, %eax 0x7fff8e2c24bc <+60>:  shrl   %eax 0x7fff8e2c24be <+62>:  andl   $0x7, %eax 0x7fff8e2c24c1 <+65>:  cmpl   $0x6, %eax 0x7fff8e2c24c4 <+68>:  ja     0x7fff8e2c259c            ; <+284> 0x7fff8e2c24ca <+74>:  leaq   0xef(%rip), %rcx          ; <+320> 0x7fff8e2c24d1 <+81>:  movslq (%rcx,%rax,4), %rax 0x7fff8e2c24d5 <+85>:  addq   %rcx, %rax 0x7fff8e2c24d8 <+88>:  jmpq   *%rax 0x7fff8e2c24da <+90>:  callq  0x7fff8e2df7b0            ; cfstringgettypeid 0x7fff8e2c24df <+95>:  jmp    0x7fff8e2c2594            ; <+276> 0x7fff8e2c24e4 <+100>: movl   0x8(%rbx), %eax 0x7fff8e2c24e7 <+103>: shrl   $0x8, %eax 0x7fff8e2c24ea <+106>: andl   $0x3ff, %eax 0x7fff8e2c24ef <+111>: movq   (%rbx), %rcx 0x7fff8e2c24f2 <+114>: testq  %rcx, %rcx 0x7fff8e2c24f5 <+117>: je     0x7fff8e2c2522            ; <+162> 0x7fff8e2c24f7 <+119>: cmpq   -0x17f41f96(%rip), %rcx   ; __cfconstantstringclassreferenceptr 0x7fff8e2c24fe <+126>: je     0x7fff8e2c2522            ; <+162> 0x7fff8e2c2500 <+128>: leaq   -0x17f43fa7(%rip), %rdx   ; __cfruntimeobjcclasstable 0x7fff8e2c2507 <+135>: movq   (%rdx,%rax,8), %r14 0x7fff8e2c250b <+139>: cmpq   %r14, %rcx 0x7fff8e2c250e <+142>: je     0x7fff8e2c2522            ; <+162> 0x7fff8e2c2510 <+144>: testb  $0x1, %cl 0x7fff8e2c2513 <+147>: je     0x7fff8e2c2594            ; <+276> 0x7fff8e2c2515 <+149>: movq   %rbx, %rdi 0x7fff8e2c2518 <+152>: callq  0x7fff8e481b6a            ; symbol stub for: object_getclass 0x7fff8e2c251d <+157>: cmpq   %r14, %rax 0x7fff8e2c2520 <+160>: jne    0x7fff8e2c2594            ; <+276> 0x7fff8e2c2522 <+162>: callq  0x7fff8e481aaa            ; symbol stub for: objc_collectablezone 0x7fff8e2c2527 <+167>: movq   %rax, %rdi 0x7fff8e2c252a <+170>: movq   %rbx, %rsi 0x7fff8e2c252d <+173>: callq  0x7fff8e481594            ; symbol stub for: auto_zone_is_valid_pointer 0x7fff8e2c2532 <+178>: testl  %eax, %eax 0x7fff8e2c2534 <+180>: je     0x7fff8e2c255b            ; <+219> 0x7fff8e2c2536 <+182>: movl   0x8(%rbx), %eax 0x7fff8e2c2539 <+185>: shrl   $0x8, %eax 0x7fff8e2c253c <+188>: andl   $0x3ff, %eax 0x7fff8e2c2541 <+193>: leaq   -0x17f45ff8(%rip), %rcx   ; __cfruntimeclasstable 0x7fff8e2c2548 <+200>: movq   (%rcx,%rax,8), %rax 0x7fff8e2c254c <+204>: testb  $0x4, (%rax) 0x7fff8e2c254f <+207>: je     0x7fff8e2c2594            ; <+276> 0x7fff8e2c2551 <+209>: movq   %rbx, %rdi 0x7fff8e2c2554 <+212>: callq  0x7fff8e2bf500            ; cfretain 0x7fff8e2c2559 <+217>: jmp    0x7fff8e2c2594            ; <+276> 0x7fff8e2c255b <+219>: cmpl   $0x0, 0xc(%rbx) 0x7fff8e2c255f <+223>: je     0x7fff8e2c2594            ; <+276> 0x7fff8e2c2561 <+225>: leaq   -0x17f72248(%rip), %rsi   ; @"storing non-gc object %p in gc collection, break on cfcollection_non_gc_storage_error debug." 0x7fff8e2c2568 <+232>: movl   $0x4, %edi 0x7fff8e2c256d <+237>: xorl   %eax, %eax 0x7fff8e2c256f <+239>: movq   %rbx, %rdx 0x7fff8e2c2572 <+242>: callq  0x7fff8e3b61e0            ; cflog 0x7fff8e2c2577 <+247>: callq  0x7fff8e3c3290            ; cfcollection_non_gc_storage_error 0x7fff8e2c257c <+252>: movq   %rbx, %rdi 0x7fff8e2c257f <+255>: popq   %rbx 0x7fff8e2c2580 <+256>: popq   %r14 0x7fff8e2c2582 <+258>: popq   %rbp 0x7fff8e2c2583 <+259>: jmp    0x7fff8e2bf500            ; cfretain 0x7fff8e2c2588 <+264>: callq  0x7fff8e2df7f0            ; cfnumbergettypeid 0x7fff8e2c258d <+269>: jmp    0x7fff8e2c2594            ; <+276> 0x7fff8e2c258f <+271>: callq  0x7fff8e2df850            ; cfdategettypeid 0x7fff8e2c2594 <+276>: movq   %rbx, %rax 0x7fff8e2c2597 <+279>: popq   %rbx 0x7fff8e2c2598 <+280>: popq   %r14 0x7fff8e2c259a <+282>: popq   %rbp 0x7fff8e2c259b <+283>: retq    0x7fff8e2c259c <+284>: int3    0x7fff8e2c259d <+285>: callq  0x7fff8e482020            ; symbol stub for: getpid 0x7fff8e2c25a2 <+290>: movl   $0x9, %esi 0x7fff8e2c25a7 <+295>: movl   %eax, %edi 0x7fff8e2c25a9 <+297>: callq  0x7fff8e482080            ; symbol stub for: kill 0x7fff8e2c25ae <+302>: leaq   0x36325e(%rip), %rax      ; "*** __cftypecollectionretain() called null; collection has been corrupted ***" 0x7fff8e2c25b5 <+309>: movq   %rax, -0x17f460c4(%rip)   ; gcrannotations + 8 0x7fff8e2c25bc <+316>: int3    ->  0x7fff8e2c25bd <+317>: jmp    0x7fff8e2c259d            ; <+285> 0x7fff8e2c25bf <+319>: nop     

this exception doesn't thrown if call clgetprograminfo param name other cl_program_binary_sizes.

i cannot figure out reason why i'm getting exception. it's puzzling because i'm writing c++ program, not objc or swift one, don't see why getting errors related core foundation or retain counts.

my guess maybe there build settings option have set incorrectly causing program think objc environment seems unlikely.

any appreciated


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -