Commit Graph

71 Commits

Author SHA1 Message Date
Saleem Abdulrasool
6f28e54505 test: repair the Android CI after #30875
The added test was not correctly indicated as a running test.
2020-04-09 11:36:41 -07:00
Dan Zheng
65ab642b1a [AutoDiff upstream] Add Differentiable.zeroTangentVector.
Add `Differentiable.zeroTangentVectorInitializer` protocol requirement and
`Differentiable.zeroTangentVector` default implementation.
2020-04-09 11:15:18 -07:00
Dan Zheng
3f06912fd9 [AutoDiff] Enable forward-mode differentiation tests.
Resolves TF-1237 TODO comments.
2020-04-09 01:49:25 -07:00
Dan Zheng
4495f6b87d Fix tests for 32-bit platforms.
- Remove unnecessary imports from test/AutoDiff/stdlib/simd.swift.
- Use platform-correct `Builtin` integer type in
  `PullbackEmitter::getArrayAdjointElementBuffer`.
2020-04-08 19:16:00 -07:00
Dan Zheng
b6d765348d [AutoDiff upstream] Test differentiable collection higher-order functions.
Test `Array.differentiableMap(_:)` and `Array.differentiableReduce(_:_:)`.
2020-04-08 02:50:50 -07:00
Dan Zheng
d599105715 [AutoDiff upstream] Fix stdlib differentiation tests.
Temporarily disable not-yet-supported differentiation tests:

- Forward-mode differentiation.
  - TF-1237: to be upstreamed.
- `Differentiable.zeroTangentVector`.
  - TF-1238: to be upstreamed.
- `SIMD.sum` differentiation.
  - TF-1103: `@_alwaysEmitIntoClient` derivative registration.
2020-04-08 02:50:43 -07:00
Dan Zheng
e377436169 Merge branch 'master' of github.com:apple/swift into autodiff_upstream_conformances_derivatives_master 2020-04-08 02:49:17 -07:00
Dan Zheng
da36555aa5 [AutoDiff upstream] Gardening.
- Standardize filenames: `XXXDifferentiation.swift`.
  - Use Pascal or snake case consistently.
- Formatting changes.
2020-04-08 02:49:12 -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
Ewa Matejska
36cf56651f fixing up some tests and turning off SIMD extension which uses @_alwaysEmitIntoClient since that's not supported yet. 2020-04-03 12:59:47 -07:00
Ewa Matejska
f07ae89636 First pass at upstreaming Differentiable conformances and derivatives 2020-04-02 19:55:26 -07:00
Dan Zheng
c6f2d7ab0a [AutoDiff] Disable failing test with -O.
Disable test/AutoDiff/stdlib/differential_operators.swift, which currently fails
with `-O`.

SR-12493 tracks fixing the issue. Add negative test.
2020-04-02 13:06:35 -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
Marc Rasi
64d0e76dd9 improve differential operator tests 2020-03-30 14:57:59 -07:00
Richard Wei
57d228b39e [AutoDiff upstream] Add differential operators and some utilities.
* Add all [differential operators](https://github.com/apple/swift/blob/master/docs/DifferentiableProgramming.md#list-of-differential-operators).
* Add `withoutDerivative(at:)`, used for efficiently stopping the derivative propagation at a value and causing the derivative at the value to be zero.
* Add utility `differentiableFunction(from:)`, used for creating a `@differentiable` function from an original function and a derivative function.

Mostly work done by @marcrasi and @dan-zheng.
Partially resolves TF-843.

TODO:
* Add `AnyDerivative`.
* Add `Array.differentiableMap(_:)` and `differentiableReduce(_:_:)`.
2020-03-30 14:15:35 -07:00
Dan Zheng
6dd557a557 [AutoDiff] NFC: garden tests. (#30588)
Add test/AutoDiff/lit.local.cfg: run tests only when `differentiable_programming`
is enabled in lit. With this, individual tests no longer need
`REQUIRES: differentiable_programming`.

Move multi-functionality SIL tests from test/AutoDiff/SIL/Serialization to
test/AutoDiff/SIL.

Garden test filenames.
2020-03-23 15:22:27 -07:00
Karoy Lorentey
f2ed81b763 Revert "[test] Mark _Differentiable tests as unsupported in Swift-in-the-OS configurations" 2019-12-19 19:16:00 -08:00
Karoy Lorentey
216d02f84d [test] Mark _Differentiable tests as unsupported in Swift-in-the-OS configuration
The new _Differentiable module is not available in any shipping OS release, but its public API currently doesn’t have availability, either.

Temporarily disable tests that import it when we’re testing with OS-provided libraries.

The typecheck test test/AutoDiff/stdlib/differentiable_protocol.swift imports _Differentable but still somehow succeeds in these configs, so leave that one enabled.

rdar://57975086
2019-12-19 12:53:23 -08:00
Daniel Rodríguez Troitiño
a46203cf65 [android] Mark differentiable_stdlib_conformances as executable.
Android CI cannot execute tests, so tests needs to be marked as
executable to be skipped.
2019-12-12 11:07:45 -08:00
Dan Zheng
8aac6f9a1a [AutoDiff upstream] Conform floating-point types to Differentiable. (#28718)
Add `Differentiable` conformances for floating-point types to the
`_Differentiation` module. The `TangentVector` associated type for
floating-point types is `Self`.

This design adheres to the differentiable programming manifesto:
docs/DifferentiableProgramming.md.

Partially resolves TF-1052.
2019-12-11 18:43:09 -08:00
Dan Zheng
b530e87737 [AutoDiff upstream] Organize AutoDiff tests.
Move all tests into appropriate subdirectories.
`test/AutoDiff` subdirectory naming matches `test/` subdirectory name.
2019-11-16 14:55:11 -08:00