KEMBAR78
Allocate a big output tensor and split in group_index_select_dim0_backward by sryap · Pull Request #1764 · pytorch/FBGEMM · GitHub
Skip to content

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
@sryap sryap force-pushed the export-D45823864 branch from e477fe9 to 3180bdc Compare June 20, 2023 20:41
@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
@sryap sryap force-pushed the export-D45823864 branch from 3180bdc to 1fc2382 Compare June 20, 2023 20:56
@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
@sryap sryap force-pushed the export-D45823864 branch from 1fc2382 to 1f93c20 Compare June 20, 2023 21:03
@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