-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Immutable kernel functions redo. #2259
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] Immutable kernel functions redo. #2259
Conversation
c2f532c
to
2b005ed
Compare
There is a warning that is being emitted by ExternalASTSource.h when building the ASTImporterTest.cpp unit test. I wasn't seeing this until I rebased. However, it seems to be in the sycl branch of intel/llvm. |
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.
FE changes LGTM.
// SYCL 2020 - kernel functions are passed by reference. | ||
template <typename name, typename Func> | ||
#if defined(SYCL2017) | ||
// expected-warning@+2 {{Passing of kernel functions by reference is a SYCL 2020 extension}} |
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.
This probably should be emitted as a note or only in pedantic mode. This API can be back-ported to SYCL-1.2.1 mode (as it's done in our implementation if I understand the patch), but it might be supported by other implementations. IIRC, DPC++ compiler sets -Wsycl-strict
if -sycl-std=
option is set. Am I right?
I'd like to hear @erichkeane opinion on this.
// expected-warning@+2 {{Passing of kernel functions by reference is a SYCL 2020 extension}} | |
// expected-warning@+2 {{Passing of kernel functions by reference is a SYCL 2020 extension}} |
"extension"? I think this is standard SYCL-2020 API.
c995f53
to
b6abab4
Compare
clang/lib/Sema/SemaSYCL.cpp
Outdated
@@ -707,7 +707,39 @@ getKernelInvocationKind(FunctionDecl *KernelCallerFunc) { | |||
|
|||
static const CXXRecordDecl *getKernelObjectType(FunctionDecl *Caller) { | |||
assert(Caller->getNumParams() > 0 && "Insufficient kernel parameters"); | |||
return Caller->getParamDecl(0)->getType()->getAsCXXRecordDecl(); | |||
|
|||
QualType KernelParamTy = (*Caller->param_begin())->getType(); |
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.
I don't know if you've done the re-merge yet, but this line changes a bit to Caller->getParamDecl(0)->getType().
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.
done.
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.
Just scrolled through the test changes, but the CFE parts look ok to me. Properly rebased as well it appears.
if (KernelParamTy->isReferenceType()) { | ||
// passing by reference, so emit warning if not using SYCL 2020 | ||
if (LangOpts.SYCLVersion < 2020) | ||
Diag(KernelFunc->getLocation(), diag::warn_sycl_pass_by_reference_future); |
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.
Note for other reviewers: since these are just warnings, we don't want them invalidating the kernelFunc.
else if (LangOpts.SYCLVersion == 2020) | ||
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "2020"); |
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.
From SYCL-2020 provisional specification.
"SYCL_LANGUAGE_VERSION substitutes an integer reflecting the version number and revision of the SYCL
language being supported by the implementation. The version of SYCL defined in this document will
have SYCL_LANGUAGE_VERSION substitute the integer 202001, composed with the general SYCL version
followed by 2 digits representing the revision number;"
As SYCL targets non-OpenCL API now, I suggest defining SYCL_LANGUAGE_VERSION
for any SYCL version using "YEARREVISION" format and define CL_SYCL_LANGUAGE_VERSION=121
only for SYCL-1.2.1.
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.
thanks. Done.
7ccef1e
to
07fab10
Compare
/summary:run |
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
8073b8e
to
391ba54
Compare
rebased (again) - |
/summary:run |
I have no idea what is going on with the Jenkins Summary - the error doesn't even look like it's pulling the same PR. But as that is not required, is it possible to get this merged anyway? This PR touches a lot of files, has been reviewed several times, but lately each time we go to merge there is a conflict with some other change, so I have to rebase, re-run the tests, re-request reviews, and by the time it all finishes, another conflict will be introduced. |
Support _for_ `sycl-std=2020` was added in an earlier PR( #2259 ) but the default SYCL version was left alone. Now we are changing the FE so that if not otherwise specified `sycl-std=2020` is elected as the default. Signed-off-by: Chris Perkins <chris.perkins@intel.com>
SPIRVEntry created in function getEntry isn't deleted when it is ExtOp and isn't SourceContinued. Original commit: KhronosGroup/SPIRV-LLVM-Translator@b891a51
[L0] Enable Immediate Command Lists by default given Intel GPU DG2 or newer
This is the same immutable kernel functions PR that was merged (and reverted) last week. The SYCL conformance tests have been updated, so hopefully this should be mergeable. I've added the
__SYCL_NONCONST_FUNCTOR__
as requested.I have also hooked up the
-sycl-std=
compiler driver flag so that it will passDCL_SYCL_LANGUAGE_VERSION=121
if SYCL 1.2.1 is chosen orDCL_SYCL_LANGUAGE_VERSION=2020
if SYCL 2020 is chosen.In SYCL 2020 kernel functions are now const and passed by reference. In this PR the existing API constant CL_SYCL_LANGUAGE_VERSION now determine another constant ( SYCL_NONCONST_FUNCTOR ) that makes the kernel functions be constant references (or not).
In the Clang Front end, both by-reference and by-value passing of the kernel functions is supported, and a diagnostic emitted if that is mismatched. The
sycl-std
flag now supports2020
as a valid option. And thesycl-std
flag will pass-DCL_SYCL_LANGUAGE_VERSION=
to match its election. Tests have been added to confirm that both kernel passings are supported and that the sycl-std flag is working correctly. Additionally, there are a lot of FE tests that employ mock kernels, these have been updated to the SYCL 2020 convention avoiding the deferred maintenance.Signed-off-by: Chris Perkins chris.perkins@intel.com