- const vec_t in = input_vector[j];
-
- vec_add_dpbusd_32(sum0, in, row0[j]);
+ constexpr IndexType NumChunks = PaddedInputDimensions / SimdWidth;
+ const auto inputVector256 = reinterpret_cast<const __m256i*>(input);
+
+ __m256i sum0 = _mm256_setzero_si256();
+ const auto row0 = reinterpret_cast<const __m256i*>(&weights[0]);
+
+ for (int j = 0; j < (int)NumChunks; ++j)
+ {
+ const __m256i in = inputVector256[j];
+ m256_add_dpbusd_epi32(sum0, in, row0[j]);
+ }
+ output[0] = m256_hadd(sum0, biases[0]);
+ }
+ else
+#endif
+ {
+#if defined (USE_AVX512)
+ constexpr IndexType NumChunks = PaddedInputDimensions / (SimdWidth * 2);
+#else
+ constexpr IndexType NumChunks = PaddedInputDimensions / SimdWidth;
+#endif
+ vec_t sum0 = vec_setzero();
+ const auto row0 = reinterpret_cast<const vec_t*>(&weights[0]);
+
+ for (int j = 0; j < (int)NumChunks; ++j)
+ {
+ const vec_t in = inputVector[j];
+ vec_add_dpbusd_32(sum0, in, row0[j]);
+ }
+ output[0] = vec_hadd(sum0, biases[0]);