2424from triton .experimental .tle .language .gpu .semantic import TLESemanticError , TLESemantic
2525import triton ._C .libtriton as libtriton
2626
27+
2728@triton .jit
2829def _encoding_frontend_kernel (layout : tl .constexpr ):
2930 x = tl .arange (0 , 128 )
@@ -42,8 +43,10 @@ def _dot_encoding_frontend_kernel(
4243 acc = tle .gpu .set_layout (tl .zeros ((32 , 8 ), tl .float32 ), mma_layout )
4344 result = tl .dot (lhs , rhs , acc = acc , out_dtype = tl .float32 ) # noqa: F841
4445
46+
4547_HAS_TLE_EXPLICIT_LAYOUT = hasattr (libtriton .ir .builder , "ensure_ttg_layout_attrs" )
4648
49+
4750def _cuda_backend_available ():
4851 from triton .compiler .compiler import get_backend
4952 try :
@@ -52,6 +55,7 @@ def _cuda_backend_available():
5255 except Exception :
5356 return False
5457
58+
5559class TestLayoutEncoding :
5660 """Test layout encoding"""
5761
@@ -70,7 +74,7 @@ def test_swizzled_shared_layout_permute(self):
7074 # Original order for 3D rank is [2, 1, 0]
7175 # Permuting with [1, 0, 2] gives: order[1], order[0], order[2] = [1, 2, 0]
7276 assert permuted .order == (1 , 2 , 0 )
73-
77+
7478 @pytest .mark .skipif (not _HAS_TLE_EXPLICIT_LAYOUT , reason = "requires __TLE__ build" )
7579 @pytest .mark .skipif (not _cuda_backend_available (), reason = "requires cuda backend" )
7680 def test_explicit_distributed_encoding_frontend (self ):
@@ -87,7 +91,7 @@ def test_explicit_distributed_encoding_frontend(self):
8791 assert "tle.gpu.set_layout" in ir
8892 assert "ttg.convert_layout" not in ir
8993 assert "#ttg.slice<{dim = 0, parent = #blocked}>" in ir
90-
94+
9195 @pytest .mark .skipif (not _HAS_TLE_EXPLICIT_LAYOUT , reason = "requires __TLE__ build" )
9296 @pytest .mark .skipif (not _cuda_backend_available (), reason = "requires cuda backend" )
9397 def test_explicit_dot_operand_encoding_frontend (self ):
0 commit comments