This commit introduces an "adaptive delay" feature to the ThreadSanitizer runtime to improve race detection by perturbing thread schedules. At various synchronization points (atomic operations, mutexes, and thread lifecycle events), the runtime may inject small delays (spin loops, yields, or sleeps) to explore different thread interleavings and expose data races that would otherwise occur only in rare execution orders. This change is inspired by prior work, which is discussed in more detail on https://discourse.llvm.org/t/rfc-tsan-implementing-a-fuzz-scheduler-for-tsan/80969. In short, https://reviews.llvm.org/D65383 was an earlier unmerged attempt at adding a random delays. Feedback on the RFC led to the version in this commit, aiming to limit the amount of delay. The adaptive delay feature uses a configurable time budget and tiered sampling strategy to balance race exposure against performance impact. It prioritizes high-value synchronization points with clear happens-before relationships: relaxed atomics receive lightweight spin delays with low sampling, synchronizing atomics (acquire / release / seq_cst) receive moderate delays with higher sampling, and mutex and thread lifecycle operations receive the longest delays with highest sampling. The feature is disabled by default and incurs minimal overhead when not enabled. Nearly all checks are guarded by an inline check on a global variable that is only set when enable_adaptive_delay=1. Microbenchmarks with tight loops of atomic operations showed no meaningful performance difference between an unmodified TSAN runtime and this version when running with empty TSAN_OPTIONS. An LLM assisted in writing portions of the adaptive delay logic, including the TimeBudget class, tiering concept, address sampler, and per-thread quota system. I reviewed the output and made amendments to reduce duplication and simplify the behavior. I also replaced the LLM's original double-based calculation logic with the integer-based Percent class. The LLM also helped write unit test cases for Percent. cc @dvyukov ## Examples I used the delay scheduler to find novel bugs that rarely or never occurred with the unmodified TSAN runtime. Some of the bugs below were found with earlier versions of the delay scheduler that I iterated on, but with this most recent implementation in this PR, I can still find the bugs far more reliably than with the standard TSAN runtime. - A use-after-free in the [BlazingMQ](https://github.com/bloomberg/blazingmq) broker during ungraceful producer disconnect. - Race in stdexec: https://github.com/NVIDIA/stdexec/pull/1395 - Race in stdexec's MPSC queue: https://github.com/NVIDIA/stdexec/pull/1812 - A few races in [BDE](https://github.com/bloomberg/bde) thread enabled data structures/algorithms. - The "Data race on variable a" test from https://ceur-ws.org/Vol-2344/paper9.pdf is more reliably reproduced with more aggressive adaptive scheduler options # Outstanding work - The [RFC](https://discourse.llvm.org/t/rfc-tsan-implementing-a-fuzz-scheduler-for-tsan/80969) suggests moving the scheduler to sanitizer_common, so that ASAN can leverage this. This should be done (should it be done in this PR?). - Missing interceptors for libdispatch
7.3 KiB
LLVM {{env.config.release}} Release Notes
```{warning} These are in-progress notes for the upcoming LLVM {{env.config.release}}
release. Release notes for previous releases can be found on
[the Download Page](https://releases.llvm.org/download.html).
```
Introduction
This document contains the release notes for the LLVM Compiler Infrastructure, release {{env.config.release}}. Here we describe the status of LLVM, including major improvements from the previous release, improvements in various subprojects of LLVM, and some of the current users of the code. All LLVM releases may be downloaded from the LLVM releases web site.
For more information about LLVM, including information about the latest release, please check out the main LLVM web site. If you have questions or comments, the Discourse forums is a good place to ask them.
Note that if you are reading this file from a Git checkout or the main LLVM web page, this document applies to the next release, not the current one. To see the release notes for a specific release, please see the releases page.
Non-comprehensive list of changes in this release
- ...
Changes to the LLVM IR
-
Removed
llvm.convert.to.fp16andllvm.convert.from.fp16intrinsics. These are equivalent tofptruncandfpextwith half with a bitcast. -
"denormal-fp-math" and "denormal-fp-math-f32" string attributes were migrated to first-class denormal_fpenv attribute.
-
The
"nooutline"attribute is now writen asnooutline. Existing IR and bitcode will be automatically updated.
Changes to LLVM infrastructure
-
Removed
Constant::isZeroValue. It was functionally identical toConstant::isNullValuefor all types except floating-point negative zero. All callers should useisNullValueinstead.isZeroValuewill be reintroduced in the future with bitwise-all-zeros semantics to support non-zero null pointers. -
Removed TypePromoteFloat legalization from SelectionDAG
Changes to building LLVM
Changes to TableGen
Changes to Interprocedural Optimizations
Changes to Vectorizers
Changes to the AArch64 Backend
Changes to the AMDGPU Backend
- Initial support for gfx1310
Changes to the ARM Backend
Changes to the AVR Backend
Changes to the DirectX Backend
Changes to the Hexagon Backend
Changes to the LoongArch Backend
- DWARF fission is now compatible with linker relaxations, allowing
-gsplit-dwarfand-mrelaxto be used together when building for the LoongArch platform.
Changes to the MIPS Backend
Changes to the NVPTX Backend
- The default SM version has been changed from
sm_30tosm_75.sm_75is the oldest GPU variant compatible with the widest range of recent major CUDA Toolkit versions (11/12/13).
Changes to the PowerPC Backend
Changes to the RISC-V Backend
llvm-objdumpnow has support for--symbolize-operandswith RISC-V.-mcpu=spacemit-x100was added.- Change P extension version to match the 019 draft specification. Encoded in
-marchas0p19. - Mnemonics for MOP/HINT-based instructions (
lpad,pause,ntl.*,c.ntl.*,sspush,sspopchk,ssrdp,c.sspush,c.sspopchk) are now always available in the assembler and disassembler without requiring their respective extensions. - Adds experimental assembler support for the 'Zvabd` (RISC-V Integer Vector Absolute Difference) extension.
-mcpu=spacemit-a100was added.
Changes to the WebAssembly Backend
Changes to the Windows Target
- The
.seh_startchainedand.seh_endchainedassembly instructions have been removed and replaced with a new.seh_splitchainedinstruction.
Changes to the X86 Backend
.att_syntaxdirective is now emitted for assembly files when AT&T syntax is in use. This matches the behaviour of Intel syntax and aids with compatibility when changing the default Clang syntax to the Intel syntax.
Changes to the OCaml bindings
Changes to the Python bindings
Changes to the C API
Changes to the CodeGen infrastructure
Changes to the Metadata Info
Changes to the Debug Info
Changes to the LLVM tools
llvm-objcopyno longer corrupts the symbol table when--update-sectionis called for ELF files.FileCheckoption-check-prefixnow accepts a comma-separated list of prefixes, making it an alias of the existing-check-prefixesoption.
Changes to LLDB
FreeBSD
Userspace Debugging
- Support for MIPS64 has been removed.
- The minimum assumed FreeBSD version is now 14. The effect of which is that watchpoints are assumed to be supported.
Kernel Debugging
- The crashed thread is now automatically selected on start.
- Threads are listed in incrmental order by pid then by tid.
Changes to BOLT
Changes to Sanitizers
- Add a random delay into ThreadSanitizer to help find rare thread interleavings.
Other Changes
External Open Source Projects Using LLVM {{env.config.release}}
Additional Information
A wide variety of additional information is available on the
LLVM web page, in particular in the
documentation section. The web page also contains
versions of the API documentation which is up-to-date with the Git version of
the source code. You can access versions of these documents specific to this
release by going into the llvm/docs/ directory in the LLVM tree.
If you have any questions or comments about LLVM, please feel free to contact us via the Discourse forums.