Skip to content

[GLUTEN-10933][VL] Support resize GPU batch and shuffle reader outputs cudf::table#11090

Merged
jinchengchenghh merged 3 commits into
apache:mainfrom
jinchengchenghh:shuffleup
Nov 25, 2025
Merged

[GLUTEN-10933][VL] Support resize GPU batch and shuffle reader outputs cudf::table#11090
jinchengchenghh merged 3 commits into
apache:mainfrom
jinchengchenghh:shuffleup

Conversation

@jinchengchenghh

@jinchengchenghh jinchengchenghh commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

Now in the post rule, we can only get the stage level plan, so we cannot decide if the ColumnarExchange output should be cudf format, currently, we suppose the ColumnarExchange is always CudfColumnarExchange, will support validation in injectQueryStagePrepRule where we can see the total plan, generated the transformed plan and validate it, then discard it.
After CudfColumnarExchange, concat the batches in GpuResizeBufferColumnarBatchExec to output cudf::table with batch size maximum integer, velox-cudf does not control the batch size now. So the CPU shuffle reader does the decompression and prepare the first batch while GPU executes the CPU tasks one by one.
Performance:
After this change, the stage 2 in TPCDS Q95 SF100 time decreases from 27s to 13s.

In the shuffle writer, split the bool to byte, and timestamp to nanoseconds int64_t to match the cudf format.
Now BroadcastExchange outputs RowVector, so the CudfFromVeclox operator should accept RowVector and CudfVector with this commit, oap-project/velox@3d6ab40

Also fix the Gluten build with GPU.

Related issue: #10933

@github-actions github-actions Bot added CORE works for Gluten Core VELOX labels Nov 14, 2025
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

2 similar comments
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions github-actions Bot added the INFRA label Nov 14, 2025
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions github-actions Bot added the BUILD label Nov 14, 2025
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

Comment thread cpp/velox/utils/GpuBufferBatchResizer.cc Outdated
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

2 similar comments
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

2 similar comments
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@jinchengchenghh jinchengchenghh changed the title [GLUTEN-10933][VL] Support resize GPU batch [GLUTEN-10933][VL] Support resize GPU batch and shuffle reader outputs cudf::table Nov 17, 2025
@jinchengchenghh

Copy link
Copy Markdown
Contributor Author

Could you help review this PR? Thanks! @marin-ma @zhztheplayer

@marin-ma marin-ma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just left some comments. Thanks!

@@ -171,6 +171,17 @@ class ColumnarShuffleWriter[K, V](
conf.get(SHUFFLE_SORT_USE_RADIXSORT),
partitionWriterHandle
)
} else if (dep.shuffleWriterType == GpuHashShuffleWriterType) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: use if(dep.shuffleWriterType == SortShuffleWriterType) in the condition branch above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you mean change the L162? This looks like not related to this PR?

Comment thread cpp/velox/shuffle/VeloxShuffleWriter.cc Outdated
@@ -20,6 +20,10 @@
#include "shuffle/VeloxRssSortShuffleWriter.h"
#include "shuffle/VeloxSortShuffleWriter.h"

#ifdef GLUTEN_ENABLE_GPU
#include "GpuShuffleWriter.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: #include "shuffle/GpuShuffleWriter.h"

Should we name it as VeloxGpuShuffleWriter to align the naming with the existing shuffle writer types?

Comment thread cpp/velox/shuffle/GpuShuffleWriter.cc Outdated
* limitations under the License.
*/

#include "GpuShuffleWriter.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto


#pragma once

#include "VeloxHashShuffleWriter.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto


namespace gluten {

class GpuBufferBatchResizer : public ColumnarBatchIterator {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice to have some cpp unit test for the functionality of this class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

1 similar comment
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@zhouyuan

Copy link
Copy Markdown
Member

Run Gluten ClickHouse CI on X86

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

1 similar comment
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

2 similar comments
@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@github-actions

Copy link
Copy Markdown

Run Gluten ClickHouse CI on ARM

@jinchengchenghh

Copy link
Copy Markdown
Contributor Author

Do you have further comments? @marin-ma

@jinchengchenghh

Copy link
Copy Markdown
Contributor Author

Run Gluten ClickHouse CI on X86

@marin-ma marin-ma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

BackendsApiManager.getSparkPlanExecApiInstance.getShuffleWriterType(outputPartitioning, output)
lazy val shuffleWriterType: ShuffleWriterType = getShuffleWriterType

// super.stringArgs ++ Iterator(output.map(o => s"${o}#${o.dataType.simpleString}"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like an outdated comment. Could you remove?

@jinchengchenghh jinchengchenghh merged commit 157b96e into apache:main Nov 25, 2025
105 of 109 checks passed
jinchengchenghh added a commit to jinchengchenghh/gluten that referenced this pull request Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants