mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AutoDiff upstream] Add forward-mode differentiation. (#30878)
JVP functions are forward-mode derivative functions. They take original arguments and return original results and a differential function. Differential functions take derivatives wrt arguments and return derivatives wrt results. `JVPEmitter` is a cloner that emits JVP and differential functions at the same time. In JVP functions, function applications are replaced with JVP function applications. In differential functions, function applications are replaced with differential function applications. In JVP functions, each basic block takes a differential struct containing callee differentials. These structs are consumed by differential functions.
This commit is contained in:
@@ -449,6 +449,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
if (Args.hasArg(OPT_enable_experimental_additive_arithmetic_derivation))
|
||||
Opts.EnableExperimentalAdditiveArithmeticDerivedConformances = true;
|
||||
|
||||
Opts.EnableExperimentalForwardModeDifferentiation |=
|
||||
Args.hasArg(OPT_enable_experimental_forward_mode_differentiation);
|
||||
|
||||
Opts.DebuggerSupport |= Args.hasArg(OPT_debugger_support);
|
||||
if (Opts.DebuggerSupport)
|
||||
Opts.EnableDollarIdentifiers = true;
|
||||
|
||||
Reference in New Issue
Block a user