Skip to content

Factored IRGenSILFunction::visitGraphOperationInst() to handle ops other than "Const". #19575

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 4 commits into from
Sep 27, 2018

Conversation

mhong
Copy link

@mhong mhong commented Sep 27, 2018

The code structure resembles TFGraphFunctionLowering::visitGraphOperationInst().

Added a new unit test based on "Add".

…her than

"Const".

Added a new unit test based on "Add".
@mhong
Copy link
Author

mhong commented Sep 27, 2018

@swift-ci please test tensorflow

@mhong mhong changed the title Factored IRGenSILFunction::visitGraphOperationInst() to handle ops ot… Factored IRGenSILFunction::visitGraphOperationInst() to handle ops other than "Const". Sep 27, 2018
Mingsheng Hong added 2 commits September 26, 2018 17:25
potential merge conflicts when we downstream code from the master branch.
@mhong mhong added the tensorflow This is for "tensorflow" branch PRs. label Sep 27, 2018
Copy link
Contributor

@lattner lattner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

Copy link
Contributor

@bgogul bgogul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -28,6 +28,8 @@
#include "swift/AST/ParameterList.h"
#include "swift/AST/Pattern.h"
#include "swift/AST/SubstitutionMap.h"
// SWIFT_ENABLE_TENSORFLOW
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification question: Why do we have #ifdefs in some places and comment in other places?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#ifdefs is intended to makes sure our branch can still be compiled without TF support. This is probably not consistently enforced though.

I'm also not sure if that's necessary. e.g. As a strategy to upstream our code, it might be sufficient to always include the TF related bits into the compiled binary, but protect the TF code path under some compiler flags. We can discuss this more outside this PR scope.

@@ -1993,54 +1994,131 @@ void IRGenSILFunction::visitGraphOperationInst(GraphOperationInst *i) {
auto eagerContext = Builder.CreateCall(getContextFn, {});

// Create a TFE op as in:
// auto* op = TFE_NewOp(ctx, "Const", status);
// auto* op = TFE_NewOp(ctx, "OpName", status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the name have to be unique?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the eager API, the op name is an op type name like "Const", not the op node name (a concept that only exists in the graph mode).

@mhong
Copy link
Author

mhong commented Sep 27, 2018

Thanks for the review!

@mhong mhong merged commit cfe5d4f into swiftlang:tensorflow Sep 27, 2018
@mhong mhong deleted the irgen_5_factored_graphop_irgen branch September 27, 2018 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tensorflow This is for "tensorflow" branch PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants