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

Fix a test error related to SerializedTableColumn #6

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ class GpuTransitionOverrides extends Rule[SparkPlan] {
ProjectExec(exprs, c2r)
}.getOrElse(c2r)
p.withNewChildren(Array(newChild))
case exec: GpuShuffleExchangeExecBase =>
addPostShuffleCoalesce(
exec.withNewChildren(Seq(optimizeGpuPlanTransitions(exec.child))))
case p =>
p.withNewChildren(p.children.map(optimizeGpuPlanTransitions))
}
Expand Down Expand Up @@ -515,6 +512,24 @@ class GpuTransitionOverrides extends Rule[SparkPlan] {
p.withNewChildren(p.children.map(c => insertCoalesce(c, shouldDisable)))
}

/**
* Inserts a shuffle coalesce after every shuffle to coalesce the serialized tables
* on the host before copying the data to the GPU.
* @note This should not be used in combination with the RAPIDS shuffle.
*/
private def insertShuffleCoalesce(plan: SparkPlan): SparkPlan = plan match {
case exec: GpuShuffleExchangeExecBase =>
// always follow a GPU shuffle with a shuffle coalesce
if (GpuShuffleEnv.serializingOnGpu(rapidsConf)) {
GpuCoalesceBatches(exec.withNewChildren(exec.children.map(insertShuffleCoalesce)),
TargetSize(rapidsConf.gpuTargetBatchSizeBytes))
} else {
GpuShuffleCoalesceExec(exec.withNewChildren(exec.children.map(insertShuffleCoalesce)),
rapidsConf.gpuTargetBatchSizeBytes)
}
case exec => exec.withNewChildren(plan.children.map(insertShuffleCoalesce))
}

/**
* Inserts a transition to be running on the CPU columnar
*/
Expand Down Expand Up @@ -787,6 +802,10 @@ class GpuTransitionOverrides extends Rule[SparkPlan] {
}
updatedPlan = insertColumnarFromGpu(updatedPlan)
updatedPlan = insertCoalesce(updatedPlan)
// only insert shuffle coalesces when using normal shuffle
if (!GpuShuffleEnv.useGPUShuffle(rapidsConf)) {
updatedPlan = insertShuffleCoalesce(updatedPlan)
}
if (plan.conf.adaptiveExecutionEnabled) {
updatedPlan = optimizeAdaptiveTransitions(updatedPlan, None)
} else {
Expand Down
Loading