[clang] [clang-repl] Bundle the HIP HSACO into an offload bundle (PR #241208)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 02:49:01 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- clang/include/clang/Driver/CommonArgs.h clang/include/clang/Interpreter/Interpreter.h clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChain.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Interpreter/DeviceOffload.cpp clang/lib/Interpreter/DeviceOffload.h clang/lib/Interpreter/Interpreter.cpp clang/tools/clang-repl/ClangRepl.cpp clang/unittests/Interpreter/DeviceOffloadTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Interpreter/DeviceOffload.cpp b/clang/lib/Interpreter/DeviceOffload.cpp
index e6ce13aee..c54388524 100644
--- a/clang/lib/Interpreter/DeviceOffload.cpp
+++ b/clang/lib/Interpreter/DeviceOffload.cpp
@@ -213,10 +213,10 @@ IncrementalHIPDeviceParser::GenerateFatbinary(llvm::StringRef HSACO) {
   BundlerConfig.BundleAlignment = 4096;
   BundlerConfig.HostInputIndex = 0;
   BundlerConfig.FilesType = "o";
-  BundlerConfig.TargetNames = {
-      "host-" + llvm::sys::getProcessTriple(),
-      OffloadKind.str() + "-" + normalizeForBundler(DeviceTriple, TargetID) +
-          "-" + TargetID};
+  BundlerConfig.TargetNames = {"host-" + llvm::sys::getProcessTriple(),
+                               OffloadKind.str() + "-" +
+                                   normalizeForBundler(DeviceTriple, TargetID) +
+                                   "-" + TargetID};
   BundlerConfig.InputFileNames = {std::string(HostFile),
                                   std::string(HSACOFile)};
   BundlerConfig.OutputFileNames = {std::string(FatbinFile)};
@@ -226,8 +226,8 @@ IncrementalHIPDeviceParser::GenerateFatbinary(llvm::StringRef HSACO) {
 
   auto FatbinBuf = llvm::MemoryBuffer::getFile(FatbinFile, /*IsText=*/false);
   if (!FatbinBuf)
-    return llvm::make_error<llvm::StringError>(
-        "Failed to read the fat binary.", llvm::inconvertibleErrorCode());
+    return llvm::make_error<llvm::StringError>("Failed to read the fat binary.",
+                                               llvm::inconvertibleErrorCode());
 
   llvm::StringRef Buffer = (*FatbinBuf)->getBuffer();
   FatbinContent.assign(Buffer.begin(), Buffer.end());

``````````

</details>


https://github.com/llvm/llvm-project/pull/241208


More information about the cfe-commits mailing list