mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Canonicalizes `differentiable_function` instructions by filling in missing derivative function operands. Derivative function emission rules, based on the original function value: - `function_ref`: look up differentiability witness with the exact or a minimal superset derivative configuration. Emit a `differentiability_witness_function` for the derivative function. - `witness_method`: emit a `witness_method` with the minimal superset derivative configuration for the derivative function. - `class_method`: emit a `class_method` with the minimal superset derivative configuration for the derivative function. If an *actual* emitted derivative function has a superset derivative configuration versus the *desired* derivative configuration, create a "subset parameters thunk" to thunk the actual derivative to the desired type. For `differentiable_function` instructions formed from curry thunk applications: clone the curry thunk (with type `(Self) -> (T, ...) -> U`) and create a new version with type `(Self) -> @differentiable (T, ...) -> U`. Progress towards TF-1211.
305 KiB
305 KiB