Fix null optional dereference in temporal_partition_vertices #5381
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.
When vertex_labels is std::nullopt, the else branch incorrectly attempted to access vertex_labels_p1->begin() and vertex_labels_p2->begin(), causing cudaErrorIllegalAddress crash.
This fix removes the label iterators from thrust::make_zip_iterator calls in the else branch, since labels are not available when vertex_labels is nullopt.
Fixes temporal neighbor sampling when called without vertex labels, e.g., homogeneous_uniform_temporal_neighbor_sample with temporal_property_name=None.
All 210+ temporal sampling tests pass with this fix.
PR_TEMPORAL_SAMPLING_FIX.md
Pull Request: Fix null optional dereference in temporal_partition_vertices
Summary
Fixes a crash (
cudaErrorIllegalAddress) when calling temporal neighbor sampling without vertex labels.Description
The
temporal_partition_verticesfunction intemporal_partition_vertices_impl.cuhhas anelsebranch that handles the case whenvertex_labelsisstd::nullopt. However, this branch incorrectly attempts to dereference the null optional when constructingthrust::make_zip_iterator, causing an illegal memory access.Root Cause
The
elsebranch was copy-pasted from theifbranch but the label iterators were not removed:The Fix
Remove label iterators from the
elsebranch since labels are not available:Testing
C++ Tests (all pass)
Python Verification
Files Changed
cpp/src/sampling/detail/temporal_partition_vertices_impl.cuhDiff
Checklist
Impact
cudaErrorIllegalAddress