Skip to content

Remove Backend -> THPLayout mapping.#37527

Closed
gchanan wants to merge 2 commits intogh/gchanan/255/basefrom
gh/gchanan/255/head
Closed

Remove Backend -> THPLayout mapping.#37527
gchanan wants to merge 2 commits intogh/gchanan/255/basefrom
gh/gchanan/255/head

Conversation

@gchanan
Copy link
Copy Markdown
Contributor

@gchanan gchanan commented Apr 29, 2020

Stack from ghstack:

This is yet another place that needs to be updated for adding a new "Backend" and is unnecessary. Instead, just use layout_from_backend and have a map from Layout -> THPLayout.

Other changes:

  • rename torch::getDtype and torch::getLayout to torch::getTHPDtype and torch::getTHPLayout since e.g. for layout you are both passing in and returning a "layout" type.
  • add NumOptions to Layout to match the dtype/ScalarType formulation.

Differential Revision: D21309836

This is yet another place that needs to be updated for adding a new "Backend" and is unnecessary.  Instead, just use layout_from_backend and have a map from Layout -> THPLayout.

Other changes:
- rename torch::getDtype and torch::getLayout to torch::getTHPDtype and torch::getTHPLayout since e.g. for layout you are both passing in and returning a "layout" type.
- add NumOptions to Layout to match the dtype/ScalarType formulation.

[ghstack-poisoned]
@gchanan gchanan requested review from albanD and apaszke as code owners April 29, 2020 20:12
@gchanan gchanan requested review from bhosmer and ezyang April 29, 2020 20:13
@gchanan
Copy link
Copy Markdown
Contributor Author

gchanan commented Apr 29, 2020

See #37378 for an example where a third party needed to update this.

This is yet another place that needs to be updated for adding a new "Backend" and is unnecessary.  Instead, just use layout_from_backend and have a map from Layout -> THPLayout.

Other changes:
- rename torch::getDtype and torch::getLayout to torch::getTHPDtype and torch::getTHPLayout since e.g. for layout you are both passing in and returning a "layout" type.
- add NumOptions to Layout to match the dtype/ScalarType formulation.

Differential Revision: [D21309836](https://our.internmc.facebook.com/intern/diff/D21309836)

[ghstack-poisoned]
gchanan added a commit that referenced this pull request Apr 29, 2020
This is yet another place that needs to be updated for adding a new "Backend" and is unnecessary.  Instead, just use layout_from_backend and have a map from Layout -> THPLayout.

Other changes:
- rename torch::getDtype and torch::getLayout to torch::getTHPDtype and torch::getTHPLayout since e.g. for layout you are both passing in and returning a "layout" type.
- add NumOptions to Layout to match the dtype/ScalarType formulation.

ghstack-source-id: 11630ff
Pull Request resolved: #37527
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Apr 29, 2020

💊 Build failures summary and remediations

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


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


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.

See how this bot performed.

This comment has been revised 2 times.

Copy link
Copy Markdown

@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.

Ahahaha I was gonna flag the old comment :)

Nice! I'm assuming layout_from_backend must line up properly or nothing would work...

@gchanan
Copy link
Copy Markdown
Contributor Author

gchanan commented Apr 29, 2020

Nice! I'm assuming layout_from_backend must line up properly or nothing would work...

That list isn't actually comprehensive, but I'm not sure any of the lists actually are...
We really need to combine these lists into a canonical place that is accurate.

But in this case, the only code path that uses layout_from_backend is code for legacy constructors like torch.FloatTensor -- so it doesn't actually need to be comprehensive.

@facebook-github-bot facebook-github-bot deleted the gh/gchanan/255/head branch May 31, 2020 14:16
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#37527

This is yet another place that needs to be updated for adding a new "Backend" and is unnecessary.  Instead, just use layout_from_backend and have a map from Layout -> THPLayout.

Other changes:
- rename torch::getDtype and torch::getLayout to torch::getTHPDtype and torch::getTHPLayout since e.g. for layout you are both passing in and returning a "layout" type.
- add NumOptions to Layout to match the dtype/ScalarType formulation.

Test Plan: Imported from OSS

Differential Revision: D21309836

Pulled By: gchanan

fbshipit-source-id: ede0e4f3bf7ff2cd04a9b17df020f0d4fd654ba3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants