Repository navigation
Conversation
FLARE_CANDIDATE_MERGE_FUSED=1 (read when a merge is prepared; set it identically for export and serving) replaces the _threshold launch + _counts launch of the DSA candidate merge with one _threshold_counts launch: every (row, tile) program takes the cutoff (minimum of the K largest scores) itself, tile 0 publishes it and writes the -1 fill that _select overwrites. 6 -> 5 launches per merge. The fused variant is a separate native contract (flare.candidate_merge_fused), so the default query, compile payload and cache keys are unchanged. Integer-identical output (selected IDs and order): 800 random cases (rows 1..16, width 8192/16384, valid 0..width, distinct and tied scores, poisoned scratch) and 10,000 graph replays per case at rows 1/4/8, 0 differences; candidate-merge tests 6 passed off and on + new test_candidate_merge_fused_cuda.py (3). CUDA graph us/merge (TP8 width 16384, RTX PRO 6000, 3 runs): valid 1500 6.30 -> 5.59 (1 row), 6.62 -> 5.86 (4), 6.95 -> 6.21 (8); valid 16384 20.00 -> 19.18, 21.49 -> 20.70, 21.99 -> 21.24. A single-program finalize (threshold+counts+select) was exact but 12 us slower whenever more than 2048 candidates are valid and is not used.
Author
|
GPU validation of this branch as published (base
The saving is the same as in the description: about 0.7 us per merge. The absolute numbers are about 0.2-1.3 us lower in this run. |
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
FLARE_CANDIDATE_MERGE_FUSED=1(default off) is read when a merge is prepared, and must be set identically for export and serving. It replaces the_thresholdlaunch plus the_countslaunch of the DSA candidate merge with one_threshold_countslaunch. Every (row, tile) program computes the cutoff (the minimum of the K largest scores) itself; tile 0 publishes it and writes the -1 fill that_selectoverwrites. That is 6 -> 5 launches per merge, over 24 DSA layers. The fused variant is a separate native contract (flare.candidate_merge_fused), so the default query, compile payload and cache keys are unchanged.CUDA graph us/merge (TP8 width 16384, RTX PRO 6000, 3 runs):
Exactness: integer-identical output (selected IDs and their order). This was checked on 800 random cases: rows 1..16, width 8192/16384, valid 0..width, distinct and tied scores, poisoned scratch. It was also checked over 10,000 graph replays per case at rows 1/4/8, with 0 differences.
🧪 Tests
tests/components/test_candidate_merge_fused_cuda.py(3 tests, GPU). On CPU it was collected and skipped (actually run). Existing candidate-merge tests: 6 passed off and on, GPU, pre-rebase tree. The CPU failure set is identical to the release branch.Topology assumptions
Generic (single GPU).
Reviewer Notes