@@ -46,18 +46,19 @@ class TypeDescription:
4646 If astype['x'] is 'y', uses PyUFunc_x_x_As_y_y/PyUFunc_xx_x_As_yy_y
4747 instead of PyUFunc_x_x/PyUFunc_xx_x.
4848 cfunc_alias : str or none, optional
49- replaces the suffix of C function name instead of using ufunc_name,
50- e.g. "FLOAT_{cfunc_alias}" instead of "FLOAT_{ufunc_name}" (see make_arrays)
49+ appended to inner loop C function name, e.g. FLOAT_{cfunc_alias} (see make_arrays)
5150 NOTE: it doesn't support 'astype'
5251 simd: list
5352 Available SIMD ufunc loops, dispatched at runtime in specified order
5453 Currently only supported for simples types (see make_arrays)
5554 dispatch: str or None, optional
56- Dispatch-able source name without its extension '.dispatch.c' that contains the definition of ufunc,
57- dispatched at runtime depending on the specified targets of the dispatch-able source.
55+ Dispatch-able source name without its extension '.dispatch.c' that
56+ contains the definition of ufunc, dispatched at runtime depending on the
57+ specified targets of the dispatch-able source.
5858 NOTE: it doesn't support 'astype'
5959 """
60- def __init__ (self , type , f = None , in_ = None , out = None , astype = None , cfunc_alias = None , simd = None , dispatch = None ):
60+ def __init__ (self , type , f = None , in_ = None , out = None , astype = None , cfunc_alias = None ,
61+ simd = None , dispatch = None ):
6162 self .type = type
6263 self .func_data = f
6364 if astype is None :
@@ -96,7 +97,8 @@ def build_func_data(types, f):
9697 func_data =
8000
[_fdata_map .get (t , '%s' ) % (f ,) for t in types ]
9798 return func_data
9899
99- def TD (types , f = None , astype = None , in_ = None , out = None , cfunc_alias = None , simd = None , dispatch = None ):
100+ def TD (types , f = None , astype = None , in_ = None , out = None , cfunc_alias = None ,
101+ simd = None , dispatch = None ):
100102 if f is not None :
101103 if isinstance (f , str ):
102104 func_data = build_func_data (types , f )
@@ -132,7 +134,8 @@ def TD(types, f=None, astype=None, in_=None, out=None, cfunc_alias=None, simd=No
132134 else :
133135 dispt = None
134136 tds .append (TypeDescription (
135- t , f = fd , in_ = i , out = o , astype = astype , cfunc_alias = cfunc_alias , simd = simdt , dispatch = dispt
137+ t , f = fd , in_ = i , out = o , astype = astype , cfunc_alias = cfunc_alias ,
138+ simd = simdt , dispatch = dispt
136139 ))
137140 return tds
138141
@@ -287,7 +290,7 @@ def english_upper(s):
287290 Ufunc (2 , 1 , Zero ,
288291 docstrings .get ('numpy.core.umath.add' ),
289292 'PyUFunc_AdditionTypeResolver' ,
290- TD (notimes_or_obj , simd = [('avx512f ' , cmplxvec ),( 'avx2 ' , ints )]),
293+ TD (notimes_or_obj , simd = [('avx2 ' , ints )], dispatch = [( 'loops_arithm_fp ' , 'fdFD' )]),
291294 [TypeDescription ('M' , FullTypeDescr , 'Mm' , 'M' ),
292295 TypeDescription ('m' , FullTypeDescr , 'mm' , 'm' ),
293296 TypeDescription ('M' , FullTypeDescr , 'mM' , 'M' ),
@@ -298,7 +301,7 @@ def english_upper(s):
298301 Ufunc (2 , 1 , None , # Zero is only a unit to the right, not the left
299302 docstrings .get ('numpy.core.umath.subtract' ),
300303 'PyUFunc_SubtractionTypeResolver' ,
301- TD (ints + inexact , simd = [('avx512f ' , cmplxvec ),( 'avx2 ' , ints )]),
304+ TD (ints + inexact , simd = [('avx2 ' , ints )], dispatch = [( 'loops_arithm_fp ' , 'fdFD' )]),
302305 [TypeDescription ('M' , FullTypeDescr , 'Mm' , 'M' ),
303306 TypeDescription ('m' , FullTypeDescr , 'mm' , 'm' ),
304307 TypeDescription ('M' , FullTypeDescr , 'MM' , 'm' ),
@@ -309,7 +312,7 @@ def english_upper(s):
309312 Ufunc (2 , 1 , One ,
310313 docstrings .get ('numpy.core.umath.multiply' ),
311314 'PyUFunc_MultiplicationTypeResolver' ,
312- TD (notimes_or_obj , simd = [('avx512f ' , cmplxvec ),( 'avx2 ' , ints )]),
315+ TD (notimes_or_obj , simd = [('avx2 ' , ints )], dispatch = [( 'loops_arithm_fp ' , 'fdFD' )]),
313316 [TypeDescription ('m' , FullTypeDescr , 'mq' , 'm' ),
314317 TypeDescription ('m' , FullTypeDescr , 'qm' , 'm' ),
315318 TypeDescription ('m' , FullTypeDescr , 'md' , 'm' ),
@@ -333,10 +336,10 @@ def english_upper(s):
333336 Ufunc (2 , 1 , None , # One is only a unit to the right, not the left
334337 docstrings .get ('numpy.core.umath.true_divide' ),
335338 'PyUFunc_TrueDivisionTypeResolver' ,
336- TD (flts + cmplx ),
337- [TypeDescription ('m' , FullTypeDescr , 'mq' , 'm' ),
338- TypeDescription ('m' , FullTypeDescr , 'md' , 'm' ),
339- TypeDescription ('m' , FullTypeDescr , 'mm' , 'd' ),
339+ TD (flts + cmplx , cfunc_alias = 'divide' , dispatch = [( 'loops_arithm_fp' , 'fd' )] ),
340+ [TypeDescription ('m' , FullTypeDescr , 'mq' , 'm' , cfunc_alias = 'divide' ),
341+ TypeDescription ('m' , FullTypeDescr , 'md' , 'm' , cfunc_alias = 'divide' ),
342+ TypeDescription ('m' , FullTypeDescr , 'mm' , 'd' , cfunc_alias = 'divide' ),
340343 ],
341344 TD (O , f = 'PyNumber_TrueDivide' ),
342345 ),
0 commit comments