Skip to content

[POC] Back libcudf scalars with one-row column storage - #23765

Draft
GregoryKimball wants to merge 10 commits into
NVIDIA:mainfrom
GregoryKimball:scalar-refactor
Draft

[POC] Back libcudf scalars with one-row column storage#23765
GregoryKimball wants to merge 10 commits into
NVIDIA:mainfrom
GregoryKimball:scalar-refactor

Conversation

@GregoryKimball

@GregoryKimball GregoryKimball commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Background

cudf::scalar and cudf::column currently use incompatible device layouts:

Sumary

  • Unifies numeric, chrono, fixed-point, string, list, and struct scalar storage with column layout.
  • Adds allocation-free const and mutable one-row column views.
  • Makes scalar validity host-authoritative and non-synchronizing, matching the column null-count contract.
  • Requires explicit reconciliation when device code modifies a scalar null mask.
  • Preserves existing typed scalar constructors and accessors as compatibility facades.
  • Removes scalar conversion allocations, typed device-view adapters, and const casts
  • Retains owning materialization for internally synthesized JIT temporaries to prevent dangling views.

This substantially addresses:

  • #8064: scalar::is_valid() no longer synchronizes.
  • #18858: compiled binary operations consume scalar storage directly.
  • #4365: migrated consumers are const-correct and no longer cast away scalar constness.
  • #10892 and #10893: scalars can participate directly in column-oriented algorithms without one-row materialization.
  • #13160: standard column device views now replace typed scalar device views in representative consumers.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Cover numeric, decimal, string, and list materialization before replacing their independent storage representations.
Unify fixed-width, decimal, string, list, and struct scalar ownership with Arrow-compatible column storage so scalar views are allocation-free and host validity checks no longer synchronize.
Pass the scalar's owned one-row view directly so AST literals avoid materializing an auxiliary column while retaining exact nullability.
@copy-pr-bot

copy-pr-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Aug 21, 2026
Keep zero-copy storage for AST literals whose owners outlive execution while materializing internally synthesized scalars such as rescale parameters.
@GregoryKimball GregoryKimball changed the title Scalar refactor [POC] Back libcudf scalars with one-row column storage Aug 22, 2026
Remove scalar conversion allocations and const casts by consuming owned one-row views directly, including null-aware string operations.
Remove scalar conversion allocations and const casts by comparing directly against owned one-row column views.
Read sequence inputs through one-row column device views, removing typed scalar adapters and const casts.
Retain scalar-backed column device views at call sites and broadcast row zero through standard column iterators, removing typed scalar adapters and const casts.
Read separators and null replacements through retained one-row column device views, removing string scalar adapters and const casts.
Expose mutable one-row column views for scalar value producers while keeping host null counts authoritative and requiring explicit reconciliation after device mask writes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libcudf Affects libcudf (C++/CUDA) code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant