Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13659] Retroactive derivative registration #53959

dan-zheng opened this issue Oct 2, 2019 · 0 comments

[SR-13659] Retroactive derivative registration #53959

dan-zheng opened this issue Oct 2, 2019 · 0 comments


Copy link

dan-zheng commented Oct 2, 2019

Previous ID SR-13659
Radar None
Original Reporter @dan-zheng
Type Bug
Additional Detail from JIRA
Votes 0
Labels Bug
Assignee @marcrasi
Priority Medium

md5: e2357f504e2da828a1cddd63fe03e829


  • SR-13660 SIL: differentiability witness data structure, parsing and serialization
  • SR-13661 Sema: lift "same-file-only derivative registration" limitation
  • SR-13662 SILGen: generate differentiability witnesses from @differentiable/@differentiating attributes
  • SR-13663 IRGen: lower differentiability witness
  • SR-13664 Add differentiability_witness_function instruction
  • SR-13665 IRGen: lower differentiability_witness_function instruction
  • SR-13666 Differentiation: revamp transform to generate differentiability witnesses
  • SR-13667 Differentiation: revamp transform to generate differentiability witness function instructions
  • SR-13668 SILOptimizer: devirtualize differentiability_witness_function instructions
  • SR-13669 Differentiation: revamp transform to directly canonicalize differentiability witnesses
  • SR-13670 Sema/SILGen: lower @derivative attribute directly to SIL differentiability witnesses
  • SR-13671 Sema: default @differentiable attribute's derivative generic signature to the original declaration's generic signature
  • SR-13672 SIL: remove SILDifferentiableAttr
  • SR-13673 Separate registered derivatives from the standard library
  • SR-13674 Use @derivative in stdlib instead of @differentiable(jvp:vjp:)
  • SR-13675 Use @derivative in tensorflow/swift-apis instead of @differentiable(vjp:)
  • SR-13676 Remove '@differentiable' attribute 'jvp:' and 'vjp:' arguments
  • SR-13677 diagnose when jvp and vjp have differing access levels
  • SR-13678 Investigate low-hanging differentiability witness compile time improvements
  • SR-13679 Miscellaneous todos
  • SR-13680 figure out correct linkage for all ad symbols
  • SR-13681 make sil_differentiability_witness more opaque
  • SR-13682 incorrect (?) "function not differentiable" error
  • SR-13683 multiple internal derivatives of the same function cause symbol redefinition linker error
  • SR-13684 sema forbids private derivatives in different scopes
  • SR-13685 diagnose duplicate derivatives for derivatives defined in other modules
  • SR-13686 @derivative attribute SILGen crash for foreign original declaration
  • SR-13687 Remove -Xfrontend -enable-experimental-cross-file-derivative-registration flag
  • SR-13688 Require @derivative functions to have same access level as original declaration
  • SR-13689 derivative of @_alwaysEmitIntoClient function
  • SR-13690 test/AutoDiff/downstream/cross_module_derivative_attr_e2e.swift fails in optimized mode
  • SR-13691 remove "jvp:" and "vjp:" arguments from "@differentiable" decl attribute


  • TF-911 Upstream SILDifferentiabilityWitness: definition, parsing, printing

is duplicated by:

  • TF-136 Retroactive differentiability
  • TF-280 Enable cross-file/cross-module differentiability

Issue Description:

Retroactive derivative registration: register derivatives for functions in other modules.


  • If module A defines func foo, then its derivatives must be in the same module.

With retroactive derivative registration:

  • If module A defines func foo;

  • And if module B imports module A and defines @derivative(of: foo) func derivativeFoo:

  • Then module C can import modules A and B and differentiate func foo (e.g. via differentiation APIs).

Retroactive derivative registration enables the following:

  • Defining derivatives in a separate module from original functions. This enables modularity: libraries like swift-numerics can define a separate "derivatives" module.

  • Derivative registration for imported C functions. Early demo here.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant