MNN icon indicating copy to clipboard operation
MNN copied to clipboard

一个四层的CNN模型,没有任何特殊的结构,ios上METAL比CPU线程慢一倍,正常吗?

Open anliyuan opened this issue 3 years ago • 4 comments

anliyuan avatar Sep 01 '22 13:09 anliyuan

如果是简单的模型,GPU 编译 + 数据传输的时间本身比 CPU 慢有可能的

SatanWoo avatar Sep 05 '22 15:09 SatanWoo

如果是简单的模型,GPU 编译 + 数据传输的时间本身比 CPU 慢有可能的

感觉不应该是这个原因,cpu处理耗时15ms,gpu处理耗时30ms,差的有点多。而且如果把模型继续改小的话,cpu和gpu都能到10ms。

anliyuan avatar Sep 06 '22 08:09 anliyuan

你 profile 一下看看,instruments,看看是不是确实跑在 metal 上了,还是有算子fallbakc了。

SatanWoo avatar Sep 13 '22 05:09 SatanWoo

看了一下,时间主要是花在了 output_tensor_->copyToHostTensor(output_tensor_host); 这一行,30ms中,有20ms是在这个地方

anliyuan avatar Sep 13 '22 05:09 anliyuan