Skip to content

Conversation

@xwang233
Copy link
Collaborator

@xwang233 xwang233 commented Jul 9, 2020

The two pointer variables ptr_top_diff and ptr_top_mask were introduced in #38953. Some end-to-end tests showed training performance regression due to this change. The performance is restored after removing the two pointer variables, and adding offset directly below in the indexing [ ] calculations.

See PR change https://github.com/pytorch/pytorch/pull/38953/files#diff-8085d370f4e98295074a51b8a1f829e9R187-R188

int offset = (n * channels + c) * pooled_height * pooled_width;
const scalar_t* ptr_top_diff = top_diff + offset;
const int64_t* ptr_top_mask = top_mask + offset;
for (int ph = phstart; ph < phend; ++ph) {
for (int pw = pwstart; pw < pwend; ++pw) {
if (ptr_top_mask[ph * pooled_width + pw] == h * width + w) {
gradient += ScalarConvert<scalar_t, accscalar_t>::to(ptr_top_diff[ph * pooled_width + pw]);
}
}
}

@xwang233
Copy link
Collaborator Author

xwang233 commented Jul 9, 2020

cc @ptrblck @mcarilli

@xwang233 xwang233 requested a review from ngimel July 9, 2020 05:10
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ngimel has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ngimel merged this pull request in 2cf31fb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants