Skip to content

Commit 60bba60

Browse files
etiottowhitneywhtsang
authored andcommitted
Sync test_core.py from upstream
1 parent 2ccc397 commit 60bba60

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

python/test/unit/language/test_core.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,8 @@ def test_atomic_rmw(op, dtype_x_str, mode, sem, device):
16101610
pytest.xfail("Only test atomic bfloat16/float16 ops on GPU")
16111611
if "uint" in dtype_x_str and mode in ["min_neg", "all_neg"]:
16121612
pytest.xfail("uint cannot be negative")
1613+
if is_xpu() and dtype_x_str == 'bfloat16':
1614+
pytest.skip("bfloat16 not yet supported for xpu")
16131615

16141616
n_programs = 5
16151617

@@ -1698,6 +1700,8 @@ def kernel(X):
16981700
for check_return_val in ([True, False] if is_hip() else [True])])
16991701
def test_tensor_atomic_rmw(shape, axis, num_ctas, dtype_x_str, check_return_val, device):
17001702
check_type_supported(dtype_x_str, device)
1703+
if is_xpu() and dtype_x_str == 'bfloat16':
1704+
pytest.skip("bfloat16 not yet supported for xpu")
17011705
shape0, shape1 = shape
17021706
# triton kernel
17031707

@@ -1777,6 +1781,8 @@ def torch_to_triton_dtype(t):
17771781
for dtype_x_str in ['bfloat16', 'float16', 'float32']])
17781782
def test_tensor_atomic_add_non_exclusive_offset(size, num_ctas, dtype_x_str, device):
17791783
check_type_supported(dtype_x_str, device)
1784+
if is_xpu() and dtype_x_str == 'bfloat16':
1785+
pytest.skip("bfloat16 not yet supported for xpu")
17801786

17811787
@triton.jit
17821788
def kernel(X, val, NUM: tl.constexpr):
@@ -1798,9 +1804,11 @@ def kernel(X, val, NUM: tl.constexpr):
17981804
@pytest.mark.parametrize("size, num_ctas, dtype_x_str", [(size, num_ctas, dtype_x_str)
17991805
for size in [2, 4, 8, 32, 64, 128]
18001806
for num_ctas in num_ctas_list
1801-
for dtype_x_str in ['float16', 'float32']])
1807+
for dtype_x_str in ['bfloat16', 'float16', 'float32']])
18021808
def test_tensor_atomic_add_shift_1(size, num_ctas, dtype_x_str, device):
18031809
check_type_supported(dtype_x_str, device)
1810+
if is_xpu() and dtype_x_str == 'bfloat16':
1811+
pytest.skip("bfloat16 not yet supported for xpu")
18041812

18051813
@triton.jit
18061814
def kernel(X, val, NUM: tl.constexpr):
@@ -1837,6 +1845,9 @@ def test_tensor_atomic_add_access_patterns(shape, idx_order, mask_step, num_ctas
18371845
if is_interpreter():
18381846
pytest.xfail("not supported in the interpreter")
18391847

1848+
if is_xpu() and dtype_x_str == 'bfloat16':
1849+
pytest.skip("bfloat16 not yet supported for xpu")
1850+
18401851
@triton.jit
18411852
def kernel(in_ptr, idx_ptr, out_ptr, shape0, shape1, mask_step, XBLOCK: tl.constexpr):
18421853
xoffset = tl.program_id(0) * XBLOCK
@@ -3284,6 +3295,8 @@ def test_reduce_layouts(M, N, src_layout, axis, epilogue_kind, dtype_str, add_ov
32843295
pytest.skip("Skipping because tensor shape is smaller than M(f)maLayout instr_shape")
32853296
if reduce_op == "sum" and dtype_str == "float16" and M * N > 1024:
32863297
pytest.xfail("Skipping sum reduction on float16 due to accuracy issues")
3298+
if isinstance(src_layout, LinearLayout) and THREADS_PER_WARP != (1 << len(src_layout.lane)):
3299+
pytest.xfail(f"Skipping. This LinearLayout assumes {1 << len(src_layout.lane)} threads per warp")
32873300

32883301
if isinstance(src_layout, MmaLayout) and src_layout.version == 3:
32893302
src_layout.instr_shape[2] = 16 if dtype_str == "float16" else 8
@@ -7682,11 +7695,11 @@ def inject_layout(ir, src: torch.Tensor, axis, indices: torch.Tensor, src_layout
76827695
pat += str(axis)
76837696
pat += r" : i32, efficient_layout} : \(tensor\<"
76847697
pat += src_spec
7685-
pat += r", (#[a-z]+[0-9]*)\>, tensor\<"
7698+
pat += r", (#[a-z]+[0-9]+)\>, tensor\<"
76867699
pat += indices_spec
7687-
pat += r", (#[a-z]+[0-9]*)\>\) -> tensor\<"
7700+
pat += r", (#[a-z]+[0-9]+)\>\) -> tensor\<"
76887701
pat += output_spec
7689-
pat += r", (#[a-z]+[0-9]*)\>"
7702+
pat += r", (#[a-z]+[0-9]+)\>"
76907703

76917704
repl = r"""
76927705
%src = ttg.convert_layout \2 : tensor<""" + src_spec + r""", \4> -> tensor<""" + src_spec + r""", #src_layout>

0 commit comments

Comments
 (0)