Improve hstack lowering - #22353
Merged
Merged
Conversation
3 tasks
Matt711
approved these changes
May 4, 2026
Matt711
left a comment
Member
There was a problem hiding this comment.
Looks good one nitpick. And I think we can write a test here.
Contributor
Author
So, I'm not entirely sure if a new test makes sense. |
…to improve-hstack-lowering
…to improve-hstack-lowering
…to improve-hstack-lowering
Contributor
Author
|
/merge |
galipremsagar
pushed a commit
to galipremsagar/cudf
that referenced
this pull request
May 6, 2026
- This is a follow-up to NVIDIA#21796 - This (hopefully) simplifies some code in NVIDIA#22191 **Problem statement**: We currently translate `HStack` nodes with non-pointwise expressions to the equivalent `Select` node at lowering time. This is because all our non-pointwise `Expr`-decomposition logic is specific to `Select`. Before this PR, this translation was skipped whenever the underlying `HStack` was completely overwriting it's original columns. The problem with this case is that we loose "anchor" columns that tell the `Select` how to broadcast scalar-aggregation results. **Proposed solution**: We add a temporary "anchor" column to the translated `HStack` so that broadcasting works correctly in the `Select` node. **Motivation**: - We can handle all `over()` expression decomposition within `Select` if we know **all** non-pointwise HStack operations are lowered to `Select` anyway. - We don't "fall back" for other non-`over` `HStack` corner cases either. Authors: - Richard (Rick) Zamora (https://github.com/rjzamora) Approvers: - Matthew Murray (https://github.com/Matt711) URL: NVIDIA#22353
shrshi
pushed a commit
to shrshi/cudf
that referenced
this pull request
May 12, 2026
- This is a follow-up to NVIDIA#21796 - This (hopefully) simplifies some code in NVIDIA#22191 **Problem statement**: We currently translate `HStack` nodes with non-pointwise expressions to the equivalent `Select` node at lowering time. This is because all our non-pointwise `Expr`-decomposition logic is specific to `Select`. Before this PR, this translation was skipped whenever the underlying `HStack` was completely overwriting it's original columns. The problem with this case is that we loose "anchor" columns that tell the `Select` how to broadcast scalar-aggregation results. **Proposed solution**: We add a temporary "anchor" column to the translated `HStack` so that broadcasting works correctly in the `Select` node. **Motivation**: - We can handle all `over()` expression decomposition within `Select` if we know **all** non-pointwise HStack operations are lowered to `Select` anyway. - We don't "fall back" for other non-`over` `HStack` corner cases either. Authors: - Richard (Rick) Zamora (https://github.com/rjzamora) Approvers: - Matthew Murray (https://github.com/Matt711) URL: NVIDIA#22353
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem statement: We currently translate
HStacknodes with non-pointwise expressions to the equivalentSelectnode at lowering time. This is because all our non-pointwiseExpr-decomposition logic is specific toSelect. Before this PR, this translation was skipped whenever the underlyingHStackwas completely overwriting it's original columns. The problem with this case is that we loose "anchor" columns that tell theSelecthow to broadcast scalar-aggregation results.Proposed solution: We add a temporary "anchor" column to the translated
HStackso that broadcasting works correctly in theSelectnode.Motivation:
over()expression decomposition withinSelectif we know all non-pointwise HStack operations are lowered toSelectanyway.overHStackcorner cases either.Checklist