-
Notifications
You must be signed in to change notification settings - Fork 784
[SYCL] Save user specified names in lambda object #5772
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
Conversation
This patch retains user specified names for lambda captures in lambda object. As a result, the name of openCL kernel arguments generated for SYCL kernel specified as a lamdba, now includes the user names in kernel argument name (matches current behavior for SYCL kernel specified as a functor object). Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
I am also working on a patch to upstream this support to LLVM project. I'm hoping to put up that patch for review this week. I will share the link here once I put it up. I'm not sure if they will accept the change since there is no strong justification for this other than "it improves SYCL". Since there is some urgency for this patch for DPCPP, I am hoping to get the ball rolling here in the meantime. |
Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
I don't have the environment to test CUDA fails. The failures however seem to be due to IR changes because of name change. I've fixed what I saw in failing tests, but could not verify fix locally. Hopefully I've caught all the issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool feature for the debug!
@bader I don't believe the failures are a result of this patch. This is the 3rd run with the same code (first run had missed a few CUDA tests which I now fixed by changing tests, second run had one flaky test which longer fails) and this is third run which has new fails which did not show up in previous runs |
Just rethinking last night about it, what happens it you have a non qualified name which appears twice, so you have a name conflict? |
I believe you will have the same name. This isn't new behavior though. Accessors defined in nested structs already had name retained in kernel lambda object. For example - Code:
AST for kernel parameters -
This is existing behavior though. Variable names nested in some class were available prior to this patch as well. Only names of direct captures were missing - since clang didn't save these in lambda object. This patch just added that. There might be value in using qualified names instead. |
@elizabethandrews I am not sure I fully understand this PR but I have a question. Value names are discarded by default for release build of the Clang (no assertions), please see: And to disable this behaviour the following option can be used: If we want to preserve value names for DPCPP then shouldn't we enforce -fno-discard-value-names in driver if -fsycl is used? |
@againull this PR wasn't about preserving names for llvm::values. This PR preserves names when generating an openCL kernel (from SYCL kernel). We were not saving user-specified names in some cases resulting in generic names in LLVM IR for openCL kernel arguments, irrespective of options used. |
Would it make sense to save a fully qualified mangled name then instead of the short one? |
From a functional perspective I don't think it makes a difference since same names don't seem to bother backend. Name generated in IR will be unique. For debugging purposes, if we have names which repeat within a kernel maybe fully qualified names helps? I'm not sure if it will make the IR verbose though. |
This patch retains user specified names for lambda captures in
lambda object. As a result, the name of openCL kernel arguments
generated for SYCL kernel specified as a lamdba, now includes the
user names in kernel argument name (matches current behavior for
SYCL kernel specified as a functor object).
Signed-off-by: Elizabeth Andrews elizabeth.andrews@intel.com