Commit Graph

6 Commits

Author SHA1 Message Date
Robert Widmann
e5885871e0 Disable Flaky Compiler Crasher Test
This test appears to cause the linker to crash every so often.

rdar://86041709
2022-01-05 13:31:32 -08:00
Slava Pestov
b57be6dbf1 Revert "AutoDiff: Disable requirement machine when building or testing Differentiation library"
This reverts commit 4f6ba29715.
2021-09-23 13:24:40 -04:00
Slava Pestov
4f6ba29715 AutoDiff: Disable requirement machine when building or testing Differentiation library
The SIL type lowering logic for AutoDiff gets the substituted generic signature
mixed up with the invocation generic signature, so it tries to ask questions
about DependentMemberTypes in a signature with no requirements. This triggers
assertions when the requirement machine is enabled.

Disable the requirement machine until this is fixed.
2021-07-30 19:42:31 -04:00
Richard Wei
af8942d940 [AutoDiff] Rename '@differentiable' to '@differentiable(reverse)'.
Compiler:
- Add `Forward` and `Reverse` to `DifferentiabilityKind`.
- Expand `DifferentiabilityMask` in `ExtInfo` to 3 bits so that it now holds all 4 cases of `DifferentiabilityKind`.
- Parse `@differentiable(reverse)` and `@differentiable(_forward)` declaration attributes and type attributes.
- Emit a warning for `@differentiable` without `reverse`.
- Emit an error for `@differentiable(_forward)`.
- Rename `@differentiable(linear)` to `@differentiable(_linear)`.
- Make `@differentiable(reverse)` type lowering go through today's `@differentiable` code path. We will specialize it to reverse-mode in a follow-up patch.

ABI:
- Add `Forward` and `Reverse` to `FunctionMetadataDifferentiabilityKind`.
- Extend `TargetFunctionTypeFlags` by 1 bit to store the highest bit of differentiability kind (linear). Note that there is a 2-bit gap in `DifferentiabilityMask` which is reserved for `AsyncMask` and `ConcurrentMask`; `AsyncMask` is ABI-stable so we cannot change that.

_Differentiation module:
- Replace all occurrences of `@differentiable` with `@differentiable(reverse)`.
- Delete `_transpose(of:)`.

Resolves rdar://69980056.
2021-02-07 14:09:46 -08:00
Dan Zheng
07f632acaa [AutoDiff] NFC: document test suite. (#35194)
Add README files explaining the differentiable programming test suite.

Add lit.local.cfg files so individual tests do not need to add
`REQUIRES: asserts` in these directories:

- test/AutoDiff/compiler_crashers
- test/AutoDiff/compiler_crashers_fixed

Motivation: it is important for compiler crasher tests to require assertions
enabled, because many of these tests crash on compiler assertions.
2020-12-23 07:19:19 -05:00
Dan Zheng
2cf7d63a5e [AutoDiff] Fix ownership error in VJPCloner::visitApplyInst. (#35003)
Change the following code pattern:

```
%x1 = convert_function %x0 : $@differentiable (...) -> ...
%x2 = begin_borrow %x1
... // use %x2
%x3 = end_borrow %x2
destroy_value %x0
```

To the following:

```
%x1 = begin_borrow %x0 : $@differentiable (...) -> ...
%x2 = convert_function %x0
... // use %x2
%x3 = end_borrow %x1
destroy_value %x0
```

Resolves SR-13933: "multiple consuming users" ownership error caused by
`VJPCloner::visitApply` related to `@differentiable`-function-typed callees.

Also upstream test/AutoDiff/SILOptimizer/generics.swift from tensorflow branch.
2020-12-08 19:48:31 -05:00