Skip to content

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
@uwedolinsky uwedolinsky changed the title [SYCL][NATIVECPU] always inline kernels with -O3 [SYCL][NATIVECPU][PERF] always inline kernels with -O3 Apr 2, 2025
auto *NewF =
cloneFunctionAndAddParam(OldF, StatePtrType, CurrentStatePointerTLS);
NewF->setLinkage(llvm::GlobalValue::LinkageTypes::LinkOnceODRLinkage);
if (O3 && !NewF->hasFnAttribute(Attribute::NoInline)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be limited to -O3 or could we do if (!NewF->hasOptNone() && !NewF->hasFnAttribute(Attribute::NoInline)) ?

(If we do want it to be limited to -O3, I think it'd be slightly better to have OptLevel as the field that we store in the pass, and check OptLevel == OptimizationLevel::O3 here, but I'm thinking we want it at other levels too.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, do we know why the regular inliner doesn't handle this?

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