Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.47k stars 4.17k forks source link

k30pro运行ncnn demo (yolov5和yolox)都会闪退 #3849

Open meixiansen opened 2 years ago

meixiansen commented 2 years ago

先是调用ncnn::set_cpu_powersave函数,会直接闪退 ,报错A/libc: Fatal signal 6。 把ncnn::set_cpu_powersave注释掉,在load_model的时候也会报同样的错误。查看源码,在ncnn-20220420\src\layer\convolution.cpp中的Convolution::create_pipeline函数会异常跳出,具体代码:

int Convolution::create_pipeline(const Option& opt)
{
#if NCNN_INT8
    // runtime quantize the weight data
    if (opt.use_int8_inference && weight_data.elemsize == (size_t)4u && int8_scale_term)
    {
        const int maxk = kernel_w * kernel_h;
        const int num_input = weight_data_size / num_output / maxk;

        Mat weight_data_r2 = weight_data.reshape(maxk, num_input, num_output);

        Mat weight_data_int8;

        Option opt_q = opt;
        opt_q.blob_allocator = weight_data.allocator;
        opt_q.use_packing_layout = false;
        quantize_to_int8(weight_data_r2, weight_data_int8, weight_data_int8_scales, opt_q);
        if (weight_data_int8.empty())
            return -100;

        weight_data = weight_data_int8.reshape(weight_data_size);
    }
#endif // NCNN_INT8

    return 0;
}

实际这个函数并没做任何操作,但是就是异常退出了 用过ncnn-20210720-Android和ncnn-20220420版本,都会出这个问题。只有自己编译,把openmp设为false才能正常运行。

zchrissirhcz commented 2 years ago

@meixiansen 粘贴代码时候可以放在三个backtick符号内,这样markdown会显示为好看的代码,即: "```"

代码 (去掉4个双引号)

"```"

zchrissirhcz commented 2 years ago

可以尝试按 https://github.com/Tencent/ncnn/issues/3782 的方式, 把完整的 backtrace 贴一下, backtrace 里面的 frame 信息, 寄存器值,可以辅助进一步判断定位