From f5050489d62e7525c30b5c77b7ee6508de1c2232 Mon Sep 17 00:00:00 2001 From: Hannah Zhang Date: Thu, 16 Oct 2025 10:15:10 -0700 Subject: [PATCH 1/4] fix: json strings should remain intact through profiler arg processing Signed-off-by: Hannah Zhang --- benchmarks/profiler/utils/config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/benchmarks/profiler/utils/config.py b/benchmarks/profiler/utils/config.py index 0250c07fbcbe..936eb2ec3740 100644 --- a/benchmarks/profiler/utils/config.py +++ b/benchmarks/profiler/utils/config.py @@ -125,8 +125,13 @@ def break_arguments(args: list[str] | None) -> list[str]: else: for arg in args: if arg is not None: - # Use shlex.split to properly handle quoted arguments - ans.extend(shlex.split(arg)) + # If the arg looks like it might be JSON (starts with { or [) or is already a single token, + # don't split it further. Only split if it contains spaces AND doesn't look like JSON. + if isinstance(arg, str) and (" " in arg or "\t" in arg) and not (arg.strip().startswith(("{", "["))): + # Use shlex.split to properly handle quoted arguments + ans.extend(shlex.split(arg)) + else: + ans.append(arg) return ans From f180081a616a95f8874c5cb3adddc515b78bc7b2 Mon Sep 17 00:00:00 2001 From: Hannah Zhang Date: Thu, 16 Oct 2025 10:15:37 -0700 Subject: [PATCH 2/4] fix: linting Signed-off-by: Hannah Zhang --- benchmarks/profiler/utils/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/benchmarks/profiler/utils/config.py b/benchmarks/profiler/utils/config.py index 936eb2ec3740..b7097635fd9a 100644 --- a/benchmarks/profiler/utils/config.py +++ b/benchmarks/profiler/utils/config.py @@ -127,7 +127,11 @@ def break_arguments(args: list[str] | None) -> list[str]: if arg is not None: # If the arg looks like it might be JSON (starts with { or [) or is already a single token, # don't split it further. Only split if it contains spaces AND doesn't look like JSON. - if isinstance(arg, str) and (" " in arg or "\t" in arg) and not (arg.strip().startswith(("{", "["))): + if ( + isinstance(arg, str) + and (" " in arg or "\t" in arg) + and not (arg.strip().startswith(("{", "["))) + ): # Use shlex.split to properly handle quoted arguments ans.extend(shlex.split(arg)) else: From 7a57da0453d4dacf1c83adf24387f0defd40831b Mon Sep 17 00:00:00 2001 From: Hannah Zhang Date: Thu, 16 Oct 2025 13:39:42 -0700 Subject: [PATCH 3/4] feat: check for empty kv cache config Signed-off-by: Hannah Zhang --- benchmarks/profiler/utils/config_modifiers/trtllm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/profiler/utils/config_modifiers/trtllm.py b/benchmarks/profiler/utils/config_modifiers/trtllm.py index 3a91bc806feb..fd168428f517 100644 --- a/benchmarks/profiler/utils/config_modifiers/trtllm.py +++ b/benchmarks/profiler/utils/config_modifiers/trtllm.py @@ -95,7 +95,7 @@ def convert_config( # - Disable enable_block_reuse (no KV reuse for prefill-only) # - Enable overlap scheduler (disabled in prefill.yaml but needed for agg) # - Remove cache_transceiver_config (not needed in agg mode) - if "kv_cache_config" not in override_dict: + if "kv_cache_config" not in override_dict or not isinstance(override_dict["kv_cache_config"], dict): override_dict["kv_cache_config"] = {} override_dict["kv_cache_config"]["enable_block_reuse"] = False override_dict[ @@ -146,7 +146,7 @@ def convert_config( # Merge our overrides for converting decode-only disagg to aggregated: # - Enable enable_block_reuse (to skip prefill in decode-only) # - Remove cache_transceiver_config (not needed in agg mode) - if "kv_cache_config" not in override_dict: + if "kv_cache_config" not in override_dict or not isinstance(override_dict["kv_cache_config"], dict): override_dict["kv_cache_config"] = {} override_dict["kv_cache_config"]["enable_block_reuse"] = True override_dict[ From bf75958f4be6f73ef168cba70f7ac1f28d08d9bf Mon Sep 17 00:00:00 2001 From: Hannah Zhang Date: Thu, 16 Oct 2025 13:40:24 -0700 Subject: [PATCH 4/4] fix: linting Signed-off-by: Hannah Zhang --- benchmarks/profiler/utils/config_modifiers/trtllm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/benchmarks/profiler/utils/config_modifiers/trtllm.py b/benchmarks/profiler/utils/config_modifiers/trtllm.py index fd168428f517..4fdfc2114d33 100644 --- a/benchmarks/profiler/utils/config_modifiers/trtllm.py +++ b/benchmarks/profiler/utils/config_modifiers/trtllm.py @@ -95,7 +95,9 @@ def convert_config( # - Disable enable_block_reuse (no KV reuse for prefill-only) # - Enable overlap scheduler (disabled in prefill.yaml but needed for agg) # - Remove cache_transceiver_config (not needed in agg mode) - if "kv_cache_config" not in override_dict or not isinstance(override_dict["kv_cache_config"], dict): + if "kv_cache_config" not in override_dict or not isinstance( + override_dict["kv_cache_config"], dict + ): override_dict["kv_cache_config"] = {} override_dict["kv_cache_config"]["enable_block_reuse"] = False override_dict[ @@ -146,7 +148,9 @@ def convert_config( # Merge our overrides for converting decode-only disagg to aggregated: # - Enable enable_block_reuse (to skip prefill in decode-only) # - Remove cache_transceiver_config (not needed in agg mode) - if "kv_cache_config" not in override_dict or not isinstance(override_dict["kv_cache_config"], dict): + if "kv_cache_config" not in override_dict or not isinstance( + override_dict["kv_cache_config"], dict + ): override_dict["kv_cache_config"] = {} override_dict["kv_cache_config"]["enable_block_reuse"] = True override_dict[