Skip to content

Commit f6226d9

Browse files
dan-zhengrxwei
authored andcommitted
[AutoDiff upstream] Add -enable-experimental-differentiable-programming frontend flag. (#27446)
This flag will enable all experimental differentiable programming features. The default will be `true` on tensorflow branch but `false` on master branch. Features will first be updated on tensorflow branch to use this flag, before being upstreamed to master. The goal is to achieve a minimal code diff between the two branches. The [TF-820](https://bugs.swift.org/browse/TF-820) master issue tracks upstreaming differentiable programming. --- Rationale: we chose to add a frontend flag rather than a `build-script`/CMake flag for easier testing. Differentiable programming `lit` tests can be run by specifying this additional flag without recompiling the compiler and standard library. [Forum discussion on upstreaming differentiable programming.](https://forums.swift.org/t/upstreaming-differentiable-attribute-and-differentiable-protocol/26821)
1 parent 2035658 commit f6226d9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ namespace swift {
325325
/// set to true.
326326
bool ExperimentalDependenciesIncludeIntrafileOnes = false;
327327

328+
/// Whether to enable experimental differentiable programming features:
329+
/// `@differentiable` declaration attribute, etc.
330+
bool EnableExperimentalDifferentiableProgramming = false;
331+
328332
/// Sets the target we are building for and updates platform conditions
329333
/// to match.
330334
///

include/swift/Option/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ def disable_bridging_pch : Flag<["-"], "disable-bridging-pch">,
424424
Flags<[HelpHidden]>,
425425
HelpText<"Disable automatic generation of bridging PCH files">;
426426

427+
// Experimental feature options
428+
def enable_experimental_differentiable_programming : Flag<["-"], "enable-experimental-differentiable-programming">,
429+
Flags<[FrontendOption]>,
430+
HelpText<"Enable experimental differentiable programming features">;
431+
427432
// Diagnostic control options
428433
def suppress_warnings : Flag<["-"], "suppress-warnings">,
429434
Flags<[FrontendOption]>,

0 commit comments

Comments
 (0)