-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Feature/engine refactor #10497
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
Merged
luotao1
merged 10 commits into
PaddlePaddle:develop
from
Superjomn:feature/engine_refactor
May 9, 2018
Merged
Feature/engine refactor #10497
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1bdf7c0
init refactor
Superjomn 8839f22
init
Superjomn f30f789
update some comment
Superjomn b871d0d
Merge branch 'develop' of github.com:PaddlePaddle/Paddle into feature…
Superjomn e561e1d
fix build
Superjomn c13e2e6
fix errorrr
Superjomn b230ed5
Merge branch 'develop' of github.com:PaddlePaddle/Paddle into feature…
Superjomn 66c1c75
fix bug
Superjomn 8c43e87
fix comment
Superjomn 3ad2629
update
Superjomn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| nv_library(tensorrt_engine SRCS engine.h engine.cc helper.h ../engine.h) | ||
|
||
| nv_test(test_tensorrt SRCS test_tensorrt.cc DEPS dynload_cuda device_context dynamic_loader) | ||
| nv_test(test_tensorrt_engine SRCS test_engine.cc engine.cc DEPS dynload_cuda) | ||
| set(ENGINE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/engine.cc) | ||
| nv_test(test_tensorrt_engine SRCS test_engine.cc DEPS dynload_cuda tensorrt_engine) | ||
|
|
||
| add_subdirectory(convert) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| nv_test(test_op_converter SRCS test_op_converter.cc mul_op.cc conv2d_op.cc DEPS ${FLUID_CORE_MODULES}) | ||
| nv_test(test_trt_activation_op SRCS test_activation_op.cc ${ENGINE_FILE} activation_op.cc | ||
| DEPS ${FLUID_CORE_MODULES} activation_op) | ||
| nv_test(test_trt_activation_op SRCS test_activation_op.cc activation_op.cc | ||
| DEPS ${FLUID_CORE_MODULES} activation_op tensorrt_engine) | ||
| nv_test(test_io_converter SRCS test_io_converter.cc io_converter.cc DEPS dynload_cuda dynamic_loader lod_tensor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,9 @@ class TensorRTEngine : public EngineBase { | |
| // these memory directly for acceleration, for example, output the converted | ||
| // data directly to the buffer to save data copy overhead. | ||
| // NOTE this should be used after calling `FreezeNetwork`. | ||
| void*& buffer(const std::string& name); | ||
| Buffer& buffer(const std::string& tensor) override; | ||
|
||
|
|
||
| cudaStream_t* stream() { return stream_; } | ||
|
|
||
| // Fill an input from CPU memory with name and size. | ||
| void SetInputFromCPU(const std::string& name, void* data, size_t size); | ||
|
|
@@ -116,7 +118,7 @@ class TensorRTEngine : public EngineBase { | |
| cudaStream_t* stream_; | ||
| nvinfer1::ILogger& logger_; | ||
|
|
||
| std::vector<void*> buffers_; | ||
| std::vector<Buffer> buffers_; | ||
| // max data size for the buffers. | ||
| std::unordered_map<std::string /*name*/, size_t /*max size*/> buffer_sizes_; | ||
| std::unordered_map<std::string /*name*/, nvinfer1::ITensor* /*ITensor*/> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
tensor->name, 这里参数指的是buffer名字吧