Skip to content

Conversation

@marcrasi
Copy link

These fixes make everything compile, and all the test pass.

I'll add github comments in the PR explaining the reasons for some of the changes.

(Note that this PR is into a tensorflow-rebase branch, not into tensorflow, so I'll need to do one final step of moving tensorflow-rebase into tensorflow after I land this PR).

@marcrasi marcrasi added the tensorflow This is for "tensorflow" branch PRs. label Jun 14, 2018
Copy link
Author

Choose a reason for hiding this comment

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

I moved these checks into the shouldInlinePredicate function, so that we can have different checks for TF and for non-TF inlining.

This is probably not the most correct solution, but it makes all the tests pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

If TF mandatory inlining needs to inline non-transaprent functions, please update the SIL linker in lib/SIL/Linker.cpp and lib/SILOptimizer/UtilityPasses/Link.cpp.

Copy link
Contributor

Choose a reason for hiding this comment

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

@slavapestov we should probably do that in a follow-on patch. As of yet, we don't have an attribute to guide that inlining decision. It is guided by structural concerns, so it may be more difficult for us to do. We may have to introduce an attribute for this concept (probably should have long ago).

@marcrasi can you please file a jira to track this for resolution after the merge?

Copy link
Author

Choose a reason for hiding this comment

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

Done: https://bugs.swift.org/browse/SR-8015

I'll also add a todo in the code here referencing the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: would you mind reordering these to be in the original order?

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Author

Choose a reason for hiding this comment

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

I pointed these at my forks of the repos, because I don't have commit access to the original repos yet. I'll point these back to the original repos before I merge this PR.

Copy link
Author

Choose a reason for hiding this comment

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

I am guessing that these differences are caused by the switch to guaranteed calling, but could someone confirm that this is correct?

Copy link

Choose a reason for hiding this comment

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

Can you provide the full SIL code?

Copy link
Author

Choose a reason for hiding this comment

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

here's the SIL for the TFPartition Host Result for this function: https://gist.github.com/marcrasi/b2fdaeb542b9b9d307bb49efe14e1406

I also included the TFPartition Host Result for the function that I changed in retain_release.swift, in case you want to look at that.

Copy link

Choose a reason for hiding this comment

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

Looks good. Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

Same.

Copy link

Choose a reason for hiding this comment

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

Yes this should be fine as it's add and removing the same # retain/release insts.

Copy link
Author

Choose a reason for hiding this comment

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

I cherry-picked this change from master, because it makes a failing test pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1!

Copy link
Author

Choose a reason for hiding this comment

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

This is just part of the cherry-picked change that I mention above.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think "noNestedConflict" is what's in the function signature.

Copy link
Author

Choose a reason for hiding this comment

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

done (all of them)

Copy link
Contributor

Choose a reason for hiding this comment

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

"noNestedConflict"

Copy link
Contributor

Choose a reason for hiding this comment

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

"noNestedConflict"

Copy link
Contributor

Choose a reason for hiding this comment

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

"noNestedConflict"

Copy link

@mhong mhong left a comment

Choose a reason for hiding this comment

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

Changes in TFUtilities.cpp and TFPartition.cpp look good.

There's one unit test change that I commented out, and can look at more when you provide the full SIL code.

Copy link

Choose a reason for hiding this comment

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

Can you provide the full SIL code?

Copy link

Choose a reason for hiding this comment

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

a heads-up that i've seen piper behave differently in this regard. one option is to replace with {{.*}}

Copy link
Author

Choose a reason for hiding this comment

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

FileCheck doesn't require that a CHECK matches the entire line, so it should already work no matter what stuff appears in front.

Copy link

Choose a reason for hiding this comment

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

You are right.

Copy link

Choose a reason for hiding this comment

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

Yes this should be fine as it's add and removing the same # retain/release insts.

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.

LGTM with minor formatting changes, thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

+1!

Copy link
Contributor

Choose a reason for hiding this comment

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

@slavapestov we should probably do that in a follow-on patch. As of yet, we don't have an attribute to guide that inlining decision. It is guided by structural concerns, so it may be more difficult for us to do. We may have to introduce an attribute for this concept (probably should have long ago).

@marcrasi can you please file a jira to track this for resolution after the merge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Plz wrap after the && to fit in 80 cols.

Copy link
Contributor

Choose a reason for hiding this comment

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

Plz indent by 2.

Copy link
Contributor

Choose a reason for hiding this comment

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

This " Only defined when usesTFEagerAPI == false." comment should be removed.

@marcrasi marcrasi force-pushed the fix-rebase-problems branch 3 times, most recently from 0fef0df to 9d6175b Compare June 18, 2018 19:07
Includes cherry-pick of d093879 to fix a test.
@marcrasi marcrasi force-pushed the fix-rebase-problems branch from 9d6175b to 70b3804 Compare June 18, 2018 19:43
@marcrasi marcrasi merged commit 13f448c into swiftlang:tensorflow-rebase Jun 18, 2018
marcrasi added a commit that referenced this pull request Jun 22, 2018
Includes cherry-pick of d093879 to fix a test.

These fixes make everything compile, and all the test pass.
marcrasi added a commit that referenced this pull request Jun 28, 2018
Includes cherry-pick of d093879 to fix a test.

These fixes make everything compile, and all the test pass.
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.

6 participants