1 #include "caffe2/perfkernels/typed_axpy.h" 2 #include "caffe2/core/types.h" 3 #include "caffe2/perfkernels/common.h" 4 #include "caffe2/utils/cpuid.h" 5 #include "caffe2/utils/math.h" 10 void TypedAxpy<float, float>(
int N,
const float a,
const float* x,
float* y) {
13 math::Axpy<float, CPUContext>(N, a, x, y,
nullptr);
16 void TypedAxpyHalffloat__base(
21 for (
int i = 0; i < N; ++i) {
27 t1.intval = x[i].x & 0x7fff;
32 t1.intval += 0x38000000;
33 t1.intval = (t3 == 0 ? 0 : t1.intval);
35 y[i] += t1.floatval * a;
39 decltype(TypedAxpyHalffloat__base) TypedAxpyHalffloat__avx2_fma;
40 decltype(TypedAxpyHalffloat__base) TypedAxpyHalffloat__avx_f16c;
42 void TypedAxpy<
at::Half,
float>(
47 AVX2_FMA_DO(TypedAxpyHalffloat, N, a, x, y);
48 AVX_F16C_DO(TypedAxpyHalffloat, N, a, x, y);
49 BASE_DO(TypedAxpyHalffloat, N, a, x, y);
52 void TypedAxpy_uint8_float__base(
55 const std::uint8_t* x,
57 for (
int i = 0; i < N; ++i) {
58 y[i] += (float)(x[i]) * a;
62 decltype(TypedAxpy_uint8_float__base) TypedAxpy_uint8_float__avx2_fma;
63 decltype(TypedAxpy_uint8_float__base) TypedAxpy_uint8_float__avx_f16c;
65 void TypedAxpy<
std::uint8_t,
float>(
68 const
std::uint8_t* x,
70 AVX2_FMA_DO(TypedAxpy_uint8_float, N, a, x, y);
71 BASE_DO(TypedAxpy_uint8_float, N, a, x, y);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Flush-To-Zero and Denormals-Are-Zero mode.