Skip to content

perf(cudf): skip uploading all-valid null masks in host->GPU reconstruction - #177

Draft
felipeblazing wants to merge 2 commits into
mainfrom
perf/h2d-convert-nullmask-skip
Draft

perf(cudf): skip uploading all-valid null masks in host->GPU reconstruction#177
felipeblazing wants to merge 2 commits into
mainfrom
perf/h2d-convert-nullmask-skip

Conversation

@felipeblazing

Copy link
Copy Markdown
Contributor

What

Two commits:

  1. NVTX phase instrumentation for 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.
  2. Skip all-valid null masks during column reconstruction. Masks upload via a synchronous per-column memcpy + stream sync (cudf factories read them at construction, so they cannot join the async copy batch). When null_count == 0 the 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 cudaMemcpyBatchAsync flush for the column constructors that don't read mask contents (fixed-width/LIST/STRUCT) — happy to rework in that direction.

🤖 Generated with Claude Code

felipeblazing and others added 2 commits July 31, 2026 06:42
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>
@copy-pr-bot

copy-pr-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant