diff --git a/src/layer/arm/convolution1d_arm.cpp b/src/layer/arm/convolution1d_arm.cpp index 1bfb375e1883..26389279b188 100644 --- a/src/layer/arm/convolution1d_arm.cpp +++ b/src/layer/arm/convolution1d_arm.cpp @@ -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; } @@ -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; } diff --git a/src/layer/arm/convolution1d_arm_asimdhp.cpp b/src/layer/arm/convolution1d_arm_asimdhp.cpp index bbbd58830272..2e194eabf21f 100644 --- a/src/layer/arm/convolution1d_arm_asimdhp.cpp +++ b/src/layer/arm/convolution1d_arm_asimdhp.cpp @@ -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; } diff --git a/src/layer/arm/convolution_arm.cpp b/src/layer/arm/convolution_arm.cpp index cfcd28c09f46..f7f04619e9e5 100644 --- a/src/layer/arm/convolution_arm.cpp +++ b/src/layer/arm/convolution_arm.cpp @@ -194,6 +194,8 @@ int Convolution_arm::create_pipeline(const Option& opt) convolution_dilation1->create_pipeline(opt); + weight_data.release(); + return 0; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } diff --git a/src/layer/arm/convolution_arm_asimdhp.cpp b/src/layer/arm/convolution_arm_asimdhp.cpp index 6480aa2e78ad..51ec51675a84 100644 --- a/src/layer/arm/convolution_arm_asimdhp.cpp +++ b/src/layer/arm/convolution_arm_asimdhp.cpp @@ -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) { @@ -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; } @@ -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; } diff --git a/src/layer/arm/convolutiondepthwise_arm.cpp b/src/layer/arm/convolutiondepthwise_arm.cpp index 2ae661650e7f..f9f4a1fdc2d0 100644 --- a/src/layer/arm/convolutiondepthwise_arm.cpp +++ b/src/layer/arm/convolutiondepthwise_arm.cpp @@ -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; } @@ -164,10 +161,7 @@ int ConvolutionDepthWise_arm::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -175,10 +169,7 @@ int ConvolutionDepthWise_arm::create_pipeline(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -1031,10 +1022,7 @@ 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; } @@ -1042,10 +1030,7 @@ int ConvolutionDepthWise_arm::create_pipeline_int8_arm(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/arm/convolutiondepthwise_arm_asimdhp.cpp b/src/layer/arm/convolutiondepthwise_arm_asimdhp.cpp index f7d2cfee84c9..1d5f2782cc19 100644 --- a/src/layer/arm/convolutiondepthwise_arm_asimdhp.cpp +++ b/src/layer/arm/convolutiondepthwise_arm_asimdhp.cpp @@ -76,10 +76,7 @@ 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; } @@ -87,10 +84,7 @@ int ConvolutionDepthWise_arm::create_pipeline_fp16s(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/arm/deconvolution_arm.cpp b/src/layer/arm/deconvolution_arm.cpp index 9061d59eafec..24c825ae2662 100644 --- a/src/layer/arm/deconvolution_arm.cpp +++ b/src/layer/arm/deconvolution_arm.cpp @@ -211,10 +211,7 @@ int Deconvolution_arm::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -957,10 +954,7 @@ int Deconvolution_arm::create_pipeline_bf16s(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/arm/deconvolution_arm_asimdhp.cpp b/src/layer/arm/deconvolution_arm_asimdhp.cpp index a12614b4d97b..b5498d815f3b 100644 --- a/src/layer/arm/deconvolution_arm_asimdhp.cpp +++ b/src/layer/arm/deconvolution_arm_asimdhp.cpp @@ -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; } diff --git a/src/layer/arm/deconvolutiondepthwise_arm.cpp b/src/layer/arm/deconvolutiondepthwise_arm.cpp index 6edd735cb975..4eac426d9de1 100644 --- a/src/layer/arm/deconvolutiondepthwise_arm.cpp +++ b/src/layer/arm/deconvolutiondepthwise_arm.cpp @@ -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; } @@ -193,10 +190,7 @@ int DeconvolutionDepthWise_arm::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/arm/deconvolutiondepthwise_arm_asimdhp.cpp b/src/layer/arm/deconvolutiondepthwise_arm_asimdhp.cpp index e6c636525a49..5fa42d074904 100644 --- a/src/layer/arm/deconvolutiondepthwise_arm_asimdhp.cpp +++ b/src/layer/arm/deconvolutiondepthwise_arm_asimdhp.cpp @@ -145,10 +145,7 @@ int DeconvolutionDepthWise_arm::create_pipeline_fp16s(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/arm/gemm_arm.cpp b/src/layer/arm/gemm_arm.cpp index 2d4ff8734f83..3463550d3d40 100644 --- a/src/layer/arm/gemm_arm.cpp +++ b/src/layer/arm/gemm_arm.cpp @@ -4201,10 +4201,7 @@ int Gemm_arm::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - A_data.release(); - } + A_data.release(); } if (constantB) @@ -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) @@ -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) @@ -4898,10 +4889,7 @@ int Gemm_arm::create_pipeline_bf16s(const Option& opt) } } - if (opt.lightmode) - { - A_data.release(); - } + A_data.release(); } if (constantB) @@ -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) @@ -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) diff --git a/src/layer/arm/gemm_arm_asimdhp.cpp b/src/layer/arm/gemm_arm_asimdhp.cpp index ff840df3b50d..cfe6ce8ce609 100644 --- a/src/layer/arm/gemm_arm_asimdhp.cpp +++ b/src/layer/arm/gemm_arm_asimdhp.cpp @@ -2736,10 +2736,7 @@ int Gemm_arm::create_pipeline_fp16sa(const Option& opt) } } - if (opt.lightmode) - { - A_data.release(); - } + A_data.release(); } if (constantB) @@ -2779,10 +2776,7 @@ int Gemm_arm::create_pipeline_fp16sa(const Option& opt) } } - if (opt.lightmode) - { - B_data.release(); - } + B_data.release(); } if (constantC && constant_broadcast_type_C != -1) @@ -2808,10 +2802,7 @@ int Gemm_arm::create_pipeline_fp16sa(const Option& opt) } } - if (opt.lightmode) - { - C_data.release(); - } + C_data.release(); } if (constantA || constantB || constantC) diff --git a/src/layer/arm/gemm_arm_vfpv4.cpp b/src/layer/arm/gemm_arm_vfpv4.cpp index 3d29af418604..5792e47e9809 100644 --- a/src/layer/arm/gemm_arm_vfpv4.cpp +++ b/src/layer/arm/gemm_arm_vfpv4.cpp @@ -427,10 +427,7 @@ int Gemm_arm::create_pipeline_fp16s(const Option& opt) } } - if (opt.lightmode) - { - A_data.release(); - } + A_data.release(); } if (constantB) @@ -470,10 +467,7 @@ int Gemm_arm::create_pipeline_fp16s(const Option& opt) } } - if (opt.lightmode) - { - B_data.release(); - } + B_data.release(); } if (constantC && constant_broadcast_type_C != -1) @@ -503,10 +497,7 @@ int Gemm_arm::create_pipeline_fp16s(const Option& opt) CT_data = C2; } - if (opt.lightmode) - { - C_data.release(); - } + C_data.release(); } if (constantA || constantB || constantC) diff --git a/src/layer/arm/gru_arm.cpp b/src/layer/arm/gru_arm.cpp index 70df351a5559..58df8275ad5b 100644 --- a/src/layer/arm/gru_arm.cpp +++ b/src/layer/arm/gru_arm.cpp @@ -250,6 +250,10 @@ int GRU_arm::create_pipeline(const Option& opt) } } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } @@ -1368,6 +1372,10 @@ int GRU_arm::create_pipeline_bf16s(const Option& opt) } } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } diff --git a/src/layer/arm/gru_arm_asimdhp.cpp b/src/layer/arm/gru_arm_asimdhp.cpp index c38458176afc..fcdce2d8e185 100644 --- a/src/layer/arm/gru_arm_asimdhp.cpp +++ b/src/layer/arm/gru_arm_asimdhp.cpp @@ -914,6 +914,10 @@ int GRU_arm::create_pipeline_fp16s(const Option& opt) } } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } diff --git a/src/layer/arm/innerproduct_arm.cpp b/src/layer/arm/innerproduct_arm.cpp index 31689008e79e..0cbc78525ebf 100644 --- a/src/layer/arm/innerproduct_arm.cpp +++ b/src/layer/arm/innerproduct_arm.cpp @@ -122,10 +122,7 @@ int InnerProduct_arm::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -868,10 +865,7 @@ int InnerProduct_arm::create_pipeline_bf16s(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -1264,10 +1258,7 @@ int InnerProduct_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; } diff --git a/src/layer/arm/innerproduct_arm_vfpv4.cpp b/src/layer/arm/innerproduct_arm_vfpv4.cpp index 435fb883e508..6a6eab84fbab 100644 --- a/src/layer/arm/innerproduct_arm_vfpv4.cpp +++ b/src/layer/arm/innerproduct_arm_vfpv4.cpp @@ -41,10 +41,7 @@ int InnerProduct_arm::create_pipeline_fp16s(const Option& opt) } #endif - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/arm/lstm_arm.cpp b/src/layer/arm/lstm_arm.cpp index 04d7277547ea..b8d5afe93dc3 100644 --- a/src/layer/arm/lstm_arm.cpp +++ b/src/layer/arm/lstm_arm.cpp @@ -124,12 +124,9 @@ int LSTM_arm::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_xc_data.release(); - bias_c_data.release(); - weight_hc_data.release(); - } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); return 0; } @@ -931,12 +928,9 @@ int LSTM_arm::create_pipeline_bf16s(const Option& opt) } } - if (opt.lightmode) - { - weight_xc_data.release(); - bias_c_data.release(); - weight_hc_data.release(); - } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); return 0; } diff --git a/src/layer/arm/lstm_arm_asimdhp.cpp b/src/layer/arm/lstm_arm_asimdhp.cpp index 1d3fc71cdfcf..593af33ccd4a 100644 --- a/src/layer/arm/lstm_arm_asimdhp.cpp +++ b/src/layer/arm/lstm_arm_asimdhp.cpp @@ -835,12 +835,9 @@ int LSTM_arm::create_pipeline_fp16s(const Option& opt) } } - if (opt.lightmode) - { - weight_xc_data.release(); - bias_c_data.release(); - weight_hc_data.release(); - } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); return 0; } diff --git a/src/layer/arm/multiheadattention_arm.cpp b/src/layer/arm/multiheadattention_arm.cpp index 37323a2255f2..b3f3d7aa8e71 100644 --- a/src/layer/arm/multiheadattention_arm.cpp +++ b/src/layer/arm/multiheadattention_arm.cpp @@ -84,11 +84,8 @@ int MultiHeadAttention_arm::create_pipeline(const Option& _opt) q_gemm->load_model(ModelBinFromMatArray(weights)); q_gemm->create_pipeline(opt); - if (opt.lightmode) - { - q_weight_data.release(); - q_bias_data.release(); - } + q_weight_data.release(); + q_bias_data.release(); } { @@ -113,11 +110,8 @@ int MultiHeadAttention_arm::create_pipeline(const Option& _opt) k_gemm->load_model(ModelBinFromMatArray(weights)); k_gemm->create_pipeline(opt); - if (opt.lightmode) - { - k_weight_data.release(); - k_bias_data.release(); - } + k_weight_data.release(); + k_bias_data.release(); } { @@ -142,11 +136,8 @@ int MultiHeadAttention_arm::create_pipeline(const Option& _opt) v_gemm->load_model(ModelBinFromMatArray(weights)); v_gemm->create_pipeline(opt); - if (opt.lightmode) - { - v_weight_data.release(); - v_bias_data.release(); - } + v_weight_data.release(); + v_bias_data.release(); } { @@ -169,11 +160,8 @@ int MultiHeadAttention_arm::create_pipeline(const Option& _opt) o_gemm->load_model(ModelBinFromMatArray(weights)); o_gemm->create_pipeline(opt); - if (opt.lightmode) - { - out_weight_data.release(); - out_bias_data.release(); - } + out_weight_data.release(); + out_bias_data.release(); } { diff --git a/src/layer/arm/rnn_arm.cpp b/src/layer/arm/rnn_arm.cpp index 19f439ea2d57..15b9f0b8a0d2 100644 --- a/src/layer/arm/rnn_arm.cpp +++ b/src/layer/arm/rnn_arm.cpp @@ -139,6 +139,10 @@ int RNN_arm::create_pipeline(const Option& opt) bias_c_data_packed = bias_c_data; + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } @@ -732,6 +736,10 @@ int RNN_arm::create_pipeline_bf16s(const Option& opt) cast_float32_to_bfloat16(bias_c_data, bias_c_data_packed, opt); + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } diff --git a/src/layer/arm/rnn_arm_asimdhp.cpp b/src/layer/arm/rnn_arm_asimdhp.cpp index c34b3e8bb480..467dba614f8b 100644 --- a/src/layer/arm/rnn_arm_asimdhp.cpp +++ b/src/layer/arm/rnn_arm_asimdhp.cpp @@ -517,6 +517,10 @@ int RNN_arm::create_pipeline_fp16s(const Option& opt) cast_float32_to_float16(bias_c_data, bias_c_data_packed, opt); + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } diff --git a/src/layer/loongarch/convolution1d_loongarch.cpp b/src/layer/loongarch/convolution1d_loongarch.cpp index 0917a79f62ef..1f804861e7ab 100644 --- a/src/layer/loongarch/convolution1d_loongarch.cpp +++ b/src/layer/loongarch/convolution1d_loongarch.cpp @@ -78,6 +78,8 @@ int Convolution1D_loongarch::create_pipeline(const Option& opt) } } + weight_data.release(); + return 0; } diff --git a/src/layer/loongarch/convolution_loongarch.cpp b/src/layer/loongarch/convolution_loongarch.cpp index c38254c00357..3c5d0c1a4244 100644 --- a/src/layer/loongarch/convolution_loongarch.cpp +++ b/src/layer/loongarch/convolution_loongarch.cpp @@ -225,10 +225,7 @@ int Convolution_loongarch::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -792,10 +789,7 @@ int Convolution_loongarch::create_pipeline_int8_loongarch(const Option& opt) scale_in_data[p] = scale_in; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/loongarch/convolutiondepthwise_loongarch.cpp b/src/layer/loongarch/convolutiondepthwise_loongarch.cpp index 2546c19bfd0f..0c5050dbce00 100644 --- a/src/layer/loongarch/convolutiondepthwise_loongarch.cpp +++ b/src/layer/loongarch/convolutiondepthwise_loongarch.cpp @@ -83,10 +83,7 @@ int ConvolutionDepthWise_loongarch::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -94,10 +91,7 @@ int ConvolutionDepthWise_loongarch::create_pipeline(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -606,16 +600,15 @@ int ConvolutionDepthWise_loongarch::create_pipeline_int8_loongarch(const Option& weight_data_tm = weight_data; } + weight_data.release(); + return 0; } // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/loongarch/deconvolution_loongarch.cpp b/src/layer/loongarch/deconvolution_loongarch.cpp index cdf7c0a26380..62b9d872b605 100644 --- a/src/layer/loongarch/deconvolution_loongarch.cpp +++ b/src/layer/loongarch/deconvolution_loongarch.cpp @@ -126,10 +126,7 @@ int Deconvolution_loongarch::create_pipeline(const Option& opt) { } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/loongarch/deconvolutiondepthwise_loongarch.cpp b/src/layer/loongarch/deconvolutiondepthwise_loongarch.cpp index cc9d24a506c5..9495a99aae05 100644 --- a/src/layer/loongarch/deconvolutiondepthwise_loongarch.cpp +++ b/src/layer/loongarch/deconvolutiondepthwise_loongarch.cpp @@ -82,16 +82,15 @@ int DeconvolutionDepthWise_loongarch::create_pipeline(const Option& opt) weight_data_tm = weight_data_transposed; } + weight_data.release(); + return 0; } // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/loongarch/innerproduct_loongarch.cpp b/src/layer/loongarch/innerproduct_loongarch.cpp index b17d3f830c2e..e6b8eb0936b9 100644 --- a/src/layer/loongarch/innerproduct_loongarch.cpp +++ b/src/layer/loongarch/innerproduct_loongarch.cpp @@ -99,10 +99,7 @@ int InnerProduct_loongarch::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -655,10 +652,7 @@ int InnerProduct_loongarch::create_pipeline_fp16s(const Option& opt) ncnn::cast_float32_to_float16(weight_data_r2, weight_data_tm, opt); } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -1146,10 +1140,7 @@ int InnerProduct_loongarch::create_pipeline_int8_loongarch(const Option& opt) scale_in_data[p] = scale_in; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/mips/convolution1d_mips.cpp b/src/layer/mips/convolution1d_mips.cpp index e9cf211e49ba..5db88c1935f7 100644 --- a/src/layer/mips/convolution1d_mips.cpp +++ b/src/layer/mips/convolution1d_mips.cpp @@ -78,6 +78,8 @@ int Convolution1D_mips::create_pipeline(const Option& opt) } } + weight_data.release(); + return 0; } diff --git a/src/layer/mips/convolution_mips.cpp b/src/layer/mips/convolution_mips.cpp index 8f566f43a6cc..af420e61a9ae 100644 --- a/src/layer/mips/convolution_mips.cpp +++ b/src/layer/mips/convolution_mips.cpp @@ -225,10 +225,7 @@ int Convolution_mips::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -792,10 +789,7 @@ int Convolution_mips::create_pipeline_int8_mips(const Option& opt) scale_in_data[p] = scale_in; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/mips/convolutiondepthwise_mips.cpp b/src/layer/mips/convolutiondepthwise_mips.cpp index 17bb2e012e6a..0c9bdca30ce7 100644 --- a/src/layer/mips/convolutiondepthwise_mips.cpp +++ b/src/layer/mips/convolutiondepthwise_mips.cpp @@ -83,10 +83,7 @@ int ConvolutionDepthWise_mips::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -94,10 +91,7 @@ int ConvolutionDepthWise_mips::create_pipeline(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -606,16 +600,15 @@ int ConvolutionDepthWise_mips::create_pipeline_int8_mips(const Option& opt) weight_data_tm = weight_data; } + weight_data.release(); + return 0; } // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/mips/deconvolution_mips.cpp b/src/layer/mips/deconvolution_mips.cpp index 607313614c0f..208400f532ef 100644 --- a/src/layer/mips/deconvolution_mips.cpp +++ b/src/layer/mips/deconvolution_mips.cpp @@ -126,10 +126,7 @@ int Deconvolution_mips::create_pipeline(const Option& opt) { } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/mips/deconvolutiondepthwise_mips.cpp b/src/layer/mips/deconvolutiondepthwise_mips.cpp index 404335b0efe0..e6f5dd43478c 100644 --- a/src/layer/mips/deconvolutiondepthwise_mips.cpp +++ b/src/layer/mips/deconvolutiondepthwise_mips.cpp @@ -82,16 +82,15 @@ int DeconvolutionDepthWise_mips::create_pipeline(const Option& opt) weight_data_tm = weight_data_transposed; } + weight_data.release(); + return 0; } // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/mips/innerproduct_mips.cpp b/src/layer/mips/innerproduct_mips.cpp index 87a32b86cfe2..9d926bfd08d0 100644 --- a/src/layer/mips/innerproduct_mips.cpp +++ b/src/layer/mips/innerproduct_mips.cpp @@ -99,10 +99,7 @@ int InnerProduct_mips::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -655,10 +652,7 @@ int InnerProduct_mips::create_pipeline_fp16s(const Option& opt) ncnn::cast_float32_to_float16(weight_data_r2, weight_data_tm, opt); } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -1146,10 +1140,7 @@ int InnerProduct_mips::create_pipeline_int8_mips(const Option& opt) scale_in_data[p] = scale_in; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/riscv/convolution1d_riscv.cpp b/src/layer/riscv/convolution1d_riscv.cpp index ff02d6bc24f7..fbf4190ca941 100644 --- a/src/layer/riscv/convolution1d_riscv.cpp +++ b/src/layer/riscv/convolution1d_riscv.cpp @@ -95,6 +95,8 @@ int Convolution1D_riscv::create_pipeline(const Option& opt) } } + weight_data.release(); + return 0; } @@ -470,6 +472,8 @@ int Convolution1D_riscv::create_pipeline_fp16s(const Option& opt) ncnn::cast_float32_to_float16(bias_data, bias_data_fp16, opt); + weight_data.release(); + return 0; } diff --git a/src/layer/riscv/convolution_riscv.cpp b/src/layer/riscv/convolution_riscv.cpp index a4c73986bc40..be413e5be252 100644 --- a/src/layer/riscv/convolution_riscv.cpp +++ b/src/layer/riscv/convolution_riscv.cpp @@ -237,10 +237,7 @@ int Convolution_riscv::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -837,10 +834,7 @@ int Convolution_riscv::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; } diff --git a/src/layer/riscv/convolutiondepthwise_riscv.cpp b/src/layer/riscv/convolutiondepthwise_riscv.cpp index 7d772d75ef92..d913fe7e1d59 100644 --- a/src/layer/riscv/convolutiondepthwise_riscv.cpp +++ b/src/layer/riscv/convolutiondepthwise_riscv.cpp @@ -104,10 +104,7 @@ int ConvolutionDepthWise_riscv::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -115,10 +112,7 @@ int ConvolutionDepthWise_riscv::create_pipeline(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -688,10 +682,7 @@ int ConvolutionDepthWise_riscv::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; } @@ -699,10 +690,7 @@ int ConvolutionDepthWise_riscv::create_pipeline_fp16s(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/riscv/deconvolution_riscv.cpp b/src/layer/riscv/deconvolution_riscv.cpp index 9483a2f8af33..6b395282908d 100644 --- a/src/layer/riscv/deconvolution_riscv.cpp +++ b/src/layer/riscv/deconvolution_riscv.cpp @@ -148,10 +148,7 @@ int Deconvolution_riscv::create_pipeline(const Option& opt) { } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -533,10 +530,7 @@ int Deconvolution_riscv::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; } diff --git a/src/layer/riscv/deconvolutiondepthwise_riscv.cpp b/src/layer/riscv/deconvolutiondepthwise_riscv.cpp index 9f127b1160c9..7b567cf63e0a 100644 --- a/src/layer/riscv/deconvolutiondepthwise_riscv.cpp +++ b/src/layer/riscv/deconvolutiondepthwise_riscv.cpp @@ -97,10 +97,7 @@ int DeconvolutionDepthWise_riscv::create_pipeline(const Option& opt) weight_data_tm = weight_data_transposed; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -108,10 +105,7 @@ int DeconvolutionDepthWise_riscv::create_pipeline(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -625,10 +619,7 @@ int DeconvolutionDepthWise_riscv::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; } @@ -636,10 +627,7 @@ int DeconvolutionDepthWise_riscv::create_pipeline_fp16s(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/riscv/gemm_riscv.cpp b/src/layer/riscv/gemm_riscv.cpp index ec5a5cdac413..33f8913bd1b3 100644 --- a/src/layer/riscv/gemm_riscv.cpp +++ b/src/layer/riscv/gemm_riscv.cpp @@ -4006,10 +4006,7 @@ int Gemm_riscv::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - A_data.release(); - } + A_data.release(); } if (constantB) @@ -4049,10 +4046,7 @@ int Gemm_riscv::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - B_data.release(); - } + B_data.release(); } if (constantC && constant_broadcast_type_C != -1) @@ -4082,10 +4076,7 @@ int Gemm_riscv::create_pipeline(const Option& opt) CT_data = C2; } - if (opt.lightmode) - { - C_data.release(); - } + C_data.release(); } if (constantA || constantB || constantC) diff --git a/src/layer/riscv/gru_riscv.cpp b/src/layer/riscv/gru_riscv.cpp index 28afa5081d06..c7e36c1c0fc7 100644 --- a/src/layer/riscv/gru_riscv.cpp +++ b/src/layer/riscv/gru_riscv.cpp @@ -714,6 +714,10 @@ int GRU_riscv::create_pipeline_fp16sa(const Option& opt) cast_float32_to_float16(weight_hc_data, weight_hc_data_fp16sa, opt); cast_float32_to_float16(bias_c_data, bias_c_data_fp16sa, opt); + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); + return 0; } diff --git a/src/layer/riscv/innerproduct_riscv.cpp b/src/layer/riscv/innerproduct_riscv.cpp index 1f0d698a9790..accfc683584f 100644 --- a/src/layer/riscv/innerproduct_riscv.cpp +++ b/src/layer/riscv/innerproduct_riscv.cpp @@ -106,10 +106,7 @@ int InnerProduct_riscv::create_pipeline(const Option& opt) weight_data_tm = weight_data; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -563,10 +560,7 @@ int InnerProduct_riscv::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; } diff --git a/src/layer/vulkan/convolution1d_vulkan.cpp b/src/layer/vulkan/convolution1d_vulkan.cpp index 12162c5b7fc0..fdef247bdf9e 100644 --- a/src/layer/vulkan/convolution1d_vulkan.cpp +++ b/src/layer/vulkan/convolution1d_vulkan.cpp @@ -135,6 +135,9 @@ int Convolution1D_vulkan::create_pipeline(const Option& _opt) pipeline_convolution1d->create(shader_type_index, opt, specializations); } + weight_data.release(); + bias_data.release(); + return 0; } diff --git a/src/layer/vulkan/convolution_vulkan.cpp b/src/layer/vulkan/convolution_vulkan.cpp index 5e3bffca51b6..4ba7c279e3c4 100644 --- a/src/layer/vulkan/convolution_vulkan.cpp +++ b/src/layer/vulkan/convolution_vulkan.cpp @@ -1150,6 +1150,9 @@ int Convolution_vulkan::create_pipeline(const Option& _opt) pipeline_convolution->create(shader_type_index, opt, specializations); } + weight_data.release(); + bias_data.release(); + return 0; } diff --git a/src/layer/vulkan/convolutiondepthwise_vulkan.cpp b/src/layer/vulkan/convolutiondepthwise_vulkan.cpp index 23405a6269d8..9b54d136ccfc 100644 --- a/src/layer/vulkan/convolutiondepthwise_vulkan.cpp +++ b/src/layer/vulkan/convolutiondepthwise_vulkan.cpp @@ -412,6 +412,9 @@ int ConvolutionDepthWise_vulkan::create_pipeline(const Option& _opt) pipeline_convolutiondepthwise_group_pack8to1->create(LayerShaderType::convolutiondepthwise_group_pack8to1, opt, specializations); } + weight_data.release(); + bias_data.release(); + return 0; } diff --git a/src/layer/vulkan/deconvolution_vulkan.cpp b/src/layer/vulkan/deconvolution_vulkan.cpp index 33d56e34ada9..83f71f841727 100644 --- a/src/layer/vulkan/deconvolution_vulkan.cpp +++ b/src/layer/vulkan/deconvolution_vulkan.cpp @@ -464,6 +464,9 @@ int Deconvolution_vulkan::create_pipeline(const Option& _opt) pipeline_deconvolution->set_optimal_local_size_xyz(local_size_xyz); pipeline_deconvolution->create(shader_type_index, opt, specializations); + weight_data.release(); + bias_data.release(); + return 0; } diff --git a/src/layer/vulkan/deconvolutiondepthwise_vulkan.cpp b/src/layer/vulkan/deconvolutiondepthwise_vulkan.cpp index 08e6b1a23c04..af23d2295479 100644 --- a/src/layer/vulkan/deconvolutiondepthwise_vulkan.cpp +++ b/src/layer/vulkan/deconvolutiondepthwise_vulkan.cpp @@ -436,6 +436,9 @@ int DeconvolutionDepthWise_vulkan::create_pipeline(const Option& _opt) pipeline_deconvolutiondepthwise_group_pack8to1->create(LayerShaderType::deconvolutiondepthwise_group_pack8to1, opt, specializations); } + weight_data.release(); + bias_data.release(); + return 0; } diff --git a/src/layer/vulkan/gemm_vulkan.cpp b/src/layer/vulkan/gemm_vulkan.cpp index ad768c63dd2e..f30fa552f11f 100644 --- a/src/layer/vulkan/gemm_vulkan.cpp +++ b/src/layer/vulkan/gemm_vulkan.cpp @@ -100,6 +100,10 @@ int Gemm_vulkan::create_pipeline(const Option& opt) pipeline_gemm->create(LayerShaderType::gemm, opt, specializations); } + A_data.release(); + B_data.release(); + C_data.release(); + return 0; } diff --git a/src/layer/vulkan/innerproduct_vulkan.cpp b/src/layer/vulkan/innerproduct_vulkan.cpp index df87b3de2582..de23feef70ea 100644 --- a/src/layer/vulkan/innerproduct_vulkan.cpp +++ b/src/layer/vulkan/innerproduct_vulkan.cpp @@ -364,6 +364,9 @@ int InnerProduct_vulkan::create_pipeline(const Option& _opt) return 0; } + weight_data.release(); + bias_data.release(); + return 0; } diff --git a/src/layer/vulkan/multiheadattention_vulkan.cpp b/src/layer/vulkan/multiheadattention_vulkan.cpp index 142ccf4f8b64..411b81b05e9a 100644 --- a/src/layer/vulkan/multiheadattention_vulkan.cpp +++ b/src/layer/vulkan/multiheadattention_vulkan.cpp @@ -72,6 +72,9 @@ int MultiHeadAttention_vulkan::create_pipeline(const Option& opt) weights[1] = q_bias_data; q_gemm->load_model(ModelBinFromMatArray(weights)); q_gemm->create_pipeline(opt); + + q_weight_data.release(); + q_bias_data.release(); } { @@ -96,6 +99,9 @@ int MultiHeadAttention_vulkan::create_pipeline(const Option& opt) weights[1] = k_bias_data; k_gemm->load_model(ModelBinFromMatArray(weights)); k_gemm->create_pipeline(opt); + + k_weight_data.release(); + k_bias_data.release(); } { @@ -120,6 +126,9 @@ int MultiHeadAttention_vulkan::create_pipeline(const Option& opt) weights[1] = v_bias_data; v_gemm->load_model(ModelBinFromMatArray(weights)); v_gemm->create_pipeline(opt); + + v_weight_data.release(); + v_bias_data.release(); } { @@ -212,6 +221,9 @@ int MultiHeadAttention_vulkan::create_pipeline(const Option& opt) weights[1] = out_bias_data; o_gemm->load_model(ModelBinFromMatArray(weights)); o_gemm->create_pipeline(opt); + + out_weight_data.release(); + out_bias_data.release(); } return 0; diff --git a/src/layer/x86/convolution1d_x86.cpp b/src/layer/x86/convolution1d_x86.cpp index 26c72678b67a..905db18b7280 100644 --- a/src/layer/x86/convolution1d_x86.cpp +++ b/src/layer/x86/convolution1d_x86.cpp @@ -43,6 +43,8 @@ int Convolution1D_x86::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; } diff --git a/src/layer/x86/convolution_x86.cpp b/src/layer/x86/convolution_x86.cpp index 5c97b02eebd8..b7c78de5e4d9 100644 --- a/src/layer/x86/convolution_x86.cpp +++ b/src/layer/x86/convolution_x86.cpp @@ -334,10 +334,7 @@ int Convolution_x86::create_pipeline(const Option& opt) convolution_dilation1->create_pipeline(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -454,10 +451,7 @@ int Convolution_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -548,10 +542,7 @@ int Convolution_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -1259,10 +1250,7 @@ int Convolution_x86::create_pipeline_int8_x86(const Option& opt) scale_in_data[p] = scale_in; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/x86/convolutiondepthwise_x86.cpp b/src/layer/x86/convolutiondepthwise_x86.cpp index 48be4ab0e064..6a9fb7fb4c21 100644 --- a/src/layer/x86/convolutiondepthwise_x86.cpp +++ b/src/layer/x86/convolutiondepthwise_x86.cpp @@ -132,10 +132,7 @@ int ConvolutionDepthWise_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -143,10 +140,7 @@ int ConvolutionDepthWise_x86::create_pipeline(const Option& opt) // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -849,16 +843,15 @@ int ConvolutionDepthWise_x86::create_pipeline_int8_x86(const Option& opt) weight_data_tm = weight_data; } + weight_data.release(); + return 0; } // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/x86/deconvolution_x86.cpp b/src/layer/x86/deconvolution_x86.cpp index 09d13616d585..6a94104a43dc 100644 --- a/src/layer/x86/deconvolution_x86.cpp +++ b/src/layer/x86/deconvolution_x86.cpp @@ -193,10 +193,7 @@ int Deconvolution_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/x86/deconvolutiondepthwise_x86.cpp b/src/layer/x86/deconvolutiondepthwise_x86.cpp index 7a7907018572..4a1e89d26a83 100644 --- a/src/layer/x86/deconvolutiondepthwise_x86.cpp +++ b/src/layer/x86/deconvolutiondepthwise_x86.cpp @@ -109,16 +109,15 @@ int DeconvolutionDepthWise_x86::create_pipeline(const Option& opt) weight_data_tm = weight_data_transposed; } + weight_data.release(); + return 0; } // group convolution create_group_ops(opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/x86/deformableconv2d_x86.cpp b/src/layer/x86/deformableconv2d_x86.cpp index b3bf9887898e..8fc7bdf28555 100644 --- a/src/layer/x86/deformableconv2d_x86.cpp +++ b/src/layer/x86/deformableconv2d_x86.cpp @@ -203,10 +203,7 @@ int DeformableConv2D_x86::create_pipeline(const Option& opt) deformableconv2d_transform_kernel_packed_sse(weight_data, weight_data_tm, num_input, num_output, kernel_w, kernel_h, elempack, out_elempack); } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/x86/gemm_x86.cpp b/src/layer/x86/gemm_x86.cpp index 19cd7ebc09a9..4ab37836a43f 100644 --- a/src/layer/x86/gemm_x86.cpp +++ b/src/layer/x86/gemm_x86.cpp @@ -7235,10 +7235,7 @@ int Gemm_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - A_data.release(); - } + A_data.release(); } if (constantB) @@ -7282,10 +7279,7 @@ int Gemm_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - B_data.release(); - } + B_data.release(); } if (constantC && constant_broadcast_type_C != -1) @@ -7321,10 +7315,7 @@ int Gemm_x86::create_pipeline(const Option& opt) CT_data = C2; } - if (opt.lightmode) - { - C_data.release(); - } + C_data.release(); } if (constantA || constantB || constantC) diff --git a/src/layer/x86/innerproduct_x86.cpp b/src/layer/x86/innerproduct_x86.cpp index 0ca253ebd1d7..dee07d1de64a 100644 --- a/src/layer/x86/innerproduct_x86.cpp +++ b/src/layer/x86/innerproduct_x86.cpp @@ -80,10 +80,7 @@ int InnerProduct_x86::create_pipeline(const Option& opt) innerproduct_transform_kernel_sse(weight_data, weight_data_tm, num_input, num_output, opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -178,10 +175,7 @@ int InnerProduct_x86::create_pipeline_fp16s(const Option& opt) innerproduct_transform_kernel_fp16s_sse(weight_data, weight_data_tm, num_input, num_output, opt); - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } @@ -287,10 +281,7 @@ int InnerProduct_x86::create_pipeline_int8_x86(const Option& opt) scale_in_data[p] = scale_in; } - if (opt.lightmode) - { - weight_data.release(); - } + weight_data.release(); return 0; } diff --git a/src/layer/x86/lstm_x86.cpp b/src/layer/x86/lstm_x86.cpp index 6ba218e53d30..5d693648f44e 100644 --- a/src/layer/x86/lstm_x86.cpp +++ b/src/layer/x86/lstm_x86.cpp @@ -182,12 +182,9 @@ int LSTM_x86::create_pipeline(const Option& opt) } } - if (opt.lightmode) - { - weight_xc_data.release(); - bias_c_data.release(); - weight_hc_data.release(); - } + weight_xc_data.release(); + bias_c_data.release(); + weight_hc_data.release(); return 0; } diff --git a/src/layer/x86/multiheadattention_x86.cpp b/src/layer/x86/multiheadattention_x86.cpp index a7ff58288c2d..2bddad5582d4 100644 --- a/src/layer/x86/multiheadattention_x86.cpp +++ b/src/layer/x86/multiheadattention_x86.cpp @@ -65,11 +65,8 @@ int MultiHeadAttention_x86::create_pipeline(const Option& opt) q_gemm->load_model(ModelBinFromMatArray(weights)); q_gemm->create_pipeline(opt); - if (opt.lightmode) - { - q_weight_data.release(); - q_bias_data.release(); - } + q_weight_data.release(); + q_bias_data.release(); } { @@ -94,11 +91,8 @@ int MultiHeadAttention_x86::create_pipeline(const Option& opt) k_gemm->load_model(ModelBinFromMatArray(weights)); k_gemm->create_pipeline(opt); - if (opt.lightmode) - { - k_weight_data.release(); - k_bias_data.release(); - } + k_weight_data.release(); + k_bias_data.release(); } { @@ -123,11 +117,8 @@ int MultiHeadAttention_x86::create_pipeline(const Option& opt) v_gemm->load_model(ModelBinFromMatArray(weights)); v_gemm->create_pipeline(opt); - if (opt.lightmode) - { - v_weight_data.release(); - v_bias_data.release(); - } + v_weight_data.release(); + v_bias_data.release(); } { @@ -202,11 +193,8 @@ int MultiHeadAttention_x86::create_pipeline(const Option& opt) o_gemm->load_model(ModelBinFromMatArray(weights)); o_gemm->create_pipeline(opt); - if (opt.lightmode) - { - out_weight_data.release(); - out_bias_data.release(); - } + out_weight_data.release(); + out_bias_data.release(); } return 0;