================
@@ -393,22 +393,17 @@ struct CUDADeviceTy : public GenericDeviceTy {
return Plugin::success();
}
- virtual Error callGlobalConstructors(GenericPluginTy &Plugin,
- DeviceImageTy &Image) override {
- // Check for the presense of global destructors at initialization time.
This
- // is required when the image may be deallocated before destructors are
run.
- GenericGlobalHandlerTy &Handler = Plugin.getGlobalHandler();
- if (Handler.isSymbolInImage(*this, Image, "nvptx$device$fini"))
- Image.setPendingGlobalDtors();
-
- return callGlobalCtorDtorCommon(Plugin, Image, /*IsCtor=*/true);
+ virtual Expected<StringRef>
+ getGlobalConstructorName(DeviceImageTy &Image) override {
+ if (auto Err = prepareGlobalCtorDtorCommon(Image, /*IsCtor=*/true))
+ return Err;
+ return "nvptx$device$init";
}
-
- virtual Error callGlobalDestructors(GenericPluginTy &Plugin,
- DeviceImageTy &Image) override {
- if (Image.hasPendingGlobalDtors())
- return callGlobalCtorDtorCommon(Plugin, Image, /*IsCtor=*/false);
- return Plugin::success();
+ virtual Expected<StringRef>
+ getGlobalDestructorName(DeviceImageTy &Image) override {
+ if (auto Err = prepareGlobalCtorDtorCommon(Image, /*IsCtor=*/false))
----------------
jhuber6 wrote:
What happened to the `pendingGlobalDtors` thing? That was required since some
configs (i.e. JIT) don't have permanent storage so they could be deallocated
during teardown. The better solution would be to make an API that copied in its
own buffer (This is what hsa_executable_freeze is AFAIK).
https://github.com/llvm/llvm-project/pull/104168
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits