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 memory usage in aggregate.scala #6859

Merged
merged 3 commits into from
Oct 20, 2022

Conversation

abellina
Copy link
Collaborator

Signed-off-by: Alessandro Bellina abellina@nvidia.com

This PR contributes to #6758. It reduces the amount of outstanding memory by un-nesting withResource usage in a few key places where memory was being kept alive unnecessarily.

Signed-off-by: Alessandro Bellina <abellina@nvidia.com>
@abellina abellina self-assigned this Oct 19, 2022
@abellina abellina added the reliability Features to improve reliability or bugs that severly impact the reliability of the plugin label Oct 19, 2022
Copy link
Collaborator

@revans2 revans2 left a comment

Choose a reason for hiding this comment

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

Just a few nits. Looks good though.

val isLastInputBatch = GpuColumnVector.isTaggedAsFinalBatch(childBatch)
val aggBatch = computeAggregateAndClose(childBatch, aggHelper)

val spillableBatch = withResource(aggBatch) { _ =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why not just combine these two lines?

val spillableBatch = withResource(computeAggregateAndClose(childBatch, aggHelper)) { aggBatch =>


// a post-processing step required in some scenarios, casting or picking
// apart a struct
helper.postProcess(aggregated)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It feels rather inconsistent that postProcess closes the aggregated batch, but preProcess does not. This is not new, but it might be nice to rename postProcess to indicate that it closes the batch.

Copy link
Collaborator Author

@abellina abellina Oct 19, 2022

Choose a reason for hiding this comment

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

made neither close the batch, so the names stay the same. Please see cbbbf6b.

@abellina
Copy link
Collaborator Author

build

@abellina
Copy link
Collaborator Author

This PR failed on this unrelated issue: #6865

@abellina
Copy link
Collaborator Author

build

@abellina abellina merged commit 81f3563 into NVIDIA:branch-22.12 Oct 20, 2022
@abellina abellina deleted the oom/aggregate_unnest branch October 20, 2022 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reliability Features to improve reliability or bugs that severly impact the reliability of the plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants