@@ -14,23 +14,27 @@ MODES = { | |||||
1: ['RELU', 'ABS', 'NEGATE', 'ACOS', 'ASIN', 'CEIL', 'COS', | 1: ['RELU', 'ABS', 'NEGATE', 'ACOS', 'ASIN', 'CEIL', 'COS', | ||||
'EXP', 'EXPM1', 'FLOOR', 'LOG', 'LOG1P', 'SIGMOID', 'SIN', | 'EXP', 'EXPM1', 'FLOOR', 'LOG', 'LOG1P', 'SIGMOID', 'SIN', | ||||
'TANH', 'FAST_TANH', 'ROUND', 'ERF', 'ERFINV', 'ERFC', | 'TANH', 'FAST_TANH', 'ROUND', 'ERF', 'ERFINV', 'ERFC', | ||||
'ERFCINV', 'H_SWISH', 'SILU', 'GELU'], | |||||
'ERFCINV', 'H_SWISH', 'SILU', 'GELU', 'SINH', 'COSH', | |||||
'ASINH', 'ACOSH', 'ATANH', 'TAN', 'SOFTPLUS', 'RELU6', | |||||
'HSIGMOID', 'LOGSIGMOID', 'SQRT', 'SQUARE', 'SIGN'], | |||||
2: ['ABS_GRAD', 'ADD', 'FLOOR_DIV', 'MAX', 'MIN', 'MOD', 'MUL', | 2: ['ABS_GRAD', 'ADD', 'FLOOR_DIV', 'MAX', 'MIN', 'MOD', 'MUL', | ||||
'SIGMOID_GRAD', 'SUB', 'SWITCH_GT0', 'TANH_GRAD', 'LT', | 'SIGMOID_GRAD', 'SUB', 'SWITCH_GT0', 'TANH_GRAD', 'LT', | ||||
'LEQ', 'EQ', 'FUSE_ADD_RELU', 'TRUE_DIV', 'POW', | 'LEQ', 'EQ', 'FUSE_ADD_RELU', 'TRUE_DIV', 'POW', | ||||
'LOG_SUM_EXP', 'FUSE_ADD_TANH', 'FAST_TANH_GRAD', | 'LOG_SUM_EXP', 'FUSE_ADD_TANH', 'FAST_TANH_GRAD', | ||||
'FUSE_ADD_SIGMOID', 'ATAN2', 'H_SWISH_GRAD', | 'FUSE_ADD_SIGMOID', 'ATAN2', 'H_SWISH_GRAD', | ||||
'FUSE_ADD_H_SWISH', 'SILU_GRAD', 'GELU_GRAD'], | |||||
3: ['COND_LEQ_MOV', 'COND_LT_MOV', 'FUSE_MUL_ADD3'], | |||||
'FUSE_ADD_H_SWISH', 'SILU_GRAD', 'GELU_GRAD', 'PRELU', | |||||
'ASINH_GRAD', 'ACOSH_GRAD', 'ATANH_GRAD', 'SOFTPLUS_GRAD', | |||||
'RELU6_GRAD', 'HSIGMOID_GRAD'], | |||||
3: ['COND_LEQ_MOV', 'COND_LT_MOV', 'FUSE_MUL_ADD3', 'CLIP', 'PRELU_GRAD'], | |||||
} | } | ||||
QINT4_MODES = { | QINT4_MODES = { | ||||
1: ['RELU', 'ABS', 'NEGATE', 'CEIL', 'FLOOR', 'SIGMOID', | 1: ['RELU', 'ABS', 'NEGATE', 'CEIL', 'FLOOR', 'SIGMOID', | ||||
'TANH', 'FAST_TANH', 'ROUND', 'H_SWISH'], | 'TANH', 'FAST_TANH', 'ROUND', 'H_SWISH'], | ||||
2: ['ADD', 'MAX', 'MIN', 'MUL', 'SUB', 'SWITCH_GT0', | |||||
'LT', 'LEQ', 'EQ', 'FUSE_ADD_RELU', 'FUSE_ADD_TANH', | |||||
'FUSE_ADD_SIGMOID', 'FUSE_ADD_H_SWISH'], | |||||
3: ['COND_LEQ_MOV', 'COND_LT_MOV', 'FUSE_MUL_ADD3'], | |||||
2: ['ADD', 'MAX', 'MIN', 'MUL', 'SUB', 'SWITCH_GT0', | |||||
'LT', 'LEQ', 'EQ', 'FUSE_ADD_RELU', 'FUSE_ADD_TANH', | |||||
'FUSE_ADD_SIGMOID', 'FUSE_ADD_H_SWISH', 'PRELU'], | |||||
3: ['COND_LEQ_MOV', 'COND_LT_MOV', 'FUSE_MUL_ADD3', 'CLIP'], | |||||
} | } | ||||
QINT32_MODES = { | QINT32_MODES = { | ||||
@@ -12,23 +12,27 @@ DTYPES = {'dt_int32': ('Int32', 'INT'), | |||||
} | } | ||||
MODES = { | MODES = { | ||||
(1, 'INT'): ['RELU', 'ABS', 'NEGATE'], | |||||
(1, 'INT'): ['RELU', 'ABS', 'NEGATE', 'RELU6', 'SQUARE', 'SIGN'], | |||||
(2, 'INT'): ['ABS_GRAD', 'ADD', 'FLOOR_DIV', 'MAX', 'MIN', 'MOD', 'MUL', | (2, 'INT'): ['ABS_GRAD', 'ADD', 'FLOOR_DIV', 'MAX', 'MIN', 'MOD', 'MUL', | ||||
'SIGMOID_GRAD', 'SUB', 'SWITCH_GT0', 'TANH_GRAD', 'LT', 'LEQ', | 'SIGMOID_GRAD', 'SUB', 'SWITCH_GT0', 'TANH_GRAD', 'LT', 'LEQ', | ||||
'EQ', 'FUSE_ADD_RELU', 'SHL', 'SHR', 'RMULH'], | |||||
(3, 'INT'): ['COND_LEQ_MOV', 'COND_LT_MOV'], | |||||
'EQ', 'FUSE_ADD_RELU', 'SHL', 'SHR', 'RMULH', 'PRELU'], | |||||
(3, 'INT'): ['COND_LEQ_MOV', 'COND_LT_MOV', 'CLIP'], | |||||
(1, 'FLOAT'): ['RELU', 'ABS', 'NEGATE', 'ACOS', 'ASIN', 'CEIL', 'COS', | (1, 'FLOAT'): ['RELU', 'ABS', 'NEGATE', 'ACOS', 'ASIN', 'CEIL', 'COS', | ||||
'EXP', 'EXPM1', 'FLOOR', 'LOG', 'LOG1P', 'SIGMOID', 'SIN', | 'EXP', 'EXPM1', 'FLOOR', 'LOG', 'LOG1P', 'SIGMOID', 'SIN', | ||||
'TANH', 'FAST_TANH', 'ROUND', 'ERF', 'ERFINV', 'ERFC', | 'TANH', 'FAST_TANH', 'ROUND', 'ERF', 'ERFINV', 'ERFC', | ||||
'ERFCINV', 'H_SWISH', 'SILU', 'GELU'], | |||||
'ERFCINV', 'H_SWISH', 'SILU', 'GELU', 'SINH', 'COSH', | |||||
'ASINH', 'ACOSH', 'ATANH', 'TAN', 'SOFTPLUS', 'RELU6', | |||||
'HSIGMOID', 'LOGSIGMOID', 'SQRT', 'SQUARE', 'SIGN'], | |||||
(2, 'FLOAT'): ['ABS_GRAD', 'ADD', 'FLOOR_DIV', 'MAX', 'MIN', 'MOD', 'MUL', | (2, 'FLOAT'): ['ABS_GRAD', 'ADD', 'FLOOR_DIV', 'MAX', 'MIN', 'MOD', 'MUL', | ||||
'SIGMOID_GRAD', 'SUB', 'SWITCH_GT0', 'TANH_GRAD', 'LT', | 'SIGMOID_GRAD', 'SUB', 'SWITCH_GT0', 'TANH_GRAD', 'LT', | ||||
'LEQ', 'EQ', 'FUSE_ADD_RELU', 'TRUE_DIV', 'POW', | 'LEQ', 'EQ', 'FUSE_ADD_RELU', 'TRUE_DIV', 'POW', | ||||
'LOG_SUM_EXP', 'FUSE_ADD_TANH', 'FAST_TANH_GRAD', | 'LOG_SUM_EXP', 'FUSE_ADD_TANH', 'FAST_TANH_GRAD', | ||||
'FUSE_ADD_SIGMOID', 'ATAN2', 'H_SWISH_GRAD', | 'FUSE_ADD_SIGMOID', 'ATAN2', 'H_SWISH_GRAD', | ||||
'FUSE_ADD_H_SWISH', 'SILU_GRAD', 'GELU_GRAD'], | |||||
(3, 'FLOAT'): ['COND_LEQ_MOV', 'COND_LT_MOV', 'FUSE_MUL_ADD3'], | |||||
'FUSE_ADD_H_SWISH', 'SILU_GRAD', 'GELU_GRAD', 'PRELU', | |||||
'ASINH_GRAD', 'ACOSH_GRAD', 'ATANH_GRAD', 'SOFTPLUS_GRAD', | |||||
'RELU6_GRAD', 'HSIGMOID_GRAD'], | |||||
(3, 'FLOAT'): ['COND_LEQ_MOV', 'COND_LT_MOV', 'FUSE_MUL_ADD3', 'CLIP', 'PRELU_GRAD'], | |||||
(1, 'BOOL'): ['NOT'], | (1, 'BOOL'): ['NOT'], | ||||
(2, 'BOOL'): ['AND', 'OR', 'XOR', 'LT', 'LEQ', 'EQ'], | (2, 'BOOL'): ['AND', 'OR', 'XOR', 'LT', 'LEQ', 'EQ'], | ||||
(3, 'BOOL'): [] | (3, 'BOOL'): [] | ||||
@@ -421,9 +421,31 @@ pdef('Elemwise').add_enum( | |||||
Doc('GELU = 58', 'unary: x Phi(x)'), | Doc('GELU = 58', 'unary: x Phi(x)'), | ||||
Doc('GELU_GRAD = 59', 'binary: grad(x Phi(x))'), | Doc('GELU_GRAD = 59', 'binary: grad(x Phi(x))'), | ||||
Doc('COND_LT_MOV = 60', 'ternary: x < y ? z : 0'), | Doc('COND_LT_MOV = 60', 'ternary: x < y ? z : 0'), | ||||
Doc('NEQ = 61', 'binary: x != y'), | |||||
Doc('ISNAN = 62', 'unary: isnan(x)'), | |||||
Doc('ISINF = 63', 'unary: isinf(x)'), | |||||
Doc('SINH = 61', 'unary: sinh(x)'), | |||||
Doc('COSH = 62', 'unary: cosh(x)'), | |||||
Doc('ASINH = 63', 'unary: asinh(x)'), | |||||
Doc('ACOSH = 64', 'unary: acosh(x)'), | |||||
Doc('ATANH = 65', 'unary: atanh(x)'), | |||||
Doc('TAN = 66', 'unary: tan(x)'), | |||||
Doc('ASINH_GRAD = 67', 'binary: y / sqrt(x^2 + 1)'), | |||||
Doc('ACOSH_GRAD = 68', 'binary: y / sqrt(x^2 - 1) (x > 1)'), | |||||
Doc('ATANH_GRAD = 69', 'binary: y / (1 - x^2) (|x| < 1)'), | |||||
Doc('PRELU = 70', 'binary: x > 0 ? x : x * y'), | |||||
Doc('CLIP = 71', 'ternary: x <= y ? y : (x <= z ? x : z)'), | |||||
Doc('PRELU_GRAD = 72', 'ternary: x > 0 ? y : y * z'), | |||||
Doc('SOFTPLUS = 73', 'unary: log(1 + e^x)'), | |||||
Doc('SOFTPLUS_GRAD = 74', 'binary: y * e^x / (1 + e^x)'), | |||||
Doc('RELU6 = 75', 'unary: min(max(0, x), 6)'), | |||||
Doc('RELU6_GRAD = 76', 'binary: x < 0 ? 0 : (x > 6 ? 0 : y)'), | |||||
Doc('HSIGMOID = 77', 'unary: relu6(x + 3) / 6'), | |||||
Doc('HSIGMOID_GRAD = 78', 'binary: x < -3 ? 0 : (x > 3 ? 0 : y / 6)'), | |||||
Doc('LOGSIGMOID = 79', 'unary: -log(1 + e^(-x))'), | |||||
Doc('SQRT = 80', 'unary: x^(1/2)'), | |||||
Doc('SQUARE = 81', 'unary: x^2'), | |||||
Doc('SIGN = 82', 'unary: sgn(x)'), | |||||
Doc('NEQ = 83', 'binary: x != y'), | |||||
Doc('ISNAN = 84', 'unary: isnan(x)'), | |||||
Doc('ISINF = 85', 'unary: isinf(x)'), | |||||
) | ) | ||||
pdef('ElemwiseMultiType').add_enum( | pdef('ElemwiseMultiType').add_enum( | ||||
@@ -25,12 +25,28 @@ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ERFCINV, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(ERFCINV, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(H_SWISH, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(H_SWISH, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(SILU, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(SILU, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(GELU, cb) | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(GELU, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SINH, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(COSH, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ASINH, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ATANH, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(TAN, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(LOGSIGMOID, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SQRT, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define MEGDNN_FOREACH_ELEMWISE_MODE_UNARY_INT(cb) \ | #define MEGDNN_FOREACH_ELEMWISE_MODE_UNARY_INT(cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(RELU, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(RELU, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(ABS, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(ABS, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(NEGATE, cb) | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(NEGATE, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define MEGDNN_FOREACH_ELEMWISE_MODE_BINARY_BOOL(cb) \ | #define MEGDNN_FOREACH_ELEMWISE_MODE_BINARY_BOOL(cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(AND, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(AND, cb) \ | ||||
@@ -66,7 +82,14 @@ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(H_SWISH_GRAD, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(H_SWISH_GRAD, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(FUSE_ADD_H_SWISH, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(FUSE_ADD_H_SWISH, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(SILU_GRAD, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(SILU_GRAD, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(GELU_GRAD, cb) | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(GELU_GRAD, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ASINH_GRAD, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH_GRAD, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(ATANH_GRAD, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS_GRAD, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(RELU6_GRAD, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID_GRAD, cb) | |||||
#define MEGDNN_FOREACH_ELEMWISE_MODE_BINARY_INT(cb) \ | #define MEGDNN_FOREACH_ELEMWISE_MODE_BINARY_INT(cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(ABS_GRAD, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(ABS_GRAD, cb) \ | ||||
@@ -86,15 +109,19 @@ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(FUSE_ADD_RELU, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(FUSE_ADD_RELU, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(SHL, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(SHL, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(SHR, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(SHR, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(RMULH, cb) | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(RMULH, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define MEGDNN_FOREACH_ELEMWISE_MODE_TERNARY_BOOL(cb) | #define MEGDNN_FOREACH_ELEMWISE_MODE_TERNARY_BOOL(cb) | ||||
#define MEGDNN_FOREACH_ELEMWISE_MODE_TERNARY_FLOAT(cb) \ | #define MEGDNN_FOREACH_ELEMWISE_MODE_TERNARY_FLOAT(cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(COND_LEQ_MOV, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(COND_LEQ_MOV, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(COND_LT_MOV, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(COND_LT_MOV, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(FUSE_MUL_ADD3, cb) | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(FUSE_MUL_ADD3, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(PRELU_GRAD, cb) | |||||
#define MEGDNN_FOREACH_ELEMWISE_MODE_TERNARY_INT(cb) \ | #define MEGDNN_FOREACH_ELEMWISE_MODE_TERNARY_INT(cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(COND_LEQ_MOV, cb) \ | MEGDNN_ELEMWISE_MODE_ENABLE(COND_LEQ_MOV, cb) \ | ||||
MEGDNN_ELEMWISE_MODE_ENABLE(COND_LT_MOV, cb) | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(COND_LT_MOV, cb) \ | |||||
MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) |
@@ -154,11 +154,18 @@ struct ElemwiseKern; | |||||
// int and float | // int and float | ||||
DEF_KERN_ALL(NEGATE, -x); | DEF_KERN_ALL(NEGATE, -x); | ||||
DEF_KERN_ALL(SQUARE, x* x); | |||||
#if defined(__HIP_PLATFORM_HCC__) && !defined(__HIP_PLATFORM_NVCC__) | #if defined(__HIP_PLATFORM_HCC__) && !defined(__HIP_PLATFORM_NVCC__) | ||||
DEF_KERN_INT(RELU, x <= ctype(0) ? ctype(0) : x); | DEF_KERN_INT(RELU, x <= ctype(0) ? ctype(0) : x); | ||||
DEF_KERN_INT(RELU6, x <= ctype(0) ? ctype(0) : (x <= ctype(6) ? x : ctype(6))); | |||||
DEF_KERN_INT(SIGN, x < ctype(0) ? ctype(-1) : (x > ctype(0) ? ctype(1) : ctype(0))); | |||||
DEF_KERN_FLOAT(RELU, x <= 0.f ? ctype(0) : x); | DEF_KERN_FLOAT(RELU, x <= 0.f ? ctype(0) : x); | ||||
DEF_KERN_FLOAT(RELU6, x <= 6.f ? ctype(0) : (x <= 6.f ? x : ctype(6))); | |||||
DEF_KERN_FLOAT(SIGN, x < 0.f ? -1.f : (x > 0.f ? 1.f : 0.f)); | |||||
#else | #else | ||||
DEF_KERN_ALL(RELU, x <= ctype(0) ? ctype(0) : x); | DEF_KERN_ALL(RELU, x <= ctype(0) ? ctype(0) : x); | ||||
DEF_KERN_ALL(RELU6, x <= ctype(0) ? ctype(0) : (x <= ctype(6) ? x : ctype(6))); | |||||
DEF_KERN_ALL(SIGN, x < ctype(0) ? ctype(-1) : (x > ctype(0) ? ctype(1) : ctype(0))); | |||||
#endif | #endif | ||||
DEF_KERN_INT(ABS, abs(int(x))); | DEF_KERN_INT(ABS, abs(int(x))); | ||||
// DEF_KERN_INT(ABS, x > ctype(0) ? x : -x); | // DEF_KERN_INT(ABS, x > ctype(0) ? x : -x); | ||||
@@ -186,6 +193,18 @@ DEF_KERN_FLOAT(ERFCINV, erfcinvf(x)); | |||||
DEF_KERN_FLOAT(H_SWISH, x* min(max(x + 3, 0.f), 6.f) * (1.f / 6.f)); | DEF_KERN_FLOAT(H_SWISH, x* min(max(x + 3, 0.f), 6.f) * (1.f / 6.f)); | ||||
DEF_KERN_FLOAT(SILU, x / (expf(-x) + 1.f)); | DEF_KERN_FLOAT(SILU, x / (expf(-x) + 1.f)); | ||||
DEF_KERN_FLOAT(GELU, x* normcdf(x)); | DEF_KERN_FLOAT(GELU, x* normcdf(x)); | ||||
DEF_KERN_FLOAT(SINH, sinhf(x)); | |||||
DEF_KERN_FLOAT(COSH, coshf(x)); | |||||
DEF_KERN_FLOAT(ASINH, asinhf(x)); | |||||
DEF_KERN_FLOAT(ACOSH, acoshf(x)); | |||||
DEF_KERN_FLOAT(ATANH, atanhf(x)); | |||||
DEF_KERN_FLOAT(TAN, tanf(x)); | |||||
DEF_KERN_FLOAT(SOFTPLUS, log1pf(expf(-fabsf(x))) + (x <= ctype(0) ? ctype(0) : x)); | |||||
DEF_KERN_FLOAT( | |||||
HSIGMOID, | |||||
x <= ctype(-3) ? ctype(0) : (x >= ctype(3) ? ctype(1) : ((x + 3.f) / 6.f))); | |||||
DEF_KERN_FLOAT(SQRT, sqrtf(x)); | |||||
DEF_KERN_FLOAT(LOGSIGMOID, -log1pf(expf(-fabsf(x))) + (x >= ctype(0) ? ctype(0) : x)); | |||||
// int only | // int only | ||||
DEF_KERN(dt_bool, NOT, x ^ 1); | DEF_KERN(dt_bool, NOT, x ^ 1); | ||||
@@ -240,6 +259,12 @@ DEF_KERN_FLOAT(FUSE_ADD_RELU, (x + y) <= 0.f ? ctype(0) : (x + y)); | |||||
#else | #else | ||||
DEF_KERN_ALL(FUSE_ADD_RELU, (x + y) <= ctype(0) ? ctype(0) : (x + y)); | DEF_KERN_ALL(FUSE_ADD_RELU, (x + y) <= ctype(0) ? ctype(0) : (x + y)); | ||||
#endif | #endif | ||||
#if defined(__HIP_PLATFORM_HCC__) && !defined(__HIP_PLATFORM_NVCC__) | |||||
DEF_KERN_INT(PRELU, x > ctype(0) ? x : (x * y)); | |||||
DEF_KERN_FLOAT(PRELU, x > 0.f ? x : (x * y)); | |||||
#else | |||||
DEF_KERN_ALL(PRELU, x > ctype(0) ? x : (x * y)); | |||||
#endif | |||||
// float only | // float only | ||||
DEF_KERN_FLOAT(TRUE_DIV, x / y); | DEF_KERN_FLOAT(TRUE_DIV, x / y); | ||||
@@ -259,6 +284,14 @@ DEF_KERN_FLOAT( | |||||
DEF_KERN_FLOAT(FUSE_ADD_H_SWISH, fuse_add_hswish(x, y)); | DEF_KERN_FLOAT(FUSE_ADD_H_SWISH, fuse_add_hswish(x, y)); | ||||
DEF_KERN_FLOAT(SILU_GRAD, silu_grad(x, y)); | DEF_KERN_FLOAT(SILU_GRAD, silu_grad(x, y)); | ||||
DEF_KERN_FLOAT(GELU_GRAD, gelu_grad(x, y)); | DEF_KERN_FLOAT(GELU_GRAD, gelu_grad(x, y)); | ||||
DEF_KERN_FLOAT(ASINH_GRAD, y / sqrt(x * x + 1.f)); | |||||
DEF_KERN_FLOAT(ACOSH_GRAD, y / sqrt(x * x - 1.f)); | |||||
DEF_KERN_FLOAT(ATANH_GRAD, y / (1.f - x * x)); | |||||
DEF_KERN_FLOAT(SOFTPLUS_GRAD, y* expf(x) / (1.f + expf(x))); | |||||
DEF_KERN_FLOAT(RELU6_GRAD, x <= ctype(0) ? ctype(0) : (x >= ctype(6) ? ctype(0) : y)); | |||||
DEF_KERN_FLOAT( | |||||
HSIGMOID_GRAD, | |||||
x <= ctype(-3) ? ctype(0) : (x >= ctype(3) ? ctype(0) : (y / 6.f))); | |||||
#undef KERN_SIG | #undef KERN_SIG | ||||
/* ================== ternary kernels ================== */ | /* ================== ternary kernels ================== */ | ||||
@@ -268,6 +301,8 @@ DEF_KERN_FLOAT(GELU_GRAD, gelu_grad(x, y)); | |||||
DEF_KERN_ALL(COND_LEQ_MOV, x <= y ? z : ctype(0)); | DEF_KERN_ALL(COND_LEQ_MOV, x <= y ? z : ctype(0)); | ||||
DEF_KERN_ALL(COND_LT_MOV, x < y ? z : ctype(0)); | DEF_KERN_ALL(COND_LT_MOV, x < y ? z : ctype(0)); | ||||
DEF_KERN_ALL(FUSE_MUL_ADD3, x* y + z); | DEF_KERN_ALL(FUSE_MUL_ADD3, x* y + z); | ||||
DEF_KERN_ALL(CLIP, x <= y ? y : (x <= z ? x : z)); | |||||
DEF_KERN_FLOAT(PRELU_GRAD, x >= 0.f ? y : (y * z)); | |||||
#undef KERN_SIG | #undef KERN_SIG | ||||
@@ -220,6 +220,28 @@ const ModeTrait& ModeTrait::from_mode(Mode mode) { | |||||
CB_MODE(Mode::GELU); | CB_MODE(Mode::GELU); | ||||
CB_MODE(Mode::GELU_GRAD); | CB_MODE(Mode::GELU_GRAD); | ||||
CB_MODE(Mode::COND_LT_MOV); | CB_MODE(Mode::COND_LT_MOV); | ||||
CB_MODE(Mode::SINH); | |||||
CB_MODE(Mode::COSH); | |||||
CB_MODE(Mode::ASINH); | |||||
CB_MODE(Mode::ACOSH); | |||||
CB_MODE(Mode::ATANH); | |||||
CB_MODE(Mode::TAN); | |||||
CB_MODE(Mode::ASINH_GRAD); | |||||
CB_MODE(Mode::ACOSH_GRAD); | |||||
CB_MODE(Mode::ATANH_GRAD); | |||||
CB_MODE(Mode::PRELU); | |||||
CB_MODE(Mode::PRELU_GRAD); | |||||
CB_MODE(Mode::CLIP); | |||||
CB_MODE(Mode::SOFTPLUS); | |||||
CB_MODE(Mode::SOFTPLUS_GRAD); | |||||
CB_MODE(Mode::RELU6); | |||||
CB_MODE(Mode::RELU6_GRAD); | |||||
CB_MODE(Mode::HSIGMOID); | |||||
CB_MODE(Mode::HSIGMOID_GRAD); | |||||
CB_MODE(Mode::LOGSIGMOID); | |||||
CB_MODE(Mode::SQRT); | |||||
CB_MODE(Mode::SQUARE); | |||||
CB_MODE(Mode::SIGN); | |||||
default: | default: | ||||
megdnn_assert( | megdnn_assert( | ||||
0, | 0, | ||||
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_int16 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_int32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_int8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_uint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(COSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(COSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(COSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(HSIGMOID, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(LOGSIGMOID, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(LOGSIGMOID, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(LOGSIGMOID, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_int16 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_int32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_int8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(PRELU, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_uint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int16 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(RELU6, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_uint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int16 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SIGN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_uint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SOFTPLUS, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQRT, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQRT, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQRT, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int16 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_int8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(SQUARE, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_uint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(TAN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_bfloat16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,7 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#if !MEGDNN_DISABLE_FLOAT16 | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(TAN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float16 | |||||
#include "../kern_impl.inl" | |||||
#endif |
@@ -0,0 +1,5 @@ | |||||
// generated by gen_elemwise_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(TAN, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_CTYPE dt_float32 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ACOSH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ASINH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH_GRAD, cb) | |||||
#define KERN_IMPL_ARITY 2 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(ATANH, cb) | |||||
#define KERN_IMPL_ARITY 1 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_STYPE dt_qint4 | |||||
#define KERN_IMPL_DTYPE dt_qint4 | |||||
#include "../kern_impl_q4.inl" |
@@ -0,0 +1,6 @@ | |||||
// generated by gen_elemwise_multi_type_kern_impls.py | |||||
#define KERN_IMPL_MODE(cb) MEGDNN_ELEMWISE_MODE_ENABLE(CLIP, cb) | |||||
#define KERN_IMPL_ARITY 3 | |||||
#define KERN_IMPL_STYPE dt_qint8 | |||||
#define KERN_IMPL_DTYPE dt_qint8 | |||||
#include "../kern_impl.inl" |