-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
optimization of max_pool3d forward #45820
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
I think it is better to list the perf value with a table. |
if (ele < | ||
input_data_cur[(d * input_height + h) * input_width + w]) { | ||
max_index = (d * input_height + h) * input_width + w; | ||
ele = input_data_cur[max_index]; |
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.
Formula (d * input_height + h) * input_width + w
has appeard twice, would it be better to assign this formula to a local data, example below:
T1 cur_data = input_data_cur[(d * input_height + h) * input_width + w];
ele = ele < cur_data] ? cur_data: ele;
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.
Because max_index should be assigned only when the condition ele < input_data_cur[(d * input_height + h) * input_width + w]
is true and it would be used at the end of funciton for return mask_data, so I should assign the value to max_index inside the if statement and therefore formula (d * input_height + h) * input_width + w
appears twice.
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.
Will time cost of formula (d * input_height + h) * input_width + w
shrink with code below ?
for (int w = wstart; w < wend; ++w) {
max_index = (d * input_height + h) * input_width + w;
if (ele < input_data[max_index]) {
ele = input_data[max_index];
}
}
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.
The max_index cannot be calculated correctly with this codes, and consequently the mask_data return in the function would be incorrect.
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.
okay
Thanks for your advice, I have modified description to present the perf value in the form of table. |
int blocks = (nthreads + thread_num - 1) / thread_num; | ||
dim3 threads(thread_num, 1); | ||
dim3 grid(blocks, 1); | ||
int thread_x = 32; |
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.
@fengxiaoshuai hi, this PR deletes code for NV_JETSON about threads config, however the thread_num is 256 in all which is under the limitation for NV_JETSON.
Can this PR be merged?
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.
jetson系列中比较低端的GPU寄存器很少,有时候会出现资源不足,kernel launch失败,这个QA后台有CE监控
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