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
[TRT] elementwise_add+transpose fusion #50081
[TRT] elementwise_add+transpose fusion #50081
Conversation
56b671f
to
175e884
Compare
for (int i = 0; i < out_dims.nbDims; i++) { | ||
out_shape.push_back(out_dims.d[i]); | ||
out_numel *= out_dims.d[i]; | ||
} |
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.
复杂的前处理都移到config里
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.
已将前处理都移到config里, 感谢review
auto input_type = input_desc[0].type; | ||
auto output_format = output_desc[0].format; | ||
if (input_type == nvinfer1::DataType::kFLOAT) { | ||
VLOG(1) << "TRT Plugin DataType selected. elementwiseadd_transpose-->fp16"; |
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.
fp32
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.
已修改笔误, 感谢review
const float *y = static_cast<const float *>(inputs[1]); | ||
float *out = static_cast<float *>(outputs[0]); | ||
VLOG(1) << "TRT Plugin format selected. elementwiseadd_transpose-->kLINEAR"; | ||
phi::DenseTensor ele_out_tensor; |
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.
改成成员变量在config里初始化可以不用每次分配释放
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.
已将中间变量改为成员变量并在config中分配, 感谢review
phi::make_ddim(x_shape)); | ||
phi::DenseTensorMeta y_meta(phi::DataType::FLOAT32, | ||
phi::make_ddim(y_shape)); | ||
phi::DenseTensorMeta out_meta(phi::DataType::FLOAT32, |
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.
meta都可以改到config里
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.
已将meta都改到configezhong, 感谢review
c1cc5ed
to
edb7d40
Compare
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
PR types
Performance optimization
PR changes
OPs
Describe
This pr make fusion of elementwise_add and transpose which transpose nhwc to nchw.