Skip to content

Commit

Permalink
RVV: replace word_type to size_t (Tencent#4100, Tencent#4118)
Browse files Browse the repository at this point in the history
  • Loading branch information
thelastlin committed Oct 1, 2022
1 parent 41fe53a commit 044dc34
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/layer/riscv/batchnorm_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int BatchNorm_riscv::forward_inplace(Mat& bottom_top_blob, const Option& opt) co
int n = bottom_top_blob.w * elempack;
while (n > 0)
{
word_type vl = vsetvl_e32m8(n);
size_t vl = vsetvl_e32m8(n);

vfloat32m8_t _p = vle32_v_f32m8(ptr, vl);
vfloat32m8_t _a = vle32_v_f32m8(ptr_a, vl);
Expand Down Expand Up @@ -103,7 +103,7 @@ int BatchNorm_riscv::forward_inplace(Mat& bottom_top_blob, const Option& opt) co
int n = w;
while (n > 0)
{
word_type vl = vsetvl_e32m8(n);
size_t vl = vsetvl_e32m8(n);
vfloat32m8_t _p = vle32_v_f32m8(ptr, vl);
_p = vfmul_vf_f32m8(_p, b, vl);
_p = vfadd_vf_f32m8(_p, a, vl);
Expand Down Expand Up @@ -137,7 +137,7 @@ int BatchNorm_riscv::forward_inplace(Mat& bottom_top_blob, const Option& opt) co
int n = size;
while (n > 0)
{
word_type vl = vsetvl_e32m8(n);
size_t vl = vsetvl_e32m8(n);
vfloat32m8_t _p = vle32_v_f32m8(ptr, vl);
_p = vfmul_vf_f32m8(_p, b, vl);
_p = vfadd_vf_f32m8(_p, a, vl);
Expand All @@ -164,7 +164,7 @@ int BatchNorm_riscv::forward_inplace(Mat& bottom_top_blob, const Option& opt) co
int w = bottom_top_blob.w;
int h = bottom_top_blob.h;

const word_type vl = vsetvl_e32m1(packn);
const size_t vl = vsetvl_e32m1(packn);
if (dims == 2)
{
#pragma omp parallel for num_threads(opt.num_threads)
Expand Down Expand Up @@ -237,7 +237,7 @@ int BatchNorm_riscv::forward_inplace_fp16s(Mat& bottom_top_blob, const Option& o
const float* ptr_b = b_data;
while (n > 0)
{
word_type vl = vsetvl_e16m4(n);
size_t vl = vsetvl_e16m4(n);

vfloat32m8_t _p = vfwcvt_f_f_v_f32m8(vle16_v_f16m4(ptr, vl), vl);
vfloat32m8_t _a = vle32_v_f32m8(ptr_a, vl);
Expand Down Expand Up @@ -272,7 +272,7 @@ int BatchNorm_riscv::forward_inplace_fp16s(Mat& bottom_top_blob, const Option& o
int n = w;
while (n > 0)
{
word_type vl = vsetvl_e16m4(n);
size_t vl = vsetvl_e16m4(n);
vfloat32m8_t _p = vfwcvt_f_f_v_f32m8(vle16_v_f16m4(ptr, vl), vl);
_p = vfmul_vf_f32m8(_p, b, vl);
_p = vfadd_vf_f32m8(_p, a, vl);
Expand All @@ -299,7 +299,7 @@ int BatchNorm_riscv::forward_inplace_fp16s(Mat& bottom_top_blob, const Option& o
int n = size;
while (n > 0)
{
word_type vl = vsetvl_e16m4(n);
size_t vl = vsetvl_e16m4(n);
vfloat32m8_t _p = vfwcvt_f_f_v_f32m8(vle16_v_f16m4(ptr, vl), vl);
;
_p = vfmul_vf_f32m8(_p, b, vl);
Expand All @@ -321,7 +321,7 @@ int BatchNorm_riscv::forward_inplace_fp16s(Mat& bottom_top_blob, const Option& o
int w = bottom_top_blob.w;
int h = bottom_top_blob.h;

const word_type vl = vsetvl_e16m1(packn);
const size_t vl = vsetvl_e16m1(packn);
if (dims == 2)
{
#pragma omp parallel for num_threads(opt.num_threads)
Expand Down Expand Up @@ -391,7 +391,7 @@ int BatchNorm_riscv::forward_inplace_fp16sa(Mat& bottom_top_blob, const Option&
const float* ptr_b = b_data;
while (n > 0)
{
word_type vl = vsetvl_e16m4(n);
size_t vl = vsetvl_e16m4(n);

vfloat16m4_t _p = vle16_v_f16m4(ptr, vl);
vfloat16m4_t _a = vfncvt_f_f_w_f16m4(vle32_v_f32m8(ptr_a, vl), vl);
Expand Down Expand Up @@ -426,7 +426,7 @@ int BatchNorm_riscv::forward_inplace_fp16sa(Mat& bottom_top_blob, const Option&
int n = w;
while (n > 0)
{
word_type vl = vsetvl_e16m8(n);
size_t vl = vsetvl_e16m8(n);
vfloat16m8_t _p = vle16_v_f16m8(ptr, vl);
_p = vfmul_vf_f16m8(_p, b, vl);
_p = vfadd_vf_f16m8(_p, a, vl);
Expand All @@ -453,7 +453,7 @@ int BatchNorm_riscv::forward_inplace_fp16sa(Mat& bottom_top_blob, const Option&
int n = size;
while (n > 0)
{
word_type vl = vsetvl_e16m8(n);
size_t vl = vsetvl_e16m8(n);
vfloat16m8_t _p = vle16_v_f16m8(ptr, vl);
;
_p = vfmul_vf_f16m8(_p, b, vl);
Expand All @@ -475,7 +475,7 @@ int BatchNorm_riscv::forward_inplace_fp16sa(Mat& bottom_top_blob, const Option&
int w = bottom_top_blob.w;
int h = bottom_top_blob.h;

const word_type vl = vsetvl_e16m1(packn);
const size_t vl = vsetvl_e16m1(packn);
if (dims == 2)
{
#pragma omp parallel for num_threads(opt.num_threads)
Expand Down

0 comments on commit 044dc34

Please sign in to comment.