Repository navigation
Conversation
2 of 3 tasks
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.
Description
Multi-column STRING focus: 1.281x event speedup, or 21.9% lower partition time, across the 117 large synthetic STRING fixtures defined below.
cudf::partitionuses a contended partition-cursor atomic increment per row to build its scatter map. For eligible inputs, save uint16 tile-local row ranks, scan partition-major tile counts, and emitscatter_map[input] = outputwithout per-row cursor atomics. This replaces only map construction; generic result materialization is shared unchanged. The fallback preserves its original allocation order and keeps histogram/scratch buffers alive through materialization.Independent split of NVIDIA/cudf#25154. One rank/scan algorithm, with no STRING materialization dependency. Both PRs can merge/revert independently and combine without conflicts.
CPU-only heuristic: N >= 1,000,000, 2 <= partitions <= 256, and at least 4 bytes of known output storage per row. Fixed-width sizes count directly; top-level STRING/LIST offsets or DICTIONARY32 indices count as 4 bytes; other nested storage conservatively contributes zero. Small tables, zero-column tables, narrow schemas and unsupported partition counts retain the histogram/cursor path. No device skew/length samples are used. The lower row boundary avoids measured small-input time regressions; the storage boundary avoids measured rank-state peak-memory regressions for 1/2-byte schemas.
291 additions + 52 deletions = 343 changed lines, including tests.
Companion independent draft: #7; both target main and neither depends on the other.
Performance
Primary workload: multi-column STRING
Across 117 large multi-column STRING fixtures, this PR gives 1.281x event-time speedup (21.9% lower partition time) and 1.280x wall-time speedup. This is the primary workload focus; the all-type aggregate is retained below as a regression/control result.
Scope: regular synthetic STRING tables with at least 1M rows, 2+ STRING columns and 2–256 partitions. Include every fixture in that scope, including nullable inputs and cases declined by this PR's heuristic. Baseline is
65b9b3c222on NVIDIA L4; these are standalone cuDF partition microbenchmarks, not application-level benchmark results, and not incremental speedups over the complete NVIDIA#25154 implementation. Each fixture has equal weight in the geometric mean.Column-count groups contain different row/length/skew mixes; this table is not an isolated column-count scaling experiment.
The regular-generator maximum is not a fixed per-row length. The long-tail row is a separate set, excluded from the 117-case headline. Nullable multi-STRING fixtures alone: 13 cases, 1.074x event speedup; the rank-map optimization retains generic STRING materialization.
Paired multi-STRING examples
Three alternating-order rounds, 30 samples per library per round. Times are medians of round medians; speedups are paired-round geometric means. The rows below are all five simultaneous-admission STRING cases in the final interaction cohort. The combined column includes both PRs; it is not this PR alone.
Across all seven interaction fixtures, no combined result declined by more than 5% against the best standalone version. Small-input retained-path latency flags remain documented below; these results do not establish universal per-case improvement.
Full matrix, retained-path flags and validation methodology
Original heuristic families, with additional controls included:
Screening: 0 admitted fixtures exceeded a 5% event or wall slowdown; 0 fixtures increased measured device peak by the 1% + 4 KiB reporting threshold. Focused validation repeated 43 selected fixtures in three alternating-order rounds of 30 samples per variant (baseline and this split); a separate interaction cohort compares baseline, each split and both. Repeated material slowdowns (>5%,>5us, at least 2 rounds): 2. All >5% ratio changes are retained in the report, including sub-5us changes.
Representative paired results (median of round medians; speedups use paired-round geometric means):
strings-n1000000-p200-c10-w8-l128-z0-m0-d0-s0strings-n1000000-p200-c10-w8-l128-z10-m0-d0-s0fixed-n1000000-p2-c1-w8-l0-z0-m0-d2-s0fixed-n1000000-p2-c1-w8-l0-z0-m0-d0-s0Retained-path cases flagged by the repeat rule (these are not admitted by the new heuristic; causality remains unresolved):
fixed-n1-p2-c2-w4-l0-z0-m1-d0-s7lists-n1025-p2-c1-w8-l32-z0-m0-d0-s7Small-input end-to-end nonregression is not established for every fixture. The full screen and paired repeats retain their slow cases above. Additional baseline A/A controls used CPU3, four rotated rounds and 100 samples on 13 selected fixtures; identical-baseline ratios ranged roughly 0.62–1.44. For one flagged fixed-width fallback (65,537 rows,P=2,C=8,I32,all-valid masks,sliced), Nsight Compute measured approximately 118.6 us total GPU kernel time for baseline and the split variants (<0.3% difference). Final rank removes the empty-map construction; CUPTI verifies that, in this profiled case, final rank and STRING fallback have the same runtime API counts as baseline (including 144
cudaGetDevice, 24 launches and 24 allocation/free pairs). These diagnostics separate the unchanged GPU work from variable CPU/API latency; they do not prove universal end-to-end improvement. Latest-upstream-main validation and stable-host latency confirmation remain before upstream review.These drafts target
res-life/cudf:mainat the original NVIDIA/cudf#25154 baseline65b9b3c222, which is also the measured base. Complete partition translation units, private headers and tests match the measured JNI sources after comments, formatting and include-order normalization. Separate ports to NVIDIA main9efdb32adbdare prepared, but no latest-upstream-main build or performance claim is made.All validation used an existing JNI checkout and its compatible build cache: unchanged common cuDF objects, separately rebuilt partition TU and relinked library per variant. NVIDIA L4, driver 595.71.05; CUDA 12.9.1, gcc-toolset 14, Release O3, sm89, PTDS, same RMM allocator and benchmark executable. Input construction and correctness checks are outside timing. >=150 ms warmup; 15 samples per fixture for screening. Event timing spans partition and output destruction, including CPU/GPU synchronization gaps; wall time additionally includes event recording and end synchronization. Speedups are baseline/candidate (larger is better). Peak memory means output plus temporary device allocations, excluding input/context/code caches and host pinned memory.
497 measured fixtures include all 348 original workloads, plus heuristic boundaries, schema/null/offset declines, long-tail STRING lengths, nested/zero-column/empty inputs. The rows above overlap; geometric means do not imply every input improves. Raw results retain per-case timings, samples, boundaries/schema/row-hash correctness, GPU-process isolation, loaded-library and artifact hashes. Only completed accepted runs contribute. Sliced STRUCT is excluded because the frozen baseline itself throws; unsliced STRUCT and sliced LIST/STRING/fixed-width remain covered. Disabled large-STRING threshold errors are covered by unit tests.
Validation
One typed test exercises all 8 supported integral map types at N=1,000,003; one table test checks CPU-expected grouping at N=999,999/1,000,000/1,000,003,P=2/16/256/257, uniform/all-hot/90%-hot maps and nullable sliced values. Existing tests cover zero columns, narrow types and nested fallback/materialization.
JNI PoC full
PARTITIONING_TEST: 1,877 passed, 1 existing disabled.STREAM_PARTITIONING_TESTwith new-testing-default stream interposition: 7 passed.8 typed map tests at N=1,000,003 through memcheck and synccheck; racecheck on the shared-memory count kernel: zero errors/hazards. The I32 value schema admits the optimized path.
Combined PoC: 1,879 partition tests + 7 stream tests passed.
Standalone patches, both application orders, identical resulting sources, actual Git merges, formatting and whitespace checks passed.
No latest-upstream-main build/test claim; these fork drafts retain the validated original baseline.
Independently scoped change with focused tests.
Performance numbers and benchmark baseline/configuration recorded.
Latest-upstream-main build and stable-host latency validation complete.