[feat] Sharding logic split to pattern detection and executor for EP and BMM (fixes #5916) - #6180
[feat] Sharding logic split to pattern detection and executor for EP and BMM (fixes #5916)#6180greg-kwasniewski1 wants to merge 21 commits into
Conversation
…rmations to return None (#71) * Refactor the signatures of AD graph transformations to return None (NVIDIA#5249) Refactor signatures of AD graph transformations from gm = transformation(gm) to transformation(gm) Since the AD graph transformations modify the input GraphModule in-place. Previous signature style was misleading. Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
…ion (#76) * Fix trtllm-bench test and enable trtllm-bench integration Signed-off-by: Neta Zmora <96238833+nzmora-nvidia@users.noreply.github.com> * Remove unneeded __init__.py Signed-off-by: Neta Zmora <96238833+nzmora-nvidia@users.noreply.github.com> --------- Signed-off-by: Neta Zmora <96238833+nzmora-nvidia@users.noreply.github.com>
) (#73) * yaml config loader for dynamic settings Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> * updates for yaml mixin Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> * addressing reviewer feedback Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> --------- Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
* [AutoDeploy] Refining AD configurability Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> * addressed reviewer feedback Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> --------- Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
…for dropout in attention, increase tolerance for rope op test (NVIDIA#5855) Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
* Add the Torch backend and update the test to use the torch backend. Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * Add the sinks and fix the test failures Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * address reviewer's comments Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * use custom op convention Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * move the ref to the utils_test Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * Add torch backend tests in ad_build_small_single.py Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * Address hidden comments... Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> --------- Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com>
Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com>
* add torch_fp8_moe and fp8 linear support in pattern matcher, update unit tests Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add torch-fp4-moe and fp4 support in pattern matcher, unit test has acc issue and e2e mixtral fp4 has kernel error wo moe matching Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add pre-commit hook Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * hacky fix for e2e run of mixtral FP4 and fp4 op unit test Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * EP support for torch_fp4_moe and torch_fp8_moe Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix rebase: op rename, shard_load_hook bug in FP4 Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix pre-commit Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix weight loading-load_hook issue for FP4, update function to handle exclude_modules in hf_quant_config Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * addressing feedback, add moe op template, update op names,other minor refinements Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * move common functionality to utility Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix FP4QuantizationImpl register from rebase Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add quantize_moe pass for patched torch_moe op Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add transformation unit tests for FP8 and FP4 Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update should_skip_quantization to fix bmm unit test Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update BMMDynamicModel and utils to extract weight for dynamic BMM case Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update BMMDynamicModel to drop linear op Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * minor Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> --------- Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
* remove assert, add qwen small to tests * lint Signed-off-by: Suyog Gupta <suyogg@nvidia.com> --------- Signed-off-by: Suyog Gupta <suyogg@nvidia.com>
* fix overlap scheduler in AD Signed-off-by: Suyog Gupta <suyogg@nvidia.com> * cleanups Signed-off-by: Suyog Gupta <suyogg@nvidia.com> * fix nest sequences Signed-off-by: Suyog Gupta <suyogg@nvidia.com> * nits * avoid hardcoding max beam width Signed-off-by: Suyog Gupta <suyogg@nvidia.com> * avoid hardcoding max beam width Signed-off-by: Suyog Gupta <suyogg@nvidia.com> * clean logic and max_beam_width arg Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> --------- Signed-off-by: Suyog Gupta <suyogg@nvidia.com> Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com> Co-authored-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
…IA#4367, NVIDIA#4366 (#84) Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
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>
* Add sink/sliding window support for Triton Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> * Add the test and fix the functional implementations Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com> --------- Signed-off-by: nvchenghaoz <211069071+nvchenghaoz@users.noreply.github.com>
Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
|
Caution Review failedThe pull request is closed. WalkthroughThis update introduces a modular, extensible transformation pipeline for the Torch AutoDeploy backend, adding new configuration management utilities, a staged transform interface, and a library of graph transformations. The refactor replaces direct in-place graph mutations with a staged, metadata-driven approach, deepens YAML-based config merging, and enhances quantization, sharding, and MoE support. Tests are updated to match the new APIs and in-place semantics. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI/Script
participant ConfigManager
participant InferenceOptimizer
participant TransformRegistry
participant Transform
participant ModelFactory
participant GraphModule
User->>CLI/Script: Launch with CLI args/YAML configs
CLI/Script->>ConfigManager: Load and merge configs (deep merge, YAML, CLI)
ConfigManager-->>CLI/Script: ExperimentConfig/AutoDeployConfig
CLI/Script->>ModelFactory: Build model (from config)
CLI/Script->>InferenceOptimizer: Initialize with ModelFactory and transform config
InferenceOptimizer->>TransformRegistry: Lookup transforms by stage
loop For each stage in config
InferenceOptimizer->>Transform: Instantiate Transform with config
Transform->>GraphModule: Apply transform (in-place)
GraphModule-->>Transform: Updated graph and metadata
end
InferenceOptimizer-->>CLI/Script: Optimized GraphModule/nn.Module
CLI/Script->>User: Ready for inference or export
Suggested reviewers
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[https://github.com//issues/5916][feat] EP and BMM Sharding logic split to pattern detection and executor
Description
A follow-up of PR nv-auto-deploy#86 , pattern matcher + executor extended to EP and BMM.
Test Coverage
tests/unittest/_torch/auto_deploy/unit/multigpu/transformations/library/test_tp_sharding.py(renamed previoustest_graph_sharding.py)tests/unittest/_torch/auto_deploy/unit/multigpu/transformations/library/test_ep_sharding.pytests/unittest/_torch/auto_deploy/unit/multigpu/transformations/library/test_bmm_sharding.pySummary by CodeRabbit
New Features
Improvements
Bug Fixes
Chores