Skip to content

Track conceptual kernel deduplication PRs and binary size savings #2888

Open

Description

@divyegala

Residual closure for the SOL comparison

The frozen integration of all 40 open/draft cuVS swarm heads on the bb8251f5282f7e3755b42de4aaa1389cd076bd54 review basis retained 93 duplicate specializations per profile. Two additional signed draft PRs close that ownership gap while preserving one concrete owning instantiation per generated TU:

  • #3014: k-means fit and centroid helpers, 24 generated owners; removes the remaining 92 k-means duplicate specializations.
  • #3015: shared IVF-flat/IVF-binary build-index launchers, nine generated owners; removes the remaining shared build-index specialization.

With both heads integrated, the freshly linked CUDA 13.3.73 library has 4,581 unique kernels and 4,581 total copies on every one of the seven native profiles and compute_120 PTX: zero duplicate copies. Required kernel identities and public cuVS exports are preserved. Every new owner module matches the linked library, and all SM90a kernel text/per-kernel constant payload sets match the pre-fix library.

All 70 focused native H200 CPU-oracle cases pass: 48 SG/MG k-means cases and 22 IVF/refinement cases. MG uses NCCL_P2P_DISABLE=1 after a standalone direct-P2P NCCL sum hung on this host. A cross-index-width shared-clique sequence also hangs in the pre-fix library; the remaining combinations pass with fresh cliques/processes. These are bounded native checks, not universal backend or runtime-path coverage.

No standalone compile-time or size saving is assigned to these new PRs. The matched baseline-versus-SOL study remains pending; its intended variable is grouping the same already-deduplicated instantiations. The older measurements and 96-residual census below retain their historical frozen basis and do not describe this new zero-duplicate library.


The swarm now uses one concrete owning instantiation per generated CUDA translation unit, through ordinary JSON matrices and the existing generate_inst_matrix. The revised signed graph has been published: 33 layout PRs updated, with 119 new signed commits, followed by signed review fixes for #2896 and #2937 (121 new signed commits total). The original 42 branch refs advanced atomically; signed validation fixes and the affected dependent branch followed. Existing PR dependencies are preserved.

Launcher headers provide declarations. Host definitions and real device kernels compile in CUDA owners. Shared lower kernel instantiations have separate owners. Includes stay at the top of files. No unity/GROUP build, .cu inclusion, RDC, new production CMake/Python module, or local RAFT patch/pin is used. RAFT and CUB remain separate concepts.

The combined validation source has 1,215 generated owners plus 43 ordinary CUDA owners. All 184 native templates are registered; each generated TU contains exactly one concrete owning instantiation. Actual project CMake configurations pass with the original full architecture lists for CUDA 12.9 and 13.3: 3,264 and 3,295 library objects respectively. Every exact PR commit tree passes native generation checks. The complete SM90 owner census finds 2,595 unique kernel names with zero duplicate copies. Full-library and runtime results are reported below.

Revised complete-library measurements

Paired full-architecture builds on the frozen 825e7438174fce3e998a9f0fb33b6a40dfcc7108 compile-time-experiment source basis, with identical Release/GCC13/compression settings. These controls differ from the older accepted per-PR measurement basis; the figures must not be mixed. Sizes are decimal MB after strip --strip-unneeded. The revised aggregate includes the approved header changes from RAFT #3189, #3187 and #3193 and the #2896 IVF-binary histogram review follow-up. The preceding v12 source and artifacts remain immutable.

CUDA Main control MB One instantiation per TU MB Saved MB Saved %
12.9 597.589872 425.329152 172.260720 28.83%
13.3 306.609224 235.749336 70.859888 23.11%

Compared with the grouped-owner implementation on this same basis (includes the new owner/closure fixes as well as the TU split):

CUDA Grouped control MB Net change in revised set MB
12.9 365.877264 59.451888
13.3 179.668424 56.080912

The grouped frozen control has 16 unresolved cuVS helper references. The revised set also completes those owners; this net comparison does not isolate CUDA-container overhead.

Complete-library native/PTX census (distinct from the 1,258-owner SM90 proof):

CUDA Unique kernels per profile Duplicate families per profile Extra copies per profile cuRAND table modules: main → revised
12.9 4,581 96 96 56 → 1
13.3 4,581 96 96 56 → 1

The owner set has zero duplicate copies. Any remaining full-library families are reported explicitly above; no claim is made that the entire library has zero duplicates. The per-PR remeasurements for the 34 changed rows remain pending; the combined delta cannot be allocated by summing owner objects.

The single remaining cuRAND table-bearing module is the existing IVF-RaBitQ random-scaling owner, which uses XORWOW. It carries eight arrays totaling 218,048 uncompressed native bytes per architecture profile. All 32 split RNG dispatch owners remain free of XORWOW/MRG implementation tables.

The #2896 review follow-up removes 33 IVF-binary histogram duplicate families from the preceding aggregate, which retained 129. The 96 residual families are 92 k-means helper families, one IVF-binary build-index family, and three PQ half-map families. All were already present in the grouped control. The published #2913 also addresses those three PQ map families; the accepted frozen caller context retains them. This is not evidence that the complete published library has zero duplicates. No new duplicate family is introduced by the revised owners.

The full-architecture owner census has 2,601 unique kernels per profile and zero duplicate copies. The standalone SM90 owner census has 2,595: the architecture lists select five extra half-radix fallback kernels and the MST fallback contributes one net extra kernel. The difference is explained by dispatch selection, with no unexplained kernel loss.

Both toolkit libraries link with -Wl,-z,defs, have zero unresolved internal references, and retain every strong export and declared public cuVS API function. Removed dynamic exports are classified weak private implementation, header-only RAFT, or standard-library helpers.

Per-PR measurement basis

The previous grouped-owner aggregate (209.495904 MB saved on CUDA 12.9; 116.015744 MB on CUDA 13.3) is historical and does not measure this new layout. The new paired aggregate is reported above. The changed PRs’ old individual deltas are retired pending fresh per-PR measurements. PR deltas overlap and must not be summed.

The measured rows below retain exact accepted frozen paired reports. All figures are decimal MB of stripped complete libcuvs.so, with identical Release/GCC13/architecture/compression settings on each side. CUDA 12.9 includes SM70/75/80/86/90a/100f/120a/120 and compute_120 PTX; CUDA 13.3 excludes SM70. They are not measurements of current nightly packages.

#2896 has two generated histogram instantiations. Its older isolated savings of 5.085520 / 2.550192 MB (CUDA 12.9 / 13.3) are historical: that accepted frozen source has no IVF-binary caller, so it cannot measure the review follow-up. The current full-PR standalone delta is pending. The freshly linked combined-library increment from this follow-up is 0.336960 / 0.189472 MB, included in the aggregate above. #2913 has 171 generated map instantiations and saves −5.336648 / −5.014024 MB: real standalone growth. Its extra container/host metadata cost is included. One newer-main bitwise-decode owner uses its exact signed current dependency context; the other 170 use the accepted frozen context.

Measured PRs, descending CUDA 13.3 savings

Status: 🟣 Merged; 🟢 Open for review; 📝 Draft. The owner column reports generated and retained static CUDA sources separately.

Status PR Concept CUDA owners: generated + retained Diff: files; +/− lines Actual prerequisites CUDA 12.9 saved MB CUDA 13.3 saved MB
🟣 Merged #2934 Narrow k-means and ScaNN serialization includes 0 + 0 2; +1/−2 main 28.749824 20.312064
📝 Draft #2894 Reuse sparse-distance dispatch from sparse search 0 + 0 1; +21/−19 main 1.878752 0.850656
📝 Draft #2910 Share IVF-PQ residual-encoding kernels 0 + 1 4; +118/−46 main 0.113576 0.076712
📝 Draft #2938 Share sparse row-count and CSR-repeat launchers 0 + 2 5; +32/−0 main 0.054992 0.014032
📝 Draft #2929 Share CAGRA ACE graph-ID adjustment kernels 0 + 1 3; +128/−64 main -0.029336 -0.017080
🟢 Open #2937 Share the CUB capability-query instantiation 0 + 1 7; +80/−3 main -0.025784 -0.021688
🟢 Open #2913 Share RAFT elementwise-map kernel instantiations 171 + 0 56; +1452/−99 main -5.336648 -5.014024

Changed PRs awaiting per-instantiation remeasurement

These rows show the published diffs and real prerequisites. Pending entries are not estimates; the former grouped-owner deltas no longer apply. They will be sorted by descending savings when remeasured.

Status PR Concept CUDA owners: generated + retained Diff: files; +/− lines Actual prerequisites CUDA 12.9 saved MB CUDA 13.3 saved MB
📝 Draft #2889 Share RAFT selection kernel instantiations 95 + 1 21; +2046/−21 #2937, #2913 Pending Pending
📝 Draft #2890 Share CAGRA search kernels and search-plan instantiations 11 + 5 14; +892/−521 main Pending Pending
📝 Draft #2891 Share CUTLASS L2 launchers across index widths 10 + 0 6; +281/−16 main Pending Pending
📝 Draft #2895 Share IVF result postprocessing launchers 4 + 0 6; +277/−124 #2913 Pending Pending
🟢 Open #2896 Share RAFT histogram launchers 2 + 0 9; +128/−47 main Pending Pending
📝 Draft #2897 Share CUB histogram launchers 36 + 0 16; +959/−103 #2937 Pending Pending
📝 Draft #2898 Share RAFT norm, reduction and PCA helper kernels 207 + 0 66; +3884/−143 #2937, #2913, #2914; RAFT#3193 Pending Pending
📝 Draft #2899 Share CAGRA graph-optimization kernels 22 + 0 34; +2892/−1542 #2913 Pending Pending
📝 Draft #2900 Share bitset population-count launchers 9 + 0 12; +244/−5 main Pending Pending
📝 Draft #2901 Share RAFT row-normalization kernels 5 + 0 9; +184/−7 main Pending Pending
📝 Draft #2902 Share NN-descent join and graph-maintenance kernels 42 + 1 21; +2563/−1566 #2913 Pending Pending
📝 Draft #2904 Share IVF-PQ build-preparation kernels 7 + 2 6; +340/−110 #2913, #2901, #2921, #2906 Pending Pending
📝 Draft #2905 Share RAFT gathering and selected-row copying 34 + 0 26; +562/−30 #2937 Pending Pending
📝 Draft #2906 Share CUB selection and supporting device dispatch 81 + 8 68; +2942/−93 #2937 Pending Pending
📝 Draft #2907 Share RNG, sampling and RaBitQ kernel instantiations 88 + 2 51; +1804/−502 #2937, #2898, #2905, #2906, #2913 Pending Pending
📝 Draft #2908 Share CUDA radix-sort kernel instantiations 63 + 1 34; +1711/−85 #2937 Pending Pending
📝 Draft #2909 Share the ANN outer-add kernel launcher 2 + 0 4; +59/−16 main Pending Pending
📝 Draft #2911 Share Vamana graph-maintenance kernels 4 + 6 12; +552/−146 #2937, #2906, #2927 Pending Pending
📝 Draft #2914 Share RAFT matrix-broadcast kernels 42 + 2 23; +731/−23 #2913; RAFT#3193 Pending Pending
📝 Draft #2915 Share RAFT matrix-argmin kernels 2 + 0 6; +75/−2 main Pending Pending
📝 Draft #2916 Share RAFT keyed row-reduction kernels 24 + 0 10; +352/−4 main Pending Pending
📝 Draft #2917 Share bitmap, CSR and sorted-MST kernels 15 + 2 29; +770/−215 #2937, #2898, #2905, #2906, #2908, #2913, #2919, #2921, #2923, #2925, #2926, #2938 Pending Pending
📝 Draft #2918 Share CUDA scalar-reduction kernels 3 + 1 9; +159/−29 #2937, #2906 Pending Pending
📝 Draft #2919 Share CUDA range-initialization kernels 47 + 1 41; +741/−177 #2937, #2906, #2913 Pending Pending
📝 Draft #2920 Share IVF-PQ non-finite-value checks 8 + 0 4; +125/−39 #2906 Pending Pending
📝 Draft #2921 Share CUDA prefix-scan kernel instantiations 34 + 0 28; +1101/−60 #2937 Pending Pending
📝 Draft #2922 Share RAFT mapped-sum reduction kernels 10 + 0 6; +116/−3 main Pending Pending
📝 Draft #2923 Share COO and sparse spectral helper kernels 55 + 1 40; +1601/−52 #2937, #2906, #2913, #2921, #2938 Pending Pending
📝 Draft #2924 Share CUDA compaction and sparse partition kernels 10 + 4 20; +871/−182 #2937, #2905, #2906, #2908 Pending Pending
📝 Draft #2925 Share row-label extraction kernels 8 + 0 10; +250/−3 #2937, #2906, #2908 Pending Pending
📝 Draft #2926 Share Thrust indexed-copy kernels 9 + 0 12; +288/−21 #2937, #2906 Pending Pending
📝 Draft #2927 Share Thrust unique-by-key kernels 2 + 1 6; +119/−4 #2937, #2906 Pending Pending
📝 Draft #2928 Share weighted k-means cost-reduction kernels 40 + 0 11; +985/−39 #2937 Pending Pending
📝 Draft #2930 Share balanced k-means center-adjustment kernels 13 + 0 6; +368/−148 main Pending Pending

RAFT work

  • 🟣 Merged — RAFT#3189: narrow RNG headers to prevent unused cuRAND table leaks. The accepted isolated frozen result, measured after cuVS Narrow k-means and ScaNN serialization includes #2934, saves 42.401792 / 29.995008 MB. That baseline is not a Git dependency. No production RAFT TU is added.
  • 📝 Draft — RAFT#3193: inline reduction and linewise launch hooks used by cuVS [WIP] Share RAFT norm, reduction and PCA helper kernels #2898 and [WIP] Share RAFT matrix-broadcast kernels #2914. Three existing RAFT headers change; RAFT stays header-only. cuVS owns the generated CUDA TUs. Its effect is included only in the revised combined analysis, not assigned an unmeasured standalone delta.
  • 📝 Draft — RAFT#3187: independent PCA/TSVD header structuring. Its exact approved header changes are included in the revised aggregate validation context, alongside #3189 and #3193. Earlier standalone grouped-owner figures remain historical; no new isolated delta is assigned.

Review and validation scope

Both outstanding swarm reviews are addressed in signed follow-ups: #2896 routes IVF-binary histogram calls through the existing shared owner, and #2937 adds the forced device-sort trustworthiness regression. Both pass pre-commit. The histogram caller and owners freshly compile for every supported architecture/PTX on both toolkits; four public IVF-binary tests pass per toolkit against the complete follow-up library. An actual compiler-dependency audit shows this header affects only the rebuilt IVF-binary caller in the aggregate. The trustworthiness test and exact PR dispatch objects compile and pass on both toolkits; kernel traces confirm CUB segmented radix sorting with zero block-sort launches. No generation or build-system input changes, new dependencies, or stack rebases are required.

The pre-follow-up v12 aggregate passed runtime verification on H200/SM90 for both toolkits: 35 bounded groups: 209 gtests with zero failures/errors/skips, plus all 48 brute-force CPU-oracle cases (float/half, three metrics, all row/column input layouts) and six MST device/managed/pinned cases. All 11 fresh strict executable links pass. The retained C API wrapper came from a different C++ ABI snapshot; rebuilding its 19 objects per toolkit against the final headers resolves that fixture mismatch. Both matching wrappers pass -z,defs, and loader-path checks confirm the final wrappers and libcuvs.so are used. No GPU test failed; the final DSO size/mtime remains unchanged throughout the run.

The current review batch remains #2896, #2937, and #2913. Reviews prioritize prerequisites that unblock the largest savings. Revised #2889, #2928 and #2907 need fresh sizes before their former ranking can be asserted.

The 11 test include-extension errors in #2911 are fixed; its full include checker and all applicable pre-commit hooks pass. No library input changes in that follow-up.

GPU runtime checks use H200/SM90; compilation covers every supported architecture. All32 split RNG dispatch owners have been checked on both toolkits across every native profile and compute_120 PTX: no XORWOW/MRG implementation tables were reintroduced. The complete-library census is reported above, separately from the owner-only census.

Only real dependencies form stacks. The cuVS graph retains 16 open roots targeting main plus the merged #2934 root; multi-parent concepts use the union of their actual providers. The linear GitHub stacks remain #2937 → #2906 → #2927 → #2911 and #2913 → #2914.

Closed redundant host-dispatch relocations: #2903, #2912. The upstream CUB experiment remains closed. No CUB changes are proposed upstream.

Activity

  1. changed the title [-]Track per-kernel-template deduplication and measured binary size savings[/-] [+]Track conceptual kernel deduplication PRs and binary size savings[/+] on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions