Skip to content

Add cuda.coop block Histogram - #11517

Draft
tpn wants to merge 1 commit into
codex/cuda-coop-numba-neighborsfrom
codex/cuda-coop-numba-histogram
Draft

tpn wants to merge 1 commit into
codex/cuda-coop-numba-neighborsfrom
codex/cuda-coop-numba-histogram

Conversation

@tpn

@tpn tpn commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Why this is needed

Block-local counting needs a histogram primitive that fits the group-first
API. Add histogram to the common API and cuda.coop.numba_mlir, backed by
CUB's atomic and sort algorithms.

counts = coop.histogram(block, samples, bins=65, bins_per_thread=2)
coop.store(block, output, counts, algorithm="striped", valid_items=65)

Each call returns fresh striped counters and preserves its samples. Counter
dtype and per-thread output extent are independent of the sample payload.
Slots beyond the requested bin count contain zero. Every sample must be a
valid bin index; there is no input valid_items parameter. Qualified calls
also accept a scalar or fixed local array.

Repeated tiles accumulate by adding returned counters into an ordinary
per-thread payload. No persistent Histogram object or parent/child lifecycle
is introduced. Caller-provided TempStorage controls scratch reuse only.

Stacked after #11516. Documentation and
the tested accumulation example are in the final docs PR #11320.

Validation

Fresh installed-wheel checks at 8d2299b79468:

  • Host contracts and packaging (full suites): 806 passed on Python 3.14.
  • Numba backend unit/compiler tests (focused, GPUs hidden): 26 passed on Python 3.14.
  • GPU runtime tests (focused): 61 passed on Python 3.14.

Wheel validation and source, installed-package, and bundled-header comparisons passed.

Remote CI passed at 8d2299b79468: GitHub Actions run. All exact-head checks and statuses, including pre-commit, are successful or conditionally skipped.

@copy-pr-bot

copy-pr-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

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.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Sep 19, 2026
@tpn tpn changed the title Add cuda.coop block Histogram Add cuda.coop block Histogram Sep 19, 2026
@tpn

tpn commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions

This comment has been minimized.

Expose atomic and sort histograms through the common and Numba APIs.
Preserve samples, infer fixed payload shapes, and return independent
counter payloads with zero padding beyond the requested bin count.

Keep accumulation explicit by adding fresh per-bin results. Support
caller-provided scratch without retaining a histogram parent object.

Signed-off-by: Trent Nelson <trent@trent.me>
@tpn
tpn force-pushed the codex/cuda-coop-numba-histogram branch from 26a2856 to 8d2299b Compare September 20, 2026 02:56
@tpn
tpn force-pushed the codex/cuda-coop-numba-neighbors branch from 21e2b3e to 494ff3b Compare September 20, 2026 02:56
@tpn

tpn commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 8d2299b

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 29m 29s: Pass: 100%/8 | Total: 1h 13m | Max: 23m 39s

See results here.

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant