[QDP] Fix streaming host-to-device copy size - #1464
Open
viiccwen wants to merge 2 commits into
Open
Conversation
Signed-off-by: viiccwen <vicwen@apache.org>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a correctness bug in the QDP streaming Parquet GPU encoder where an element count (f64 elements) was incorrectly passed to a helper expecting a byte count, causing truncated H2D copies and silently corrupted amplitude/angle results. Adds a stronger integration test that validates numerical output (not just shape) to prevent regressions.
Changes:
- Convert streaming Parquet chunk length from element-count to byte-count before
PipelineContext::async_copy_to_device, with overflow checking. - Extend the existing GPU angle streaming integration test to download the produced
complex128DLPack tensor and validate all amplitudes against the analytical formula. - Add a test helper to download
complex128CUDA DLPack tensors to host for verification.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| qdp/qdp-core/src/encoding/mod.rs | Fixes H2D copy length by converting element counts to byte counts with overflow handling. |
| qdp/qdp-core/tests/gpu_angle_encoding.rs | Strengthens the Parquet streaming angle test to validate numerical correctness by downloading and checking amplitudes. |
| qdp/qdp-core/tests/common/mod.rs | Adds a CUDA DLPack complex128 download helper used by the new/extended integration test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: viiccwen <vicwen@apache.org>
Contributor
|
LGTM. |
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.
Related Issues
Closes #1463
Changes
Why
The streaming Parquet encoder passed an
f64element count to a helper that expects a byte count. Consequently, amplitude and angle encoders copied only one eighth of every input chunk to GPU staging memory. The CUDA copy completed successfully, so callers received a state tensor with no error even though its amplitudes were incorrect.Existing integration tests only checked the returned DLPack shape and therefore did not detect this numerical corruption.
How
f64elements to bytes before callingPipelineContext::async_copy_to_device.checked_mul(size_of::<f64>())and return a memory-allocation error if the byte-count calculation overflows.formula;
The regression test was also run against the previous implementation. It failed as expected:
state[0]was1.0, while the analytical result was0.9316157966884513. The test passes with this change.Checklist