Avoid eager input materialization for GPU range shuffle - #15941
Conversation
Signed-off-by: Rahul Prabhu <raprabhu@nvidia.com>
| // A range shuffle consumes every input batch independently. Avoid reading and retaining the | ||
| // next wide batch while the current range-shuffle batch is still live. | ||
| while (numRows < filteringModeRowsThreshold && !hasOnDeck && | ||
| !(RangeInputBatching.isActive && hasAnyToConcat) && iter.hasNext) { |
There was a problem hiding this comment.
The new stop-after-one condition applies to every AbstractGpuCoalesceIterator, including RequireSingleBatch and RequireSingleBatchWithFilter, even though the intended optimization is only for size-based, independently consumable batches.
| def apply(producer: GpuDataProducer[Table], | ||
| dataTypes: Array[DataType]): GpuColumnarBatchIterator = { | ||
| if (RangeInputBatching.isActive && producer.canReleaseSemaphoreBetweenBatches) { | ||
| new RangeGpuDataProducerIterator(producer, dataTypes) |
There was a problem hiding this comment.
Returning RangeGpuDataProducerIterator here defers every producer.next until later, after the caller's retry block has returned. Both production Parquet paths deliberately create and drain CachedGpuBatchIterator inside RmmRapidsRetryIterator.withRetryNoSplit
|
My concern is that the performance numbers are for a single bad use case, but it does not show what happens on other use cases. I get that for a wide schema spilling can be problematic but what happens as we change the structure of the data? More rows, fewer columns/etc. |
Fixes #15940 and fixes #15444.
Description
This PR changes GPU range shuffles to consume chunked Parquet input incrementally
instead of eagerly materializing multiple decoded full row batches.
CachedGpuBatchIteratornormally drains a GPU data producer before returning, andsize based coalescing can retain an additional lookahead batch. For wide range-shuffle
inputs, this leaves multiple decoded batches live while the current batch is being
partitioned.
That behavior caused avoidable GPU spill, re-materialization, and semaphore
contention in wide Delta liquid-clustering workloads.
Implementation
shuffle.
is active.
GpuDataProducerimplementations that canremain open across semaphore releases.
before each producer interaction.
opt into streaming.
Performance Results
OPTIMIZE FULLoperation on a table clustered by a column.The input contained:
The following configuration was used for both runs:
g4dn.8xlargeGPU executorsspark.sql.files.maxPartitionBytes=2gOnly the range-shuffle input consumption implementation changed between the runs. The original implementation eagerly drained and retained decoded batches from the chunked Parquet reader. The optimized implementation streams one decoded batch at a time to range partitioning and avoids coalescing a subsequent wide batch while the current batch remains live.
OPTIMIZE FULLdurationChecklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance