Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions tensorrt_llm/configure/database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from pathlib import Path

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

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.

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"

@anish-shanbhag anish-shanbhag Nov 19, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that in #9104 env_overrides is now a field within LlmArgs, so I don't think we need this as a separate field (it would just be part of config)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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

@fadi-sadi fadi-sadi Nov 20, 2025 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 tensor_parallel_size: 8.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this since it's specific to logging?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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
Loading
Loading