[all-commits] [llvm/llvm-project] 9d8964: [compiler-rt] Add device memory pool and data symb...

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu Oct 1 18:11:04 PDT 2026


  Branch: refs/heads/users/jhuber6/csan
  Home:   https://github.com/llvm/llvm-project
  Commit: 9d8964f9cf457a8e0f1bbed44f33da82bee532a6
      https://github.com/llvm/llvm-project/commit/9d8964f9cf457a8e0f1bbed44f33da82bee532a6
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_offload.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_offload.h
    M compiler-rt/lib/sanitizer_common/sanitizer_offload_hsa.h
    M compiler-rt/lib/sanitizer_common/sanitizer_offload_image.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h
    M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp

  Log Message:
  -----------
  [compiler-rt] Add device memory pool and data symbolization to offload layer

Summary:
This adds a few helpers to the common sanitizer offload layer that the
GPU concurrency sanitizer will need. `Offload::GetMemoryPool` and
`Offload::Allocate` allocate device-local memory from an agent's
coarse-grained memory pool. `Offload::SymbolizeData` and
`Symbolizer::SymbolizeModuleData` symbolize global data addresses inside
device images, which are not mapped into the host process.


  Commit: af23a104abb5f0114429253ed4230ae8d4ea9437
      https://github.com/llvm/llvm-project/commit/af23a104abb5f0114429253ed4230ae8d4ea9437
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M compiler-rt/cmake/caches/AMDGPU.cmake
    M compiler-rt/cmake/config-ix.cmake
    A compiler-rt/lib/csan/CMakeLists.txt
    A compiler-rt/lib/csan/csan.cpp
    A compiler-rt/lib/csan/csan.h
    A compiler-rt/lib/csan/csan_defs.h
    A compiler-rt/lib/csan/csan_flags.inc
    A compiler-rt/lib/csan/csan_gpu.cpp
    A compiler-rt/lib/csan/csan_offload_packet.h
    A compiler-rt/lib/csan/csan_report.cpp
    A compiler-rt/lib/csan/csan_watch.h
    A compiler-rt/lib/csan/offload/CMakeLists.txt
    A compiler-rt/lib/csan/offload/csan_offload.h
    A compiler-rt/lib/csan/offload/csan_offload_hsa_interceptors.cpp
    A compiler-rt/lib/csan/offload/csan_offload_report.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
    M compiler-rt/lib/sanitizer_common/sanitizer_offload_opcodes.h
    A compiler-rt/test/csan/AMDGPU/aba-race.hip
    A compiler-rt/test/csan/AMDGPU/array-race.hip
    A compiler-rt/test/csan/AMDGPU/atomic-nonatomic.hip
    A compiler-rt/test/csan/AMDGPU/atomic.hip
    A compiler-rt/test/csan/AMDGPU/disjoint.hip
    A compiler-rt/test/csan/AMDGPU/global-race.hip
    A compiler-rt/test/csan/AMDGPU/helper-race.hip
    A compiler-rt/test/csan/AMDGPU/lds-disjoint.hip
    A compiler-rt/test/csan/AMDGPU/lds-race.hip
    A compiler-rt/test/csan/AMDGPU/lit.local.cfg.py
    A compiler-rt/test/csan/AMDGPU/memcpy-large-race.hip
    A compiler-rt/test/csan/AMDGPU/memcpy-race.hip
    A compiler-rt/test/csan/AMDGPU/memmove-race.hip
    A compiler-rt/test/csan/AMDGPU/openmp-race.cpp
    A compiler-rt/test/csan/AMDGPU/race.h
    A compiler-rt/test/csan/AMDGPU/shared-watchpoints.hip
    A compiler-rt/test/csan/AMDGPU/single-thread.hip
    A compiler-rt/test/csan/AMDGPU/write-read-race.hip
    A compiler-rt/test/csan/CMakeLists.txt
    A compiler-rt/test/csan/access-sizes.cpp
    A compiler-rt/test/csan/atomic-nonatomic.cpp
    A compiler-rt/test/csan/atomic.cpp
    A compiler-rt/test/csan/halt-on-error.cpp
    A compiler-rt/test/csan/ignore-thread.cpp
    A compiler-rt/test/csan/large-access.cpp
    A compiler-rt/test/csan/large-range-race.cpp
    A compiler-rt/test/csan/lit.common.cfg.py
    A compiler-rt/test/csan/lit.site.cfg.py.in
    A compiler-rt/test/csan/race.cpp
    A compiler-rt/test/csan/read-read.cpp
    A compiler-rt/test/csan/single-thread.cpp
    A compiler-rt/test/csan/unknown-origin.cpp
    M compiler-rt/test/lit.common.cfg.py

  Log Message:
  -----------
  [compiler-rt] Add 'csan' library for the concurrency sanitizer

Summary:
Adds the runtime for the concurrency sanitizer, both CPU and GPU.
Fundamentally, this works using the following pseudocode:

```c
static u64 watchpoints[N]; // Hash-indexed, zero is empty.

// Emitted before the access, so we never trip on our own write.
void check_access(volatile void *addr, u32 size, u32 type) {
    // Every access probes. A read conflicts only with a watched write, a
    // write conflicts with either.
    if (u64 *wp = find_watchpoint(addr, size, type))
        consume(wp, this_pc()); // Hand our location to the owner.

    if (!should_sample()) // Wave-uniform, 1-in-N chance.
        return;

    u64 *wp = arm_watchpoint(addr, size, type);
    if (!wp) // Slot is already taken.
        return;

    auto old = read(addr, size);
    delay(ctx.rand()); // Randomized, bounded.

    if (void *peer = disarm(wp))
        report_race(addr, this_pc(), peer);
    else if (read(addr, size) != old)
        report_race(addr, this_pc(), UNKNOWN);
}
```

This implementation is kept intentionally minimal to simplify the review
process. Many options are planned for later. The intended use is for
users to pass `-fsanitize=concurrency` for supported compilations.


  Commit: 70b3ee3ce2d2447e85e7d71c423d1c03788e15ff
      https://github.com/llvm/llvm-project/commit/70b3ee3ce2d2447e85e7d71c423d1c03788e15ff
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
    M compiler-rt/cmake/config-ix.cmake
    M compiler-rt/lib/csan/CMakeLists.txt
    M compiler-rt/lib/csan/csan_gpu.cpp
    M compiler-rt/lib/csan/offload/CMakeLists.txt
    M compiler-rt/test/csan/CMakeLists.txt

  Log Message:
  -----------
  comments


  Commit: e9330916daa572552cedb8069ceaaec99e40b4bf
      https://github.com/llvm/llvm-project/commit/e9330916daa572552cedb8069ceaaec99e40b4bf
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M compiler-rt/lib/csan/CMakeLists.txt
    A compiler-rt/lib/csan/csan.syms.extra
    M compiler-rt/lib/csan/offload/CMakeLists.txt
    M compiler-rt/lib/csan/offload/csan_offload_hsa_interceptors.cpp
    A compiler-rt/lib/csan/offload/csan_offload_preinit.cpp
    M compiler-rt/test/csan/AMDGPU/global-race.hip
    M compiler-rt/test/csan/AMDGPU/openmp-race.cpp
    A compiler-rt/test/csan/hsa-load-order.cpp
    A compiler-rt/test/csan/hsa-missing.cpp
    M compiler-rt/test/csan/lit.common.cfg.py
    M compiler-rt/test/csan/race.cpp

  Log Message:
  -----------
  [compiler-rt] Remove dlsym interceptor and support `-shared-libsan` for CSan

Summary:
Follow the UBSan offload runtime. Offload now resolves HSA through the
global scope, so the `dlsym` interceptor is no longer needed. The real
HSA entry points are still taken from the loaded HSA library rather than
`RTLD_NEXT`, since every DSO with a static runtime exports the same
wrappers and they would otherwise chain back into each other.

Build `libclang_rt.csan.so` with the offload objects folded in. The
exported HSA wrappers report failure when HSA is absent and warn when HSA
was loaded ahead of the runtime. The preinit hook moves to a separate
`csan_offload-preinit` archive for executables.


  Commit: 36eb4f71b29d7788e95c161a70a5e5a2bf604d14
      https://github.com/llvm/llvm-project/commit/36eb4f71b29d7788e95c161a70a5e5a2bf604d14
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M compiler-rt/lib/csan/csan.cpp
    M compiler-rt/lib/csan/csan_gpu.cpp
    A compiler-rt/test/csan/AMDGPU/volatile.hip
    A compiler-rt/test/csan/volatile.cpp

  Log Message:
  -----------
  Remove separate volatile entry points


  Commit: 2a1a5316950a07a886495b16abc52b10e8623bff
      https://github.com/llvm/llvm-project/commit/2a1a5316950a07a886495b16abc52b10e8623bff
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M compiler-rt/lib/csan/csan.cpp
    M compiler-rt/test/csan/access-sizes.cpp

  Log Message:
  -----------
  Use unaligned loads when snapshotting watched values


Compare: https://github.com/llvm/llvm-project/compare/6917c68e505f...2a1a5316950a

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