-
Notifications
You must be signed in to change notification settings - Fork 745
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] Propagate attributes of original kernel to wrapper kernel generated for range-rounding #3306
Conversation
Signed-off-by: rdeodhar <rajiv.deodhar@intel.com>
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.
Please, cherry-pick 496f9a0 to this pull request to fix the checks.
…s when rounding up the range (intel#3154) Parallel_for range rounding creates a wrapped version of the original kernel. Kernel attributes need to be copied from original kernel to new wrapped kernel. Signed-off-by: rdeodhar <rajiv.deodhar@intel.com>
@rdeodhar please fix the conflicts |
Signed-off-by: rdeodhar <rajiv.deodhar@intel.com>
@rdeodhar please update commit message and title to reflect the re-landing of this patch. Thanks! |
No objections from my side, I'd like @AaronBallman to take a look.
clang/lib/Sema/SemaSYCL.cpp
Outdated
@@ -306,6 +306,36 @@ static int64_t getIntExprValue(const Expr *E, ASTContext &Ctx) { | |||
return E->getIntegerConstantExpr(Ctx)->getSExtValue(); | |||
} | |||
|
|||
// Collect function attributes related to SYCL |
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.
Add a period at the end of the comment.
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.
OK
clang/lib/Sema/SemaSYCL.cpp
Outdated
// For a wrapped parallel_for, copy attributes from original | ||
// kernel to wrapped kernel. | ||
void Sema::copySYCLKernelAttrs(const CXXRecordDecl *KernelObj) { | ||
// Get the operator() function of the wrapper |
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.
Add a period to the end of the comment.
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.
OK.
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
@@ -0,0 +1,54 @@ | |||
// RUN: %clang_cc1 %s -fsyntax-only -ast-dump -fsycl -fsycl-is-device -triple spir64 | FileCheck %s |
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 how we typically organize test, but in community, tests for -ast-dump
typically live in the AST
directory.
@@ -6,7 +6,7 @@ | |||
using namespace cl::sycl; | |||
queue q; | |||
|
|||
[[intel::use_stall_enable_clusters]] void test() {} //expected-warning{{'use_stall_enable_clusters' attribute ignored}} | |||
[[intel::use_stall_enable_clusters]] void test() {} // expected-warning{{'use_stall_enable_clusters' attribute allowed only on a function directly called from a SYCL kernel}} |
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.
Can you use the full attribute diagnostic here (it drops the attribute ignored
part, which made me think the diagnostic text was a problem)?
At some point we need to consider replacing most of the fancy comfort attributes by just using the C++ type system, for example like http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2183r0.html So instead of hacking the compiler for each magical class, it is mostly metaprogramming in the C++ run-time library. |
Strong +1 (many of these attributes feel a bit suspect to me). |
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.
sycl/test/kernel_param/attr.cpp LGTM
* upstream/sycl: (1804 commits) [SYCL] SYCL 2020 backend interoperability part 1 (intel#3354) [Driver][SYCL] Address issue when unbundling for non-FPGA archive (intel#3366) [SYCL][Doc] Update compiler options descriptions (intel#3340) [SYCL] Update ABI dump tool to disable checks with libcxx by default (intel#3370) [SYCL] Update the way we handle -sycl-std= based on community review feedback (intel#3371) [SYCL] Move tests to llvm-test-suite (intel#3359) [SYCL][PI][L0] Revert copy batching from intel#3232 (intel#3363) [SYCL] Remove unsupported option. [SYCL] Fix pragma setting in sycl-post-link (intel#3358) [SYCL] Add ITT annotation instructions (intel#3299) [SYCL] Propagate attributes of original kernel to wrapper kernel generated for range-rounding (intel#3306) [BuildBot] Uplift GPU RT version for Linux to 21.09.19150 (intel#3316) [SYCL] Retain PI events until they have signaled (intel#3350) [SYCL] Add caching when using interop constructor (intel#3327) Add ITT stubs and wrappers for SPIR-V devices (intel#3279) [SYCL] Add zero argument version of buffer::reinterpret() for SYCL 2020 (intel#3333) [SYCL] Restore old behavior of get() method (intel#3356) [Driver][SYCL][FPGA] Improve FPGA AOT when using Triple (intel#3330) [SYCL] Revert support for pinned_host_memory extension in Level-Zero backend. Make it a NOP (intel#3349) [SYCL] Remove redundant build options processing (intel#3342) ...
This change propagates attributes of a user-written SYCL kernel to the kernel generated as a wrapper around the original kernel. The wrapped kernel is executed with the original range rounded-up, which improves work group formation on CPUs and GPUs.
Signed-off-by: rdeodhar rajiv.deodhar@intel.com