Introduction
This document contains the release notes for the automatic differentiation plugin for clang Clad, release 1.9. 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 1.9?
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-9 to clang-19
Forward Mode & Reverse Mode
- Improved differentiation support for complex mathematical expressions.
- Enhanced function overload handling in both forward and reverse modes.
- Enable differentiation when functions are defined in transparent contexts.
Forward Mode
- Optimized forward mode differentiation for performance improvements.
- Added support for additional intrinsic functions.
Reverse Mode
- Enhanced handling of control flow structures in reverse mode.
- Improved memory efficiency during differentiation.
- Support member calls with xvalue bases in the reverse mode.
- Initialize object adjoints using a copy of the original when copy constructor is available. Eg:
The new clad::zero_init function relies on the iterators to initialize the elements.
std::vector<...> v{x, y, z}; std::vector<...> _d_v{v}; // The length of the vector is preserved clad::zero_init(_d_v); // All elements are initialized to 0
CUDA
- Introduced experimental support for differentiating CUDA kernels.
- Optimized CUDA differentiation to reduce compilation overhead.
Misc
- General improvements in documentation and code clarity.
- Various performance optimizations across Clad.
- Improved
DiffRequest
andDynamicGraph
printing.
Fixed Bugs
Special Kudos
This release wouldn't have happened without the efforts of our contributors,
listed in the form of Firstname Lastname (#contributions):
FirstName LastName (#commits)
A B (N)
Vassil Vassilev (36)
petro.zarytskyi (12)
mcbarton (2)
PetroZarytskyi (2)
dependabot[bot] (1)
ToshitJain (1)
Rohith Suresh (1)
Abdelrhman Elrawy (1)
What's Changed
- Use ASTContext's printing policy, reuse the Sema variable. NFC by @vgvassilev in #1175
- Remove extra variable, rely on the one that already exists by @vgvassilev in #1176
- Simplify if-conditions. NFC. by @vgvassilev in #1177
- Enable differentiation when functions are defined in transparent contexts by @vgvassilev in #1178
- Remove unused declaration; improve custom_derivatives docs. by @vgvassilev in #1182
- Improve DiffRequest and DynamicGraph printing. by @vgvassilev in #1183
- [cmake] Do not issue a fatal error on version mismatch for Debug builds. by @vgvassilev in #1184
- Bump jinja2 from 3.1.4 to 3.1.5 by @dependabot in #1185
- Harmonize Derive and DerivePushforward by @vgvassilev in #1186
- Harmonize Derive and DerivePullback by @vgvassilev in #1187
- Use CloneParmVarDecl instead of manual cloning. NFC by @vgvassilev in #1188
- Rework computation of derivative function prototype. by @vgvassilev in #1189
- Move computing of the effective derivative name in DiffRequest. NFC. by @vgvassilev in #1190
- Move the computation of parameters in SetupDerivativeParameters. by @vgvassilev in #1191
- Move the seed initialization into a separate function. by @vgvassilev in #1192
- Reroute pushforwards to the generic ::Derive method. by @vgvassilev in #1193
- Reduce duplicated code. by @vgvassilev in #1194
- Move more cases computing the derivative name in ComputeDerivativeName. by @vgvassilev in #1195
- Remove unused data member. by @vgvassilev in #1196
- Remove unused member by @vgvassilev in #1197
- Invert if-stmt, remove a fixme of resolved bug and add a new fixme. by @vgvassilev in #1198
- Use CloneParmVarDecl and the parameters stored in the DiffRequest. NFC by @vgvassilev in #1203
- Remove dead code. NFC by @vgvassilev in #1204
- [ci] OSX homebrew dropped llvm13 by @vgvassilev in #1206
- Simplify error estimation by not storing m_ParamTypes by @vgvassilev in #1205
- Clean up the code computing the parameters and their types. by @vgvassilev in #1208
- Remove redundant for error estimation callback. by @vgvassilev in #1209
- Reroute pullback to the generic ::Derive method. by @vgvassilev in #1210
- Don't pass derived args to forw pass unless they are references by @PetroZarytskyi in #1207
- Update README with clang version note for macos by @RS2007 in #1200
- Improve derivative registration. by @vgvassilev in #1211
- Improve graph printing. by @vgvassilev in #1213
- Support std::initializer_list parameters in the reverse mode by @PetroZarytskyi in #1212
- Initialize object adjoints using a copy of the original by @PetroZarytskyi in #1179
- Improve formatting of DiffRequest::dump and make it available in gdb. by @vgvassilev in #1214
- Support member calls with xvalue bases in the reverse mode by @PetroZarytskyi in #1219
- Add a regression test for Assertion _size' failed. by @vgvassilev in #1220
- Add Ubuntu arm runners to ci by @mcbarton in #1221
- Support differentiating functions that return CXXConstructExpr by @PetroZarytskyi in #1223
- Don't accept functions of object return types in clad::gradient by @PetroZarytskyi in #1224
- Support VisitCXXFunctionalCastExpr in the reverse mode by @PetroZarytskyi in #1225
- Fix for Parenthesis issue in gradients by @toshit3q34 in #1180
- Remove VisitWithExplicitNoDfDx and replace it with plain Visit. by @PetroZarytskyi in #1226
- Simplify RMV::VisitExprWithCleanups by @PetroZarytskyi in #1227
- Don't return zero initialization as the derivative of InitListExpr by @PetroZarytskyi in #1228
- Don't use original stmts in the generated code by @PetroZarytskyi in #1229
- Remove m_DerivativeForForwSweep from StmtDiff by @PetroZarytskyi in #1230
- Enable llvm19, remove llvm8 support. by @vgvassilev in #1233
- Fix clang-format workflow by @mcbarton in #1234
- Update Developer Installation Instruction on README.md by @a-elrawy in #1236
- Don't set init and init style of a declaration manually by @PetroZarytskyi in #1232
New Contributors
- @RS2007 made their first contribution in #1200
- @toshit3q34 made their first contribution in #1180
- @a-elrawy made their first contribution in #1236
Full Changelog: v1.8...v1.9