[llvm-branch-commits] [clang] [Clang] Enable UBSan for AMDGPU device offload (PR #219973)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Sep 13 12:59:21 PDT 2026
================
@@ -1669,15 +1669,45 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC,
CmdArgs.push_back("-lresolv");
}
+// Host interceptor library for offload UBSan.
+static bool hostNeedsUbsanOffloadRt(Compilation &C, const ToolChain &HostTC) {
+ if (HostTC.getTriple().isGPU())
+ return false;
+
+ static constexpr Action::OffloadKind Kinds[] = {
+ Action::OFK_Cuda, Action::OFK_OpenMP, Action::OFK_HIP, Action::OFK_SYCL};
+ for (Action::OffloadKind Kind : Kinds) {
+ for (const auto &Entry : llvm::make_range(C.getOffloadToolChains(Kind))) {
+ const ToolChain *DevTC = Entry.second;
+ // FIXME: CUDA/HIPSPV copy the host mask and ignore device sanitizers.
+ const llvm::Triple &TT = DevTC->getTriple();
+ if (!TT.isAMDGCN() || TT.getOS() != llvm::Triple::AMDHSA)
----------------
arsenm wrote:
Why the OS check? Presumably it would work with anything since it's standalone?
https://github.com/llvm/llvm-project/pull/219973
More information about the llvm-branch-commits
mailing list