[inductor] Save producer partials for downstream sums#1
Draft
eellison wants to merge 1 commit into
Draft
Conversation
f5648a7 to
2e283fc
Compare
2e283fc to
c774b53
Compare
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.
Submitted by my agent.
This is a default-off prototype for better-benchmark issue pytorch#21, narrowed to the simple landable shape: existing mixed-order producers can attach compatible downstream producer-body
sumconsumers as extra saved partials. It does not relax normal mixed-order producer/consumer fusion and does not include the marginal simple-producer path.Mechanically: while the mixed-order producer materializes a large fp32 full output that is still needed, it also writes compact saved sum partials for values already computed in that producer body. The wrapper then final-reduces the compact workspace instead of rereading the full materialized output/body values.
Current head:
c774b530fc8.Validation:
test/inductor/test_producer_sum_reduction_accumulation.py -v, 4 tests passed.better-benchmark/scratch_issue21_guarded_validation_simplified_64m_20260529.Why the 64MiB gate:
sum_sum_sum_69414585b76bwent 3 -> 1 kernels but 0.085ms -> 0.090ms.Key 64MiB sweep results on B200:
sum_sum_sum_6107a2f54029: 0.8357ms -> 0.1793ms, kernels 4 -> 1.sum_sum_sum_dc96c4651516: 0.8098ms -> 0.1766ms, kernels 4 -> 1.sum_sum_sum_e2d4961f3571: 0.0788ms -> 0.0739ms, kernels 3 -> 1.sum_sum_sum_59e022113eeb: 0.1115ms -> 0.1066ms, kernels 3 -> 1.sum_sum_sum_97999676281e: 0.0933ms -> 0.0907ms, kernels 3 -> 1.sum_sum_sum_64f701d26f0a: 0.1725ms -> 0.1679ms, kernels 6 -> 4.This should stay default-off until the profitability model is stronger.