Skip to content

[AutoDiff] NFC: garden differentiation transform. #32770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- JVPEmitter.h - JVP Generation in Differentiation -----*- C++ -*---===//
//===--- JVPCloner.h - JVP function generation ----------------*- C++ -*---===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -15,8 +15,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_JVPEMITTER_H
#define SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_JVPEMITTER_H
#ifndef SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_JVPCLONER_H
#define SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_JVPCLONER_H

#include "swift/SILOptimizer/Differentiation/AdjointValue.h"
#include "swift/SILOptimizer/Differentiation/DifferentiationInvoker.h"
Expand All @@ -40,8 +40,8 @@ namespace autodiff {

class ADContext;

class JVPEmitter final
: public TypeSubstCloner<JVPEmitter, SILOptFunctionBuilder> {
class JVPCloner final
: public TypeSubstCloner<JVPCloner, SILOptFunctionBuilder> {
private:
/// The global context.
ADContext &context;
Expand Down Expand Up @@ -368,9 +368,9 @@ class JVPEmitter final
void prepareForDifferentialGeneration();

public:
explicit JVPEmitter(ADContext &context, SILFunction *original,
SILDifferentiabilityWitness *witness, SILFunction *jvp,
DifferentiationInvoker invoker);
explicit JVPCloner(ADContext &context, SILFunction *original,
SILDifferentiabilityWitness *witness, SILFunction *jvp,
DifferentiationInvoker invoker);

static SILFunction *
createEmptyDifferential(ADContext &context,
Expand Down Expand Up @@ -411,4 +411,4 @@ class JVPEmitter final
} // end namespace autodiff
} // end namespace swift

#endif // SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPEMITTER_H
#endif // SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_JVPCLONER_H

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- VJPEmitter.h - VJP Generation in differentiation -----*- C++ -*---===//
//===--- VJPCloner.h - VJP function generation ----------------*- C++ -*---===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -15,8 +15,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPEMITTER_H
#define SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPEMITTER_H
#ifndef SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPCLONER_H
#define SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPCLONER_H

#include "swift/SILOptimizer/Analysis/DifferentiableActivityAnalysis.h"
#include "swift/SILOptimizer/Differentiation/DifferentiationInvoker.h"
Expand All @@ -35,11 +35,11 @@ class SILInstruction;
namespace autodiff {

class ADContext;
class PullbackEmitter;
class PullbackCloner;

class VJPEmitter final
: public TypeSubstCloner<VJPEmitter, SILOptFunctionBuilder> {
friend class PullbackEmitter;
class VJPCloner final
: public TypeSubstCloner<VJPCloner, SILOptFunctionBuilder> {
friend class PullbackCloner;

private:
/// The global context.
Expand Down Expand Up @@ -90,9 +90,9 @@ class VJPEmitter final
SILAutoDiffIndices indices, SILFunction *vjp);

public:
explicit VJPEmitter(ADContext &context, SILFunction *original,
SILDifferentiabilityWitness *witness, SILFunction *vjp,
DifferentiationInvoker invoker);
explicit VJPCloner(ADContext &context, SILFunction *original,
SILDifferentiabilityWitness *witness, SILFunction *vjp,
DifferentiationInvoker invoker);

SILFunction *createEmptyPullback();

Expand Down Expand Up @@ -170,4 +170,4 @@ class VJPEmitter final
} // end namespace autodiff
} // end namespace swift

#endif // SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPEMITTER_H
#endif // SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_VJPCLONER_H
6 changes: 3 additions & 3 deletions lib/SILOptimizer/Differentiation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ target_sources(swiftSILOptimizer PRIVATE
ADContext.cpp
Common.cpp
DifferentiationInvoker.cpp
JVPEmitter.cpp
JVPCloner.cpp
LinearMapInfo.cpp
PullbackEmitter.cpp
PullbackCloner.cpp
Thunk.cpp
VJPEmitter.cpp)
VJPCloner.cpp)
Loading