forked from NVIDIA/NeMo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into auto_cudagraph
- Loading branch information
Showing
16 changed files
with
614 additions
and
71 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Empty file.
73 changes: 73 additions & 0 deletions
73
nemo/collections/llm/recipes/tp_overlap_configs/userbuffers.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class TPOverlapCfg: | ||
pass | ||
|
||
|
||
@dataclass | ||
class PipelineOverlapCfg(TPOverlapCfg): | ||
num_sm: int | ||
cga_size: int | ||
num_splits: int | ||
set_sm_margin: bool | ||
fp8_buf: bool = (False,) | ||
method: str = 'pipeline' | ||
|
||
|
||
@dataclass | ||
class RingExchangeOverlapCfg(TPOverlapCfg): | ||
aggregate: bool = False | ||
method: str = 'ring_exchange' | ||
|
||
|
||
@dataclass | ||
class BulkOverlapCfg(TPOverlapCfg): | ||
num_sm: int | ||
cga_size: int | ||
set_sm_margin: bool | ||
method: str = 'bulk' | ||
|
||
|
||
@dataclass | ||
class TransformerLayerTPOverlapCfg: | ||
qkv_dgrad: TPOverlapCfg | ||
qkv_wgrad: TPOverlapCfg | ||
fc1_dgrad: TPOverlapCfg | ||
fc1_wgrad: TPOverlapCfg | ||
qkv_fprop: TPOverlapCfg | ||
proj_dgrad: TPOverlapCfg | ||
fc1_fprop: TPOverlapCfg | ||
fc2_dgrad: TPOverlapCfg | ||
proj_fprop: TPOverlapCfg | ||
fc2_fprop: TPOverlapCfg | ||
|
||
|
||
# TODO: Add more configs and create a getter function for expose a single api | ||
# Model configs: H100/70B/TP8/MBS1/SeqLen8K | ||
userbuffers_bf16_h100_h8192_tp4_mbs1_seqlen8192 = TransformerLayerTPOverlapCfg( | ||
qkv_dgrad=BulkOverlapCfg(num_sm=4, cga_size=2, set_sm_margin=False), | ||
qkv_wgrad=BulkOverlapCfg(num_sm=24, cga_size=2, set_sm_margin=False), | ||
fc1_dgrad=BulkOverlapCfg(num_sm=2, cga_size=2, set_sm_margin=False), | ||
fc1_wgrad=BulkOverlapCfg(num_sm=4, cga_size=2, set_sm_margin=False), | ||
qkv_fprop=RingExchangeOverlapCfg(aggregate=False), | ||
proj_dgrad=RingExchangeOverlapCfg(aggregate=False), | ||
fc1_fprop=RingExchangeOverlapCfg(aggregate=False), | ||
fc2_dgrad=RingExchangeOverlapCfg(aggregate=False), | ||
proj_fprop=PipelineOverlapCfg(num_sm=24, cga_size=2, num_splits=4, set_sm_margin=True), | ||
fc2_fprop=PipelineOverlapCfg(num_sm=16, cga_size=2, num_splits=4, set_sm_margin=True), | ||
) | ||
|
||
userbuffers_fp8_h100_h8192_tp4_mbs1_seqlen8192 = TransformerLayerTPOverlapCfg( | ||
qkv_dgrad=BulkOverlapCfg(num_sm=4, cga_size=2, set_sm_margin=False), | ||
qkv_wgrad=BulkOverlapCfg(num_sm=24, cga_size=2, set_sm_margin=False), | ||
fc1_dgrad=BulkOverlapCfg(num_sm=2, cga_size=2, set_sm_margin=False), | ||
fc1_wgrad=BulkOverlapCfg(num_sm=4, cga_size=2, set_sm_margin=False), | ||
qkv_fprop=RingExchangeOverlapCfg(aggregate=False), | ||
proj_dgrad=RingExchangeOverlapCfg(aggregate=False), | ||
fc1_fprop=RingExchangeOverlapCfg(aggregate=False), | ||
fc2_dgrad=RingExchangeOverlapCfg(aggregate=False), | ||
proj_fprop=PipelineOverlapCfg(num_sm=24, cga_size=2, num_splits=4, set_sm_margin=True, fp8_buf=True), | ||
fc2_fprop=PipelineOverlapCfg(num_sm=16, cga_size=2, num_splits=4, set_sm_margin=True, fp8_buf=True), | ||
) |
This file contains 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
Oops, something went wrong.