[VL] Unify gpu hash shuffle writer output#12499
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns GPU-hash shuffle writer output with the CPU/hash shuffle writer so that shuffle data remains readable when AQE changes the downstream stage to CPU execution (hybrid CPU/GPU mode).
Changes:
- Route
kGpuHashShufflewriter creation throughVeloxHashShuffleWriterto unify on a single hash-shuffle output format. - Remove the dedicated
VeloxGpuHashShuffleWriterimplementation and shift boolean/timestamp value normalization intoGpuBufferColumnarBatch::compose. - Update JNI/test option wiring to use
HashShuffleWriterOptions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cpp/velox/tests/VeloxGpuShuffleWriterTest.cc | Updates GPU-hash test configuration to use HashShuffleWriterOptions. |
| cpp/velox/shuffle/VeloxShuffleWriter.cc | Treats kGpuHashShuffle as an alias for hash shuffle writer creation. |
| cpp/velox/shuffle/VeloxGpuShuffleWriter.h | Removes the GPU hash shuffle writer class definition. |
| cpp/velox/shuffle/VeloxGpuShuffleWriter.cc | Removes the GPU hash shuffle writer implementation. |
| cpp/velox/memory/GpuBufferColumnarBatch.cc | Adds boolean/timestamp value conversions when composing GPU buffer batches. |
| cpp/velox/CMakeLists.txt | Drops the removed GPU shuffle writer source from the GPU build. |
| cpp/core/jni/JniWrapper.cc | Switches GPU-hash JNI writer creation to HashShuffleWriterOptions. |
Comments suppressed due to low confidence (1)
cpp/core/jni/JniWrapper.cc:1105
createGpuHashShuffleWriternow builds aHashShuffleWriterOptions, which defaultsshuffleWriterTypetokHashShuffle. SinceVeloxRuntime::createShuffleWriterselects the writer usingoptions->shuffleWriterType, this JNI API will no longer create akGpuHashShufflewriter (behavior change vs the previousGpuHashShuffleWriterOptions). If the caller still expects a GPU-hash writer type, setshuffleWriterTypeexplicitly after construction.
auto shuffleWriterOptions = std::make_shared<HashShuffleWriterOptions>(
toPartitioning(jStringToCString(env, partitioningNameJstr)),
startPartitionId,
splitBufferSize,
splitBufferReallocThreshold);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (const auto& colType : type->children()) { | ||
| bufferSizes[bufferTypes.size()] = arrow::bit_util::BytesForBits(numRows); | ||
| bufferTypes.push_back(BufferType::kNull); |
There was a problem hiding this comment.
The size should be decided by cudf allocation rule here because the copy is purely between arrow buffers. The cudf device buffers are allocated in getMaskBuffer and the arrow buffers will be copied to the device buffers there.
50536a0 to
a0b6d58
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
cpp/core/jni/JniWrapper.cc:1055
createGpuHashShuffleWriternow constructsHashShuffleWriterOptions, which defaultsshuffleWriterTypetokHashShuffle.VeloxRuntime::createShuffleWriterselects the writer based onoptions->shuffleWriterType, so this JNI entrypoint will no longer create akGpuHashShufflewriter (and may affect downstream selection/metadata that relies on the GPU-hash type). SetshuffleWriterTypetokGpuHashShuffleexplicitly (or switch back toGpuHashShuffleWriterOptions) to preserve the intended writer type while still using the unified writer implementation.
auto shuffleWriterOptions = std::make_shared<HashShuffleWriterOptions>(
toPartitioning(jStringToCString(env, partitioningNameJstr)),
startPartitionId,
splitBufferSize,
splitBufferReallocThreshold);
Currently, gpu shuffle writer splits the boolean and timestamp vector to buffers that is same as arrow/cudf format because it assumes the shuffle reader stage will execute on GPU and use gpu shuffle reader. However, the stage execution is decided at runtime when AQE is on. If the next stage is planed to execute on CPU, the shuffle read will fail.
In order to support a more general hybrid execution mode, it's necessary to unify the cpu/gpu shuffle writer output for a specific shuffle writer type (currently hash or sort).