[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-10 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

In D81427#2085739 , @thakis wrote:

> This doesn't pass tests: http://45.33.8.238/linux/19977/step_7.txt
>
> Please take a look, and please revert for now if fixing takes a while.


Fixed in 
https://github.com/llvm/llvm-project/commit/6dd058083208d58c6a7005bfb092cee085fd9a48


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427



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


[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-10 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

In D81427#2085739 , @thakis wrote:

> This doesn't pass tests: http://45.33.8.238/linux/19977/step_7.txt
>
> Please take a look, and please revert for now if fixing takes a while.


Thanks. I am building with PowerPC enabled to reproduce this issue. There 
should be a minor fix on that test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427



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


[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-10 Thread Michael Liao via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8b6821a5843b: [hip] Fix device-only relocatable code 
compilation. (authored by hliao).

Changed prior to commit:
  https://reviews.llvm.org/D81427?vs=269555=269928#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/hip-rdc-device-only.hip

Index: clang/test/Driver/hip-rdc-device-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-rdc-device-only.hip
@@ -0,0 +1,144 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
+
+// With `-emit-llvm`, the output should be the same as the aforementioned line
+// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -c -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
+
+// With `-emit-llvm`, the output should be the same as the aforementioned line
+// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -S -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
+
+// With `-save-temps`, commane lines for each steps are dumped. For assembly
+// output, there should 3 steps (preprocessor, compile, and backend) per source
+// and per target, totally 12 steps.
+
+// RUN: %clang -### -save-temps -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefix=SAVETEMP %s
+
+// COMMON: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
+// COMMON-SAME: "-fapply-global-visibility-to-externs"
+// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
+// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
+// CHECK-SAME: {{.*}} {{".*a.cu"}}
+
+// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
+// COMMON-SAME: "-fapply-global-visibility-to-externs"
+// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
+// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
+// COMMON-SAME: {{.*}} {{".*a.cu"}}
+
+// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
+// COMMON-SAME: "-fapply-global-visibility-to-externs"
+// EMITBC-SAME: {{.*}} "-o" {{"b.*bc"}} "-x" "hip"
+// EMITLL-SAME: {{.*}} "-o" {{"b.*ll"}} "-x" "hip"
+// COMMON-SAME: {{.*}} {{".*b.hip"}}
+
+// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" 

[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-10 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

This doesn't pass tests: http://45.33.8.238/linux/19977/step_7.txt

Please take a look, and please revert for now if fixing takes a while.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427



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


[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427



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


[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-09 Thread Michael Liao via Phabricator via cfe-commits
hliao updated this revision to Diff 269555.
hliao added a comment.

Revise following reviewer's comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/hip-device-only.hip
  clang/test/Driver/hip-rdc-device-only.hip

Index: clang/test/Driver/hip-device-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-device-only.hip
@@ -1,144 +0,0 @@
-// REQUIRES: clang-driver
-// REQUIRES: x86-registered-target
-// REQUIRES: amdgpu-registered-target
-
-// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
-// RUN:   -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
-// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
-// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
-
-// With `-emit-llvm`, the output should be the same as the aforementioned line
-// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
-
-// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
-// RUN:   -c -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
-// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
-// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
-
-// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
-// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
-// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
-// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
-
-// With `-emit-llvm`, the output should be the same as the aforementioned line
-// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
-
-// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
-// RUN:   -S -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
-// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
-// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
-
-// With `-save-temps`, commane lines for each steps are dumped. For assembly
-// output, there should 3 steps (preprocessor, compile, and backend) per source
-// and per target, totally 12 steps.
-
-// RUN: %clang -### -save-temps -target x86_64-linux-gnu \
-// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
-// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
-// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
-// RUN: 2>&1 | FileCheck -check-prefix=SAVETEMP %s
-
-// COMMON: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
-// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
-// EMITBC-SAME: "-emit-llvm-bc"
-// EMITLL-SAME: "-emit-llvm"
-// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
-// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
-// COMMON-SAME: "-fapply-global-visibility-to-externs"
-// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
-// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
-// CHECK-SAME: {{.*}} {{".*a.cu"}}
-
-// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
-// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
-// EMITBC-SAME: "-emit-llvm-bc"
-// EMITLL-SAME: "-emit-llvm"
-// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
-// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
-// COMMON-SAME: "-fapply-global-visibility-to-externs"
-// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
-// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
-// COMMON-SAME: {{.*}} {{".*a.cu"}}
-
-// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
-// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
-// EMITBC-SAME: "-emit-llvm-bc"
-// EMITLL-SAME: "-emit-llvm"
-// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
-// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
-// COMMON-SAME: "-fapply-global-visibility-to-externs"
-// EMITBC-SAME: {{.*}} "-o" {{"b.*bc"}} "-x" "hip"
-// EMITLL-SAME: {{.*}} "-o" {{"b.*ll"}} "-x" "hip"
-// COMMON-SAME: {{.*}} {{".*b.hip"}}
-
-// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
-// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
-// EMITBC-SAME: "-emit-llvm-bc"
-// EMITLL-SAME: "-emit-llvm"
-// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
-// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
-// COMMON-SAME: "-fapply-global-visibility-to-externs"
-// EMITBC-SAME: {{.*}} "-o" {{"b.*bc"}} 

[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

LGTM in general, but I'll let Sam stamp it.




Comment at: clang/lib/Driver/Driver.cpp:4594-4599
+if (!AtTopLevel && JA.getType() == types::TY_LLVM_BC &&
+(C.getArgs().hasArg(options::OPT_emit_llvm) ||
+ (JA.getOffloadingDeviceKind() == Action::OFK_HIP &&
+  isa(JA) &&
+  C.getArgs().hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
+  false

This is rather hard to understand.
Would it be simpler to specify when we shouldn't add `.tmp`?
At the very least I'd extract the newly added clause into a temporary variable 
and would add some comments explaining why -fgpu-rdc gets special treatment.



Comment at: clang/test/Driver/hip-device-only.hip:6
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \

We appear to test `-fgpu-rdc` only and the test case seems to be fairly 
specific to the way that option is handled by HIP.
Perhaps the test file should reflect that. `hip-rdc-device-only` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81427



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


[PATCH] D81427: [hip] Fix device-only relocatable code compilation.

2020-06-08 Thread Michael Liao via Phabricator via cfe-commits
hliao created this revision.
hliao added reviewers: yaxunl, tra.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- In HIP, just as the regular device-only compilation, the device-only 
relocatable code compilation should not involve offload bundle.
- In addition, that device-only relocatable code compilation should have the 
similar 3 steps, namely preprocessor, compile, and backend, to the regular code 
generation with `-emit-llvm`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81427

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/hip-device-only.hip

Index: clang/test/Driver/hip-device-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-device-only.hip
@@ -0,0 +1,144 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
+
+// With `-emit-llvm`, the output should be the same as the aforementioned line
+// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -c -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
+
+// With `-emit-llvm`, the output should be the same as the aforementioned line
+// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -S -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
+
+// With `-save-temps`, commane lines for each steps are dumped. For assembly
+// output, there should 3 steps (preprocessor, compile, and backend) per source
+// and per target, totally 12 steps.
+
+// RUN: %clang -### -save-temps -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
+// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck -check-prefix=SAVETEMP %s
+
+// COMMON: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
+// COMMON-SAME: "-fapply-global-visibility-to-externs"
+// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
+// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
+// CHECK-SAME: {{.*}} {{".*a.cu"}}
+
+// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
+// COMMON-SAME: "-fapply-global-visibility-to-externs"
+// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
+// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
+// COMMON-SAME: {{.*}} {{".*a.cu"}}
+
+// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
+// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
+// COMMON-SAME: "-fapply-global-visibility-to-externs"
+// EMITBC-SAME: {{.*}} "-o" {{"b.*bc"}} "-x" "hip"
+// EMITLL-SAME: {{.*}} "-o" {{"b.*ll"}} "-x" "hip"
+// COMMON-SAME: {{.*}} {{".*b.hip"}}
+
+// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
+// EMITBC-SAME: "-emit-llvm-bc"
+// EMITLL-SAME: "-emit-llvm"
+// COMMON-SAME: {{.*}}