Skip to content

Optimize work_group reduce for GroupNorm Forward #1688

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

yucai-intel
Copy link
Contributor

Optimized the calculation of data on shared memory in GroupReduceWithoutBroadcast, so that the performance of GroupNorm Forward when shape=(1024, 128, 32, 32) is improved by 20+% (latency 2700+ms->~2000ms).
image


[[intel::reqd_sub_group_size(SIMD)]] void operator()(
sycl::nd_item<1> item) const {
const int64_t i = item.get_group(0);
WelfordOp welford_op = {/*correction=*/0, /*take_sqrt=*/false, item};
WelfordOp welford_op = {/*correction=*/0, /*take_sqrt=*/false};
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the nd_item object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WelfordOpXPU is replaced by WelfordOp, which does not need item as a pamameter.

@EikanWang
Copy link
Contributor

@xytintel , @yucai-intel , may I know which workload drives such an optimization?

@xytintel
Copy link
Contributor

@xytintel , @yucai-intel , may I know which workload drives such an optimization?

  1. Subgroup reduce for reducing computation
    image

  2. Use more fine-grained paths to allow small workloads to go directly into subgroup reduce.
    image

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.

3 participants