Skip to content

Commit 0f75bff

Browse files
Update docs/DifferentiableProgrammingImplementation.md
Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent e19cdc2 commit 0f75bff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/DifferentiableProgrammingImplementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ In the Swift compiler, we have a class called [`JVPEmitter`](https://github.com/
472472

473473
One important note is that in the JVP, we visit every single instruction in the original function - sometimes it’s an exact copy, and other times there is some special logic we wrote to handle it differently (e.g. like control-flow discussed below). This is so that the JVP function behaves just like the original function. With this, if the original function has a print statement, the JVP will as well. However, when we consider the differential, we will only transform SIL instructions from the original that we deem to be fit (so no print statement in the differential!). These instructions are those that should be differentiated, which uses the activity analysis calculated earlier to determine which SIL instructions are important in computing the tangent values of a function.
474474

475-
In Swift code, the generated differential function can be written as a closure, capturing the callee differentials from the JVP. But in SIL, all functions are top-level; closures are represented as top-level functions with captured values as an explicit argument. This requires a differential struct which will be discussed in the next section. What’s important here is that the `JVPEmitter` emits code both in a top level JVP function, but also a corresponding top level differential function.
475+
In Swift code, the generated differential function can be written as a closure, capturing the "callee differentials" from the JVP. But in SIL, all functions are top-level; closures are represented as top-level functions with captured values as an explicit argument. This requires a differential struct which will be discussed in the next section. What’s important here is that the `JVPCloner` emits code both in a top level JVP function, but also a corresponding top level differential function.
476476

477477
Here is what the more accurate, closure-free SIL pseudocode looks like:
478478

0 commit comments

Comments
 (0)