Skip to content

[SYCL] Optimize operator[] method of host accessor #6853

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

Merged
merged 3 commits into from
Sep 23, 2022

Conversation

romanovvlad
Copy link
Contributor

Compiler cannot optimize out calls to getPtr(), getOffset() and getMemoryRange(), that were used in accessor::operator[], because they may have side effects(e.g. printf). The patch adds a member in the accessor which points to the actual data stored in the accessor_impl. This pointer is initialized once during construction and used instead of functions mentioned above.

Compiler cannot optimize out calls to getPtr(), getOffset() and
getMemoryRange(), that were used in accessor::operator[], because
they may have side effects(e.g. printf). The patch adds a member
in the accessor which points to the actual data stored in the
accessor_impl. This pointer is initialized once during construction
and used instead of functions mentioned above.
@romanovvlad romanovvlad requested a review from a team as a code owner September 22, 2022 16:49
Copy link
Contributor

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1,26 @@
// RUN: %clangxx -O2 -fsycl -S -emit-llvm %s -o - | FileCheck %s
Copy link
Contributor

@bader bader Sep 23, 2022

Choose a reason for hiding this comment

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

I think this test is supposed to call only a host compiler.

Copy link
Contributor Author

@romanovvlad romanovvlad Sep 23, 2022

Choose a reason for hiding this comment

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

Modified the compile line. Is there a convenient way to call the host compiler only?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think -fsycl-host-only might be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cannot find this option in the clang's help.

Copy link
Contributor

Choose a reason for hiding this comment

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

@romanovvlad romanovvlad merged commit 01e60f7 into intel:sycl Sep 23, 2022
@pvchupin
Copy link
Contributor

@romanovvlad
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants