Files
wehub-resource-sync 770d92cb1f
Lint / lint (push) Has been cancelled
Build Docs / Deploy Docs (push) Has been cancelled
Windows CI / Windows (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:23:58 +08:00

38 lines
1.1 KiB
Python

import pytest
from tvm.target import Target
from mlc_llm.support.auto_target import _apply_webgpu_subgroups
# test category "unittest"
pytestmark = [pytest.mark.unittest]
def test_apply_webgpu_subgroups_enables_webgpu_target():
target = Target("webgpu")
updated = _apply_webgpu_subgroups(target, True)
assert updated is not target
assert dict(target.export())["supports_subgroups"] is False
assert dict(updated.export())["supports_subgroups"] is True
def test_apply_webgpu_subgroups_non_webgpu_target_is_unchanged():
target = Target("llvm")
updated = _apply_webgpu_subgroups(target, True)
assert updated is target
assert dict(updated.export()) == dict(target.export())
@pytest.mark.parametrize("target_kind", ["webgpu", "llvm"])
@pytest.mark.parametrize("enable_subgroups", [False, None])
def test_apply_webgpu_subgroups_disabled_is_unchanged(target_kind, enable_subgroups):
target = Target(target_kind)
updated = _apply_webgpu_subgroups(target, enable_subgroups)
assert updated is target
assert dict(updated.export()) == dict(target.export())