swift
a8393188 - [AutoDiff] Enable differentiation of generic functions. (#22023)

Commit
6 years ago
[AutoDiff] Enable differentiation of generic functions. (#22023) - Relax differentiability diagnostic for generic functions. - Previously, an error was emitted when attempting to differentiate any generic function. Now, diagnose only functions with indirect differentiation parameters/result. - Propagate differentiation associated function generic signature throughout differentiation pass. - Change `PrimalGenCloner` to inherit `TypeSubstCloner`. - Make primal value structs inherit primal function's generic parameters and signature. - Calculate correct substitution map for `PrimalGenCloner::visitApplyInst`. Emit diagnostic when apply instruction's associated function (e.g. VJP) has generic requirements unmet by the primal generic environment. - Remap types in `AdjointEmitter`. - Remove manual `@differentiable` attribute where clause conformance requirement checks. - `GenericSignatureBuilder` already performs checks so manual checks are unnecessary.
Author
Parents
  • include/swift/AST
    • File
      DiagnosticsSIL.def
  • lib
    • SIL
      • File
        SILFunctionType.cpp
    • SILOptimizer/Mandatory
      • File
        Differentiation.cpp
    • Sema
      • File
        TypeCheckAttr.cpp
  • test
    • AutoDiff
      • File
        autodiff_diagnostics.swift
      • File
        differentiable_attr_type_checking.swift
      • File
        generics.swift
    • TensorFlowRuntime
      • File
        tensor_autodiff_runtime.swift