[PATCH] D94871: [Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 18 14:20:31 PST 2021


ABataev added a comment.





================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:2944-2947
+    // This could happen if the device compilation is invoked standalone.
+    if (!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum))
+      initializeTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum,
+                                      OffloadingEntriesNum);
----------------
jdoerfert wrote:
> ABataev wrote:
> > I would add a chack that to auxiliary device was specified. And if it was specified, it means this is not device-only mode and still need to emit an error.
> No it doesn't. There is nothing wrong with https://godbolt.org/z/T1h9b5, and as I said before, I can build the situation in various other ways as well, some of which will be outside of the users control. A global can exist in the host/device code only.
I'm not saying that this is wrong. This code was used to check that the compiler works correctly and it just allows developer to understand that there is a problem with the compiler if it misses something and there is a difference between host and device codegens. If we don't want to emit an error here, still would be good to have something like an assert to be sure that the host/device codegens are synced.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94871/new/

https://reviews.llvm.org/D94871



More information about the cfe-commits mailing list