Skip to content

Conversation

@peterbell10
Copy link
Collaborator

@peterbell10 peterbell10 commented Aug 13, 2020

Stack from ghstack:

Differential Revision: D23751851

@dr-ci
Copy link

dr-ci bot commented Aug 13, 2020

💊 CI failures summary and remediations

As of commit cb144dd (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 32 times.

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Aug 13, 2020
@peterbell10 peterbell10 requested a review from mruberry August 13, 2020 14:56
peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Aug 13, 2020
@mruberry mruberry requested review from bhosmer and removed request for apaszke and mruberry August 13, 2020 17:05
@gchanan gchanan added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 13, 2020
Copy link

@bhosmer bhosmer left a comment

Choose a reason for hiding this comment

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

Looks good! Need to teach codegen in one more place (noted inline) and then I think you're good to go.

elif t == 'str':
t = 'std::string'
elif t == 'str?':
t = 'std::string?'
Copy link

Choose a reason for hiding this comment

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

I think you'll need to add the inverse conversion here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, added.

Copy link

@bhosmer bhosmer left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Aug 20, 2020
peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Aug 20, 2020
'int64_t': '{}.toInt()',
'int64_t?': '{}.toOptional<int64_t>()',
'std::string': '{}.toStringRef()',
'std::string?': '{}.toOptional<std::string>()',
Copy link
Contributor

Choose a reason for hiding this comment

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

Following the mapping for std::string, I think it should be'std::string?': '{}.toOptionalStringRef()'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After some experimenting, I think that would require the C++ signature of native functions be changed from c10::optional<std::string> to c10::optional<std::reference_wrapper<const std::string>> which I think is really ugly.

A nicer way to avoid the copy would be to change from std::string to c10::string_view everywhere, in which case we don't need the reference_wrapper.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But I figure the copy is okay since std::string functions will take a copy currently anyway. So I think a string_view conversion could be left for a separate PR.

TORCH_API void addInputs(
Node* n,
const char* name,
const c10::optional<std::string>& value);
Copy link
Contributor

Choose a reason for hiding this comment

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

const c10::optional<std::reference_wrapper<const std::string>> value

inline c10::optional<at::MemoryFormat> memoryformatOptional(int i);
inline at::QScheme toQScheme(int i);
inline std::string string(int i);
inline c10::optional<std::string> stringOptional(int i);
Copy link
Contributor

Choose a reason for hiding this comment

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

inline c10::optional<std::reference_wrapper<const std::string>> stringOptional(int i);

return THPUtils_unpackString(args[i]);
}

inline c10::optional<std::string> PythonArgs::stringOptional(int i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

inline c10::optional<std::reference_wrapper<const std::string>> PythonArgs::stringOptional(int i) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would cause a dangling reference.

@codecov
Copy link

codecov bot commented Aug 31, 2020

Codecov Report

Merging #43010 into gh/peterbell10/2/base will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@                    Coverage Diff                    @@
##           gh/peterbell10/2/base   #43010      +/-   ##
=========================================================
- Coverage                  67.94%   67.94%   -0.01%     
=========================================================
  Files                        384      384              
  Lines                      49743    49743              
=========================================================
- Hits                       33799    33798       -1     
- Misses                     15944    15945       +1     
Impacted Files Coverage Δ
torch/utils/_benchmark/utils/common.py 77.68% <0.00%> (-1.66%) ⬇️
torch/testing/_internal/expecttest.py 78.57% <0.00%> (+1.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64ae7e0...cb144dd. Read the comment docs.

peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Sep 9, 2020
peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Sep 15, 2020
@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in fd4e21c.

peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Sep 19, 2020
@facebook-github-bot facebook-github-bot deleted the gh/peterbell10/2/head branch September 22, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants