Repository navigation
Draft: [TRTC-1934][feat] Initial SA recipe database. #9272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b7665d3
d427dda
adc08b2
b79365b
414a1c0
f5203b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| from pathlib import Path | ||
| from typing import Any, Dict, Iterator, List, Optional | ||
|
|
||
| import pandas as pd | ||
| import yaml | ||
| from pydantic import BaseModel, Field, RootModel | ||
|
|
||
| DATABASE_LIST_PATH = Path(__file__).parent / "database" / "scenario_list.yaml" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we verified that the full recipe DB is included within the built TRTLLM wheel, meaning reading this path still works when we don't have the full TRTLLM repo stored locally? |
||
|
|
||
|
|
||
| class RecipeConstraints(BaseModel): | ||
| """Recipe record for scenario list.""" | ||
|
|
||
| model: str = Field(description="Model name") | ||
| gpu: str = Field(description="GPU name") | ||
| isl: int = Field(description="Input sequence length") | ||
| osl: int = Field(description="Output sequence length") | ||
| concurrency: int = Field(description="Concurrency") | ||
| config_path: str = Field(description="Configuration path") | ||
| tps_per_user: Optional[int] = Field(description="TPS per user", default=None) | ||
| tps_per_gpu: Optional[int] = Field(description="TPS per GPU", default=None) | ||
| num_gpus: int = Field(description="Number of GPUs") | ||
|
|
||
| def to_pandas_row(self) -> pd.Series: | ||
| """Convert recipe record to pandas Series. | ||
|
|
||
| Returns: | ||
| pd.Series: Pandas Series containing the recipe record. | ||
| """ | ||
| return pd.Series(self.model_dump()) | ||
|
|
||
| def load_config(self) -> Dict[str, Any]: | ||
| """Load configuration from the configuration path.""" | ||
| with open(self.config_path, "r") as f: | ||
| return Recipe(**yaml.load(f, Loader=yaml.FullLoader)) | ||
|
|
||
|
|
||
| class Recipe(BaseModel): | ||
| """Recipe that describes a single scenario.""" | ||
|
|
||
| constraints: RecipeConstraints = Field(description="Recipe constraints") | ||
| env_overrides: Dict[str, Any] = Field(description="Environment overrides", default_factory=dict) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that in #9104
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah -- I saw that. Will modify this to align there. Thanks for keeping track 🙂 |
||
| config: Dict[str, Any] = Field(description="Configuration overrides", default_factory=dict) | ||
|
|
||
|
|
||
| class RecipeList(RootModel[List[RecipeConstraints]]): | ||
| @classmethod | ||
| def from_yaml(cls, yaml_path: Path) -> "RecipeList": | ||
| """Load recipe list from YAML file and validate the data. | ||
|
|
||
| Args: | ||
| yaml_path (Path): Path to the YAML file containing the recipe list. | ||
|
|
||
| Returns: | ||
| RecipeList: Recipe list object. | ||
| """ | ||
| with open(yaml_path, "r") as f: | ||
| data = yaml.load(f, Loader=yaml.FullLoader) | ||
| return cls(data) | ||
|
|
||
| def to_pandas_dataframe(self) -> pd.DataFrame: | ||
| """Convert recipe list to pandas DataFrame. | ||
|
|
||
| Returns: | ||
| pd.DataFrame: Pandas DataFrame where each row contains a recipe record. | ||
| """ | ||
| return pd.DataFrame([record.to_pandas_row() for record in self.root]) | ||
|
|
||
| def __iter__(self) -> Iterator[RecipeConstraints]: | ||
| """Iterate over the recipe list. | ||
|
|
||
| Returns: | ||
| Iterator[RecipeRecord]: Iterator over the recipe list. | ||
| """ | ||
| for record in self.root: | ||
| yield record | ||
|
|
||
| def __len__(self) -> int: | ||
| """Get the number of recipes in the list. | ||
|
|
||
| Returns: | ||
| int: Number of recipes in the list. | ||
| """ | ||
| return len(self.root) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused because based on the filename and the constraint this should have tp=8 but it isn't in the config. The configs should have Also since I already brought it up, maybe we should consider changing the filename format from ..._tp<num_gpus>... to ..._gpus<num_gpus>... since if the constraint says num_gpus=8 theoretically we could be using a different parallelism config other than tp=num_gpus that's at least what I'm doing in !5 |
||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 16 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we remove this since it's specific to logging?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah -- can do. |
||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 32 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 4 | ||
|
|
||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 64 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 8 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 8192 | ||
| target_osl: 1024 | ||
| target_concurrency: 16 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 8192 | ||
| target_osl: 1024 | ||
| target_concurrency: 32 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 8192 | ||
| target_osl: 1024 | ||
| target_concurrency: 4 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 8192 | ||
| target_osl: 1024 | ||
| target_concurrency: 64 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: true | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM | ||
| attention_dp_config: | ||
| batching_wait_iters: 0 | ||
| enable_balance: true | ||
| timeout_iters: 60 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: B200_NVL | ||
| num_gpus: 8 | ||
| target_isl: 8192 | ||
| target_osl: 1024 | ||
| target_concurrency: 8 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 256 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.8 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: DEEPGEMM |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: H200_SXM | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 16 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 128 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.75 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: CUTLASS |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: H200_SXM | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 32 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 128 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.75 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: CUTLASS |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| constraints: | ||
| model: deepseek-ai/DeepSeek-R1-0528 | ||
| gpu: H200_SXM | ||
| num_gpus: 8 | ||
| target_isl: 1024 | ||
| target_osl: 1024 | ||
| target_concurrency: 4 | ||
| env_overrides: | ||
|
|
||
| config: | ||
| cuda_graph_config: | ||
| enable_padding: true | ||
| max_batch_size: 128 | ||
| enable_attention_dp: false | ||
| print_iter_log: true | ||
| kv_cache_config: | ||
| dtype: fp8 | ||
| free_gpu_memory_fraction: 0.75 | ||
| enable_block_reuse: false | ||
| stream_interval: 10 | ||
| moe_config: | ||
| backend: CUTLASS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test to validate that all recipes in the DB are valid, e.g. what @venkywonka had in https://github.com/NVIDIA/TensorRT-LLM/pull/8990/files#diff-4bbcd72bf3493bac466a30030fb7124f2f22ab9952f62936ca04b67c3759c4f8R33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call -- I can add one yeah.