[PATCH] D47376: [CUDA][HIP] Do not offload for -M

2018-06-05 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

Just to make it clear, I'm not against making a sensible default choice, but 
rather want to make sure that it is possible to override it if the user needs 
to.


https://reviews.llvm.org/D47376



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47376: [CUDA][HIP] Do not offload for -M

2018-06-05 Thread Artem Belevich via Phabricator via cfe-commits
tra requested changes to this revision.
tra added a comment.
This revision now requires changes to proceed.

I'm not sure this is the right thing to do. What if user explicitly wants 
device-side dependencies and runs `clang --cuda-device-only -M` ? This patch 
makes it impossible.

I'd rather tell users that they have to explicitly provide *which* compilation 
they want to generate dependencies for. If they want them for the host, just 
pass along --cuda-host-only.


https://reviews.llvm.org/D47376



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47376: [CUDA][HIP] Do not offload for -M

2018-06-03 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

ping


https://reviews.llvm.org/D47376



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47376: [CUDA][HIP] Do not offload for -M

2018-05-25 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.

CUDA and HIP action builder currently tries to do offloading for -M, which 
causes dependency file
not generated.

This patch changes action builder so that only host compilation is performed to 
generate dependency
file.

This assumes that the header files do not depend on whether it is device 
compilation or host
compilation. This is not ideal, but at least let projects using -M compile.

Ideally, we should create an offloading action for host dependency file and 
device dependency file
and merge them to be on dependency file, which will be done in a separate patch.


https://reviews.llvm.org/D47376

Files:
  lib/Driver/Driver.cpp
  test/Driver/cuda-phases.cu


Index: test/Driver/cuda-phases.cu
===
--- test/Driver/cuda-phases.cu
+++ test/Driver/cuda-phases.cu
@@ -246,3 +246,14 @@
 // DASM2-DAG: [[P7:[0-9]+]]: compiler, {[[P6]]}, ir, (device-[[T]], [[ARCH2]])
 // DASM2_NV-DAG: [[P8:[0-9]+]]: backend, {[[P7]]}, assembler, (device-[[T]], 
[[ARCH2]])
 // DASM2_NV-DAG: [[P9:[0-9]+]]: offload, "device-[[T]] ([[TRIPLE]]:[[ARCH2]])" 
{[[P8]]}, assembler
+
+//
+// Test -M does not cause device input.
+//
+// RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-phases 
--cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s -M 2>&1 \
+// RUN: | FileCheck -check-prefixes=DEP %s
+// RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases 
--cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s -M 2>&1 \
+// RUN: | FileCheck -check-prefixes=DEP %s
+// DEP-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:.*]], 
(host-[[T]])
+// DEP-DAG: [[P1:[0-9]+]]: preprocessor, {[[P0]]}, dependencies, (host-[[T]])
+
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2210,7 +2210,10 @@
 // Set the flag to true, so that the builder acts on the current input.
 IsActive = true;
 
-if (CompileHostOnly)
+// ToDo: Handle situations where device compilation and host
+// compilation have different dependencies. Currently we assume they
+// are the same therefore device compilation is not performed for -M.
+if (CompileHostOnly || Args.getLastArg(options::OPT_M))
   return ABRT_Success;
 
 // Replicate inputs for each GPU architecture.


Index: test/Driver/cuda-phases.cu
===
--- test/Driver/cuda-phases.cu
+++ test/Driver/cuda-phases.cu
@@ -246,3 +246,14 @@
 // DASM2-DAG: [[P7:[0-9]+]]: compiler, {[[P6]]}, ir, (device-[[T]], [[ARCH2]])
 // DASM2_NV-DAG: [[P8:[0-9]+]]: backend, {[[P7]]}, assembler, (device-[[T]], [[ARCH2]])
 // DASM2_NV-DAG: [[P9:[0-9]+]]: offload, "device-[[T]] ([[TRIPLE]]:[[ARCH2]])" {[[P8]]}, assembler
+
+//
+// Test -M does not cause device input.
+//
+// RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-phases --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s -M 2>&1 \
+// RUN: | FileCheck -check-prefixes=DEP %s
+// RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s -M 2>&1 \
+// RUN: | FileCheck -check-prefixes=DEP %s
+// DEP-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:.*]], (host-[[T]])
+// DEP-DAG: [[P1:[0-9]+]]: preprocessor, {[[P0]]}, dependencies, (host-[[T]])
+
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2210,7 +2210,10 @@
 // Set the flag to true, so that the builder acts on the current input.
 IsActive = true;
 
-if (CompileHostOnly)
+// ToDo: Handle situations where device compilation and host
+// compilation have different dependencies. Currently we assume they
+// are the same therefore device compilation is not performed for -M.
+if (CompileHostOnly || Args.getLastArg(options::OPT_M))
   return ABRT_Success;
 
 // Replicate inputs for each GPU architecture.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits