Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
8c366149
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8c366149
编写于
8月 07, 2020
作者:
Z
zlsh80826
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add USE_NVINFER_PLUGIN define detection
上级
bb6b8480
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
2 deletion
+23
-2
paddle/fluid/inference/tensorrt/convert/gelu_op.cc
paddle/fluid/inference/tensorrt/convert/gelu_op.cc
+7
-0
paddle/fluid/inference/tensorrt/engine.h
paddle/fluid/inference/tensorrt/engine.h
+2
-1
paddle/fluid/platform/dynload/tensorrt.cc
paddle/fluid/platform/dynload/tensorrt.cc
+7
-0
paddle/fluid/platform/dynload/tensorrt.h
paddle/fluid/platform/dynload/tensorrt.h
+7
-1
未找到文件。
paddle/fluid/inference/tensorrt/convert/gelu_op.cc
浏览文件 @
8c366149
...
...
@@ -47,6 +47,8 @@ class GeluOpConverter : public OpConverter {
nvinfer1
::
ILayer
*
layer
=
nullptr
;
if
(
engine_
->
with_dynamic_shape
())
{
#if IS_TRT_VERSION_GE(6000)
#ifdef USE_NVINFER_PLUGIN
auto
creator
=
getPluginRegistry
()
->
getPluginCreator
(
"CustomGeluPluginDynamic"
,
"1"
);
assert
(
creator
!=
nullptr
);
...
...
@@ -68,6 +70,11 @@ class GeluOpConverter : public OpConverter {
creator
->
createPlugin
(
"CustomGeluPluginDynamic"
,
pluginPtr
);
layer
=
engine_
->
network
()
->
addPluginV2
(
&
input
,
input_num
,
*
pluginObj
);
assert
(
layer
!=
nullptr
);
#else
plugin
::
GeluPluginDynamic
*
plugin
=
new
plugin
::
GeluPluginDynamic
();
layer
=
engine_
->
AddPluginV2
(
&
input
,
input_num
,
plugin
);
#endif
#else
PADDLE_THROW
(
platform
::
errors
::
Fatal
(
"You are running the TRT Dynamic Shape mode, need to confirm that "
...
...
paddle/fluid/inference/tensorrt/engine.h
浏览文件 @
8c366149
...
...
@@ -157,8 +157,9 @@ class TensorRTEngine {
"version should be at least 6."
;
#endif
}
#ifdef USE_NVINFER_PLUGIN
dy
::
initLibNvInferPlugins
(
&
logger
,
""
);
#endif
}
~
TensorRTEngine
()
{}
...
...
paddle/fluid/platform/dynload/tensorrt.cc
浏览文件 @
8c366149
...
...
@@ -22,13 +22,18 @@ namespace dynload {
std
::
once_flag
tensorrt_dso_flag
;
void
*
tensorrt_dso_handle
;
#ifdef USE_NVINFER_PLUGIN
std
::
once_flag
tensorrt_plugin_dso_flag
;
void
*
tensorrt_plugin_dso_handle
;
#endif
#define DEFINE_WRAP(__name) DynLoad__##__name __name
TENSORRT_RAND_ROUTINE_EACH
(
DEFINE_WRAP
);
#ifdef USE_NVINFER_PLUGIN
TENSORRT_PLUGIN_RAND_ROUTINE_EACH
(
DEFINE_WRAP
);
#endif
void
*
GetDsoHandle
(
const
std
::
string
&
dso_name
)
{
#if !defined(_WIN32)
...
...
@@ -75,6 +80,7 @@ void* GetTensorRtHandle() {
return
GetDsoHandle
(
dso_name
);
}
#ifdef USE_NVINFER_PLUGIN
void
*
GetTensorRtPluginHandle
()
{
#if defined(__APPLE__) || defined(__OSX__)
std
::
string
dso_name
=
"libnvinfer_plugin.dylib"
;
...
...
@@ -85,6 +91,7 @@ void* GetTensorRtPluginHandle() {
#endif
return
GetDsoHandle
(
dso_name
);
}
#endif
}
// namespace dynload
}
// namespace platform
...
...
paddle/fluid/platform/dynload/tensorrt.h
浏览文件 @
8c366149
...
...
@@ -14,7 +14,9 @@ limitations under the License. */
#pragma once
#include <NvInfer.h>
#ifdef USE_NVINFER_PLUGIN
#include <NvInferPlugin.h>
#endif
#if !defined(_WIN32)
#include <dlfcn.h>
#endif
...
...
@@ -29,13 +31,15 @@ namespace platform {
namespace
dynload
{
void
*
GetTensorRtHandle
();
void
*
GetTensorRtPluginHandle
();
extern
std
::
once_flag
tensorrt_dso_flag
;
extern
void
*
tensorrt_dso_handle
;
#ifdef USE_NVINFER_PLUGIN
void
*
GetTensorRtPluginHandle
();
extern
std
::
once_flag
tensorrt_plugin_dso_flag
;
extern
void
*
tensorrt_plugin_dso_handle
;
#endif
#define DECLARE_DYNAMIC_LOAD_TENSORRT_WRAP(__name) \
struct DynLoad__##__name { \
...
...
@@ -88,7 +92,9 @@ extern void* tensorrt_plugin_dso_handle;
__macro(initLibNvInferPlugins);
TENSORRT_RAND_ROUTINE_EACH
(
DECLARE_DYNAMIC_LOAD_TENSORRT_WRAP
)
#ifdef USE_NVINFER_PLUGIN
TENSORRT_PLUGIN_RAND_ROUTINE_EACH
(
DECLARE_DYNAMIC_LOAD_TENSORRT_PLUGIN_WRAP
)
#endif
}
// namespace dynload
}
// namespace platform
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录