Introduction
This document contains the release notes for the automatic differentiation plugin for clang Clad, release 2.4. Clad is built on top of Clang and LLVM compiler infrastructure. Here we describe the status of Clad in some detail, including major improvements from the previous release and new feature work.
Note that if you are reading this file from a git checkout, this document applies to the next release, not the current one.
What's New in Clad 2.4?
Some of the major new features and improvements to Clad are listed here. Generic improvements to Clad as a whole or to its underlying infrastructure are described first.
External Dependencies
- Clad now works with clang-12 to clang-22. Support for clang-11 has been dropped as the support window shifted to the last ten major releases.
Forward Mode & Reverse Mode
- Add support for the OpenMP
criticaldirective in both forward and reverse mode. - Safely fall back when differentiating functions with no parameters instead of crashing.
Reverse Mode
- Handle member access on call results by seeding the corresponding member of the record adjoint before visiting the call, so expressions like
objVal(x).valemit the needed pullback call instead of an empty gradient. - Allow redefining builtin custom derivatives: lookup now prioritizes
custom_derivatives::overridesand only falls back to the builtin when no overrides declaration exists.
CUDA
- Extend tape functionality to support GPU offloading to VRAM.
- Add
CUDA_HOST_DEVICEtoTape::destroy_element()so it can be called from device code.
Error Estimation
Misc
- Guard statement scopes with a
ScopeRAIIhandle so scope balance is enforced by the type rather than by hand (NFC). - Skip backend pass registration when clad is built as a static library (
CLAD_BUILD_STATIC_ONLY=ON), fixing rootcling dictionary generation in ROOT. - Use
std::unique_ptrforReverseModeVisitor::m_ExternalSourceto make ownership explicit and exception-safe. - Add LLVM 22 AddressSanitizer CI coverage and resolve the issues it surfaced.
Fixed Bugs
767 1298 1376 1624 1815 1839 1855
Special Kudos
This release wouldn't have happened without the efforts of our contributors, listed in the form of Firstname Lastname (#contributions):
Vassil Vassilev (12)
Vedant2005goyal (5)
Md Saif Ali Molla (2)
dependabot[bot] (2)
Shubham Shukla (1)
SahilPatidar (1)
leetcodez (1)
Devajith Valaparambil Sreeramaswamy (1)
What's Changed
- [ci] Cap parallelism by cgroup cpu.max on constrained runners. by @vgvassilev in #1817
- Fix: For issue-1815 by @Vedant2005goyal in #1816
- Implements GPU-Offload feature to the tape by @Vedant2005goyal in #1812
- Bump idna from 3.7 to 3.15 by @dependabot[bot] in #1823
- [ci] Move LLVM/Clang install onto ci-workflows' setup-llvm. by @vgvassilev in #1822
- Bump urllib3 from 2.6.3 to 2.7.0 by @dependabot[bot] in #1820
- [ci] Adopt CppInterOp's WoL action, repro hint, and selfh split. by @vgvassilev in #1829
- Port to LLVM 22 and shift the support window to clang 12-22. by @vgvassilev in #1830
- Handle member access on call results in reverse mode by @MdSaifAliMolla in #1828
- Add support for omp critical directive in forward and reverse mode by @Fermats-Last-Theorem in #1833
- Add CUDA_HOST_DEVICE to Tape::destroy_element() by @Vedant2005goyal in #1836
- Use unique_ptr for ReverseModeVisitor::m_ExternalSource by @Elvand-Lie in #1840
- Fix TBRAnalyzer visiting the true branch twice in TraverseConditionalOperator by @leetcodez in #1842
- Stop leaking CladFunction's m_Code; point at the static literal. by @vgvassilev in #1845
- Fix clang::Scope leak in reverse-mode switch differentiation. by @vgvassilev in #1846
- Fix reference-variable VarData set leak in TBR analysis. by @vgvassilev in #1844
- [ci] Add LLVM 22 ASan matrix row. by @vgvassilev in #1831
- Guard statement scopes with a ScopeRAII handle. NFC by @vgvassilev in #1849
- Guard TBR analysis for untracked pointers by @Elvand-Lie in #1857
- Skip backend pass registration when built as static library by @devajithvs in #1854
- Fix dyn_cast assertion failures in ReverseMode AST Visitors by @Vedant2005goyal in #1858
New Contributors
- @Elvand-Lie made their first contribution in #1840
- @devajithvs made their first contribution in #1854
Full Changelog: v2.3...v2.4