mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
18 lines
765 B
Swift
18 lines
765 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend %s -emit-module -parse-as-library -o %t
|
|
// RUN: llvm-bcanalyzer %t/differentiable_function.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER
|
|
// RUN: %target-sil-opt -disable-sil-linking -enable-sil-verify-all %t/differentiable_function.swiftmodule -o - | %FileCheck %s
|
|
|
|
// BCANALYZER-NOT: UnknownCode
|
|
|
|
import _Differentiation
|
|
|
|
func a(_ f: @differentiable (Float) -> Float) {}
|
|
// CHECK: func a(_ f: @differentiable (Float) -> Float)
|
|
|
|
func b(_ f: @differentiable(linear) (Float) -> Float) {}
|
|
// CHECK: func b(_ f: @differentiable(linear) (Float) -> Float)
|
|
|
|
func c(_ f: @differentiable (Float, @noDerivative Float) -> Float) {}
|
|
// CHECK: func c(_ f: @differentiable (Float, @noDerivative Float) -> Float)
|