-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PIR] translate old ir to pir_program and trt program #70364
base: develop
Are you sure you want to change the base?
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
keys = list(prog_config.inputs.keys()) | ||
trt_config.input_data_type = prog_config.inputs[keys[0]].dtype | ||
|
||
paddle.framework.set_flags({"FLAGS_trt_min_group_size": 1}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个在执行完对比结果的时候最好还原,设置为3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
@@ -342,6 +342,143 @@ def _cast(self) -> None: | |||
return self | |||
|
|||
|
|||
def create_fake_pir_model(program_config): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不能复用create_fake_model吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不能复用create_fake_model吗
不可以,两个函数返回的值不一样
# for static_shape | ||
clear_dynamic_shape() | ||
self.trt_param.precision = paddle_infer.PrecisionType.Float32 | ||
yield self.create_inference_config(), generate_trt_nodes_num( | ||
attrs, False | ||
), 1e-5 | ||
self.trt_param.precision = paddle_infer.PrecisionType.Half | ||
yield self.create_inference_config(), generate_trt_nodes_num( | ||
attrs, False | ||
), (1e-3, 1e-3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pir-trt下不再有static shape,可以在单测基类里设置一下,如果跑的单测case是static shape(没有设置min/max shape),直接跳过即可
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
@@ -0,0 +1,173 @@ | |||
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后续其他单测需要这样一个个新创建一个单测文件吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要
PR Category
Execute Infrastructure
PR Types
Others
Description
此PR功能:
test/ir/inference/下的单测都是跑的旧IR单测,并且覆盖的case场景比较全,之前的逻辑是将旧ir转成trt program,然后对比旧IR和trt program的结果,现在利用PT,将old ir转成 pir ,然后将pir转成trt program,对比新IR下和trr program下的结果,用此来摸底pir-trt场景下算子问题,暂时使用exe.run的方式,没有选择predictor.run的方式,此PR在多个算子验证成功
暴露出的问题
1 新IR progrma转trt program时,config文件里的输入数据只支持fp32,不支持int32,此PR修复此问题
2 使用predictor.run的方式遇到一些program没有builtin.paramter,在save_inference_model时不会保存.pdiparams,然后在paddle_infer.create_predictor(config)会报错
3 有些算子对trt版本有要求,在新IR下要求trt不能低于8.6
1 验证更多的算子
2 使用inpreter.run跑新IR program和trt program