[clang] 3006cb2 - [HIP] Unbundler allows missing host entry

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 19 19:14:03 PST 2023


Author: Yaxun (Sam) Liu
Date: 2023-01-19T22:13:17-05:00
New Revision: 3006cb2aa8d9fb1cbcb15a7e4dcd321614fa7478

URL: https://github.com/llvm/llvm-project/commit/3006cb2aa8d9fb1cbcb15a7e4dcd321614fa7478
DIFF: https://github.com/llvm/llvm-project/commit/3006cb2aa8d9fb1cbcb15a7e4dcd321614fa7478.diff

LOG: [HIP] Unbundler allows missing host entry

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D142118

Added: 
    

Modified: 
    clang/lib/Driver/OffloadBundler.cpp
    clang/test/Driver/clang-offload-bundler.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp
index d304ea5e9281..cdacceb0a86a 100644
--- a/clang/lib/Driver/OffloadBundler.cpp
+++ b/clang/lib/Driver/OffloadBundler.cpp
@@ -1060,7 +1060,8 @@ Error OffloadBundler::UnbundleFiles() {
 
   // If we found elements, we emit an error if none of those were for the host
   // in case host bundle name was provided in command line.
-  if (!FoundHostBundle && BundlerConfig.HostInputIndex != ~0u)
+  if (!(FoundHostBundle || BundlerConfig.HostInputIndex == ~0u ||
+        BundlerConfig.AllowMissingBundles))
     return createStringError(inconvertibleErrorCode(),
                              "Can't find bundle for the host target");
 

diff  --git a/clang/test/Driver/clang-offload-bundler.c b/clang/test/Driver/clang-offload-bundler.c
index b803db5f90ca..0d5d26afcb62 100644
--- a/clang/test/Driver/clang-offload-bundler.c
+++ b/clang/test/Driver/clang-offload-bundler.c
@@ -224,8 +224,11 @@
 // RUN: 
diff  %t.empty %t.res.tgt2
 
 // Check that bindler prints an error if given host bundle does not exist in the fat binary.
-// RUN: not clang-offload-bundler -type=s -targets=host-amdgcn-xxx-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -output=%t.res.s -output=%t.res.tgt1 -input=%t.bundle3.s -unbundle -allow-missing-bundles 2>&1 | FileCheck %s --check-prefix CK-NO-HOST-BUNDLE
-// CK-NO-HOST-BUNDLE: error: Can't find bundle for the host target
+// RUN: not clang-offload-bundler -type=s -targets=host-amdgcn-xxx-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -output=%t.res.s -output=%t.res.tgt1 -input=%t.bundle3.s -unbundle 2>&1 | FileCheck %s --check-prefix CK-NO-HOST-BUNDLE
+// CK-NO-HOST-BUNDLE: error: Can't find bundles for host-amdgcn-xxx-linux-gnu
+
+// Check missing host entry is allowed with -allow-missing-bundles
+// RUN: clang-offload-bundler -type=s -targets=host-amdgcn-xxx-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -output=%t.res.s -output=%t.res.tgt1 -input=%t.bundle3.s -unbundle -allow-missing-bundles
 
 //
 // Check binary bundle/unbundle. The content that we have before bundling must be the same we have after unbundling.


        


More information about the cfe-commits mailing list