[PATCH] D45489: [HIP] Add input type for HIP

2018-04-18 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330279: [HIP] Add driver input type for HIP (authored by 
yaxunl, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45489?vs=141851=142972#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45489

Files:
  cfe/trunk/include/clang/Driver/Types.def
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/lib/Driver/Types.cpp


Index: cfe/trunk/include/clang/Driver/Types.def
===
--- cfe/trunk/include/clang/Driver/Types.def
+++ cfe/trunk/include/clang/Driver/Types.def
@@ -46,6 +46,9 @@
 TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u")
 TYPE("cuda", CUDA, PP_CUDA, "cu","u")
 TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","")
+TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u")
+TYPE("hip",  HIP,  PP_HIP,  "cu","u")
+TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","")
 TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u")
 TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u")
 TYPE("objective-c",  ObjC, PP_ObjC, "m", "u")
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -2257,9 +2257,10 @@
 assert(!GpuArchList.empty() &&
"We should have at least one GPU architecture.");
 
-// If the host input is not CUDA, we don't need to bother about this
-// input.
-if (IA->getType() != types::TY_CUDA) {
+// If the host input is not CUDA or HIP, we don't need to bother about
+// this input.
+if (IA->getType() != types::TY_CUDA &&
+IA->getType() != types::TY_HIP) {
   // The builder will ignore this input.
   IsActive = false;
   return ABRT_Inactive;
@@ -2272,9 +2273,12 @@
   return ABRT_Success;
 
 // Replicate inputs for each GPU architecture.
-for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
-  CudaDeviceActions.push_back(C.MakeAction(
-  IA->getInputArg(), types::TY_CUDA_DEVICE));
+auto Ty = IA->getType() == types::TY_HIP ? types::TY_HIP_DEVICE
+ : types::TY_CUDA_DEVICE;
+for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
+  CudaDeviceActions.push_back(
+  C.MakeAction(IA->getInputArg(), Ty));
+}
 
 return ABRT_Success;
   }
Index: cfe/trunk/lib/Driver/Types.cpp
===
--- cfe/trunk/lib/Driver/Types.cpp
+++ cfe/trunk/lib/Driver/Types.cpp
@@ -102,6 +102,9 @@
   case TY_CL:
   case TY_CUDA: case TY_PP_CUDA:
   case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
   case TY_ObjC: case TY_PP_ObjC: case TY_PP_ObjC_Alias:
   case TY_CXX: case TY_PP_CXX:
   case TY_ObjCXX: case TY_PP_ObjCXX: case TY_PP_ObjCXX_Alias:
@@ -141,6 +144,9 @@
   case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader:
   case TY_CXXModule: case TY_PP_CXXModule:
   case TY_CUDA: case TY_PP_CUDA: case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
 return true;
   }
 }
@@ -166,6 +172,9 @@
   case TY_CUDA:
   case TY_PP_CUDA:
   case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
 return true;
   }
 }


Index: cfe/trunk/include/clang/Driver/Types.def
===
--- cfe/trunk/include/clang/Driver/Types.def
+++ cfe/trunk/include/clang/Driver/Types.def
@@ -46,6 +46,9 @@
 TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u")
 TYPE("cuda", CUDA, PP_CUDA, "cu","u")
 TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","")
+TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u")
+TYPE("hip",  HIP,  PP_HIP,  "cu","u")
+TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","")
 TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u")
 TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u")
 TYPE("objective-c",  ObjC, PP_ObjC, "m", "u")
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -2257,9 +2257,10 @@
 assert(!GpuArchList.empty() &&
"We should have at least one GPU architecture.");
 
-// If the host input 

[PATCH] D45489: [HIP] Add input type for HIP

2018-04-18 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D45489#1071177, @tra wrote:

> In https://reviews.llvm.org/D45489#1071044, @yaxunl wrote:
>
> > In https://reviews.llvm.org/D45489#1070929, @yaxunl wrote:
> >
> > > In https://reviews.llvm.org/D45489#1070470, @tra wrote:
> > >
> > > > I'm getting confused about the order of the patches. 
> > > >  The patch stack phabricator displays in this patch is different 
> > > > compared to the stack in https://reviews.llvm.org/D44984. Which one 
> > > > should I trust?
> > >
> > >
> > > Sorry I think I may misunderstand the parent/child relation between 
> > > reviews. I thought a review depends on its parent reviews, i.e., parent 
> > > reviews should be committed first. Is that correct? Thanks.
> >
> >
> > I think it is just visual difference. The relations are the same.
>
>
> Would it be possible to arrange the changes in order in which you apply them 
> in the tree you are working on? If I want to try (partially) apply your 
> parches in my tree, it would help to know that what I get matches your setup. 
> Patch relationships as they are right now make intended order ambiguous.


I reordered them as a simple linear relation. In the stack display, the patches 
should be applied from bottom to top.


https://reviews.llvm.org/D45489



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


[PATCH] D45489: [HIP] Add input type for HIP

2018-04-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In https://reviews.llvm.org/D45489#1071044, @yaxunl wrote:

> In https://reviews.llvm.org/D45489#1070929, @yaxunl wrote:
>
> > In https://reviews.llvm.org/D45489#1070470, @tra wrote:
> >
> > > I'm getting confused about the order of the patches. 
> > >  The patch stack phabricator displays in this patch is different compared 
> > > to the stack in https://reviews.llvm.org/D44984. Which one should I trust?
> >
> >
> > Sorry I think I may misunderstand the parent/child relation between 
> > reviews. I thought a review depends on its parent reviews, i.e., parent 
> > reviews should be committed first. Is that correct? Thanks.
>
>
> I think it is just visual difference. The relations are the same.


Would it be possible to arrange the changes in order in which you apply them in 
the tree you are working on? If I want to try (partially) apply your parches in 
my tree, it would help to know that what I get matches your setup. Patch 
relationships as they are right now make intended order ambiguous.


https://reviews.llvm.org/D45489



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


[PATCH] D45489: [HIP] Add input type for HIP

2018-04-18 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D45489#1070929, @yaxunl wrote:

> In https://reviews.llvm.org/D45489#1070470, @tra wrote:
>
> > I'm getting confused about the order of the patches. 
> >  The patch stack phabricator displays in this patch is different compared 
> > to the stack in https://reviews.llvm.org/D44984. Which one should I trust?
>
>
> Sorry I think I may misunderstand the parent/child relation between reviews. 
> I thought a review depends on its parent reviews, i.e., parent reviews should 
> be committed first. Is that correct? Thanks.


I think it is just visual difference. The relations are the same.


https://reviews.llvm.org/D45489



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


[PATCH] D45489: [HIP] Add input type for HIP

2018-04-18 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D45489#1070470, @tra wrote:

> I'm getting confused about the order of the patches. 
>  The patch stack phabricator displays in this patch is different compared to 
> the stack in https://reviews.llvm.org/D44984. Which one should I trust?


Sorry I think I may misunderstand the parent/child relation between reviews. I 
thought a review depends on its parent reviews, i.e., parent reviews should be 
committed first. Is that correct? Thanks.


https://reviews.llvm.org/D45489



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


[PATCH] D45489: [HIP] Add input type for HIP

2018-04-17 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

I'm getting confused about the order of the patches. 
The patch stack phabricator displays in this patch is different compared to the 
stack in https://reviews.llvm.org/D44984. Which one should I trust?


https://reviews.llvm.org/D45489



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


[PATCH] D45489: [HIP] Add input type for HIP

2018-04-14 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D45489



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


[PATCH] D45489: [HIP] Add input type for HIP

2018-04-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: tra, Hahnfeld.

This patch is split from https://reviews.llvm.org/D45212


https://reviews.llvm.org/D45489

Files:
  include/clang/Driver/Types.def
  lib/Driver/Driver.cpp
  lib/Driver/Types.cpp


Index: lib/Driver/Types.cpp
===
--- lib/Driver/Types.cpp
+++ lib/Driver/Types.cpp
@@ -102,6 +102,9 @@
   case TY_CL:
   case TY_CUDA: case TY_PP_CUDA:
   case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
   case TY_ObjC: case TY_PP_ObjC: case TY_PP_ObjC_Alias:
   case TY_CXX: case TY_PP_CXX:
   case TY_ObjCXX: case TY_PP_ObjCXX: case TY_PP_ObjCXX_Alias:
@@ -141,6 +144,9 @@
   case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader:
   case TY_CXXModule: case TY_PP_CXXModule:
   case TY_CUDA: case TY_PP_CUDA: case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
 return true;
   }
 }
@@ -166,6 +172,9 @@
   case TY_CUDA:
   case TY_PP_CUDA:
   case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
 return true;
   }
 }
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2249,9 +2249,10 @@
 assert(!GpuArchList.empty() &&
"We should have at least one GPU architecture.");
 
-// If the host input is not CUDA, we don't need to bother about this
-// input.
-if (IA->getType() != types::TY_CUDA) {
+// If the host input is not CUDA or HIP, we don't need to bother about
+// this input.
+if (IA->getType() != types::TY_CUDA &&
+IA->getType() != types::TY_HIP) {
   // The builder will ignore this input.
   IsActive = false;
   return ABRT_Inactive;
@@ -2264,9 +2265,12 @@
   return ABRT_Success;
 
 // Replicate inputs for each GPU architecture.
-for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
-  CudaDeviceActions.push_back(C.MakeAction(
-  IA->getInputArg(), types::TY_CUDA_DEVICE));
+auto Ty = IA->getType() == types::TY_HIP ? types::TY_HIP_DEVICE
+ : types::TY_CUDA_DEVICE;
+for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
+  CudaDeviceActions.push_back(
+  C.MakeAction(IA->getInputArg(), Ty));
+}
 
 return ABRT_Success;
   }
Index: include/clang/Driver/Types.def
===
--- include/clang/Driver/Types.def
+++ include/clang/Driver/Types.def
@@ -46,6 +46,9 @@
 TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u")
 TYPE("cuda", CUDA, PP_CUDA, "cu","u")
 TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","")
+TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u")
+TYPE("hip",  HIP,  PP_HIP,  "cu","u")
+TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","")
 TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u")
 TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u")
 TYPE("objective-c",  ObjC, PP_ObjC, "m", "u")


Index: lib/Driver/Types.cpp
===
--- lib/Driver/Types.cpp
+++ lib/Driver/Types.cpp
@@ -102,6 +102,9 @@
   case TY_CL:
   case TY_CUDA: case TY_PP_CUDA:
   case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
   case TY_ObjC: case TY_PP_ObjC: case TY_PP_ObjC_Alias:
   case TY_CXX: case TY_PP_CXX:
   case TY_ObjCXX: case TY_PP_ObjCXX: case TY_PP_ObjCXX_Alias:
@@ -141,6 +144,9 @@
   case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader:
   case TY_CXXModule: case TY_PP_CXXModule:
   case TY_CUDA: case TY_PP_CUDA: case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
 return true;
   }
 }
@@ -166,6 +172,9 @@
   case TY_CUDA:
   case TY_PP_CUDA:
   case TY_CUDA_DEVICE:
+  case TY_HIP:
+  case TY_PP_HIP:
+  case TY_HIP_DEVICE:
 return true;
   }
 }
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2249,9 +2249,10 @@
 assert(!GpuArchList.empty() &&
"We should have at least one GPU architecture.");
 
-// If the host input is not CUDA, we don't need to bother about this
-// input.
-if (IA->getType() != types::TY_CUDA) {
+// If the host input is not CUDA or HIP, we don't need to bother about
+// this input.
+if (IA->getType() != types::TY_CUDA &&
+IA->getType() != types::TY_HIP) {
   // The builder will ignore this input.
   IsActive = false;