Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Jan 4, 2024
1 parent 90a4ec4 commit 661e347
Show file tree
Hide file tree
Showing 60 changed files with 212 additions and 432 deletions.
4 changes: 4 additions & 0 deletions src/layer/arm/convolution1d_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ int Convolution1D_arm::create_pipeline(const Option& opt)

convolution1d_transform_kernel_packed(weight_data, weight_data_tm, num_input, num_output, kernel_w);

weight_data.release();

return 0;
}

Expand Down Expand Up @@ -237,6 +239,8 @@ int Convolution1D_arm::create_pipeline_bf16s(const Option& /*opt*/)

convolution1d_transform_kernel_packed_bf16s(weight_data, weight_data_tm, num_input, num_output, kernel_w);

weight_data.release();

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions src/layer/arm/convolution1d_arm_asimdhp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ int Convolution1D_arm::create_pipeline_fp16s(const Option& opt)

ncnn::cast_float32_to_float16(bias_data, bias_data_fp16, opt);

weight_data.release();

return 0;
}

Expand Down
37 changes: 9 additions & 28 deletions src/layer/arm/convolution_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ int Convolution_arm::create_pipeline(const Option& opt)

convolution_dilation1->create_pipeline(opt);

weight_data.release();

return 0;
}

Expand Down Expand Up @@ -222,10 +224,7 @@ int Convolution_arm::create_pipeline(const Option& opt)
else
conv3x3s1_winograd23_transform_kernel(weight_data, weight_winograd23_data, num_input, num_output, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -271,10 +270,7 @@ int Convolution_arm::create_pipeline(const Option& opt)
{
convolution_im2col_gemm_transform_kernel(weight_data, weight_sgemm_data, num_input, num_output, kernel_w, kernel_h, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -309,10 +305,7 @@ int Convolution_arm::create_pipeline(const Option& opt)
convolution_transform_kernel_packed(weight_data, weight_data_tm, num_input, num_output, kernel_w, kernel_h);
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -911,10 +904,7 @@ int Convolution_arm::create_pipeline_bf16s(const Option& opt)
else
conv3x3s1_winograd23_transform_kernel(weight_data, weight_winograd23_data, num_input, num_output, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -960,10 +950,7 @@ int Convolution_arm::create_pipeline_bf16s(const Option& opt)
{
convolution_im2col_gemm_transform_kernel_bf16s(weight_data, weight_sgemm_data, num_input, num_output, kernel_w, kernel_h, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand All @@ -984,10 +971,7 @@ int Convolution_arm::create_pipeline_bf16s(const Option& opt)
convolution_transform_kernel_packed_bf16s(weight_data, weight_data_tm, num_input, num_output, kernel_w, kernel_h);
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -1300,10 +1284,7 @@ int Convolution_arm::create_pipeline_int8_arm(const Option& opt)
scale_in_data[p] = scale_in;
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
15 changes: 3 additions & 12 deletions src/layer/arm/convolution_arm_asimdhp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ int Convolution_arm::create_pipeline_fp16s(const Option& opt)
else
conv3x3s1_winograd23_transform_kernel_fp16sa(weight_data, weight_winograd23_data, num_input, num_output, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

if (opt.use_fp16_arithmetic)
{
Expand Down Expand Up @@ -192,10 +189,7 @@ int Convolution_arm::create_pipeline_fp16s(const Option& opt)

ncnn::cast_float32_to_float16(bias_data, bias_data_fp16, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -225,10 +219,7 @@ int Convolution_arm::create_pipeline_fp16s(const Option& opt)
ncnn::cast_float32_to_float16(bias_data, bias_data_fp16, opt);
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
25 changes: 5 additions & 20 deletions src/layer/arm/convolutiondepthwise_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ int ConvolutionDepthWise_arm::create_pipeline(const Option& opt)
ncnn::cast_float32_to_bfloat16(weight_data, weight_data_tm, opt);
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -164,21 +161,15 @@ int ConvolutionDepthWise_arm::create_pipeline(const Option& opt)
}
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}

// group convolution
create_group_ops(opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -1031,21 +1022,15 @@ int ConvolutionDepthWise_arm::create_pipeline_int8_arm(const Option& opt)
weight_data_tm = weight_data;
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}

// group convolution
create_group_ops(opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
10 changes: 2 additions & 8 deletions src/layer/arm/convolutiondepthwise_arm_asimdhp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,15 @@ int ConvolutionDepthWise_arm::create_pipeline_fp16s(const Option& opt)

ncnn::cast_float32_to_float16(bias_data, bias_data_fp16, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}

// group convolution
create_group_ops(opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
10 changes: 2 additions & 8 deletions src/layer/arm/deconvolution_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,7 @@ int Deconvolution_arm::create_pipeline(const Option& opt)
}
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -957,10 +954,7 @@ int Deconvolution_arm::create_pipeline_bf16s(const Option& opt)
}
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
5 changes: 1 addition & 4 deletions src/layer/arm/deconvolution_arm_asimdhp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ int Deconvolution_arm::create_pipeline_fp16s(const Option& opt)

ncnn::cast_float32_to_float16(bias_data, bias_data_fp16, opt);

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
10 changes: 2 additions & 8 deletions src/layer/arm/deconvolutiondepthwise_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ int DeconvolutionDepthWise_arm::create_pipeline(const Option& opt)
ncnn::cast_float32_to_bfloat16(weight_data_transposed, weight_data_tm, opt);
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down Expand Up @@ -193,10 +190,7 @@ int DeconvolutionDepthWise_arm::create_pipeline(const Option& opt)
}
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
5 changes: 1 addition & 4 deletions src/layer/arm/deconvolutiondepthwise_arm_asimdhp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ int DeconvolutionDepthWise_arm::create_pipeline_fp16s(const Option& opt)
}
}

if (opt.lightmode)
{
weight_data.release();
}
weight_data.release();

return 0;
}
Expand Down
30 changes: 6 additions & 24 deletions src/layer/arm/gemm_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4201,10 +4201,7 @@ int Gemm_arm::create_pipeline(const Option& opt)
}
}

if (opt.lightmode)
{
A_data.release();
}
A_data.release();
}

if (constantB)
Expand Down Expand Up @@ -4244,10 +4241,7 @@ int Gemm_arm::create_pipeline(const Option& opt)
}
}

if (opt.lightmode)
{
B_data.release();
}
B_data.release();
}

if (constantC && constant_broadcast_type_C != -1)
Expand Down Expand Up @@ -4277,10 +4271,7 @@ int Gemm_arm::create_pipeline(const Option& opt)
CT_data = C2;
}

if (opt.lightmode)
{
C_data.release();
}
C_data.release();
}

if (constantA || constantB || constantC)
Expand Down Expand Up @@ -4898,10 +4889,7 @@ int Gemm_arm::create_pipeline_bf16s(const Option& opt)
}
}

if (opt.lightmode)
{
A_data.release();
}
A_data.release();
}

if (constantB)
Expand Down Expand Up @@ -4941,10 +4929,7 @@ int Gemm_arm::create_pipeline_bf16s(const Option& opt)
}
}

if (opt.lightmode)
{
B_data.release();
}
B_data.release();
}

if (constantC && constant_broadcast_type_C != -1)
Expand Down Expand Up @@ -4974,10 +4959,7 @@ int Gemm_arm::create_pipeline_bf16s(const Option& opt)
CT_data = C2;
}

if (opt.lightmode)
{
C_data.release();
}
C_data.release();
}

if (constantA || constantB || constantC)
Expand Down
Loading

0 comments on commit 661e347

Please sign in to comment.