[PATCH] D63335: [HIP] Change kernel stub name again

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 10:09:07 PDT 2019


hliao marked an inline comment as done.
hliao added inline comments.


================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:222-226
+  assert((CGF.CGM.getContext().getAuxTargetInfo() &&
+          (CGF.CGM.getContext().getAuxTargetInfo()->getCXXABI() !=
+           CGF.CGM.getContext().getTargetInfo().getCXXABI())) ||
+         getDeviceStubName(getDeviceSideName(CGF.CurFuncDecl)) ==
+             CGF.CurFn->getName());
----------------
hliao wrote:
> tra wrote:
> > I'm not sure I understand what exactly this assertion checks.
> > The condition appears to be true is host/device ABIs are different OR the name of the current function is the same as the (possibly mangled) device-side name + __device_stub_ prefix.
> > 
> > While the first part makes sense, I'm not sure I understand the name comparison part.
> > Could you tell me more and, maybe, add a comment explaining what's going on here.
> The second is to ensure, if, under the same ABI, kernel stub name derived from device-side name mangling should be the same the sub name generated from host-side, CGF.CurFn->getName() is the mangled named from host compilation
previous assertion expression gets the same goal, if ABI is different, the stub name from device-side should match the stub name from the host-side compilation. As we add a dedicated interface to the derive stub name, we could simplify the comparison to a single one.
Also, we put the simple condition checking ahead (a common practice) to reduce the overhead of string comparison


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63335





More information about the cfe-commits mailing list