[feat] TP Sharding logic split to pattern detection and executor (fixes #5916) - #86
Merged
Merged
Conversation
…sharding Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
lucaslie
reviewed
Jul 14, 2025
… functionality, applied to test_graph_sharding Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
…applies any generic transformations Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
lucaslie
reviewed
Jul 15, 2025
…rk on node.name Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
lucaslie
pushed a commit
that referenced
this pull request
Jul 18, 2025
NVIDIA#5916) (#86) * introduced basic sharding config logic * transformation_executor works for TP parallelism. Updated test_graph_sharding Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Switched from dataclass to pydantic. Added run_pattern_detection_test functionality, applied to test_graph_sharding Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Restructured transformation execution logic. transformation_executor applies any generic transformations Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Detection + execution logic moved only to sharding. Transformation work on node.name Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Removed redundant params Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> --------- Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
lucaslie
pushed a commit
that referenced
this pull request
Jul 21, 2025
NVIDIA#5916) (#86) * introduced basic sharding config logic * transformation_executor works for TP parallelism. Updated test_graph_sharding Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Switched from dataclass to pydantic. Added run_pattern_detection_test functionality, applied to test_graph_sharding Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Restructured transformation execution logic. transformation_executor applies any generic transformations Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Detection + execution logic moved only to sharding. Transformation work on node.name Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> * Removed redundant params Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com> --------- Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
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.
[https://github.com/NVIDIA/issues/5916][feat] TP Sharding logic split to pattern detection and executor
Description
column_row_shard, which directly modifyingGraphModule, is replaced by two-step solution:detect_column_row_shard(gm) -> List[TPSharingTransformation]is read-only w.r.t.gmand returns a list of detected_insert_sharded_matmulpatterns,transformation_executor()that consumes the sharding config and applies transformations onGraphModuleThis first PR is just the first step, covering only tensor-parallel sharding. However, the
transformation_executoris meant to be a container class for any graph transformations, especially other sharding strategies (MoE, BMM).The expected benefit is that by detaching the pattern detection and graph transformations, the transformation config can be intercepted and either provided directly by a user, or inferred from model's config (e.g., Llama4
base_model_tp_plan) .Test Coverage
tests/unittest/_torch/auto_deploy/unit/multigpu/transformations/library/test_graph_sharding.pyhas been updated to test new sharding logic.