Summary
cssl-autodiff implements source-to-source automatic differentiation with 19 math primitives (FAdd, FSub, FMul, FDiv, FNeg, Sqrt, Sin, Cos, Exp, Log, and piecewise-linear min/max/abs).
The forward-mode (apply_fwd) and backward-mode (apply_bwd) passes are tested via unit tests, but property-based tests (using the proptest crate, already in workspace deps) could catch more edge cases — especially NaN/inf behaviour and the chain rule invariant.
What to do
In cssl-autodiff/src/ (or a tests/ subdirectory), add proptest cases for:
- Linearity of forward-mode:
apply_fwd(a*f + b*g) == a*apply_fwd(f) + b*apply_fwd(g) (for affine-safe primitives)
- Chain rule sanity:
apply_fwd(compose(f, g)) == apply_fwd(f) ∘ apply_fwd(g) for a simple two-primitive chain
- Primal preservation: applying
DiffMode::Primal is identity on the MIR body
Proptest is already available via proptest.workspace = true in Cargo.toml.
Why this is a good first issue
- Proptest is straightforward to use — see existing property tests in
cssl-testing
- Autodiff is one of Sigil's headline features; more coverage is always welcome
- No unsafe, no GPU, no FFI involved
- Tests live entirely within the
cssl-autodiff crate
Files
compiler-rs/crates/cssl-autodiff/src/ (add tests here or in tests/proptest.rs)
compiler-rs/Cargo.toml (proptest.workspace = true already defined)
Summary
cssl-autodiffimplements source-to-source automatic differentiation with 19 math primitives (FAdd, FSub, FMul, FDiv, FNeg, Sqrt, Sin, Cos, Exp, Log, and piecewise-linear min/max/abs).The forward-mode (
apply_fwd) and backward-mode (apply_bwd) passes are tested via unit tests, but property-based tests (using theproptestcrate, already in workspace deps) could catch more edge cases — especially NaN/inf behaviour and the chain rule invariant.What to do
In
cssl-autodiff/src/(or atests/subdirectory), add proptest cases for:apply_fwd(a*f + b*g) == a*apply_fwd(f) + b*apply_fwd(g)(for affine-safe primitives)apply_fwd(compose(f, g)) == apply_fwd(f) ∘ apply_fwd(g)for a simple two-primitive chainDiffMode::Primalis identity on the MIR bodyProptest is already available via
proptest.workspace = truein Cargo.toml.Why this is a good first issue
cssl-testingcssl-autodiffcrateFiles
compiler-rs/crates/cssl-autodiff/src/(add tests here or intests/proptest.rs)compiler-rs/Cargo.toml(proptest.workspace = truealready defined)