From c4ab8822f4e915e520cf081a0cd1c3bb770d35c3 Mon Sep 17 00:00:00 2001 From: "Skrobot, Daniel" Date: Thu, 19 Sep 2024 11:54:58 +0200 Subject: [PATCH] follow up clean up of tests --- .../check-work-group-size-hint-device.cpp | 41 +----------- .../SemaSYCL/intel-max-work-group-size.cpp | 11 ++-- clang/test/SemaSYCL/reqd-sub-group-size.cpp | 25 ++------ clang/test/SemaSYCL/reqd_work_group_size.cpp | 64 ++++++------------- clang/test/SemaSYCL/sub-group-size.cpp | 10 --- ...ce-intel-reqd-work-group-size-template.cpp | 6 +- 6 files changed, 32 insertions(+), 125 deletions(-) diff --git a/clang/test/SemaSYCL/check-work-group-size-hint-device.cpp b/clang/test/SemaSYCL/check-work-group-size-hint-device.cpp index 6737fe7f2aa70..16873e96fd9ab 100644 --- a/clang/test/SemaSYCL/check-work-group-size-hint-device.cpp +++ b/clang/test/SemaSYCL/check-work-group-size-hint-device.cpp @@ -17,8 +17,7 @@ // Produce a conflicting attribute warning when the args are different. [[sycl::work_group_size_hint(4, 1, 1)]] void f3(); // expected-note {{previous attribute is here}} -[[sycl::work_group_size_hint(1, 1, 32)]] void f3() {} // expected-warning {{attribute 'work_group_size_hint' is already applied with different arguments}} \ -// expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}} +[[sycl::work_group_size_hint(1, 1, 32)]] void f3(); // expected-warning {{attribute 'work_group_size_hint' is already applied with different arguments}} // 1 and 2 dim versions [[sycl::work_group_size_hint(2)]] void f4(); // ok @@ -44,13 +43,6 @@ class Functor_1 { template [[sycl::work_group_size_hint(N, 1, 1)]] void f8(); // #f8 -// Test that template redeclarations also get diagnosed properly. -template -[[sycl::work_group_size_hint(1, 1, 1)]] void f9(); // #f9prev - -template -[[sycl::work_group_size_hint(X, Y, Z)]] void f9() {} // #f9 - // Test that a template redeclaration where the difference is known up front is // diagnosed immediately, even without instantiation. template @@ -70,15 +62,6 @@ void instantiate() { // expected-error@#f8 {{'work_group_size_hint' attribute requires a positive integral compile time constant expression}} f8<0>(); // expected-note {{in instantiation}} #endif - - // expected-warning@#f9prev {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}} - f9<1, 1, 1>(); // OK, args are the same on the redecl. - - // expected-warning@#f9 {{attribute 'work_group_size_hint' is already applied with different arguments}} - // expected-note@#f9prev {{previous attribute is here}} - // expected-warning@#f9prev {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}} - - f9<1, 2, 3>(); // expected-note {{in instantiation}} } // Show that the attribute works on member functions. @@ -101,20 +84,7 @@ class Functor16x2x1 { class Functor4x4x4 { public: - [[sycl::work_group_size_hint(4, 4, 4)]] void operator()() const {}; // expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}} -}; - -// Checking whether propagation of the attribute happens or not, according to the SYCL version. -#if defined(EXPECT_PROP) // if attribute is propagated, then we expect errors here -void f8x8x8(){}; -#else // otherwise no error -[[sycl::work_group_size_hint(8, 8, 8)]] void f8x8x8(){}; // expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}} -#endif -class FunctorNoProp { -public: - void operator()() const { - f8x8x8(); - }; + [[sycl::work_group_size_hint(4, 4, 4)]] void operator()() const {}; }; void invoke() { @@ -137,12 +107,6 @@ void invoke() { // CHECK-NEXT: value: Int 1 // CHECK-NEXT: IntegerLiteral{{.*}}1{{$}} - - FunctorNoProp fNoProp; - h.single_task(fNoProp); - // CHECK: FunctionDecl {{.*}} {{.*}}kernel_3 - // CHECK-NOT: SYCLWorkGroupSizeHintAttr - h.single_task([]() [[sycl::work_group_size_hint(4,4,4)]] {}); // CHECK: FunctionDecl {{.*}}kernel_name4 // CHECK: SYCLWorkGroupSizeHintAttr {{.*}} @@ -156,6 +120,7 @@ void invoke() { // CHECK-NEXT: value: Int 4 // CHECK-NEXT: IntegerLiteral{{.*}}4{{$}} + h.single_task(f4x4x4); }); // FIXME: Add tests with the C++23 lambda attribute syntax. diff --git a/clang/test/SemaSYCL/intel-max-work-group-size.cpp b/clang/test/SemaSYCL/intel-max-work-group-size.cpp index 36d25d34a99eb..11aff3d3777a0 100644 --- a/clang/test/SemaSYCL/intel-max-work-group-size.cpp +++ b/clang/test/SemaSYCL/intel-max-work-group-size.cpp @@ -70,15 +70,14 @@ void instantiate() { // a declaration along with [[sycl::reqd_work_group_size(X1, Y1, Z1)]] // attribute, check to see if values of reqd_work_group_size arguments are // equal or less than values coming from max_work_group_size attribute. -[[sycl::reqd_work_group_size(64, 64, 64)]] // expected-note {{conflicting attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} +[[sycl::reqd_work_group_size(64, 64, 64)]] // expected-note {{conflicting attribute is here}} [[intel::max_work_group_size(64, 16, 64)]] // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}} void -f9() {} +f9(); [[intel::max_work_group_size(4, 4, 4)]] void f10(); [[sycl::reqd_work_group_size(2, 2, 2)]] void f10(); // OK -[[sycl::reqd_work_group_size(2, 2, 2)]] [[intel::max_work_group_size(4, 4, 4)]] void f11() {} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} [[sycl::reqd_work_group_size(64, 64, 64)]] void f12(); // expected-note {{conflicting attribute is here}} [[intel::max_work_group_size(16, 16, 16)]] void f12(); // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}} @@ -91,14 +90,14 @@ f13() {} [[sycl::reqd_work_group_size(64, 64, 64)]] void f14(); // expected-error{{'reqd_work_group_size' attribute conflicts with 'max_work_group_size' attribute}} [[cl::reqd_work_group_size(1, 2, 3)]] // expected-warning {{attribute 'cl::reqd_work_group_size' is deprecated}} \ - // expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} + // expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}} [[intel::max_work_group_size(1, 2, 3)]] void -f15() {} // OK +f15(); // OK [[intel::max_work_group_size(2, 3, 7)]] void f16(); // expected-note {{conflicting attribute is here}} [[sycl::reqd_work_group_size(7, 3, 2)]] void f16(); // expected-error{{'reqd_work_group_size' attribute conflicts with 'max_work_group_size' attribute}} -[[intel::max_work_group_size(1, 2, 3)]] [[sycl::reqd_work_group_size(1, 2, 3)]] void f17(){}; // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} +[[intel::max_work_group_size(1, 2, 3)]] [[sycl::reqd_work_group_size(1, 2, 3)]] void f17(); [[sycl::reqd_work_group_size(16)]] // expected-note {{conflicting attribute is here}} [[intel::max_work_group_size(16, 1, 1)]] void // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}} diff --git a/clang/test/SemaSYCL/reqd-sub-group-size.cpp b/clang/test/SemaSYCL/reqd-sub-group-size.cpp index e86b68db49cfa..cbf0c8ae79f8a 100644 --- a/clang/test/SemaSYCL/reqd-sub-group-size.cpp +++ b/clang/test/SemaSYCL/reqd-sub-group-size.cpp @@ -33,22 +33,7 @@ int main() { return 0; } [[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B(); -[[intel::reqd_sub_group_size(16)]] void A() // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} -{ -} -[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B() { // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} - A(); -} -// expected-note@+1 {{conflicting attribute is here}} -[[intel::reqd_sub_group_size(2)]] void sg_size2() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} - -// expected-note@+3 {{conflicting attribute is here}} -// expected-error@+2 {{conflicting attributes applied to a SYCL kernel}} -// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} -[[intel::reqd_sub_group_size(4)]] __attribute__((sycl_device)) void sg_size4() { - sg_size2(); -} // Test that checks support and functionality of reqd_sub_group_size attribute support on function. @@ -69,7 +54,7 @@ int main() { // No diagnostic is emitted because the arguments match. [[intel::reqd_sub_group_size(12)]] void same(); -[[intel::reqd_sub_group_size(12)]] void same() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} +[[intel::reqd_sub_group_size(12)]] void same(); // No diagnostic because the attributes are synonyms with identical behavior. [[sycl::reqd_sub_group_size(12)]] void same(); // OK @@ -119,16 +104,14 @@ int check() { // Test that checks template parameter support on function. template -// expected-error@+2{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}} -// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} -[[intel::reqd_sub_group_size(N)]] void func3() {} +// expected-error@+1{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}} +[[intel::reqd_sub_group_size(N)]] void func3(); template -// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}} [[intel::reqd_sub_group_size(4)]] void func4(); // expected-note {{previous attribute is here}} template -[[intel::reqd_sub_group_size(N)]] void func4() {} // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}} +[[intel::reqd_sub_group_size(N)]] void func4(); // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}} int check1() { // no error expected diff --git a/clang/test/SemaSYCL/reqd_work_group_size.cpp b/clang/test/SemaSYCL/reqd_work_group_size.cpp index a2d2760480117..81170d71de0da 100644 --- a/clang/test/SemaSYCL/reqd_work_group_size.cpp +++ b/clang/test/SemaSYCL/reqd_work_group_size.cpp @@ -22,44 +22,31 @@ class Functor30 { // Tests for 'reqd_work_group_size' attribute duplication. // No diagnostic is emitted because the arguments match. Duplicate attribute is silently ignored. -// expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} -[[sycl::reqd_work_group_size(6, 6, 6)]] [[sycl::reqd_work_group_size(6, 6, 6)]] void f2() {} +[[sycl::reqd_work_group_size(6, 6, 6)]] [[sycl::reqd_work_group_size(6, 6, 6)]] void f2(); // No diagnostic is emitted because the arguments match. [[sycl::reqd_work_group_size(32, 32, 32)]] void f3(); [[sycl::reqd_work_group_size(32, 32, 32)]] void f3(); // OK // Produce a conflicting attribute warning when the args are different. -[[sycl::reqd_work_group_size(6, 6, 6)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} +[[sycl::reqd_work_group_size(6, 6, 6)]] // expected-note {{previous attribute is here}} [[sycl::reqd_work_group_size(16, 16, 16)]] void // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} -f4() {} +f4(); // Catch the easy case where the attributes are all specified at once with // different arguments. struct TRIFuncObjGood1 { - // expected-note@+3 {{previous attribute is here}} - // expected-error@+2 {{attribute 'reqd_work_group_size' is already applied with different arguments}} - // expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} - [[sycl::reqd_work_group_size(64)]] [[sycl::reqd_work_group_size(128)]] void operator()() const {} + // expected-note@+2 {{previous attribute is here}} + // expected-error@+1 {{attribute 'reqd_work_group_size' is already applied with different arguments}} + [[sycl::reqd_work_group_size(64)]] [[sycl::reqd_work_group_size(128)]] void operator()() const; }; struct TRIFuncObjGood2 { - // expected-note@+3 {{previous attribute is here}} - // expected-error@+2 {{attribute 'reqd_work_group_size' is already applied with different arguments}} - // expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} - [[sycl::reqd_work_group_size(64, 64)]] [[sycl::reqd_work_group_size(128, 128)]] void operator()() const {} + // expected-note@+2 {{previous attribute is here}} + // expected-error@+1 {{attribute 'reqd_work_group_size' is already applied with different arguments}} + [[sycl::reqd_work_group_size(64, 64)]] [[sycl::reqd_work_group_size(128, 128)]] void operator()() const; }; -struct TRIFuncObjGood3 { - [[sycl::reqd_work_group_size(8, 8)]] void // expected-note {{previous attribute is here}} - operator()() const; -}; - -[[sycl::reqd_work_group_size(4, 4)]] // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} \ -// expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} -void -TRIFuncObjGood3::operator()() const {} - // Show that the attribute works on member functions. class Functor { public: @@ -77,9 +64,9 @@ class FunctorC { class Functor32 { public: - [[sycl::reqd_work_group_size(32, 1, 1)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} + [[sycl::reqd_work_group_size(32, 1, 1)]] // expected-note {{previous attribute is here}} [[sycl::reqd_work_group_size(1, 1, 32)]] void // expected-error{{attribute 'reqd_work_group_size' is already applied with different arguments}} - operator()() const {} + operator()() const; }; // Ensure that template arguments behave appropriately based on instantiations. @@ -91,7 +78,7 @@ template [[sycl::reqd_work_group_size(1, 1, 1)]] void f7(); // #f7prev template -[[sycl::reqd_work_group_size(X, Y, Z)]] void f7() {} // #f7 +[[sycl::reqd_work_group_size(X, Y, Z)]] void f7(); // #f7 // Test that a template redeclaration where the difference is known up front is // diagnosed immediately, even without instantiation. @@ -109,45 +96,31 @@ void instantiate() { f7<1, 1, 1>(); // OK, args are the same on the redecl. // expected-error@#f7 {{attribute 'reqd_work_group_size' is already applied with different arguments}} // expected-note@#f7prev {{previous attribute is here}} - // expected-warning@#f7prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} - // expected-warning@#f7prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} f7<2, 2, 2>(); // expected-note {{in instantiation}} } // Tests for 'reqd_work_group_size' attribute duplication. -[[sycl::reqd_work_group_size(8)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} +[[sycl::reqd_work_group_size(8)]] // expected-note {{previous attribute is here}} [[sycl::reqd_work_group_size(1, 1, 8)]] void // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} -f8(){}; +f8(); -[[sycl::reqd_work_group_size(32, 32, 1)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} -[[sycl::reqd_work_group_size(32, 32)]] void f9() {} // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} +[[sycl::reqd_work_group_size(32, 32, 1)]] // expected-note {{previous attribute is here}} +[[sycl::reqd_work_group_size(32, 32)]] void f9(); // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} // Test that template redeclarations also get diagnosed properly. template [[sycl::reqd_work_group_size(64, 1, 1)]] void f10(); // #f10prev template -[[sycl::reqd_work_group_size(X, Y, Z)]] void f10() {} // #f10err +[[sycl::reqd_work_group_size(X, Y, Z)]] void f10(); // #f10err void test() { f10<64, 1, 1>(); // OK, args are the same on the redecl. // expected-error@#f10err {{attribute 'reqd_work_group_size' is already applied with different arguments}} // expected-note@#f10prev {{previous attribute is here}} - // expected-warning@#f10prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} - // expected-warning@#f10prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} f10<1, 1, 64>(); // expected-note {{in instantiation}} } -struct TRIFuncObjBad { - [[sycl::reqd_work_group_size(32, 1, 1)]] void // expected-note {{previous attribute is here}} - operator()() const; -}; - -[[sycl::reqd_work_group_size(1, 1, 32)]] // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} \ -// expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} -void -TRIFuncObjBad::operator()() const {} - // Test that checks wrong function template instantiation and ensures that the type // is checked properly when instantiating from the template definition. @@ -183,9 +156,8 @@ int main() { KernelFunctor<16, 1, 1>(); } // Test that checks template parameter support on function. -// expected-warning@+2 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} template -[[sycl::reqd_work_group_size(N, N1, N2)]] void func3() {} +[[sycl::reqd_work_group_size(N, N1, N2)]] void func3(); int check() { func3<8, 8, 8>(); diff --git a/clang/test/SemaSYCL/sub-group-size.cpp b/clang/test/SemaSYCL/sub-group-size.cpp index aa85dec244fb0..c5a0947e35a84 100644 --- a/clang/test/SemaSYCL/sub-group-size.cpp +++ b/clang/test/SemaSYCL/sub-group-size.cpp @@ -115,20 +115,10 @@ void calls_kernel_3() { }); } -[[intel::sub_group_size(10)]] void AttrFunc2() {} // #AttrFunc2 -[[intel::sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalDefined2() {} // #AttrExternalDefined2 [[intel::sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalNotDefined2(); // #AttrExternalNotDefined2 void calls_kernel_4() { sycl::kernel_single_task([]() { // #Kernel4 - // integer-error@#AttrFunc2{{kernel-called function must have a sub group size that matches the size specified for the kernel}} - // integer-note@#Kernel4{{kernel declared here}} - // expected-warning@#AttrFunc2 {{'sub_group_size' attribute can only be applied to a SYCL kernel function}} - AttrFunc2(); - // integer-error@#AttrExternalDefined2{{kernel-called function must have a sub group size that matches the size specified for the kernel}} - // integer-note@#Kernel4{{kernel declared here}} - // expected-warning@#AttrExternalDefined2 {{'sub_group_size' attribute can only be applied to a SYCL kernel function}} - AttrExternalDefined2(); // integer-error@#AttrExternalNotDefined2{{kernel-called function must have a sub group size that matches the size specified for the kernel}} // integer-note@#Kernel4{{kernel declared here}} AttrExternalNotDefined2(); diff --git a/clang/test/SemaSYCL/sycl-device-intel-reqd-work-group-size-template.cpp b/clang/test/SemaSYCL/sycl-device-intel-reqd-work-group-size-template.cpp index 380a3e2425cbc..a15edebb6211d 100644 --- a/clang/test/SemaSYCL/sycl-device-intel-reqd-work-group-size-template.cpp +++ b/clang/test/SemaSYCL/sycl-device-intel-reqd-work-group-size-template.cpp @@ -58,9 +58,8 @@ int main() { // CHECK-NEXT: IntegerLiteral{{.*}}1{{$}} // Test that checks template parameter support on function. -// expected-warning@+2 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} template -[[sycl::reqd_work_group_size(N, N1, N2)]] void func3() {} +[[sycl::reqd_work_group_size(N, N1, N2)]] void func3(); int check() { func3<8, 8, 8>(); @@ -87,8 +86,7 @@ int check() { // CHECK-NEXT: IntegerLiteral{{.*}}8{{$}} // No diagnostic is emitted because the arguments match. Duplicate attribute is silently ignored. -// expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}} -[[sycl::reqd_work_group_size(4, 4, 4)]] [[sycl::reqd_work_group_size(4, 4, 4)]] void func4() {} +[[sycl::reqd_work_group_size(4, 4, 4)]] [[sycl::reqd_work_group_size(4, 4, 4)]] void func4(); // CHECK: FunctionDecl {{.*}} {{.*}} func4 'void ()' // CHECK: SYCLReqdWorkGroupSizeAttr // CHECK-NEXT: ConstantExpr{{.*}}'int'