Replace nested static_for lambdas with compile-time search helper#6696
Open
tenpercent wants to merge 1 commit into
Open
Replace nested static_for lambdas with compile-time search helper#6696tenpercent wants to merge 1 commit into
tenpercent wants to merge 1 commit into
Conversation
Add sequence_find_value and find_in_tuple_of_sequences helpers using O(1) template depth via constexpr array lookup and pack expansion. Replace nested static_for lambdas in TensorDescriptor and TensorAdaptor: - GetTransformAndItsUpperDimension: use find_in_tuple_of_sequences - InitializeElementSize: replace generate_tuple lambda with pack expansion This eliminates the bulk of applier::operator() instantiations that previously came from nested lambda closures in the tensor descriptor transform search. Conflict-resolved rebase of ROCm/composable_kernel#3600 onto develop. Supersedes #4287. Generated-by: Claude Code (claude-sonnet-4-6)
4 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
sequence_find_valueandfind_in_tuple_of_sequencescompile-time search helpers with O(1) template depthstatic_forlambdas inTensorDescriptor::GetTransformAndItsUpperDimensionandInitializeElementSizeTensorAdaptorSupersedes #4287. Conflict-resolved rebase of ROCm/composable_kernel#3600 onto current develop.
Motivation
The
TensorDescriptorandTensorAdaptorclasses had excessive template instantiation from:static_forloops with lambdas creating unique closure types at every call sitegenerate_tuplewith lambdas causing per-type instantiation overheadThe new helpers use constexpr array lookup and pack expansion instead of recursive template patterns, achieving O(1) template depth.
Results (
example_grouped_conv_fwd_xdl_fp16, n=10, interleaved,-j1,-ftime-trace)grouped_conv_fwd_xdl_fp16(host)grouped_conv_fwd_xdl_fp16(device)Unrelated TUs (
device_memory,host_tensor,convolution_parameter) show no significant difference (p > 0.3), serving as negative controls.Methodology
-j1for accurate per-TU timingTest plan
sequence_find_value, 6 forfind_in_tuple_of_sequences)Tracking issue: #4229
Generated-by: Claude Code (claude-sonnet-4-6)