Skip to content

feature/trt engine op test#11182

Merged
Superjomn merged 10 commits intoPaddlePaddle:developfrom
Superjomn:feature/trt_engine_op_test
Jun 6, 2018
Merged

feature/trt engine op test#11182
Superjomn merged 10 commits intoPaddlePaddle:developfrom
Superjomn:feature/trt_engine_op_test

Conversation

@Superjomn
Copy link
Contributor

@Superjomn Superjomn commented Jun 5, 2018

  • pass a BlockDesc to tensorrt_engine_op
  • execute the whole phase

NEXT STEP:

write a tool to execute a larger model and output the benchmark.

@Superjomn Superjomn requested review from luotao1 and panyx0718 June 5, 2018 05:41
#pragma once

#ifdef PADDLE_WITH_CUDA
#if PADDLE_WITH_CUDA
Copy link
Contributor

Choose a reason for hiding this comment

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

这里是ifdef

#include "paddle/fluid/inference/tensorrt/convert/op_converter.h"
#include "paddle/fluid/inference/tensorrt/convert/ut_helper.h"

USE_CPU_ONLY_OP(tensorrt_engine);
Copy link
Contributor

Choose a reason for hiding this comment

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

请问为什么tensorrt_engine_op是CPU ONLY呢?不应该是GPU ONLY么

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tensorrt engine op 的kernel逻辑是在 cpu里跑,会触发 gpu

const framework::Scope& scope,
bool test_mode = false) {}

// Convert a single fluid operaotr and add the corresponding layer to TRT.
Copy link
Contributor

Choose a reason for hiding this comment

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

operaotr-》operator


engine_->DeclareOutput(layer, 0, op_desc.Output("Out")[0]);
auto output_name = op_desc.Output("Out")[0];
engine_->SetITensor(output_name, layer->getOutput(0));
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 为什么单侧(test_mode)的时候不知道输出名字是什么呢?这个能否在之后的PR中去掉呢?
  • 如果是单侧的时候要用,可以改成unittest_mode? 不然会认为是测试阶段,而TRT只有前向过程,会造成困扰。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里避免硬编码

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

@Superjomn Superjomn merged commit 4f95bc9 into PaddlePaddle:develop Jun 6, 2018
@Superjomn Superjomn deleted the feature/trt_engine_op_test branch June 6, 2018 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants