1616from .._cext import CallingConvention
1717
1818
19- def cconv_require_tuple_constraint (cconv : CallingConvention , cursor : "_Cursor | None" = None ):
20- if cconv .version < 2 :
21- msg = (f"Tuple parameters ('T' constraint) are not supported by calling convention"
22- f" { cconv .name } ; version >= 2 is required" )
23- raise cursor .make_error (msg ) if cursor is not None else ValueError (msg )
24-
25-
26- def cconv_require_static_shape (cconv : CallingConvention , cursor : "_Cursor | None" = None ):
27- if cconv .version < 2 :
28- msg = (f"Static array shapes ('s' predicate) are not supported by calling convention"
29- f" { cconv .name } ; version >= 2 is required" )
30- raise cursor .make_error (msg ) if cursor is not None else ValueError (msg )
31-
32-
3319def mangle_kernel_name (function_name : str ,
3420 kernel_signature : KernelSignature ) -> str :
3521 alias_group_map , alias_group_names = _map_alias_groups (kernel_signature .parameters )
@@ -158,7 +144,6 @@ def _mangle_constraint(p: ParameterConstraint, alias_group_map: dict[str, int],
158144 assert isinstance (p .element , ArrayConstraint )
159145 return "L" + _mangle_list_constraint (p , alias_group_map , cconv )
160146 elif isinstance (p , TupleConstraint ):
161- cconv_require_tuple_constraint (cconv )
162147 return "T" + _mangle_tuple_constraint (p , alias_group_map , cconv )
163148 elif isinstance (p , ScalarConstraint ):
164149 return "S" + _mangle_dtype (p .dtype )
@@ -186,7 +171,6 @@ def _demangle_constraint(cursor: _Cursor,
186171 elif c == "L" :
187172 return _demangle_list_constraint (cursor , alias_group_demangler , cconv )
188173 elif c == "T" :
189- cconv_require_tuple_constraint (cconv , orig_cursor )
190174 return _demangle_tuple_constraint (cursor , alias_group_demangler , cconv )
191175 elif c == "S" :
192176 dtype = _demangle_dtype (cursor )
@@ -206,8 +190,6 @@ def _demangle_constraint(cursor: _Cursor,
206190def _mangle_array_constraint (a : ArrayConstraint ,
207191 alias_group_map : dict [str , int ],
208192 cconv : CallingConvention ) -> str :
209- if any (v is not None for v in a .shape_constant ):
210- cconv_require_static_shape (cconv )
211193 ret = f"{ a .ndim } { _mangle_dtype (a .dtype )} "
212194
213195 # NOTE: since we encode axis masks as hex, letters a-f can't be used for predicates
@@ -273,10 +255,8 @@ def _demangle_array_constraint(cursor: _Cursor,
273255 raise mask_cursor .make_error (f"Axis mask { axis_mask :x} has more bits"
274256 f" ({ axis_mask .bit_length ()} ) than array ndim ({ ndim } )" )
275257
276- s_cursor = cursor .clone ()
277258 axis_shape_constant = None
278259 if cursor .read ("s" ) is not None :
279- cconv_require_static_shape (cconv , s_cursor )
280260 axis_shape_constant = _demangle_signed_int (cursor )
281261
282262 axis_shape_div_by = 1
0 commit comments