[benchmark] add max_workspace_size flags for tensorrt/pptrt backend (#2058)

* [benchmark] fixed paddlex benchmark for picodet 320

* [Bug Fix] fixed paddlex ppseg pp-trt infer error

* [Bug Fix] fixed paddlex dino benchmark trt shapes

* [benchmark] support paddlex ppyoloe pptrt benchmark

* [benchmark] adjust paddlex dino trt shapes

* [benchmark] add max_workspace_size flags for tensorrt/pptrt backend

* [benchmark] add max_workspace_size flags for tensorrt/pptrt backend

* [benchmark] add max_workspace_size flags for tensorrt/pptrt backend

---------

Co-authored-by: qiuyanjun <qiuyanjun@baidu.com>
This commit is contained in:
DefTruth
2023-06-22 16:43:39 +08:00
committed by GitHub
parent 269d65a9bb
commit ff835690a2
3 changed files with 15 additions and 2 deletions

View File

@@ -63,7 +63,10 @@ DEFINE_int32(device_id, -1,
DEFINE_bool(enable_log_info, false, DEFINE_bool(enable_log_info, false,
"Optional, whether to enable log info for paddle backend," "Optional, whether to enable log info for paddle backend,"
"default false."); "default false.");
DEFINE_int32(max_workspace_size, -1,
"Optional, set max workspace size for tensorrt, default -1."
"will force to override the value in config file "
"eg, 2147483647(2GB)");
static void PrintUsage() { static void PrintUsage() {
std::cout << "Usage: infer_demo --model model_path --image img_path " std::cout << "Usage: infer_demo --model model_path --image img_path "
"--config_path config.txt[Path of benchmark config.] " "--config_path config.txt[Path of benchmark config.] "

View File

@@ -34,6 +34,11 @@ static void UpdateBaseCustomFlags(
if (FLAGS_xpu_l3_cache >= 0) { if (FLAGS_xpu_l3_cache >= 0) {
config_info["xpu_l3_cache"] = std::to_string(FLAGS_xpu_l3_cache); config_info["xpu_l3_cache"] = std::to_string(FLAGS_xpu_l3_cache);
} }
if (FLAGS_max_workspace_size > 0) {
config_info["max_workspace_size"] = std::to_string(FLAGS_max_workspace_size);
} else {
config_info["max_workspace_size"] = "-1";
}
// update custom options for paddle backend // update custom options for paddle backend
if (FLAGS_enable_log_info) { if (FLAGS_enable_log_info) {
config_info["enable_log_info"] = "true"; config_info["enable_log_info"] = "true";
@@ -60,6 +65,11 @@ static bool CreateRuntimeOption(fastdeploy::RuntimeOption* option,
if (config_info["enable_log_info"] == "true") { if (config_info["enable_log_info"] == "true") {
option->paddle_infer_option.enable_log_info = true; option->paddle_infer_option.enable_log_info = true;
} }
if (config_info["max_workspace_size"] != "-1") {
int max_workspace_size = std::stoi(config_info["max_workspace_size"]);
option->paddle_infer_option.trt_option.max_workspace_size = max_workspace_size;
option->trt_option.max_workspace_size = max_workspace_size;
}
if (config_info["device"] == "gpu") { if (config_info["device"] == "gpu") {
option->UseGpu(std::stoi(config_info["device_id"])); option->UseGpu(std::stoi(config_info["device_id"]));
if (config_info["backend"] == "ort") { if (config_info["backend"] == "ort") {

View File

@@ -19,7 +19,7 @@ fi
# PaddleDetection # PaddleDetection
./benchmark_ppdet --model rt_detr_hgnetv2_l --image ppdet_det_img.jpg --config_path $CONFIG_PATH ./benchmark_ppdet --model rt_detr_hgnetv2_l --image ppdet_det_img.jpg --config_path $CONFIG_PATH
./benchmark_ppdet --model dino_r50_4scale --image ppdet_det_img_800x800.jpg --config_path $CONFIG_PATH --trt_shape 1,3,800,800:1,3,800,800:1,3,800,800 ./benchmark_ppdet --model dino_r50_4scale --image ppdet_det_img_800x800.jpg --config_path $CONFIG_PATH --trt_shape 1,3,800,800:1,3,800,800:1,3,800,800 --max_workspace_size 2147483647
./benchmark_ppdet --model PP-PicoDet_s_320_lcnet --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320 ./benchmark_ppdet --model PP-PicoDet_s_320_lcnet --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320
./benchmark_ppdet --model PP-PicoDet_s_320_lcnet_with_nms --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320 ./benchmark_ppdet --model PP-PicoDet_s_320_lcnet_with_nms --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320
./benchmark_ppdet --model PP-PicoDet_s_320_lcnet_without_nms --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320 --no_nms ./benchmark_ppdet --model PP-PicoDet_s_320_lcnet_without_nms --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320 --no_nms