Skip to content
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

Allocate a big output tensor and split in group_index_select_dim0_backward #1764

Closed
wants to merge 1 commit into from

Conversation

sryap
Copy link
Contributor

@sryap sryap commented May 12, 2023

Summary:
Before this diff, group_index_select_dim0 backward calls at::zeros
group_size number of times which launches group_size elementwise
kernels. Since group_size can be a large value (up to 55), this can
be costly.

This diff fixes the problem by allocating one big tensor and splitting
it into smaller tensors. This will launch only one elementwise kernel
per group. However, this can cause higher overhead on the host side.

Differential Revision: D45823864

@netlify
Copy link

netlify bot commented May 12, 2023

Deploy Preview for pytorch-fbgemm-docs canceled.

Name Link
🔨 Latest commit 1f93c20
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/649214286985e6000832b72d

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45823864

sryap added a commit to sryap/FBGEMM that referenced this pull request Jun 20, 2023
…kward (pytorch#1764)

Summary:
Pull Request resolved: pytorch#1764

Before this diff, `group_index_select_dim0` backward calls `at::zeros`
`group_size` number of times which launches `group_size` elementwise
kernels.  Since `group_size` can be a large value (up to 55), this can
be costly.

This diff fixes the problem by allocating one big tensor and splitting
it into smaller tensors.  This will launch only one elementwise kernel
per group.  However, this can cause higher overhead on the host side.

Reviewed By: jspark1105

Differential Revision: D45823864

fbshipit-source-id: 83832fede9085ff5829f06e7621dfee8621a3e06
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45823864

sryap added a commit to sryap/FBGEMM that referenced this pull request Jun 20, 2023
…kward (pytorch#1764)

Summary:
Pull Request resolved: pytorch#1764

Before this diff, `group_index_select_dim0` backward calls `at::zeros`
`group_size` number of times which launches `group_size` elementwise
kernels.  Since `group_size` can be a large value (up to 55), this can
be costly.

This diff fixes the problem by allocating one big tensor and splitting
it into smaller tensors.  This will launch only one elementwise kernel
per group.  However, this can cause higher overhead on the host side.

Reviewed By: jspark1105

Differential Revision: D45823864

fbshipit-source-id: 92939fbd3801c599c475f45609c55dcc23cedbfc
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45823864

…kward (pytorch#1764)

Summary:
Pull Request resolved: pytorch#1764

Before this diff, `group_index_select_dim0` backward calls `at::zeros`
`group_size` number of times which launches `group_size` elementwise
kernels.  Since `group_size` can be a large value (up to 55), this can
be costly.

This diff fixes the problem by allocating one big tensor and splitting
it into smaller tensors.  This will launch only one elementwise kernel
per group.  However, this can cause higher overhead on the host side.

Reviewed By: jspark1105

Differential Revision: D45823864

fbshipit-source-id: c44dd60e4707ec25ba9d4d667cdc1a0ef17566ea
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45823864

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 0185ac7.

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.

2 participants