| 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 import envs |
| 8 | from vllm.platforms import current_platform |
| 9 | |
| 10 | |
| 11 | @pytest.fixture(autouse=True) |
| 12 | def skip_unsupported_flashinfer_sampler(): |
| 13 | # CI runs this suite with FlashInfer both explicitly enabled and disabled. |
| 14 | if ( |
| 15 | current_platform.is_cuda() |
| 16 | and envs.is_set("VLLM_USE_FLASHINFER_SAMPLER") |
| 17 | and envs.VLLM_USE_FLASHINFER_SAMPLER |
| 18 | and current_platform.num_compute_units(torch.accelerator.current_device_index()) |
| 19 | <= 16 |
| 20 | ): |
| 21 | pytest.skip("FlashInfer top-k masking requires more than 16 SMs") |