[PATCH] D46473: [HIP] Let clang-offload-bundler support HIP

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 11 12:06:04 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC332121: [HIP] Let clang-offload-bundler support HIP (authored by yaxunl, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D46473

Files:
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains/Clang.cpp
  tools/clang-offload-bundler/ClangOffloadBundler.cpp


Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp
===================================================================
--- tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -969,11 +969,11 @@
     getOffloadKindAndTriple(Target, Kind, Triple);
 
     bool KindIsValid = !Kind.empty();
-    KindIsValid = KindIsValid &&
-                  StringSwitch<bool>(Kind)
-                      .Case("host", true)
-                      .Case("openmp", true)
-                      .Default(false);
+    KindIsValid = KindIsValid && StringSwitch<bool>(Kind)
+                                     .Case("host", true)
+                                     .Case("openmp", true)
+                                     .Case("hip", true)
+                                     .Default(false);
 
     bool TripleIsValid = !Triple.empty();
     llvm::Triple T(Triple);
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -5542,6 +5542,10 @@
     Triples += Action::GetOffloadKindName(CurKind);
     Triples += '-';
     Triples += CurTC->getTriple().normalize();
+    if (CurKind == Action::OFK_HIP && CurDep->getOffloadingArch()) {
+      Triples += '-';
+      Triples += CurDep->getOffloadingArch();
+    }
   }
   CmdArgs.push_back(TCArgs.MakeArgString(Triples));
 
@@ -5611,6 +5615,11 @@
     Triples += Action::GetOffloadKindName(Dep.DependentOffloadKind);
     Triples += '-';
     Triples += Dep.DependentToolChain->getTriple().normalize();
+    if (Dep.DependentOffloadKind == Action::OFK_HIP &&
+        !Dep.DependentBoundArch.empty()) {
+      Triples += '-';
+      Triples += Dep.DependentBoundArch;
+    }
   }
 
   CmdArgs.push_back(TCArgs.MakeArgString(Triples));
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -3736,9 +3736,12 @@
           UI.DependentToolChain->getTriple().normalize(),
           /*CreatePrefixForHost=*/true);
       auto CurI = InputInfo(
-          UA, GetNamedOutputPath(C, *UA, BaseInput, UI.DependentBoundArch,
-                                 /*AtTopLevel=*/false, MultipleArchs,
-                                 OffloadingPrefix),
+          UA,
+          GetNamedOutputPath(C, *UA, BaseInput, UI.DependentBoundArch,
+                             /*AtTopLevel=*/false,
+                             MultipleArchs ||
+                                 UI.DependentOffloadKind == Action::OFK_HIP,
+                             OffloadingPrefix),
           BaseInput);
       // Save the unbundling result.
       UnbundlingResults.push_back(CurI);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46473.146377.patch
Type: text/x-patch
Size: 2784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180511/94f63eb8/attachment.bin>


More information about the cfe-commits mailing list