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

Reduce indices buffer memory usage in LocalPartition #7939

Closed
wants to merge 1 commit into from

Conversation

Yuhta
Copy link
Contributor

@Yuhta Yuhta commented Dec 8, 2023

Summary: In the current code, if we partition N rows with M columns to K partitions, we allocate a buffer of N indices for each partitioned output M columns, so the total memory for these indices is $O(NMK)$. In this change we reduce this to $O(NM)$ by allocating the indices for each partition with the number of rows in that partition only.

Differential Revision: D51984975

Copy link

netlify bot commented Dec 8, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 0470e54
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6573672e48f7f9000885323a

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 8, 2023
@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@Yuhta nice optimization. Thanks!

@@ -331,10 +330,14 @@ void LocalPartition::addInput(RowVectorPtr input) {
}

auto numInput = input->size();
Copy link
Contributor

Choose a reason for hiding this comment

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

NYC: const auto numInput =

…or#7939)

Summary:

In the current code, if we partition N rows with M columns to K partitions, we allocate a buffer of N indices for each partitioned output M columns, so the total memory for these indices is $`O(NMK)`$.  In this change we reduce this to $`O(NM)`$ by allocating the indices for each partition with the number of rows in that partition only.

Reviewed By: xiaoxmeng

Differential Revision: D51984975
@facebook-github-bot
Copy link
Contributor

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

1 similar comment
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 4f95700.

Copy link

Conbench analyzed the 1 benchmark run on commit 4f95700a.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants