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 crash caused by functor without call operator as Kernel #7104

Merged
merged 12 commits into from
Oct 28, 2022

Conversation

srividya-sundaram
Copy link
Contributor

@srividya-sundaram srividya-sundaram commented Oct 18, 2022

When a named function object without a call operator defined is used as a kernel, the compiler causes a crash.
With the changes in this PR, a compiler error is thrown when a lambda or function object without a call operator defined is used as a kernel.

@srividya-sundaram srividya-sundaram changed the title [WIP] [SYCL] Fix crash caused by functor without call operator as Kernel [SYCL] Fix crash caused by functor without call operator as Kernel Oct 21, 2022
@srividya-sundaram srividya-sundaram marked this pull request as ready for review October 21, 2022 05:52
@srividya-sundaram srividya-sundaram requested a review from a team as a code owner October 21, 2022 05:52
clang/lib/Sema/SemaSYCL.cpp Outdated Show resolved Hide resolved
clang/lib/Sema/SemaSYCL.cpp Outdated Show resolved Hide resolved
clang/test/SemaSYCL/undefined-functor.cpp Show resolved Hide resolved
clang/test/SemaSYCL/undefined-functor.cpp Outdated Show resolved Hide resolved
clang/lib/Sema/SemaSYCL.cpp Outdated Show resolved Hide resolved
@srividya-sundaram
Copy link
Contributor Author

ping @intel/dpcpp-cfe-reviewers

Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

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

Can you make the changes in c779855 a separate NFC PR? Not needed as part of this one.

clang/test/SemaSYCL/undefined-functor.cpp Outdated Show resolved Hide resolved
clang/test/SemaSYCL/undefined-functor.cpp Show resolved Hide resolved
@srividya-sundaram
Copy link
Contributor Author

Failures in SYCL / Linux / OCL GEN9 LLVM Test Suite and SYCL / Linux / OCL x64 LLVM Test Suite are unrelated to this patch.

clang/lib/Sema/SemaSYCL.cpp Outdated Show resolved Hide resolved
clang/test/SemaSYCL/undefined-functor.cpp Outdated Show resolved Hide resolved
srividya-sundaram and others added 2 commits October 26, 2022 10:31
Co-authored-by: premanandrao <premanand.m.rao@intel.com>
Co-authored-by: premanandrao <premanand.m.rao@intel.com>
@srividya-sundaram
Copy link
Contributor Author

@intel/llvm-gatekeepers Hi, this is ready to be merged. Thanks!

@steffenlarsen
Copy link
Contributor

@srividya-sundaram - CI seems to fail in SemaSYCL/undefined-functor.cpp.

@srividya-sundaram
Copy link
Contributor Author

srividya-sundaram commented Oct 28, 2022

@steffenlarsen Thanks for pointing out. I have fixed the failures.
Linux / OCL x64 LLVM Test Suite failures seem unrelated to this patch.

Note to the reviewers:
I have removed the test case causing failure for the below reasons:
We currently diagnose undefined functions called on device from either kernels or SYCL device functions unless they are marked with the SYCL_EXTERNAL attribute. We could either add the SYCL_EXTERNAL attribute or expect the error to fix the test.
But this seems like a tangent to what we want to test in this patch.
Also, lambda expressions(closure types) and functors, which are used to define SYCL kernels, have the call operator defined in them. Hence dropping the test case with just the call operator declared seemed appropriate. Hope this is okay.

@premanandrao
Copy link
Contributor

I have removed the test case causing failure

What was the nature of the failure?

@srividya-sundaram
Copy link
Contributor Author

I have removed the test case causing failure

What was the nature of the failure?

The test was throwing this error for the undefined functor case:
SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute error: 'note' diagnostics seen but not expected

@srividya-sundaram
Copy link
Contributor Author

ping @intel/llvm-gatekeepers

@pvchupin
Copy link
Contributor

OCL x64 testing failed on drivers download attempt. Looks like some sporadic network issue.

@pvchupin pvchupin merged commit 490ee55 into intel:sycl Oct 28, 2022
srividya-sundaram added a commit to srividya-sundaram/llvm that referenced this pull request Jan 18, 2023
bader pushed a commit that referenced this pull request Jan 19, 2023
…nctors without call operators (#8047)

This PR reverts the support for templated call operators in functors and
functors without call operators which were introduced in #7104 and #7970

We found a regression internally with
#7104 that
#7970 attempted to fix. A subsequent
review of #7970 internally, lead to
identifying some pre-existing caveats with regards to supporting
templated call operators in functor, supporting cases where there are
multiple call operators in functor and making sure the right
instantiated version is selected etc.

In order to better address the pre-existing issues as well as gaps in
#7970 , it was decided to revert the above two
PRs.
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.

7 participants