main
py 29 lines 965 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 tests.kernels.utils import opcheck
8 from vllm import _custom_ops as ops # noqa: F401
9
10
11 @pytest.mark.skipif(
12 not hasattr(torch.ops._C, "awq_dequantize"),
13 reason="AWQ is not supported on this GPU type.",
14 )
15 def test_awq_dequantize_opcheck(monkeypatch: pytest.MonkeyPatch):
16 with monkeypatch.context() as m:
17 m.setenv("VLLM_USE_TRITON_AWQ", "0")
18 qweight = torch.randint(
19 -2000000000, 2000000000, (8192, 256), device="cuda", dtype=torch.int32
20 )
21 scales = torch.rand((64, 2048), device="cuda", dtype=torch.float16)
22 zeros = torch.empty((64, 256), device="cuda", dtype=torch.int32)
23 split_k_iters = 0
24 thx = 0
25 thy = 0
26 opcheck(
27 torch.ops._C.awq_dequantize,
28 (qweight, scales, zeros, split_k_iters, thx, thy),
29 )