Commit Graph

3 Commits

Author SHA1 Message Date
Dan Zheng
df830bc120 [AutoDiff] NFC: Reimplement VJPCloner using pimpl pattern.
`VJPCloner.h` is now tiny: `VJPCloner` exposes only a `bool run()` entry point.

All of the implementation is moved to `VJPCloner::Implementation` in
`VJPCloner.cpp`. Methods can be defined directly in `VJPCloner.cpp` without
separate declarations.
2020-07-10 13:16:44 -07:00
Dan Zheng
7fccbadce4 [AutoDiff] NFC: Reimplement PullbackCloner using pimpl pattern. (#32778)
Reimplement `PullbackCloner` using the pointer-to-implementation pattern.

`PullbackCloner.h` is now tiny: `PullbackCloner` exposes only a `bool run()`
entry point.

All of the implementation is moved to `PullbackCloner::Implementation` in
`PullbackCloner.cpp`.

Benefits of this approach:

- A main benefit is that methods can be defined directly in `PullbackCloner.cpp`
  without needing to separately declare them in `PullbackCloner.h`.
  - There is now no code duplication between `PullbackCloner.h` and
    `PullbackCloner.cpp`.
  - Consequently, method documentation is easier to read because it appears
    directly on method definitions, instead of on method declarations in a
    separate file. This is important for documentation of `PullbackCloner`
    instruction visitor methods, which explain pullback transformation rules.
- Incremental recompilation may be faster since `PullbackCloner.h` changes less
  often.

Partially resolves SR-13182.
2020-07-09 07:18:14 -07:00
Dan Zheng
ec5da7427b [AutoDiff] NFC: garden differentiation transform. (#32770)
Rename "emitters" to "cloners", for consistency:
- `JVPEmitter` -> `JVPCloner`
- `VJPEmitter` -> `VJPCloner`
- `PullbackEmitter` -> `PullbackCloner`

Improve `PullbackCloner` documentation.
- Document previously undocumented methods.
- Update outdated documentation.
  - For adjoint value accumulation helpers: rename "buffer access" occurrences to
    "address". Pullback generation no logner uses buffer accesses (`begin_apply`).
2020-07-08 19:26:36 -07:00