[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 11 15:40:30 PDT 2020


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

LGTM, modulo cosmetic test changes mentioned below.



================
Comment at: clang/test/SemaCUDA/function-overload.cu:479
+namespace ImplicitHostDeviceVsWrongSided {
+inline CorrectOverloadRetTy callee(double x);
+#pragma clang force_cuda_host_device begin
----------------
Is `inline` necessary in these new tests? Please remove it where it's not needed.


================
Comment at: clang/test/SemaCUDA/function-overload.cu:493
+namespace ImplicitHostDeviceVsSameSide {
+inline InCorrectOverloadRetTy callee(int x);
+#pragma clang force_cuda_host_device begin
----------------
Nit: `Incorrect` should not have `C` capitalized as it's one word.


================
Comment at: clang/test/SemaCUDA/function-overload.cu:502-529
+// In the implicit host device function 'caller', the second 'callee' should be
+// since it has better match, even though it is an implicit host device function
+// whereas the first 'callee' is a host function. A diagnostic will be emitted
+// if the first 'callee' is chosen since deduced return type cannot be used
+// before it is defined.
+namespace ImplicitHostDeviceByConstExpr {
+template <class a> a b;
----------------
Please move this test below the other two as keeping them together is useful to illustrate the differences in behavior of overloading in explicit HD vs implicit HD functions.


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

https://reviews.llvm.org/D79526





More information about the cfe-commits mailing list