Commit Graph

7 Commits

Author SHA1 Message Date
Dan Zheng
e9ed2d50cf [AutoDiff] Fix @derivative attribute type-checking crash. (#30936)
Fix `@derivative` attribute type-checking crash, so far reproducible only via
`-parse-stdlib`.

The crash occurs because it is not sufficient for type-checking to check for
`Differentiable` conformances. We must also check for invalid `TangentVector`
associated types.

Resolves SR-12559.
2020-04-10 02:14:02 -07:00
Dan Zheng
c142fcf6e2 [AutoDiff] Add SynthesizedFileUnit TBDGen/serialization tests.
Upstream `SynthesizedFileUnit` failing tests from TF-1239.
2020-04-08 21:22:06 -07:00
Dan Zheng
606c070e11 [SILOptimizer] Disable SILCombiner::visitPartialApplyInst for method callees.
Disable `SILCombiner::visitPartialApplyInst` from rewriting `partial_apply` with
with `@convention(method)` callee to `thin_to_thick_function`.

This fixes SIL verification errors: `thin_to_thick_function` only supports
`@convention(thin)` operands.

Resolves SR-12548.
2020-04-08 12:40:44 +00:00
Dan Zheng
f7a9eed4de [AutoDiff] Add generated implicit declarations to SynthesizedFileUnit.
Add implicit declarations generated by the differentiation transform to a
`SynthesizedFileUnit` instead of an ad-hoc pre-existing `SourceFile`.

Resolves TF-1232: type reconstruction for AutoDiff-generated declarations.

Previously, type reconstruction failed because retroactively adding declarations
to a `SourceFile` did not update name lookup caches.
2020-04-07 18:29:34 -07:00
marcrasi
15f512b81b [AutoDiff] fix SR-12493 (#30817)
We simply needed to upstream `TypeSubstCloner::visitDifferentiableFunctionExtractInst`.
The code has a detailed comment explaining what it does.
2020-04-05 19:36:10 -07:00
Dan Zheng
1308fc69c5 [AutoDiff] Simplify conditions enabling differentiable programming. (#30765)
Previously, two conditions were necessary to enable differentiable programming:
- Using the `-enable-experimental-differentiable-programming` frontend flag.
- Importing the `_Differentiation` module.

Importing the `_Differentiation` module is the true condition because it
contains the required compiler-known `Differentiable` protocol. The frontend
flag is redundant and cumbersome.

Now, the frontend flag is removed.
Importing `_Differentiation` is the only condition.
2020-04-02 03:24:03 -07:00
Dan Zheng
1cefebe227 [AutoDiff] Fix @differentiable-related override matching crash. (#29985)
Remove meaningless `assert(false)` assertion from
`hasOverridingDifferentiableAttribute` in `TypeCheckDeclOverride.cpp`.

The assertion served no purpose and can safely be removed.

Resolves TF-1167. Add test.
2020-02-21 09:29:29 -08:00