Skip to content

Conversation

@yuanlehome
Copy link
Contributor

@yuanlehome yuanlehome commented Aug 1, 2023

PR types

New features

PR changes

Others

Description

This PR's work:

  1. save_optimized_model_pass support tensorrt, cpu/gpu/xpu has been supported and verified in [Inference] Save optimized model by pass #53696, [Inference] save_optimized_model_pass support gpu #55551.
  2. Uniformly package all non runtime parameters of TenosrRTEngine to ConstructionParams.
  3. Support load trt engine in runtime(in tensorrt_engine op run).
  4. Remove some unused function and variable in trt related code.
  5. Refine some unittest related to trt.
  6. Add unittest for function of save_optimized_model_pass(gpu/trt).

How to use:

//
// Step 1: first run
//
// other code
config.SetModel(/*model dir*/);
// other code
config.EnableUseGpu(...); // for gpu
config.EnableTensorRtEngine(..., use_static=true, ...). // for tensorrt
// other code
config.SwitchIrOptim(true);
config.SetOptimCacheDir("./optim_cache");
config.EnableSaveOptimModel(true);
// other code
auto predictor = CreatePredictor(config);

// Optimized model will be save to ./optim_cache/_optimized.*

//
// Step 2: second run
//
// other code
config.SetModel(/*optimized model dir*/);
// other code
config.EnableUseGpu(...); // for gpu
config.EnableTensorRtEngine(..., use_static=true, ...). // for tensorrt
// other code
config.SwitchIrOptim(false);
// other code
auto predictor = CreatePredictor(config);
// other code
predictor->Run();
// other code

Note:

  1. Not support EnableTensorRtEngine(..., use_cuda_graph=true).

Others

Pcard-71500

@paddle-bot
Copy link

paddle-bot bot commented Aug 1, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@yuanlehome yuanlehome force-pushed the save_optimized_model_support_trt branch from 0aea06a to b7cc00c Compare August 2, 2023 06:46
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Aug 2, 2023
@PaddlePaddle PaddlePaddle unlocked this conversation Aug 2, 2023
@yuanlehome yuanlehome force-pushed the save_optimized_model_support_trt branch from fc4104d to ee94157 Compare August 2, 2023 09:45
@yuanlehome yuanlehome force-pushed the save_optimized_model_support_trt branch from 282aa9b to 74830e2 Compare August 4, 2023 08:48
@yuanlehome yuanlehome force-pushed the save_optimized_model_support_trt branch from 3a97204 to 7fd1336 Compare August 4, 2023 17:12
Copy link
Contributor

@XieYunshen XieYunshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for set_tests_properties(test_save_optimized_model_pass PROPERTIES TIMEOUT 300)

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for ENFORCE MSG

Copy link
Contributor

@zhangjun zhangjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yuanlehome yuanlehome merged commit 6b10c0e into PaddlePaddle:develop Aug 7, 2023
eee4017 pushed a commit to eee4017/Paddle that referenced this pull request Nov 8, 2023
…55893)

* fix cudnn 8.7+ bug on cudnnConvolutionBiasActivationForward

* save_optimized_model_pass support tensorrt

* update

* update

* fix compile

* update

* fix ut timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants