Skip to content

Added OptionalArrayRef template class#64084

Closed
heitorschueroff wants to merge 2 commits intogh/heitorschueroff/18/basefrom
gh/heitorschueroff/18/head
Closed

Added OptionalArrayRef template class#64084
heitorschueroff wants to merge 2 commits intogh/heitorschueroff/18/basefrom
gh/heitorschueroff/18/head

Conversation

@heitorschueroff
Copy link
Contributor

@heitorschueroff heitorschueroff commented Aug 27, 2021

Stack from ghstack:

closes #63645

TODO

  • add non-member functions
  • add tests
  • update codegen to map []? to OptionalArrayRef

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Aug 27, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit fdea43b (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 to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

heitorschueroff added a commit that referenced this pull request Aug 27, 2021
ghstack-source-id: abd4468
Pull Request resolved: #64084
closes #63645

**TODO**

- [ ] add non-member functions
- [ ] add tests
- [ ] update codegen to map []? to OptionalArrayRef

[ghstack-poisoned]
heitorschueroff added a commit that referenced this pull request Aug 27, 2021
ghstack-source-id: c5f3aa1
Pull Request resolved: #64084
@ezyang
Copy link
Contributor

ezyang commented Aug 30, 2021

we discussed this in person and I was hoping we could simplify the optional implementation to remove some of the unnecessary genericism. Hopefully doing this is not too high risk.

@ezyang
Copy link
Contributor

ezyang commented Aug 30, 2021

@gchanan says you can skip reimplementing all of optional by just storing an optional<ArrayRef> internally and then writing a bunch of methods that forward to the internal implementations. Much better than copy pasting!

@heitorschueroff
Copy link
Contributor Author

@gchanan says you can skip reimplementing all of optional by just storing an optional<ArrayRef> internally and then writing a bunch of methods that forward to the internal implementations. Much better than copy pasting!

That would work for now, but once we start using std::optional this solution would lose the optimization added by @swolchok in c10::optional. Moreover, the implementation of optional is quite simple, and can be made simpler since we are restricting T to ArrayRef. The complexity is in the template metaprogramming which would still be required with this proposed solution.

@ezyang
Copy link
Contributor

ezyang commented Aug 30, 2021

Oh right, the optimization. Carry on then

@facebook-github-bot
Copy link
Contributor

Hi @heitorschueroff!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

pytorchmergebot pushed a commit that referenced this pull request Mar 26, 2022
This PR uses the `OptionalArrayRef` template class that was drafted in #64084.

Fixes #44409
Pull Request resolved: #70864
Approved by: https://github.com/ezyang
facebook-github-bot pushed a commit that referenced this pull request Mar 29, 2022
Summary:
This PR uses the `OptionalArrayRef` template class that was drafted in #64084.

Fixes #44409
Pull Request resolved: #70864
Approved by: https://github.com/ezyang

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/5375b2e994ee666996a47526c7f9629e85acfc54

Reviewed By: bdhirsh

Differential Revision: D34602980

fbshipit-source-id: f920e82616c05a36fe7fc8309a787f6f62b03ad9
@github-actions
Copy link
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label Apr 13, 2022
@github-actions github-actions bot closed this May 13, 2022
@facebook-github-bot facebook-github-bot deleted the gh/heitorschueroff/18/head branch June 13, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants