[VL] Unify gpu hash shuffle writer output#12499
Open
marin-ma wants to merge 3 commits into
Open
Conversation
Contributor
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.
| @@ -21,7 +21,6 @@ | |||
| #include "config/GlutenConfig.h" | |||
| #include "memory/GpuBufferColumnarBatch.h" | |||
| #include "shuffle/VeloxGpuShuffleWriter.h" | |||
Comment on lines
+166
to
+172
| VELOX_CHECK_LE(valueBufferOffset + bufferSize, returnBuffers[bufferIdx + 1]->size()); | ||
| const auto* src = reinterpret_cast<const int64_t*>(batch->bufferAt(bufferIdx + 1)->data()); | ||
| auto* dst = reinterpret_cast<int64_t*>(returnBuffers[bufferIdx + 1]->mutable_data()); | ||
| for (auto j = 0; j < batch->numRows(); ++j) { | ||
| dst[valueBufferOffset + j] = src[j << 1] * 1'000'000'000L + src[j << 1 | 1]; | ||
| } | ||
| valueBufferOffset += bufferSize; |
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.
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).