Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Fix threshold skipping if flg = -1 #917

Merged
merged 5 commits into from
Mar 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void QuantizedConv2DTiling(const tiling_input_t& input,
if (p.thresholds != nullptr) {
#define LOAD_TH(k) \
const auto ts##k = vld4q_s16(p.thresholds + NUM_OF_A2W1_THRESHOLD * (out_ch_high * OutChUnroll2 + Om + 8 * k)); \
const auto is_neg##k = vreinterpretq_s16_u16(vcltq_s16(ts##k.val[3], vdupq_n_s16(0))); \
const auto mask##k = vreinterpretq_s16_u16(0x0003 & vcltq_s16(ts##k.val[3], vdupq_n_s16(0))); \
const auto m2_##k = vsubq_s16(ts##k.val[3], vdupq_n_s16(2)); \
const auto is_const##k = vcgeq_s16(m2_##k, vdupq_n_s16(0));
LOAD_TH(0)
Expand All @@ -292,11 +292,11 @@ void QuantizedConv2DTiling(const tiling_input_t& input,
if (col_high + col >= out_width) break;
#define APPLY(k) \
const auto d##k = vld1q_s16(out_tile + buf_index + 8 * k); \
const auto f##k##0 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[0])) & ts##k.val[3]; \
const auto f##k##1 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[1])) & ts##k.val[3]; \
const auto f##k##2 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[2])) & ts##k.val[3]; \
const auto tmp##k = f##k##0 + f##k##1 + f##k##2 + is_neg##k; \
const auto res##k = vreinterpretq_u8_s16(vbslq_s16(is_const##k, m2_##k, tmp##k));
const auto f##k##0 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[0]) & 0x0001u); \
const auto f##k##1 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[1]) & 0x0001u); \
const auto f##k##2 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[2]) & 0x0001u); \
const auto tmp##k = f##k##0 + f##k##1 + f##k##2; \
const auto res##k = vreinterpretq_u8_s16(vbslq_s16(is_const##k, m2_##k, mask##k ^ tmp##k));
const auto buf_index = row * TileWidth * OutChUnroll
+ col * OutChUnroll;
APPLY(0)
Expand Down Expand Up @@ -546,7 +546,7 @@ void QuantizedConv2DTiling(const tiling_input_t& input,
if (p.thresholds != nullptr) {
#define LOAD_TH(k) \
const auto ts##k = vld4q_s16(p.thresholds + NUM_OF_A2W1_THRESHOLD * (out_ch_high * OutChUnroll2 + Om + 8 * k)); \
const auto is_neg##k = vreinterpretq_s16_u16(vcltq_s16(ts##k.val[3], vdupq_n_s16(0))); \
const auto mask##k = vreinterpretq_s16_u16(0x0003 & vcltq_s16(ts##k.val[3], vdupq_n_s16(0))); \
const auto m2_##k = vsubq_s16(ts##k.val[3], vdupq_n_s16(2)); \
const auto is_const##k = vcgeq_s16(m2_##k, vdupq_n_s16(0));
LOAD_TH(0)
Expand All @@ -557,11 +557,11 @@ void QuantizedConv2DTiling(const tiling_input_t& input,
if (col_high + col >= out_width) break;
#define APPLY(k) \
const auto d##k = vld1q_s16(out_tile + buf_index + 8 * k); \
const auto f##k##0 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[0])) & ts##k.val[3]; \
const auto f##k##1 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[1])) & ts##k.val[3]; \
const auto f##k##2 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[2])) & ts##k.val[3]; \
const auto tmp##k = f##k##0 + f##k##1 + f##k##2 + is_neg##k; \
const auto res##k = vreinterpretq_u8_s16(vbslq_s16(is_const##k, m2_##k, tmp##k));
const auto f##k##0 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[0]) & 0x0001u); \
const auto f##k##1 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[1]) & 0x0001u); \
const auto f##k##2 = vreinterpretq_s16_u16(vcgeq_s16(d##k, ts##k.val[2]) & 0x0001u); \
const auto tmp##k = f##k##0 + f##k##1 + f##k##2; \
const auto res##k = vreinterpretq_u8_s16(vbslq_s16(is_const##k, m2_##k, mask##k ^ tmp##k));
const auto buf_index = row * TileWidth * OutChUnroll
+ col * OutChUnroll;
APPLY(0)
Expand Down