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 TypedAxpy_float16_float__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;
40 void TypedAxpy<float16, float>(
45 AVX2_FMA_DO(TypedAxpy_float16_float, N, a, x, y);
46 AVX_F16C_DO(TypedAxpy_float16_float, N, a, x, y);
47 BASE_DO(TypedAxpy_float16_float, N, a, x, y);
50 void TypedAxpy_uint8_float__base(
53 const std::uint8_t* x,
55 for (
int i = 0; i < N; ++i) {
56 y[i] += (float)(x[i]) * a;
61 void TypedAxpy<std::uint8_t, float>(
64 const std::uint8_t* x,
66 AVX2_FMA_DO(TypedAxpy_uint8_float, N, a, x, y);
67 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 ...