Browse Source

fix build without riscv v ext, third try

tags/20210720
nihuini 5 years ago
parent
commit
63154d6b95
2 changed files with 8 additions and 0 deletions
  1. +4
    -0
      src/layer/riscv/convolution_riscv.cpp
  2. +4
    -0
      src/layer/riscv/convolutiondepthwise_riscv.cpp

+ 4
- 0
src/layer/riscv/convolution_riscv.cpp View File

@@ -65,18 +65,22 @@ int Convolution_riscv::create_pipeline(const Option& opt)
}
#endif

#if __riscv_vector
const int packn = csrr_vlenb() / 4;
#endif

const int maxk = kernel_w * kernel_h;
const int num_input = weight_data_size / maxk / num_output;

int elempack = 1;
int out_elempack = 1;
#if __riscv_vector
if (opt.use_packing_layout)
{
elempack = num_input % packn == 0 ? packn : 1;
out_elempack = num_output % packn == 0 ? packn : 1;
}
#endif

// src = kw-kh-inch-outch
// dst = pb-pa-kw-kh-inch/pa-outch/pb


+ 4
- 0
src/layer/riscv/convolutiondepthwise_riscv.cpp View File

@@ -48,7 +48,9 @@ int ConvolutionDepthWise_riscv::create_pipeline(const Option& opt)
}
#endif

#if __riscv_vector
const int packn = csrr_vlenb() / 4;
#endif

const int maxk = kernel_w * kernel_h;
int channels = (weight_data_size / group) / maxk / (num_output / group) * group;
@@ -57,10 +59,12 @@ int ConvolutionDepthWise_riscv::create_pipeline(const Option& opt)
if (channels == group && group == num_output)
{
int elempack = 1;
#if __riscv_vector
if (opt.use_packing_layout)
{
elempack = channels % packn == 0 ? packn : 1;
}
#endif

#if __riscv_vector
// packn


Loading…
Cancel
Save