Add container and tuple optimization helpers#4290
Draft
assistant-librarian[bot] wants to merge 4 commits intodevelopfrom
Draft
Add container and tuple optimization helpers#4290assistant-librarian[bot] wants to merge 4 commits intodevelopfrom
assistant-librarian[bot] wants to merge 4 commits intodevelopfrom
Conversation
- Replace lambdas with named functors in container_concat - Add make_uniform_tuple helper for repeated value patterns - Add container_product helper with O(1) depth fold expression - Add merge_sequences_functor and unpack_and_merge_sequences - Add 16 unit tests for container helpers Co-Authored-By: Claude <noreply@anthropic.com>
Detailed comments explain: - Why named functors reduce instantiations vs lambdas in container_concat - Impact: 50% reduction in container_concat (186 → 93 instantiations) - make_uniform_tuple optimization using pack expansion instead of lambda - generate_identity_sequences optimization for identity permutations - When to apply these patterns elsewhere This documentation helps maintainers understand the build-time optimization strategies and prevents reverting to less efficient patterns.
…evelop/ROCm_composable_kernel/pr-3590
2 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.
Summary
container_concatmake_uniform_tuplehelper for repeated value patternscontainer_producthelper with O(1) depth fold expressioncontainer_concatinstantiations from 186 to 93 (50% reduction)Why It Works
Lambda expressions in
container_concatcreated unique types at each call site. Themake_tuple_functornamed struct shares one type across all uses, halving instantiation count.The
make_uniform_tuplehelper eliminates repeated lambda instantiations for creating tuples with the same value repeated N times.Test Plan
container_concatandmake_uniform_tuplehelpersPR Stack
This PR is part of the build time optimization effort (issue #4229). All PRs now target develop independently:
__make_integer_seqTracking issue: #4229
🔁 Imported from ROCm/composable_kernel#3590
🧑💻 Originally authored by @tenpercent