main
py 22 lines 663 Bytes
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 import pytest
5 import torch
6
7 from vllm.platforms import current_platform
8 from vllm.v1.worker.workspace import init_workspace_manager, reset_workspace_manager
9
10
11 @pytest.fixture(autouse=True)
12 def _workspace_manager_for_compile_passes(cleanup_fixture):
13 if not current_platform.is_rocm():
14 yield
15 return
16
17 # Release workspace tensors before cleanup_fixture flushes the allocator.
18 reset_workspace_manager()
19 if torch.accelerator.is_available():
20 init_workspace_manager(torch.device(0))
21 yield
22 reset_workspace_manager()