Skip to content

Cache the chosen kernel of operators'.#16004

Merged
luotao1 merged 3 commits intoPaddlePaddle:developfrom
Xreki:core_opt_choose_kernel
Apr 8, 2019
Merged

Cache the chosen kernel of operators'.#16004
luotao1 merged 3 commits intoPaddlePaddle:developfrom
Xreki:core_opt_choose_kernel

Conversation

@Xreki
Copy link
Contributor

@Xreki Xreki commented Mar 1, 2019

No description provided.

@Xreki Xreki force-pushed the core_opt_choose_kernel branch from db95f2a to d4674da Compare March 1, 2019 10:12
@luotao1
Copy link
Contributor

luotao1 commented Mar 1, 2019

I test it on PyramidDnn inference case.
Command: ./paddle/fluid/inference/tests/api/test_analyzer_pyramid_dnn --infer_model=third_party/inference_demo/pyramid_dnn/model/ --infer_data=third_party/inference_demo/pyramid_dnn/data.txt --gtest_filter=Analyzer_Pyramid_DNN.profile --paddle_num_threads=1 --repeat=1000 --batch_size=1

2450 v2 (ms per sample) 2620 v3 (ms per sample)
before 0.305032 0.228627
after 0.264652 0.206517
speedup 13% 9.6%

PADDLE_THROW(
"There are no kernels which are registered in the %s operator.", type_);
}
if (!kernel_type_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

924行if内部,可以再封装成一个函数么?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

protected:
mutable OpKernelConfigsMap kernel_configs_map_;
mutable std::shared_ptr<OpKernelType> kernel_type_;
mutable std::shared_ptr<OpKernelFunc> kernel_func_;
Copy link
Contributor

Choose a reason for hiding this comment

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

建议使用unique_ptr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Xreki Xreki force-pushed the core_opt_choose_kernel branch from 9017f37 to d5c64cb Compare March 5, 2019 07:36
test=develop
@Xreki Xreki force-pushed the core_opt_choose_kernel branch from d5c64cb to 1041e18 Compare March 5, 2019 08:23
@luotao1 luotao1 requested a review from panyx0718 March 5, 2019 11:18
@luotao1 luotao1 merged commit 1041e18 into PaddlePaddle:develop Apr 8, 2019
@Xreki Xreki deleted the core_opt_choose_kernel branch October 29, 2019 00:40
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.

2 participants