PaddlePaddle / Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
https://www.paddlepaddle.org.cn/lite
Apache License 2.0
6.89k stars 1.6k forks source link

[OpenCL]remove process_type to fix FP16 result error #10451

Open engineer1109 opened 4 months ago

engineer1109 commented 4 months ago

PR devices

OpenCL

PR types

Bug fixes

PR changes

OP

Description

之前离职员工tiantian留下的BUG。 对于某些特殊模型,会设置process_type为2, 禁止io_copy的FP16模式(触发机制和意义不明,会导致yolov5_s等推理结果出错) 导致FP16的Tensor,被当成FP32使用。精度混乱。

这里删除了 param.process_type != 2的判定条件。 强制在FP16模式,使用FP16的逻辑处理。

paddle-bot[bot] commented 4 months ago

Thanks for your contribution!

engineer1109 commented 4 months ago

yolov5_s复现模型 链接: https://pan.baidu.com/s/1xfv8A0LXm-6-Yk0wyq5sEA?pwd=tvbe 提取码: tvbe

engineer1109 commented 4 months ago

@hong19860320 CI已经年久失修了,连git clone的能力都没有

hong19860320 commented 4 months ago

@hong19860320 CI已经年久失修了,连git clone的能力都没有

已经正在修了,git clone 失败是代理问题。

hong19860320 commented 4 months ago

@engineer1109 从之前 tiantian 提的 PR 来看 https://github.com/PaddlePaddle/Paddle-Lite/pull/9688 ,可能是为了解决自定义 CPU GPU 异构时,在 h2d 过程中可以同步实现 fp32->fp16 的转换,可能实现考虑的不全。 @Travis-Lee 看下这个PR吧,基于提供的模型看下是否可以复现这个问题,然后结合 @engineer1109 的修复方案,看下是否有影响最小的解决方案。

sprouteer commented 3 months ago

空闲时间回忆了下当初的实现思路,大致如下,如https://github.com/PaddlePaddle/Paddle-Lite/pull/9688 所描述,为了支持更多的模型,支持cpu, opencl image2d, opencl buffer 混合layout,混合精度推理,可配置算子后端信息等,对iocopy, layout 等算子和pass做出了修改。对于yolo模型,之前未进行适配,可能存在精度问题,需进一步check image