Skip to content
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

[SYCL][NATIVECPU] always inline kernels with -O3 #17360

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

uwedolinsky
Copy link
Contributor

Inlines kernels into subhandler when compiling for -O3, and removes the kernels if inlining succeeded.

@uwedolinsky uwedolinsky requested a review from a team as a code owner March 7, 2025 16:25
if (!NewF->hasFnAttribute(Attribute::AlwaysInline))
NewF->addFnAttr(Attribute::AlwaysInline);
// Set internal linkage to enable removal of kernel after inlining
NewF->setLinkage(llvm::GlobalValue::LinkageTypes::InternalLinkage);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a behavioral change that probably should not depend on -O3, we should probably always adjust the linkage. If we do always adjust the linkage, do we still need AlwaysInline, or does the regular inliner already handle it then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The regular inliner might require increasing the threshold to inline large kernels, whereas the AlwaysInliner probably always works if the kernel is inlineable (which it should be). We probably want to keep the existing linkage on other optimisation levels to avoid potentially increasing code size for example when calling kernels from functions with multiple definitions.

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.

2 participants