Skip to content

[SYCL] Disable dead arg elimination for free function kernels #19776

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 19 commits into
base: sycl
Choose a base branch
from

Conversation

lbushi25
Copy link
Contributor

@lbushi25 lbushi25 commented Aug 12, 2025

This PR disables dead argument elimination for free function kernels. When using a free function kernel, the user sets the arguments manually using handler::set_arg but if certain arguments are optimized away in case they are not used, the implementation needs to be aware of this and remove the relevant set_arg calls. Instead, its much more feasible to just disable dead arg elimination in this case.

Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

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

We need a LIT test for the change, see llvm/test/Transforms/DeadArgElim/sycl-kernels.ll for an example of existing test

@aelovikov-intel
Copy link
Contributor

I've removed reference to the internal bug report from the PR's description. That's not how upstream development should be done.

That said, the rest of the description was great and provides enough context for the change, so no additional actions needed.

@aelovikov-intel
Copy link
Contributor

Something is wrong with codeownership. I'd expect llvm to be owned by @intel/dpcpp-tools-reviewers , not by @intel/llvm-reviewers-runtime .

@lbushi25 lbushi25 requested a review from a team as a code owner August 13, 2025 18:48
// This test verifies that the dead argument elimination optimization pass does not affect
// free function kernels.

// CHECK-NOT: !sycl_kernel_omit_args
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a non-free-function kernel to this test and check that DAE still works?

Copy link
Contributor Author

@lbushi25 lbushi25 Aug 14, 2025

Choose a reason for hiding this comment

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

I refactored the tests. I deleted this one and I added two test cases for free function kernels in the existing test sycl-kernels-neg.ll using LLVM IR directly.
Note that there is already another test sycl-kernels.ll in the same directory which checks that DAE still works with other kernels.

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