-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Core] Add the graph optimization of subblocks for transformer model #3947
[Core] Add the graph optimization of subblocks for transformer model #3947
Conversation
hong19860320
commented
Jul 14, 2020
•
edited
Loading
edited
- Fix the dims of parent idx of the arm kernel of beam_search op
- elementwise_mul supports int64_t data type with broadcasting
- Add print op and kernel for debugging
- Support throwing the exception when the internal error occurs
- Refine while and conditional_block op kernel
- Support the graph optimization on subblocks
- Pass program_desc and block_idx into the kernel of the control flow ops(while/conditional_block/subgraph), and create the RuntimeProgram online, it make it possiable to call the control flow ops recursively
- Add unit test for masked transformer model
…_t data type, add print op and kernel, add exeception test=develop
…into hongming/support_subblock
…into hongming/support_subblock
test=develop
LOG(FATAL) | ||
<< "Getting 'tensor_desc' is not supported by the type of var %s." | ||
<< this->Name(); | ||
LOG(WARNING) << "Getting 'tensor_desc' is not supported by the type(" |
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.
while op会带有STEP_SCOPE类型的var,如果使用FATAL会导致模型加载失败,程序挂掉。
TARGET(kHost), type.precision(), DATALAYOUT(kNCHW)); | ||
} | ||
} | ||
|
||
// Update a's kUnk fields from b's fields. | ||
void UpdateTypeFrom(const Type*& a, const Type* b) { // NOLINT |
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.
const Type*&a -> const Type* a ?
POD 不需要引用
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.
需要修改a的值的,等价于const Type** a
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.
为了防止歧义,已修改为const Type** a
const char kBackward[] = "BACKWARD"; | ||
const char kBoth[] = "BOTH"; | ||
|
||
class TensorFormatter { |
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.
TensorReprFormatter
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.
if [[ $WITH_EXCEPTION == "ON" && $ARCH == "armv7" && $TOOLCHAIN != "clang" ]]; then | ||
set +x | ||
echo | ||
echo -e "Error: only clang provide C++ exception handling support for 32-bit ARM." |
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.
是否需要修改文档?
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.
是否需要修改文档?
只有在armv7需要支持exception的时候才要求用clang,而支持exception是一个新特性,可以在发版的时候修改文档
…into hongming/support_subblock test=develop
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.
LGTM
…former model (PaddlePaddle#3947) test=develop * [Core][ARM] Fix beam_search, eltwise_mul supports broadcast and int64_t data type, add print op and kernel, add exeception test=develop * Fix the dims of parent idx of the arm kernel of beam_search op * elementwise_mul supports int64_t data type with broadcasting * Add print op and kernel for debugging * Support throwing the exception when the internal error occurs * Refine while and conditional_block op kernel * Support the graph optimization on subblocks * Pass program_desc and block_idx into the kernel of the control flow ops(while/conditional_block/subgraph), and create the RuntimeProgram online, it make it possiable to call the control flow ops recursively *Add unit test for masked transformer model
…former model (#3947) (#3979) * [Cherry-pick][Core] Add the graph optimization of subblocks for transformer model (#3947) test=develop * [Core][ARM] Fix beam_search, eltwise_mul supports broadcast and int64_t data type, add print op and kernel, add exeception test=develop * Fix the dims of parent idx of the arm kernel of beam_search op * elementwise_mul supports int64_t data type with broadcasting * Add print op and kernel for debugging * Support throwing the exception when the internal error occurs * Refine while and conditional_block op kernel * Support the graph optimization on subblocks * Pass program_desc and block_idx into the kernel of the control flow ops(while/conditional_block/subgraph), and create the RuntimeProgram online, it make it possiable to call the control flow ops recursively *Add unit test for masked transformer model