Skip to content

Commit 0a35667

Browse files
Nicoshevmeta-codesync[bot]
authored andcommitted
Fix build break (#5076)
Summary: X-link: https://github.com/facebookresearch/FBGEMM/pull/2081 Pull Request resolved: #5076 D85603930 removed AVX from aarch64 compilation, and broke Sigrid build. Proposed changes fix the build break. There is an fbgemm routine without ref implementation, so we need to implement a NEON port at a later diff. For now, four AVX2 files are compiled with the NEON package Reviewed By: YifanYuan3 Differential Revision: D85918535 fbshipit-source-id: 3a9892535046a0edc05c8c1fccbb0dac8ca8de35
1 parent 44d0f95 commit 0a35667

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

include/fbgemm/Fbgemm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ class FBGEMM_API PackWeightsForConv {
616616
return W_im2col_packed_;
617617
}
618618

619-
#if !defined(__aarch64__)
619+
#if defined(FBGEMM_FBCODE) || !defined(__aarch64__)
620620
std::shared_ptr<PackedDepthWiseConvMatrix> getPackedWForDepthwise() {
621621
return W_dw_packed_;
622622
}
@@ -672,7 +672,7 @@ class FBGEMM_API PackWeightsForConv {
672672
const conv_param_t<SPATIAL_DIM> conv_param_;
673673
// Packed weights if we use im2col based convolution implementation
674674
std::shared_ptr<PackBMatrix<T, accT>> W_im2col_packed_;
675-
#if !defined(__aarch64__)
675+
#if defined(FBGEMM_FBCODE) || !defined(__aarch64__)
676676
// Packed weights if we use depthwise convolution implementation
677677
std::shared_ptr<PackedDepthWiseConvMatrix> W_dw_packed_;
678678
#endif // __aarch64__

include/fbgemm/FbgemmI8DepthwiseAvx2.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#pragma once
1010

11-
#if !defined(__aarch64__)
12-
1311
#include <cstdint>
1412
#include "fbgemm/ConvUtils.h"
1513
#include "fbgemm/FbgemmBuild.h"
@@ -112,5 +110,3 @@ FBGEMM_API void depthwise_3d_same_pad(
112110
int num_threads = 1);
113111

114112
} // namespace fbgemm
115-
116-
#endif // !defined(__aarch64__)

include/fbgemm/QuantUtilsAvx2.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ void RequantizeAvx2(
9696
int len,
9797
const RequantizationParams& params);
9898

99+
#endif // !defined(__aarch64__)
100+
99101
/// @ingroup fbgemm-quant-utils-avx2
100102
///
101103
/// Requantize with avx2 and bias is fused.
@@ -145,6 +147,8 @@ FBGEMM_API void requantizeForFloatAvx2(
145147
int ld_in,
146148
const requantizationForFloatParams_t& r);
147149

150+
#if !defined(__aarch64__)
151+
148152
template <typename InputType, int BIT_RATE>
149153
void FloatOrHalfToFusedNBitRowwiseQuantizedSBHalfAvx2(
150154
const InputType* input,

src/PackWeightsForConv.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PackWeightsForConv<SPATIAL_DIM, T, accT>::PackWeightsForConv(
2525
// FbgemmConv.cc
2626
switch (ConvFastPath<SPATIAL_DIM, accT>(conv_p)) {
2727
case optimized_conv_t::depthwise: {
28-
#if defined(__aarch64__)
28+
#if !defined(FBGEMM_FBCODE) && defined(__aarch64__)
2929
throw std::runtime_error(
3030
"PackWeightsForConv<SPATIAL_DIM, T, accT>::PackWeightsForConv(): No fallback available for aarch64");
3131
#else
@@ -61,7 +61,7 @@ PackWeightsForConv<SPATIAL_DIM, T, accT>::PackWeightsForConv(
6161
break;
6262
}
6363
case optimized_conv_t::directconv: {
64-
#if defined(__aarch64__)
64+
#if !defined(FBGEMM_FBCODE) && defined(__aarch64__)
6565
throw std::runtime_error(
6666
"PackWeightsForConv<SPATIAL_DIM, T, accT>::PackWeightsForConv(): No fallback available for aarch64");
6767
#else
@@ -98,7 +98,7 @@ PackWeightsForConv<SPATIAL_DIM, T, accT>::PackWeightsForConv(
9898

9999
template <int SPATIAL_DIM, typename T, typename accT>
100100
void PackWeightsForConv<SPATIAL_DIM, T, accT>::unpack(T* origin_buf) {
101-
#if !defined(__aarch64__)
101+
#if defined(FBGEMM_FBCODE) || !defined(__aarch64__)
102102
if (W_dw_packed_) {
103103
W_dw_packed_->unpack(origin_buf);
104104
} else

src/PackWeightsForDirectConv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void fbgemmDirectConv(
239239
return;
240240
}
241241

242-
#if defined(__aarch64__)
242+
#if !defined(FBGEMM_FBCODE) && defined(__aarch64__)
243243
throw std::runtime_error(
244244
"fbgemmDirectConv<SPATIAL_DIM, Q_GRAN, FUSE_RELU, BIAS_TYPE>(): No fallback available for aarch64");
245245
#else

src/QuantUtilsAvx2.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ SPECIALIZE_FUSEDDQAVX2(int8_t)
280280

281281
#undef SPECIALIZE_FUSEDDQAVX2
282282

283+
#ifndef __aarch64__
284+
283285
void FindMinMax(const float* m, float* min, float* max, int64_t len) {
284286
if (len <= 0) {
285287
*min = 0.0f;
@@ -317,6 +319,8 @@ void FindMinMax(const float* m, float* min, float* max, int64_t len) {
317319
*max = temp_max;
318320
}
319321

322+
#endif
323+
320324
////////////////////////////////////////////////////////////////////////////////
321325
// Requantization (with floats)
322326

0 commit comments

Comments
 (0)