feat: Empty Block Complementing#343
Conversation
Greptile SummaryThis PR implements empty-block complementing for Slurm block topology: when an accelerator domain spans more hosts than
Confidence Score: 4/5Safe to merge for all current production code paths; the logic gap is not reachable through today's call sites but leaves the stated safety invariant incompletely enforced. The pkg/translate/block_complement.go — specifically Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["complementBlocks(blocks, blockSizes)"] --> B{"fanoutsPerLevel OK\n& nt.domains != nil?"}
B -- No --> Z["return original blocks"]
B -- Yes --> C["domainsForBlocks:\nfilter to partition-owned nodes"]
C --> D{"len(domains) == 0?"}
D -- Yes --> Z
D -- No --> E["groupSizeFromDomains:\ncompute 2^n padding factor"]
E --> F["packDomainsIntoBaseBlocks:\nsplit each domain into base blocks\npad to multiple of groupSize"]
F --> G["expandFanoutsForCapacity:\ngrow last fanout tier until\ntree fits len(packed)"]
G --> H["buildAggregateShape +\nmergeBaseBlocksIntoTree"]
H --> I{"len(packed) == len(blocks)?"}
I -- Yes: no splits/padding --> J["required = len(packed)"]
I -- No: splits or missing domains --> K["required = totalBaseBlockSlots"]
J & K --> L["blocksFromShapedTree(tree, byName, required)"]
L --> M["shouldUseComplementedBlocks(input, out)"]
M -- "len(out) < len(input)" --> Z
M -- "hasEmptyBlockSlots(out)" --> N["return complemented out"]
M -- "len(out) > len(input)" --> N
M -- else --> Z
Reviews (12): Last reviewed commit: "feat: Empty Block Complementing" | Re-trigger Greptile |
91ad1ef to
c122256
Compare
f048cb8 to
eb4d16a
Compare
77b28c3 to
dba4934
Compare
Signed-off-by: Ravi Shankar <ravish@nvidia.com>
dba4934 to
7f30438
Compare
Description
Empty Block Complementing for Slurm Block Topology.
Checklist
git commit -s).