Skip to content

Commit

Permalink
RVV: ShuffleChannel make C906 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
thelastlin committed Aug 22, 2023
1 parent 1f1fe44 commit b0ff625
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/layer/riscv/shufflechannel_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,22 @@ int ShuffleChannel_riscv::forward(const Mat& bottom_blob, Mat& top_blob, const O
// handle the last channel
{
size_t vl = vsetvl_e32m2(packn * 2);
#if C906
index_c906[0] = 0;
index_c906[2] = 1;
index_c906[4] = 2;
index_c906[6] = 3;
index_c906[1] = 4;
index_c906[3] = 5;
index_c906[5] = 6;
index_c906[7] = 7;
vuint32m2_t _idx = vle32_v_u32m2(index_c906, vl);
#else
vbool16_t _mask = vlm_v_b16(bitmask, vl);
vuint32m2_t _idx = viota_m_u32m2(_mask, vl);
vuint32m2_t _idx_shifted = vslideup_vx_u32m2(vundefined_u32m2(), vadd_vx_u32m2_m(_mask, vundefined_u32m2(), _idx, packn, vl), 1, vl);
_idx = vmerge_vvm_u32m2(_mask, _idx_shifted, _idx, vl);
#endif

const float* ptr0 = bottom_blob.channel(channels_per_group);
const float* ptr1 = bottom_blob.channel(channels_per_group + channels_per_group);
Expand Down

0 comments on commit b0ff625

Please sign in to comment.