@@ -194,72 +194,6 @@ llvm::Value* CodeGenCUDA_Host::LowerGPUKernelLauncher(
194194 return function;
195195}
196196
197- llvm::Value* CodeGenCUDA_Host::LowerHostFunc (const ir::_LoweredFunc_* func) {
198- // Create the function
199- // @{
200- auto * function_type = GenFunctionTypeFromCinnFunction (func, true );
201- f_ = llvm::Function::Create (
202- function_type, llvm::Function::ExternalLinkage, func->name , m_);
203- f_->setCallingConv (llvm::CallingConv::C);
204- f_->setHasUWTable ();
205-
206- std::vector<llvm::Value*> ll_function_args;
207- std::transform (f_->arg_begin (),
208- f_->arg_end (),
209- std::back_inserter (ll_function_args),
210- [](auto & arg) { return std::addressof (arg); });
211- // @}
212-
213- // Set local scope table
214- PADDLE_ENFORCE_EQ (ll_function_args.size (),
215- func->args .size (),
216- phi::errors::InvalidArgument (
217- " The number of arguments is not equal to the number of "
218- " function arguments" ));
219- for (int i = 0 ; i < ll_function_args.size (); ++i) {
220- SetVar (func->args [i].name (), ll_function_args[i]);
221- }
222- llvm::BasicBlock* entry = llvm::BasicBlock::Create (
223- /* Context=*/ b_->getContext (),
224- /* Name=*/ " entry" ,
225- /* Parent=*/ f_,
226- /* InsertBefore=*/ nullptr );
227- b_->SetInsertPoint (entry);
228- CodeGenLLVM::Visit (&func->body );
229-
230- // Reset local scope table
231- for (const ir::Argument& func_arg : func->args ) {
232- symbol_table_->Erase (func_arg.name ());
233- }
234- RetVoid ();
235-
236- return f_;
237- }
238-
239- llvm::Value* CodeGenCUDA_Host::LowerParseArgsValueCall (
240- const ir::Call* call_ir) {
241- auto ret_type = CinnTypeToLLVMType (Int (64 ), m_);
242- std::vector<llvm::Type*> args_type;
243- PADDLE_ENFORCE_EQ (
244- call_ir->read_args .size (),
245- 2 ,
246- phi::errors::InvalidArgument (
247- " The number of arguments of ParseArgsValue should be 2" ));
248- CHECK (call_ir->read_args [0 ].is_var () &&
249- call_ir->read_args [0 ].as_var ()->type ().is_cpp_handle ());
250- CHECK (call_ir->read_args [1 ].type ().is_int (32 ));
251- args_type.push_back (CinnTypeToLLVMType (type_of<void *>(), m_));
252- args_type.push_back (CinnTypeToLLVMType (type_of<int32_t >(), m_));
253-
254- auto func_type = llvm::FunctionType::get (ret_type, args_type, false );
255- auto call_func = m_->getOrInsertFunction (call_ir->name , func_type);
256-
257- std::vector<llvm::Value*> call_args;
258- call_args.push_back (std::addressof (*f_->arg_begin ()));
259- call_args.push_back (b_->getInt32 (call_ir->read_args [1 ].as_int32 ()));
260- return b_->CreateCall (call_func, call_args);
261- }
262-
263197llvm::Value* CodeGenCUDA_Host::LowerCUDAKernelCall (const ir::Call* call_ir) {
264198 std::vector<llvm::Value*> ll_function_args;
265199 std::transform (f_->arg_begin (),
0 commit comments