Skip to content

Commit 2d15bbd

Browse files
enjustlicodex
andcommitted
update
Co-authored-by: Codex <noreply@openai.com>
1 parent eb43a67 commit 2d15bbd

2 files changed

Lines changed: 70 additions & 52 deletions

File tree

python/examples/conftest.py

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@
44
import pytest
55
import os
66
import tempfile
7+
import torch
78
import triton
89
from triton.backends.triton_shared.driver import CPUDriver
910

1011
triton.runtime.driver.set_active(CPUDriver())
1112

13+
if not torch.cuda.is_available():
14+
torch.cuda.get_device_capability = lambda *args, **kwargs: (0, 0)
1215

13-
def empty_decorator(func):
14-
return func
16+
17+
def empty_decorator(func=None, *args, **kwargs):
18+
if func is not None and callable(func):
19+
return func
20+
21+
def decorator(func):
22+
return func
23+
24+
return decorator
1525

1626

1727
pytest.mark.interpreter = empty_decorator
@@ -48,50 +58,49 @@ def with_allocator():
4858
triton.set_allocator(NullAllocator())
4959

5060

51-
core_tests_supported = {
52-
"test_store_eviction_policy",
53-
"test_unary_op",
54-
"test_umulhi",
55-
"test_for_iv",
56-
"test_trans_2d",
57-
"test_math_op",
58-
"test_math_fma_op",
59-
"test_abs",
60-
"test_call",
61-
"test_vectorization",
62-
"test_convert_float16_to_float32",
63-
"test_index1d",
64-
"test_shift_op",
65-
"test_full",
66-
"test_floordiv",
67-
"test_empty_kernel",
68-
"test_if_return",
69-
"test_value_specialization",
70-
"test_propagate_nan",
71-
"test_clamp",
72-
"test_clamp_symmetric",
73-
"test_store_cache_modifier",
74-
"test_permute",
75-
"test_broadcast",
76-
"test_precise_math",
77-
"test_vectorization_hints",
78-
"test_dot",
79-
"test_value_specialization_overflow",
80-
"test_bitwise_op",
81-
"test_const",
82-
"test_unary_math",
83-
"test_dot_mulbroadcasted",
84-
"test_masked_load_scalar",
85-
"test_enable_fp_fusion",
86-
"test_load_cache_modifier",
87-
"test_dot_without_load",
88-
"test_cat",
89-
"test_addptr",
90-
"test_transpose",
91-
"test_trans_4d",
92-
"test_unsplat",
93-
"test_arange",
94-
"test_constexpr",
61+
unsupported_case = {
62+
# 'INT_MIN % -1' run into Floating point exception, which is not handled in x86 CPU
63+
"test_bin_op",
64+
"test_atomic_rmw",
65+
"test_tensor_atomic_rmw",
66+
"test_tensor_atomic_add_non_exclusive_offset",
67+
"test_tensor_atomic_add_shift_1",
68+
"test_tensor_atomic_add_access_patterns",
69+
"test_atomic_cas",
70+
"test_tensor_atomic_cas",
71+
"test_tensor_atomic_use_result",
72+
"test_scaled_dot",
73+
"test_atomic_rmw_predicate",
74+
"test_tensor_atomic_rmw_block",
75+
"test_atomic_min_max_neg_zero",
76+
# do not support launch_cooperative_grid on CPU
77+
"test_load_scope_sem_coop_grid_cta_not_one",
78+
"test_load_scope_sem_coop_grid_cta_one",
79+
# do not support IR CHECK with 'ttgir' on CPU
80+
"test_optimize_thread_locality",
81+
"test_cat_nd",
82+
"test_math_erf_op",
83+
"test_shapes_as_params",
84+
"test_no_rematerialization_op",
85+
"test_generic_reduction",
86+
"test_assume",
87+
"test_pointer_arguments",
88+
"test_num_warps_pow2",
89+
"test_map_elementwise",
90+
"test_map_elementwise_multiple_outputs",
91+
"test_map_elementwise_pack",
92+
"test_reshape",
93+
"test_trans_reshape",
94+
"test_constexpr_if_return",
95+
"test_tl_range_fuse",
96+
"test_gather",
97+
"test_tl_range_fuse_dependent",
98+
"test_tl_range_option_none",
99+
"test_disable_licm",
100+
"test_zero_strided_tensors",
101+
"test_unroll_attr",
102+
"test_tensor_member",
103+
"test_libdevice_rint",
95104
}
96105

97106
annotations_tests_supported = {
@@ -100,18 +109,24 @@ def with_allocator():
100109
}
101110

102111

112+
def _is_float8_dtype(value):
113+
value = str(value)
114+
return "float8" in value or "fp8" in value
115+
116+
103117
def pytest_collection_modifyitems(config, items):
104118
skip_marker = pytest.mark.skip(reason="CPU backend does not support it yet")
105119
# There is a dependency issue on build machine which breaks bfloat16
106120
skip_marker_bfloat = pytest.mark.skip(reason="bfloat16 linking issue")
121+
skip_marker_float16 = pytest.mark.skip(reason="float16 linking issue")
107122
skip_marker_tf32 = pytest.mark.skip(reason="tf32 is not supported on CPU")
108123
skip_marker_float8 = pytest.mark.skip(reason="float8 is not supported on CPU")
109124

110125
for item in items:
111126
test_func_name = item.originalname if item.originalname else item.name
112127

113128
test_file = str(item.fspath)
114-
if test_file.endswith("test_core.py") and test_func_name not in core_tests_supported:
129+
if test_file.endswith("test_core.py") and (test_func_name in unsupported_case):
115130
item.add_marker(skip_marker)
116131
continue
117132

@@ -121,10 +136,13 @@ def pytest_collection_modifyitems(config, items):
121136

122137
if "parametrize" in item.keywords:
123138
for param_name, param_value in item.callspec.params.items():
124-
if (param_name.startswith('dtype') or param_name.endswith('dtype')) and param_value == 'bfloat16':
125-
item.add_marker(skip_marker_bfloat)
139+
if ('dtype' in param_name or param_name == "in_type_str"):
140+
if param_value == 'bfloat16':
141+
item.add_marker(skip_marker_bfloat)
142+
if _is_float8_dtype(param_value):
143+
item.add_marker(skip_marker_float8)
144+
if param_value == 'float16' or param_value == 'fp16':
145+
item.add_marker(skip_marker_float16)
126146
if param_name.startswith('input_precision') and (param_value.startswith('tf32')
127147
or param_value.startswith('bf16')):
128148
item.add_marker(skip_marker_tf32)
129-
if (param_name.startswith('dtype') or param_name.endswith('dtype')) and ('float8' in str(param_value)):
130-
item.add_marker(skip_marker_float8)

test/Conversion/StructuredToMemref/cumsum.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: triton-shared-opt --split-input-file --triton-arith-to-linalg %s | FileCheck %s
1+
// RUN: triton-shared-opt --split-input-file --triton-to-linalg-experimental %s | FileCheck %s
22

33
// @triton.jit
44
// def test_cumsum_op(

0 commit comments

Comments
 (0)