[cuda] Include GPU binary into host object file and generate init/deinit code.
- added -fcuda-include-gpubinary option to incorporate results of device-side compilation into host-side one. - generate code to register GPU binaries and associated kernels with CUDA runtime and clean-up on exit. - added test case for init/deinit code generation. Differential Revision: http://reviews.llvm.org/D9507 llvm-svn: 236765
This commit is contained in:
@@ -350,6 +350,13 @@ void CodeGenModule::Release() {
|
||||
if (ObjCRuntime)
|
||||
if (llvm::Function *ObjCInitFunction = ObjCRuntime->ModuleInitFunction())
|
||||
AddGlobalCtor(ObjCInitFunction);
|
||||
if (Context.getLangOpts().CUDA && !Context.getLangOpts().CUDAIsDevice &&
|
||||
CUDARuntime) {
|
||||
if (llvm::Function *CudaCtorFunction = CUDARuntime->makeModuleCtorFunction())
|
||||
AddGlobalCtor(CudaCtorFunction);
|
||||
if (llvm::Function *CudaDtorFunction = CUDARuntime->makeModuleDtorFunction())
|
||||
AddGlobalDtor(CudaDtorFunction);
|
||||
}
|
||||
if (PGOReader && PGOStats.hasDiagnostics())
|
||||
PGOStats.reportDiagnostics(getDiags(), getCodeGenOpts().MainFileName);
|
||||
EmitCtorList(GlobalCtors, "llvm.global_ctors");
|
||||
@@ -3678,4 +3685,3 @@ void CodeGenModule::EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
|
||||
CXXGlobalInits.push_back(InitFunction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user