Repository navigation
feat(analytic): add a multi-chip model on DeepStack's network model - #122
Merged
Merged
Conversation
Move the stage pricing of estimate_decoder_latency into price_stage and rename the running phase sum to PhaseTotals, and export both, so other estimators can price a stage's compute against its DRAM traffic the same way. Behaviour is unchanged.
DeepStack (tile-ai/DeepStack, arXiv:2604.04750) provides the hierarchical NoC topologies, collective algorithms and MoE routing statistics that the multi-chip model builds on. Pin it at 17e21bf, which includes the all-switch link aggregation fix and all_gather_wrapper. Add SciPy, DeepStack's only dependency PLENA did not already have, and exclude the submodule from ruff like the other submodules.
analytic_models.distributed estimates TTFT and decode throughput of a decoder served by several PLENA chips under TP, EP, DP, PP and CP. Each chip is PerfModel compute priced against a stacked_dram memory system; the network side (NoC hierarchy and routing, all-reduce/all-gather/ all-to-all algorithms, pipeline transfers, MoE routing statistics and NoC energy) is DeepStack's, imported from the submodule. The import shim loads DeepStack source modules only and fails if a bundled reference binary is loaded. - Layer compositions follow llama_model.py and gpt_oss_model.py; one device reproduces them, and stacked_dram.estimate_decoder_latency, exactly. - Plan semantics follow DeepStack's decode driver: EP ranks act as data parallel outside MoE layers, TP ranks can fold into EP ranks in MoE layers, micro-batches of ceil(batch / pp), one micro-batch of tokens per pipeline period. - MoE routing: balanced (PerfModel's assumption), random, or DeepStack's qwen3_235b and deepseek_v3 traces, with DeepStack's switch to its closed-form imbalance estimate for large token counts. - JSON NoC profiles; the examples are illustrative values taken from DeepStack's public h200x32 preset and custom_noc.py example. - CLI (describe-noc, estimate), justfile recipes, README and tests that compare collectives with DeepStack's wrappers called directly.
GeorgeWu1204
approved these changes
Oct 25, 2026
GeorgeWu1204
left a comment
Collaborator
There was a problem hiding this comment.
lgtm, approve. Thanks Zhiwen!
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
Adds
analytic_models/distributed: TTFT and decode throughput of a decoder served by several PLENA chips under tensor, expert, data, pipeline and context parallelism. Each chip isPerfModelcompute priced against astacked_drammemory system. The network side is DeepStack's (arXiv:2604.04750): hierarchical NoC topologies and routing, collective algorithms, pipeline transfers, MoE routing statistics and NoC energy. It is vendored as theDeepStackgit submodule (tile-ai/DeepStack at17e21bf) and imported, not copied.a35565acrefactor(stacked_dram)price_stageandPhaseTotals; no behaviour changec7eddbefbuildce1adbcdfeat(analytic)How a layer is costed
On each device a layer is one roofline stage (compute against its DRAM traffic) followed by its collectives (
--comm-overlap none, the default) or overlapped with them (full).llamafollowsllama_model.py, andmoefollowsgpt_oss_model.py(full or sliding-window attention per layer, routed experts, the LM head in prefill).--moe-tp-mode replace, DeepStack'sreplace_only) or keep the experts tensor parallel (keep); pipeline stages holdceil(layers / pp)layers.balanced(PerfModel.mlp_moe's assumption, exact on one device),random, or DeepStack'sqwen3_235banddeepseek_v3traces. As in DeepStack, the busiest rank's load comes from the routed tokens below 4096 micro-batch tokens and from DeepStack's closed-form imbalance estimate above; the all-to-all switches at 8192.ceil(batch / pp)sequences. The period is the slowest stage plus one stage-to-stage transfer. TTFT is one micro-batch's prefill through every stage plus its first decode step, TPS is one micro-batch of tokens per period, and per-sequence TPS is one token everyppperiods (DeepStack's utps).git submodule update --init DeepStack just distributed-describe-noc analytic_models/distributed/examples/illustrative_gpu_cluster_32.json just distributed-estimate llama-3.1-70b analytic_models/distributed/examples/illustrative_gpu_cluster_32.json \ --profile analytic_models/stacked_dram/examples/fictional_stacked_dram.json --tp 8 --pp 4 just distributed-estimate gpt-oss-20b analytic_models/distributed/examples/illustrative_gpu_node_8.json \ --fixed-bandwidth-gbs 1000 --tp 2 --ep 4 --routing random just test-distributedValidation
stacked_dram.estimate_decoder_latencyexactly (three memories, LM head on and off) and, with unbounded bandwidth,llama_model.pyandgpt_oss_model.py(relative error ≤ 2.2e-16).ruff format --check .andruff check .pass with the locked ruff.Modeling choices worth a look
pp − 1transfers. DeepStack multiplies one stage time bypp, which counts one more transfer.--include-lm-headis given.Notes
import analytic_modelsdoes not need the submodule;analytic_models.distributeddoes (git submodule update --init DeepStack, orPLENA_DEEPSTACK_ROOTfor another checkout). The import shim loads DeepStack source modules only and fails if any of DeepStack's bundled reference binaries gets loaded.h200x32GPU preset and two itsexamples/custom_noc.py, all with DeepStack's example energy coefficients; none describes PLENA hardware.main:b7adc20keeps switch instances apart in all-switch hierarchies, and17e21bfimplementsall_gather_wrapper.main, so it runs here once this PR is retargeted.