Skip to content

Commit

Permalink
minor changes in UniConvTest and GConvTest (#357)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #357

Code refactoring

Reviewed By: dskhudia

Differential Revision: D20983905

fbshipit-source-id: 87aecd966c08e2fae446dd7e1a6c54d82cb34204
  • Loading branch information
jspark1105 authored and facebook-github-bot committed Apr 13, 2020
1 parent 5183b3c commit 15e343c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/PackWeightMatrixForGConv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ inline int PackWeightMatrixForGConv<T, accT, SPATIAL_DIM>::packed_index_(
}

/**
* @ brief Pack or unpack matrix
* @brief Pack or unpack matrix
*
* Let IC_per_G be number of input channels per group and OC_per_G be number of
* output channels per group.
Expand Down
6 changes: 1 addition & 5 deletions src/QuantUtilsAvx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ using namespace std;

// ASAN seems to have a false-positive for _mm_maskmoveu_si128
template <typename T>
void
NO_SANITIZE("address")
QuantizeAvx2(
void NO_SANITIZE("address") QuantizeAvx2(
const float* src,
T* dst,
int len,
Expand Down Expand Up @@ -1083,10 +1081,8 @@ void requantizeOutputProcessingGConvAvx2(
_mm_set1_ps(r.act_times_w_scale[quant_param_idx + 0])),
_mm_set1_ps(r.act_times_w_scale[quant_param_idx + 1]),
1);

} else if (C_PER_G == 8) {
diviser_v = _mm256_set1_ps(r.act_times_w_scale[quant_param_idx]);

} else {
assert(C_PER_G == 16);
diviser_v = _mm256_set1_ps(r.act_times_w_scale[quant_param_idx]);
Expand Down
4 changes: 2 additions & 2 deletions test/GConvTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ void runRequantizeTest(matrix_op_t /* unused */,
// weights
// when btrans == Transpose, the weight matrix is
// in layout G K/G (T R S C/G) instead of G (T R S C/G) K/G
aligned_vector<int8_t> Bint8(T * R * S * conv_p.G * IC_per_G * OC_per_G, 0);
aligned_vector<int8_t> Bint8_tr(T * R * S * G * IC_per_G * OC_per_G, 0);
aligned_vector<int8_t> Bint8(T * R * S * G * IC_per_G * OC_per_G, 0);
aligned_vector<int8_t> Bint8_tr(Bint8.size(), 0);

aligned_vector<int32_t> Cint32_ref(conv_p.MB *OT *OH * OW * OC, 0);
aligned_vector<int32_t> Cint32_fb(Cint32_ref.size(), 0);
Expand Down
7 changes: 3 additions & 4 deletions test/UniConvTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ TEST_P(UniConvQGranTest, requantizeTest) {

// weights
// The weight matrix is in layout G K/G (R S C/G)
aligned_vector<int8_t> Bint8(R * S * conv_p.G * IC_per_G * OC_per_G, 0);
aligned_vector<int8_t> Bint8_tr(R * S * G * IC_per_G * OC_per_G, 0);
aligned_vector<int8_t> Bint8(R * S * G * IC_per_G * OC_per_G, 0);
aligned_vector<int8_t> Bint8_tr(Bint8.size(), 0);

aligned_vector<int32_t> Cint32_ref(conv_p.MB * OH * OW * OC, 0);
aligned_vector<int32_t> Cint32_fb(Cint32_ref.size(), 0);
Expand Down Expand Up @@ -511,9 +511,8 @@ TEST_P(UniConvQGranTest, requantizeTest) {
}
// reference implementation
// conv_ref expects weights to be in G (R S C/G) K/G
int8_t* rightBData = Bint8.data();
transposeConvWeights(conv_p, Bint8.data(), Bint8_tr.data());
rightBData = Bint8_tr.data();
int8_t* rightBData = Bint8_tr.data();
for (int g = 0; g < G; ++g) {
col_offsets_with_zero_pt_s8acc32_ref(
R * S * IC_per_G,
Expand Down

0 comments on commit 15e343c

Please sign in to comment.