[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 23 14:31:36 PDT 2020


tra added a comment.

In D84364#2170244 <https://reviews.llvm.org/D84364#2170244>, @tra wrote:

> I'm going to try the patch on our CUDA code and see how it fares. Stay tuned.


The patch works well enough to build TensorFlow which is a good sign that existing working code should be OK -- we're making HD checks less strict, so already working code should not be affected.

The remaining concern is whether we're going to unintentionally allow something we should not have. Let me see if I can come up with some examples, in addition to the `hdf_not_called()`one I've commented on in the test file.



================
Comment at: clang/test/SemaCUDA/deferred-all.cu:12-18
+// Check no diagnostics for this function since it is never
+// called.
+
+inline __host__ __device__ void hdf_not_called() {
+  callee(1);
+  bad_line
+}
----------------
I think we do need diagnostics in this scenario, regardless of whether the function is called or not.
We would have emitted it for a regular inline function and I believe it should be the case here, too.


================
Comment at: clang/test/SemaCUDA/deferred-all.cu:44
+
+struct A { int x; typedef int type; };
+struct B { int x; };
----------------
Nit: I'd rename `type` -> `isA` which would make its use in sfinae() more obvious.


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

https://reviews.llvm.org/D84364





More information about the cfe-commits mailing list