Skip to content

[SYCL] Correctly handle debug information in global offset pass #16963

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
Mar 19, 2025

Conversation

jchlanda
Copy link
Contributor

Make sure that cloned functions do not use debug information that points to the original function. In doing so for each cloned function, create a DISubprogram that describe the clone and walk the instructions of cloned functions to correctly fix up the debug information.

@jchlanda jchlanda requested a review from a team as a code owner February 11, 2025 11:16
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from 1564ff0 to a89e7b4 Compare February 11, 2025 11:30
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from a89e7b4 to 37b3f73 Compare February 11, 2025 12:30
@jchlanda jchlanda marked this pull request as draft February 12, 2025 09:56
@asudarsa
Copy link
Contributor

Thanks for the PR.
Two pointers:

  1. I think this will benefit from a review from someone in the debug info team.
  2. Looking at the change itself, this issue could arise whenever anyone tries to clone a function. Can we address this issue upstream whenever we clone a function?

Thanks

@jchlanda
Copy link
Contributor Author

jchlanda commented Feb 14, 2025

2. Looking at the change itself, this issue could arise whenever anyone tries to clone a function. Can we address this upstream whenever we clone a function?

You are right, I think if we manage to populate the ValueToValueMapTy &VMap of the CloneFunctionInto with all the duplicated functions, then llvm would resolve the debug information for us, and the manual fixups done in the first commit will not be needed.
I've marked this PR as a draft and will explore the VMap solution.

Thank you.

@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from 37b3f73 to 1c33761 Compare February 14, 2025 07:42
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from efeee4e to 2ea9c7c Compare February 14, 2025 10:15
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from 2ea9c7c to 9775c5b Compare February 19, 2025 07:15
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from 9775c5b to 5a2aafa Compare February 24, 2025 10:26
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from 5a2aafa to c89a0b0 Compare February 25, 2025 14:10
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from c89a0b0 to d215a34 Compare February 27, 2025 08:47
@jchlanda jchlanda force-pushed the jakub/disubprogram_global_offset branch from a2d6b29 to f111514 Compare March 6, 2025 06:39
Make sure that cloned functions do not use debug information that points
to the original function.
@asudarsa
Copy link
Contributor

asudarsa commented Mar 7, 2025

Hi @jchlanda

Can you please let me know about the recent changes on this PR? I see only one commit and am unable to comment about the changes after my earlier comment.

Thanks

@jchlanda
Copy link
Contributor Author

jchlanda commented Mar 7, 2025

Hi @jchlanda

Can you please let me know about the recent changes on this PR? I see only one commit and am unable to comment about the changes after my earlier comment.

Thanks

HI @asudarsa

I've followed your suggestion and worked on a solution that utilizes llvm's CloneFunction machinery. Essential what this patch does now is that it creates all the functions that would be cloned during the execution of the pass ahead of time - that is before we get to create functions with offset. This is done so that we can populate a value-to-value map that llvm uses to keep track of all the debug information amongst other).

While this PR was in draft state, I rebased it and dropped some of the earlier, now not needed, commits.

Thanks.

@jchlanda
Copy link
Contributor Author

Ping @intel/dpcpp-tools-reviewers this PR should now be ready for your review.
Thank you.

@jchlanda
Copy link
Contributor Author

Friendly ping @intel/dpcpp-tools-reviewers

@npmiller
Copy link
Contributor

@intel/dpcpp-tools-reviewers could we get some help with an approval/review on this? It's actually only needed for CUDA and HIP (maybe we should change the codeowners on these files?), and we'd like to get this patch into the next release.

@npmiller
Copy link
Contributor

Updated the codeowners here: #17484

@jchlanda
Copy link
Contributor Author

With the change to the codeowners structure and @npmiller's approval this should be read to merge @intel/llvm-gatekeepers

@sommerlukas
Copy link
Contributor

@jchlanda Github UI still says that merge is blocked due to missing review from @intel/dpcpp-tools-reviewers, so the change to code owners might only take effect for new PRs.

@intel/dpcpp-tools-reviewers can we get a quick review on this one?

Copy link
Contributor

@maarquitos14 maarquitos14 left a comment

Choose a reason for hiding this comment

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

LGTM.

@jchlanda
Copy link
Contributor Author

@intel/llvm-gatekeepers we should be ready to roll now. Thank you.

@ldrumm ldrumm merged commit 1fd2ac5 into intel:sycl Mar 19, 2025
22 checks passed
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