[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-30 Thread Artem Belevich via Phabricator via cfe-commits
tra abandoned this revision. tra added a comment. It appears that the issue that originally prompted this change is due to suspected bug in glibc triggered by specific details of our internal build. https://reviews.llvm.org/D49763 ___ cfe-commits m

[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-24 Thread Artem Belevich via Phabricator via cfe-commits
tra planned changes to this revision. tra added a comment. Ugh. Apparently moving this code up just disabled module destructor. :-( That explains why we no longer crash. https://reviews.llvm.org/D49763 ___ cfe-commits mailing list cfe-commits@lists

[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-24 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. Depends a bit on the platform, __cxa_atexit on most modern ELF systems, fallback to atexit. If the global dtor is run too late, it smells like a missing library dependency. They are executed in topological order after all. https://reviews.llvm.org/D49763 _

[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-24 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In https://reviews.llvm.org/D49763#1174283, @joerg wrote: > Can this ever end up in a shared library? If yes, please use the normal logic > for creating a global destructor. atexit is not very friendly to dlopen... Yes, it can end up in a shared library. What would be the

[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-24 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. Can this ever end up in a shared library? If yes, please use the normal logic for creating a global destructor. atexit is not very friendly to dlopen... https://reviews.llvm.org/D49763 ___ cfe-commits mailing list cfe-commits

[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-24 Thread Justin Lebar via Phabricator via cfe-commits
jlebar accepted this revision. jlebar added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/CodeGen/CGCUDANV.cpp:379 + // Create destructor and register it with atexit() the way NVCC does it. Doing + // it during regular destructor phase

[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

2018-07-24 Thread Artem Belevich via Phabricator via cfe-commits
tra created this revision. tra added reviewers: jlebar, timshen. Herald added subscribers: bixia, sanjoy. There's apparently a race between fatbin destructors registered by us and some internal calls registered by CUDA runtime from cudaRegisterFatbin. Moving fatbin de-registration to atexit() was