[llvm] [Instrumentation] Add TSan instrumentation for AMDGPU targets (PR #207713)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 05:10:27 PDT 2026


jhuber6 wrote:

> There's an alternative to either extending the TSan pass or forking the TSan pass entirely: add a smaller instrumentation pass that is inserted either before or after TSan pass that translates the AMDGPU-specific intrinsics, and anything else AMDGPU-specific that doesn't belong into the TSan pass.
> 
> As for the prefix, you could add either a constructor param, or an cl::opt option to change the prefix. But that's cosmetic, and not a user-visible detail, so up to you if it's worth doing.

Thanks for the review, I'm working on a new set of changes for this. My current plan is to insert an entirely new sanitizer category, but share this instrumentation pass through a boolean flag because they will still be 90% similar. The issue is that for our purposes we really need custom instrumentation. I plan to start with an x64 version and then layer the GPU support on top of it, hopefully I'll be able to put update the PRs soon.

| Surface | Value |
|---|---|
| Flag | `-fsanitize=concurrency` |
| IR attribute | `sanitize_concurrency` (suppress: `no_sanitize("concurrency")`) |
| Macro / feature | `__SANITIZE_CONCURRENCY__` / `__has_feature(concurrency_sanitizer)` |
| Runtime | `libclang_rt.csan.a` |

The one problem are the `cl::opt` flags we might want to share, I'm wondering if we could alias those to `csan` as well.

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


More information about the llvm-commits mailing list