[all-commits] [llvm/llvm-project] 635e12: [PGO][HIP] Stop pulling ROCm.o into every PGO host...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Wed May 27 19:36:43 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 635e120fb87304924508a7a204574727e3c37363
      https://github.com/llvm/llvm-project/commit/635e120fb87304924508a7a204574727e3c37363
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2026-05-27 (Wed, 27 May 2026)

  Changed paths:
    M compiler-rt/lib/profile/InstrProfilingFile.c
    M compiler-rt/lib/profile/InstrProfilingPlatformROCm.cpp

  Log Message:
  -----------
  [PGO][HIP] Stop pulling ROCm.o into every PGO host link (#200101)

PR #177665 added an unconditional `extern` reference to
`__llvm_profile_hip_collect_device_data` from `InstrProfilingFile.c`,
which forces `InstrProfilingPlatformROCm.o` (and its sanitizer_common /
interception dependencies) out of `libclang_rt.profile.a` in every PGO
binary. That breaks bots without `-lpthread` and races dlsym/PLT state
in non-HIP programs via the interceptor constructor.

Fix:
- Declare the hook `COMPILER_RT_WEAK` and gate the call on its address.
No `COMPILER_RT_VISIBILITY`: a hidden weak-undef function would be
non-preemptible and the address test would fold to true.
- Gate `installHipModuleInterceptors` on `dlsym(hipModuleLoad)` so the
constructor is a no-op if `ROCm.o` is still pulled in.

Fixes:
- https://lab.llvm.org/buildbot/#/builders/66/builds/31311
- https://lab.llvm.org/buildbot/#/builders/174/builds/36180

Verified:
- `check-profile` 134/134 pass.
- `nm` on a non-HIP `clang -fprofile-generate` binary: zero
`installHip`/`ROCm`/`sanitizer`/`hip_collect` symbols.
- HIP offload PGO end-to-end on gfx1101 (compile → run → `llvm-profdata
merge` → `llvm-cov`) still works; interceptor installs, device profile
collected via shared API.



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