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] Fix 'move instead of copy' Coverity hits #17619

Merged
merged 5 commits into from
Mar 26, 2025
Merged

Conversation

ayylol
Copy link
Contributor

@ayylol ayylol commented Mar 24, 2025

Avoid copying by:

  • Making the Queue parameter of completeSpecConstMaterialization passed by a const reference. Also changes materializeSpecConstants, getTargetInfo and getTargetFormat to accomodate this change.
  • Makes returned DefaultValue string non const so that the move ctor is called automatically in two get functions.
  • Remove dead if statement that copied value for a function call.

@ayylol ayylol requested review from a team as code owners March 24, 2025 20:35
@ayylol ayylol requested a review from slawekptak March 24, 2025 20:35
@ayylol ayylol temporarily deployed to WindowsCILock March 24, 2025 20:35 — with GitHub Actions Inactive
@ayylol ayylol marked this pull request as draft March 24, 2025 20:39
@ayylol ayylol temporarily deployed to WindowsCILock March 24, 2025 21:09 — with GitHub Actions Inactive
@ayylol ayylol temporarily deployed to WindowsCILock March 24, 2025 21:09 — with GitHub Actions Inactive
@@ -1044,14 +1044,16 @@ jit_compiler::fuseKernels(QueueImplPtr Queue,
std::shared_ptr<detail::kernel_bundle_impl> KernelBundleImplPtr;
if (TargetFormat == ::jit_compiler::BinaryFormat::SPIRV) {
detail::getSyclObjImpl(get_kernel_bundle<bundle_state::executable>(
Queue->get_context(), {Queue->get_device()}, {FusedKernelId}));
Queue->get_context(), {Queue->get_device()},
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this code doing? Why do we need to call getSyclObjImpl here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not too sure, it does look strange that we dont seem to use the returned object impl after we get it. From the looks of it, this was introduced by @sommerlukas in #8747, would you mind commenting on this bit, thanks.

For now I just reverted the change.

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 this is indeed dead code. Kernel fusion is currently not exercised since we removed the scheduler integration for it and we're currently planning a refactoring of this code.
I think you can just remove the entire if here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, i've removed that if statement

@ayylol ayylol temporarily deployed to WindowsCILock March 25, 2025 15:45 — with GitHub Actions Inactive
@ayylol ayylol marked this pull request as ready for review March 25, 2025 16:02
@ayylol ayylol temporarily deployed to WindowsCILock March 25, 2025 16:33 — with GitHub Actions Inactive
Copy link
Contributor

@sommerlukas sommerlukas left a comment

Choose a reason for hiding this comment

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

Changes on the JIT compiler look good to me, but I'd like @jchlanda to review the spec constant materialization bit of it.

@sommerlukas sommerlukas requested a review from jchlanda March 25, 2025 17:27
@ayylol
Copy link
Contributor Author

ayylol commented Mar 26, 2025

@intel/llvm-reviewers-runtime friendly ping

@aelovikov-intel aelovikov-intel dismissed their stale review March 26, 2025 18:03

Missed "if removal", need more time to look at it.

Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

"dead if" was confirmed to be dead by kernel fusion devs.

@sarnex
Copy link
Contributor

sarnex commented Mar 26, 2025

The Jenkins fail seems unrelated and I don't see how this PR could cause the issue.

@sarnex sarnex merged commit 80cf11c into intel:sycl Mar 26, 2025
21 of 22 checks passed
@ayylol ayylol deleted the move-coverity branch March 26, 2025 20:02
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.

6 participants