Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
763 Views

AOC crashes when using kernel with function calls

Hi everyone,  

 

I am new to the Altera world and I am using the altera aoc compiler for implementing my OpenCL application on an Altera FPGA. 

 

I have a kernel code, written in OpenCL that calls some functions. I tested the code on a GPU and on my CPU and everything works great, the problem is that whenever I try to compile the kernel code with aoc, the tool crashes giving me this call: 

 

aocl-clang: CGCall.cpp:1492: void checkArgMatches(llvm::Value*, unsigned int&, llvm::FunctionType*): Assertion `Elt->getType() == FTy->getParamType(ArgNo)' failed. 0 libLLVM-3.0.so 0x00007fe47dd913af 1 libLLVM-3.0.so 0x00007fe47dd93322 2 libpthread.so.0 0x00007fe47cd5c3e0 3 libc.so.6 0x00007fe47bd6f428 gsignal + 56 4 libc.so.6 0x00007fe47bd7102a abort + 362 5 libc.so.6 0x00007fe47bd67bd7 6 libc.so.6 0x00007fe47bd67c82 7 aocl-clang 0x0000000000775768 clang::CodeGen::CodeGenFunction::EmitCall(clang::CodeGen::CGFunctionInfo const&, llvm::Value*, clang::CodeGen::ReturnValueSlot, clang::CodeGen::CallArgList const&, clang::Decl const*, llvm::Instruction**) + 2712 8 aocl-clang 0x00000000007b8933 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, llvm::Value*, clang::CodeGen::ReturnValueSlot, clang::ConstExprIterator, clang::ConstExprIterator, clang::Decl const*) + 883 9 aocl-clang 0x00000000007c3452 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) + 530 10 aocl-clang 0x00000000007e4466 11 aocl-clang 0x00000000007ec6ce 12 aocl-clang 0x00000000007ed260 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 96 13 aocl-clang 0x00000000007a2507 clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 807 14 aocl-clang 0x00000000007a2b8b clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 587 15 aocl-clang 0x00000000007a3e41 clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) + 1937 16 aocl-clang 0x00000000007a5833 clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) + 83 17 aocl-clang 0x000000000084815f clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 127 18 aocl-clang 0x00000000008529a5 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 101 19 aocl-clang 0x000000000084eb77 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39 20 aocl-clang 0x0000000000852790 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 272 21 aocl-clang 0x0000000000852a4f clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 271 22 aocl-clang 0x000000000084eb77 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39 23 aocl-clang 0x0000000000851ee6 clang::CodeGen::CodeGenFunction::EmitForStmt(clang::ForStmt const&) + 1414 24 aocl-clang 0x0000000000852790 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 272 25 aocl-clang 0x0000000000852a4f clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 271 26 aocl-clang 0x000000000084eb77 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39 27 aocl-clang 0x0000000000851ee6 clang::CodeGen::CodeGenFunction::EmitForStmt(clang::ForStmt const&) + 1414 28 aocl-clang 0x0000000000852790 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 272 29 aocl-clang 0x0000000000852a4f clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 271 30 aocl-clang 0x000000000084eb77 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39 31 aocl-clang 0x0000000000861cdb clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 715 32 aocl-clang 0x0000000000743f94 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl) + 660 33 aocl-clang 0x000000000074528e clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 190 34 aocl-clang 0x000000000074589d clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1229 35 aocl-clang 0x0000000000745cc1 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 449 36 aocl-clang 0x000000000071ba64 37 aocl-clang 0x000000000071b401 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 161 38 aocl-clang 0x0000000000881de4 clang::ParseAST(clang::Sema&, bool) + 308 39 aocl-clang 0x000000000071a7c4 clang::CodeGenAction::ExecuteAction() + 68 40 aocl-clang 0x00000000005ab835 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 373 41 aocl-clang 0x0000000000592779 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1401 42 aocl-clang 0x0000000000588a9a cc1_main(char const**, char const**, char const*, void*) + 618 43 aocl-clang 0x00000000005914f7 main + 7015 44 libc.so.6 0x00007fe47bd5a830 __libc_start_main + 240 45 aocl-clang 0x0000000000587039  

 

Does anyone know why all this is happening? 

 

Thanks for your help
0 Kudos
2 Replies
Highlighted
Valued Contributor III
5 Views

can you post your .cl?

0 Kudos
Highlighted
Valued Contributor III
5 Views

can't post the original version but it is something like this 

 

void function1( my_type * arg_1, my_type_2 *arg_2){ //normale opencl c code } __kernel kernel_1(__global my_type * arg_1, __global my_type_2 * arg_2, __global my_type * out) { //doing some stuff that works correctly function1(arg_1, arg_2); //doing some stuff that works correctly }  

 

where my_type are structs.  

 

I tested the code and I found out the problem to be the function call. I do not understand why, just having a function call cause aoc to crash. 

 

I tried commenting out everything that was inside the function and still the tool was crashing... 

 

 

Any clue?
0 Kudos