Commit Graph

15 Commits

Author SHA1 Message Date
Jaap Wijnen
bd4730fdf2 Mark Differentiation related FloatingPoint methods with @inlinable for more optimization opportunities (#78806)
Co-authored-by: Jaap Wijnen <jaap@passivelogic.com>
2025-02-20 15:03:07 -08:00
Max Desiatov
633d5bc45a Enable x86_64 and i686 ELF triples for embedded Swift (#70642)
This is just as useful for x86 bare metal as the already enabled `arm*-none-none-eabi` triples.
2024-01-26 21:39:17 +00:00
Jaap Wijnen
dfe1e691a8 [AutoDiff] Add missing vjp, jvp functions to existing FloatingPoint initializers (#70688)
Adds derivatives to already existing initializers that allow converting between floating point type. For example converting a Float to a Double.

Co-authored-by: Jaap Wijnen <jaap@passivelogic.com>
2024-01-05 13:29:04 -08:00
Anton Korobeynikov
8ddbc68f64 Add missed vjp / jvp functions for floating-point constructors (#64417)
Fixes #64406
2023-03-16 08:38:39 -07:00
Philip Turner
c74cbce95a Fix incorrect derivative (#41423) 2022-05-24 23:32:04 -07:00
Richard Wei
8bc6143a4c [AutoDiff] Rename 'move(along:)' to 'move(by:)'.
Rename `move(along:)` to `move(by:)` based on the proposal feedback. The main argument for the change is that tangent vectors specify both a direction and a magnitude, whereas `along:` does not indicate that `self` is being moved by the specified magnitude.
2021-02-23 21:45:01 -05:00
Richard Wei
e3db926e0c [AutoDiff] Remove '_Differentiable.zeroTangentVectorInitializer'. (#35329)
Remove `_Differentiable.zeroTangentVectorInitializer` to address the feedback on the [proposal thread](https://forums.swift.org/t/differentiable-programming-for-gradient-based-machine-learning/42147). The corresponding change has already been made in the [proposal](https://github.com/rxwei/swift-evolution/blob/autodiff/proposals/0000-differentiable-programming.md).

Removed components:
- `zeroTangentVectorInitializer` and `zeroTangentVector` in `Differentiable`, `Array`, `Optional`, `Float`, `Double`, `Float80`, and SIMD types.
- `zeroTangentVectorInitializer` synthesis logic in `Differentiable` derived conformances.
2021-01-20 10:45:03 -08:00
Victor Guerra
6298351ad5 [AutoDiff] Registers VJPs for FloatingPoint.[maximum|minimum] (#35379)
Resolves TF-1134.
2021-01-13 11:40:46 -08:00
Alex Efremov
83b2ebe8f1 [AutoDiff] Support forward mode differentiation of functions with inout parameters (#33584)
Adds forward mode support for `apply` instruction with `inout` arguments.

Example of supported code:
```
func add(_ x: inout Float, _ y: inout Float) -> Float {
  var result = x
  result += y
  return result
}
print(differential(at: 1, 1, in: add)(1, 1)) // prints "2"
```
2020-08-21 17:57:39 -07:00
Stephen Canon
103961a7d5 Make Float16 unavailable on macOS and macCatalyst, mirroring Xcode's Swift. (#32868)
LLVM doesn't have a stable ABI for Float16 on x86 yet; we're working with Intel to get that fixed, but we don't want to make the type available on macOS until a stable ABI is actually available, because we'd break binaries compiled before any calling convention changes if we do.
2020-07-14 20:42:12 -04:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Dan Zheng
f9c5d7ae6c [AutoDiff] Derive Differentiable.zeroTangentVectorInitializer. (#31823)
`Differentiable` conformance derivation now supports
`Differentiable.zeroTangentVectorInitializer`.

There are two potential cases:
1. Memberwise derivation: done when `TangentVector` can be initialized memberwise.
2. `{ TangentVector.zero }` derivation: done as a fallback.

`zeroTangentVectorInitializer` is a closure that produces a zero tangent vector,
capturing minimal necessary information from `self`.

It is an instance property, unlike the static property `AdditiveArithmetic.zero`,
and should be used by the differentiation transform for correctness.

Remove `Differentiable.zeroTangentVectorInitializer` dummy default implementation.

Update stdlib `Differentiable` conformances and tests.
Clean up DerivedConformanceDifferentiable.cpp cruft.

Resolves TF-1007.
Progress towards TF-1008: differentiation correctness for projection operations.
2020-05-29 01:59:52 -07:00
Dan Zheng
2c112141dd [AutoDiff upstream] Deduplicate floating-point Differentiable conformances.
Move `Differentiable` conformances out of Differentiable.swift.
All `Differentiable` conformances exist in separate files.
2020-04-08 02:49:21 -07:00
Dan Zheng
ece4fb75b0 [AutoDiff upstream] Add Float16 derivatives.
Add `@available` attributes for declarations using `Float16`.
2020-04-08 02:49:18 -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