We seem to have two versions of synthesis for dadd, dmul and dzero. One on the AST side (trySynthesizeDifferentialMethodRequirementWitness in slang-check-decl.cpp), and then again on the IR side (fillDifferentialTypeImplementationForStruct in slang-ir-autodiff.cpp).
The IR-side synthesis is pretty much necessary because some differentiable struct types (such as the intermediate context) are generated during IR passes.
We could simply bottleneck all differential type synthesis through the IR-side machinery, and only generate function headers on the AST side, and cut down on redundant code.
We seem to have two versions of synthesis for
dadd
,dmul
anddzero
. One on the AST side (trySynthesizeDifferentialMethodRequirementWitness
in slang-check-decl.cpp), and then again on the IR side (fillDifferentialTypeImplementationForStruct
in slang-ir-autodiff.cpp).The IR-side synthesis is pretty much necessary because some differentiable struct types (such as the intermediate context) are generated during IR passes.
We could simply bottleneck all differential type synthesis through the IR-side machinery, and only generate function headers on the AST side, and cut down on redundant code.