File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -452,11 +452,13 @@ def test_init_profiler_enabled(
452
452
mock_logger ,
453
453
mock_envs_vllm ,
454
454
):
455
- """Test _init_profiler method - profiler enabled case"""
455
+ """Test _init_profiler method - profiler enabled case with stack and memory profiling enabled """
456
456
from vllm_ascend .worker .worker_v1 import NPUWorker
457
457
458
458
# Set environment variables to enable profiler
459
459
mock_envs_vllm .VLLM_TORCH_PROFILER_DIR = "/path/to/traces"
460
+ mock_envs_vllm .VLLM_TORCH_PROFILER_WITH_STACK = True
461
+ mock_envs_vllm .VLLM_TORCH_PROFILER_WITH_PROFILE_MEMORY = True
460
462
461
463
# Set enum mocks
462
464
mock_export_type .Text = "Text"
@@ -516,8 +518,8 @@ def test_init_profiler_enabled(
516
518
# Verify profiler parameters
517
519
expected_activities = ["CPU" , "NPU" ]
518
520
self .assertEqual (profile_kwargs ["activities" ], expected_activities )
519
- self .assertFalse (profile_kwargs ["with_stack" ])
520
- self .assertFalse (profile_kwargs ["profile_memory" ])
521
+ self .assertTrue (profile_kwargs ["with_stack" ])
522
+ self .assertTrue (profile_kwargs ["profile_memory" ])
521
523
self .assertFalse (profile_kwargs ["with_modules" ])
522
524
self .assertEqual (profile_kwargs ["experimental_config" ],
523
525
mock_experimental_config_instance )
Original file line number Diff line number Diff line change @@ -336,8 +336,9 @@ def _init_profiler(self):
336
336
torch_npu .profiler .ProfilerActivity .CPU ,
337
337
torch_npu .profiler .ProfilerActivity .NPU ,
338
338
],
339
- with_stack = False ,
340
- profile_memory = False ,
339
+ with_stack = envs_vllm .VLLM_TORCH_PROFILER_WITH_STACK ,
340
+ profile_memory = envs_vllm .\
341
+ VLLM_TORCH_PROFILER_WITH_PROFILE_MEMORY ,
341
342
with_modules = False ,
342
343
experimental_config = experimental_config ,
343
344
on_trace_ready = torch_npu .profiler .tensorboard_trace_handler (
@@ -352,4 +353,4 @@ def get_supported_tasks(self) -> "tuple[SupportedTask, ...]":
352
353
return self .model_runner .get_supported_tasks ()
353
354
354
355
def take_draft_token_ids (self ) -> Optional [DraftTokenIds ]:
355
- return self .model_runner .take_draft_token_ids ()
356
+ return self .model_runner .take_draft_token_ids ()
You can’t perform that action at this time.
0 commit comments