Skip to content

[SYCL] Emit kernel args size warning for real sycl headers #2554

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 2 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -11005,7 +11005,7 @@ def err_sycl_restrict : Error<
"}0">;
def warn_sycl_kernel_too_big_args : Warning<
"size of kernel arguments (%0 bytes) may exceed the supported maximum "
"of %1 bytes on some devices">, InGroup<SyclStrict>;
"of %1 bytes on some devices">, InGroup<SyclStrict>, ShowInSystemHeader;
def err_sycl_virtual_types : Error<
"No class with a vtable can be used in a SYCL kernel or any code included in the kernel">;
def note_sycl_recursive_function_declared_here: Note<"function implemented using recursion declared here">;
Expand Down
21 changes: 21 additions & 0 deletions sycl/test/basic_tests/args-size-overflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN: %clangxx -fsycl -fsycl-device-only -Xclang -verify -Wsycl-strict %s -fsyntax-only

#include <CL/sycl.hpp>

using namespace cl::sycl;

// expected-warning@../../include/sycl/CL/sycl/handler.hpp:919 {{size of kernel arguments (8068 bytes) may exceed the supported maximum of 2048 bytes on some devices}}

int main() {
struct S {
int A;
int B;
int Array[2015];
} Args;
queue myQueue;
myQueue.submit([&](handler &cgh) {
// expected-note@+1 {{in instantiation of function template specialization 'cl::sycl::handler::single_task}}
cgh.single_task<class kernel>([=]() { (void)Args; });
});
return 0;
}