forked from microsoft/triton-shared
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
125 lines (103 loc) · 3.52 KB
/
Copy pathconftest.py
File metadata and controls
125 lines (103 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import pytest
import os
import tempfile
import triton
from triton.backends.triton_shared.driver import CPUDriver
triton.runtime.driver.set_active(CPUDriver())
def empty_decorator(func):
return func
pytest.mark.interpreter = empty_decorator
@pytest.fixture
def device(request):
return "cpu"
# this fixture is used for test_enable_fp_fusion
@pytest.fixture
def fresh_knobs():
from triton._internal_testing import _fresh_knobs_impl
fresh_function, reset_function = _fresh_knobs_impl()
try:
yield fresh_function()
finally:
reset_function()
# this fixture is used for test_trans_4d && test_trans_reshape
@pytest.fixture
def with_allocator():
import triton
from triton.runtime._allocation import NullAllocator
from triton._internal_testing import default_alloc_fn
triton.set_allocator(default_alloc_fn)
try:
yield
finally:
triton.set_allocator(NullAllocator())
core_tests_supported = {
"test_store_eviction_policy",
"test_unary_op",
"test_umulhi",
"test_for_iv",
"test_trans_2d",
"test_math_op",
"test_math_fma_op",
"test_abs",
"test_call",
"test_vectorization",
"test_convert_float16_to_float32",
"test_index1d",
"test_shift_op",
"test_full",
"test_floordiv",
"test_empty_kernel",
"test_if_return",
"test_value_specialization",
"test_propagate_nan",
"test_clamp",
"test_clamp_symmetric",
"test_store_cache_modifier",
"test_permute",
"test_broadcast",
"test_precise_math",
"test_vectorization_hints",
"test_dot",
"test_value_specialization_overflow",
"test_bitwise_op",
"test_const",
"test_unary_math",
"test_dot_mulbroadcasted",
"test_masked_load_scalar",
"test_enable_fp_fusion",
"test_load_cache_modifier",
"test_dot_without_load",
"test_cat",
"test_addptr",
"test_transpose",
"test_trans_4d",
"test_unsplat",
"test_arange",
}
annotations_tests_supported = {
"test_int_annotation",
"test_unknown_annotation",
}
def pytest_collection_modifyitems(config, items):
skip_marker = pytest.mark.skip(reason="CPU backend does not support it yet")
# There is a dependency issue on build machine which breaks bfloat16
skip_marker_bfloat = pytest.mark.skip(reason="bfloat16 linking issue")
skip_marker_tf32 = pytest.mark.skip(reason="tf32 is not supported on CPU")
skip_marker_float8 = pytest.mark.skip(reason="float8 is not supported on CPU")
for item in items:
test_func_name = item.originalname if item.originalname else item.name
test_file = str(item.fspath)
if test_file.endswith("test_core.py") and test_func_name not in core_tests_supported:
item.add_marker(skip_marker)
continue
if test_file.endswith("test_annotations.py") and test_func_name not in annotations_tests_supported:
item.add_marker(skip_marker)
continue
if "parametrize" in item.keywords:
for param_name, param_value in item.callspec.params.items():
if (param_name.startswith('dtype') or param_name.endswith('dtype')) and param_value == 'bfloat16':
item.add_marker(skip_marker_bfloat)
if param_name.startswith('input_precision') and param_value.startswith('tf32'):
item.add_marker(skip_marker_tf32)
if (param_name.startswith('dtype') or param_name.endswith('dtype')) and ('float8' in str(param_value)):
item.add_marker(skip_marker_float8)