[PATCH] D44435: CUDA ctor/dtor Module-Unique Symbol Name

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 24 10:41:46 PDT 2018


tra added inline comments.


================
Comment at: lib/CodeGen/CGCUDANV.cpp:287
+    CtorSuffix.append("_");
+    CtorSuffix.append(ModuleName);
+  }
----------------
SimeonEhrig wrote:
> tra wrote:
> > There is a general problem with this approach. File name can contain the characters that PTX does not allow.
> > We currently only deal with '.' and '@', but that's not enough here.
> > You may want to either mangle the name somehow to avoid/convert illegal characters or use some other way to provide unique suffix. Hex-encoded hash of the file name would avoid this problem, for example.
> > 
> > 
> > 
> Maybe I'm wrong but I think, that should be no problem, because the generating of a cuda ctor/dtor have nothing to do with the PTX generation. 
> 
> The function 'makeModuleCtorFunction' should just generate llvm ir code for the host (e.g. x86_64).
> 
> If I'm wrong, could you tell me please, where in the source code the 'makeModuleCtorFunction' affect the PTX generation.
You are correct that PTX is irrelevant here. I've completely missed that this will be generated for the host, which is more forgiving. 

That said, I'm still not completely sure whether we're guaranteed that using arbitrary characters in a symbol name is OK on x86 and, potentially, other host platforms. As an experiment, try using a module which has a space in its name.


https://reviews.llvm.org/D44435





More information about the cfe-commits mailing list