[PATCH] D49083: [HIP] Register/unregister device fat binary only once

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 11:01:41 PDT 2018


yaxunl added inline comments.


================
Comment at: lib/CodeGen/CGCUDANV.cpp:444
+    auto HandleValue =
+        CtorBuilder.CreateAlignedLoad(GpuBinaryHandle, CGM.getPointerAlign());
+    llvm::Constant *Zero = llvm::Constant::getNullValue(HandleValue->getType());
----------------
rjmccall wrote:
> yaxunl wrote:
> > rjmccall wrote:
> > > Do you not need to worry about concurrency here?
> > The ctor functions are executed by the dynamic loader before the program gains the control. The dynamic loader cannot excute the ctor functions concurrently since doing that would not gurantee thread safety of the loaded program. Therefore we can assume sequential execution of ctor functions here.
> Okay.  That's worth a comment.
> 
> Is the name here specified by some ABI document, or is it just a conventional name that we're picking now?
Will add a comment for that.

You mean `__hip_gpubin_handle`? It is an implementation detail. It is not defined by ABI or other documentation. Since it is only used internally by ctor functions, it is not a visible elf symbol. Its name is by convention since the cuda corresponding one was named __cuda_gpubin_handle.


https://reviews.llvm.org/D49083





More information about the cfe-commits mailing list