@@ -46,18 +46,19 @@ class TypeDescription:
46
46
If astype['x'] is 'y', uses PyUFunc_x_x_As_y_y/PyUFunc_xx_x_As_yy_y
47
47
instead of PyUFunc_x_x/PyUFunc_xx_x.
48
48
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)
51
50
NOTE: it doesn't support 'astype'
52
51
simd: list
53
52
Available SIMD ufunc loops, dispatched at runtime in specified order
54
53
Currently only supported for simples types (see make_arrays)
55
54
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.
58
58
NOTE: it doesn't support 'astype'
59
59
"""
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 ):
61
62
self .type = type
62
63
self .func_data = f
63
64
if astype is None :
@@ -96,7 +97,8 @@ def build_func_data(types, f):
96
97
func_data = [_fdata_map .get (t , '%s' ) % (f ,) for t in types ]
97
98
return func_data
98
99
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 ):
100
102
if f is not None :
101
103
if isinstance (f , str ):
102
104
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
132
134
else :
133
135
dispt = None
134
136
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
136
139
))
137
140
return tds
138
141
@@ -287,7 +290,7 @@ def english_upper(s):
287
290
Ufunc (2 , 1 , Zero ,
288
291
docstrings .get ('numpy.core.umath.add' ),
289
292
'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' )]),
291
294
[TypeDescription ('M' , FullTypeDescr , 'Mm' , 'M' ),
292
295
TypeDescription ('m' , FullTypeDescr , 'mm' , 'm' ),
293
296
TypeDescription ('M' , FullTypeDescr , 'mM' , 'M' ),
@@ -298,7 +301,7 @@ def english_upper(s):
298
301
Ufunc (2 , 1 , None , # Zero is only a unit to the right, not the left
299
302
docstrings .get ('numpy.core.umath.subtract' ),
300
303
'PyUFunc_SubtractionTypeResolver' ,
301
- TD (ints + inexact , simd = [('avx512f ' , cmplxvec ),( 'avx2 ' , ints )]),
304
+ TD (ints + inexact , simd = [('avx2 ' , ints )], dispatch = [( 'loops_arithm_fp ' , 'fdFD' )]),
302
305
[TypeDescription ('M' , FullTypeDescr , 'Mm' , 'M' ),
303
306
TypeDescription ('m' , FullTypeDescr , 'mm' , 'm' ),
304
307
TypeDescription ('M' , FullTypeDescr , 'MM' , 'm' ),
@@ -309,7 +312,7 @@ def english_upper(s):
309
312
Ufunc (2 , 1 , One ,
310
313
docstrings .get ('numpy.core.umath.multiply' ),
311
314
'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' )]),
313
316
[TypeDescription ('m' , FullTypeDescr , 'mq' , 'm' ),
314
317
TypeDescription ('m' , FullTypeDescr , 'qm' , 'm' ),
315
318
TypeDescription ('m' , FullTypeDescr , 'md' , 'm' ),
@@ -333,10 +336,10 @@ def english_upper(s):
333
336
Ufunc (2 , 1 , None , # One is only a unit to the right, not the left
334
337
docstrings .get ('numpy.core.umath.true_divide' ),
335
338
'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' ),
340
343
],
341
344
TD (O , f = 'PyNumber_TrueDivide' ),
342
345
),
0 commit comments