[all-commits] [llvm/llvm-project] d85a81: [OffloadBundler] Rework the ctor of `OffloadTarget...

Shilei Tian via All-commits all-commits at lists.llvm.org
Tue Mar 18 07:09:59 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d85a81b4e4cfc0fdc7c259d64f847e7bbeee56d2
      https://github.com/llvm/llvm-project/commit/d85a81b4e4cfc0fdc7c259d64f847e7bbeee56d2
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2025-03-18 (Tue, 18 Mar 2025)

  Changed paths:
    M clang/docs/ClangOffloadBundler.rst
    M clang/include/clang/Driver/OffloadBundler.h
    M clang/lib/Driver/OffloadBundler.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/HIPUtility.cpp
    M clang/test/Driver/clang-offload-bundler-asserts-on.c
    M clang/test/Driver/clang-offload-bundler-standardize.c
    M clang/test/Driver/clang-offload-bundler.c
    M clang/test/Driver/hip-link-bc-to-bc.hip
    M clang/test/Driver/hip-link-bundle-archive.hip
    M clang/test/Driver/hip-offload-compress-zlib.hip
    M clang/test/Driver/hip-offload-compress-zstd.hip
    M clang/test/Driver/hip-rdc-device-only.hip
    M clang/test/Driver/hip-toolchain-rdc-separate.hip
    M clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
    M llvm/utils/lit/lit/llvm/config.py

  Log Message:
  -----------
  [OffloadBundler] Rework the ctor of `OffloadTargetInfo` to support AMDGPU's generic target (#122629)

The current parsing logic for the target string assumes it follows the
format `<kind>-<triple>-<target id>:<feature>`, such as
`hipv4-amdgcn-amd-amdhsa-gfx1030:+xnack`.
Specifically, it assumes that `<target id>` does not contain any `-`,
relying on `rsplit` for parsing.
However, this assumption breaks for AMDGPU's generic targets, which may
contain one or more `-`, such as `gfx10-3-generic` or `gfx12-generic`.
As a result, the existing approach using `rstrip` is no longer reliable.

This patch reworks the parsing logic to handle target strings more
robustly, including support for generic targets.
The bundler now strictly requires a 4-field target triple.
Additionally, a new Python helper function has been added to `config.py`
to normalize the target triple into the 4-field format when it is not,
ensuring tests pass reliably.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list