perf(cudf): skip uploading all-valid null masks in host->GPU reconstruction - #177
Draft
felipeblazing wants to merge 2 commits into
Draft
perf(cudf): skip uploading all-valid null masks in host->GPU reconstruction#177felipeblazing wants to merge 2 commits into
felipeblazing wants to merge 2 commits into
Conversation
Named ranges (hg:convert / presync / acquire_stream / reconstruct / dev_alloc / nullmask_sync / offsets_cast / flush_submit / final_sync) around each phase of the host->GPU conversion, plus an RAII nvtx_scope helper. Zero-cost without a profiler attached; with nsys these produce a per-phase breakdown of conversion wall time (they are how the null-mask and batch-submission overheads in the follow-up commit were found). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…uction Null masks are copied synchronously per column (cudf column factories read the mask at construction, so it cannot ride the async copy batch). For an all-valid column (null_count == 0) the mask is semantically identical to no mask: skip the upload and construct the column non-nullable. On TPC-H SF1000 host-pinned (GB300), where every column is all-valid, this removes ~975 blocking memcpy+stream-sync round-trips and 5.2 GB of mask bytes per q9 iteration; NVTX phase profiling attributed ~10.4 ms of each 39 ms five-GB conversion to these syncs. q9 hot -3.5%, whole-suite ~-2-3%, results byte-identical. Semantics note: reconstructed all-valid columns are now non-nullable rather than nullable-with-full-validity. cudf treats these as equivalent; strict column-equality assertions that compare nullability flags may need the alternative approach (batching masks into the existing flush for constructors that do not read mask contents). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Two commits:
convert_host_fast_to_gpu— named ranges around each conversion phase (presync, stream acquisition, column reconstruction, device alloc, null-mask sync, offsets cast, batch flush, final sync). Zero-cost without a profiler; with nsys it yields a per-phase wall-time breakdown of every host→GPU conversion.null_count == 0the mask is semantically a no-op — skip the upload and construct the column non-nullable.Why / measurements
Profiling TPC-H SF1000 host-pinned scans on GB300 (all columns all-valid): the mask syncs accounted for ~10.4 ms of every 39 ms five-GB conversion (~975 blocking round-trips and 5.2 GB of mask bytes per q9 iteration), amplified by pooled-stream aliasing across converting threads. With the fix, per-conversion wall time drops ~2.5x in combination with larger host block sizes, q9 hot improves 3.5%, and copy-engine duty within conversion windows reaches ~89% (link-bound). Query results are byte-identical.
Semantics caveat for review
Reconstructed all-valid columns become non-nullable instead of nullable-with-all-valid-mask. cudf treats these as equivalent for computation, but strict column-equality checks that compare nullability flags could notice. If that is a concern, the alternative is batching mask uploads into the existing
cudaMemcpyBatchAsyncflush for the column constructors that don't read mask contents (fixed-width/LIST/STRUCT) — happy to rework in that direction.🤖 Generated with Claude Code