| 111 | } |
| 112 | |
| 113 | float NFloat16Ops::DotProductOnFloatAuto(const float* f32, const TFloat16* f16, size_t len) { |
| 114 | Y_ASSERT(size_t(f16) % Float16BufferAlignmentRequirementInBytes == 0); |
| 115 | Y_ASSERT(size_t(f32) % Float32BufferAlignmentRequirementInBytes == 0); |
| 116 | |
| 117 | if (AreIntrinsicsAvailableOnHost()) { |
| 118 | return DotProductOnFloatIntrisincs(f32, f16, len); |
| 119 | } |
| 120 | float res = 0; |
| 121 | while(len > 0) { |
| 122 | res += (*f32) * f16->AsFloat(); |
| 123 | f32 += 1; |
| 124 | f16 += 1; |
| 125 | len -= 1; |
| 126 | } |
| 127 | return res; |
| 128 | } |
| 129 | |
| 130 | template <> |
| 131 | void Out<TFloat16>(IOutputStream& out, typename TTypeTraits<TFloat16>::TFuncParam value) { |