Skip to content

Commit 028d270

Browse files
committed
negative values and fix sm version to not rely on default
1 parent 4867154 commit 028d270

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

clang/test/SemaCUDA/launch_bounds.cu

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
1+
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple nvptx-unknown-unknown -target-cpu sm_75 -verify %s
22

33
#include "Inputs/cuda.h"
44

@@ -11,6 +11,7 @@ __launch_bounds__(0x10000000000000000) void TestWayTooBigArg(void); // expected-
1111

1212
__launch_bounds__(-128, 7) void TestNegArg1(void); // expected-warning {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
1313
__launch_bounds__(128, -7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}
14+
__launch_bounds__(128, 2, -8) void TestNegArg2(void); // expected-warning {{maxclusterrank requires sm_90 or higher, CUDA arch provided: sm_75, ignoring 'launch_bounds' attribute}}
1415

1516
__launch_bounds__(1, 2, 3, 4) void Test4Args(void); // expected-error {{'launch_bounds' attribute takes no more than 3 arguments}}
1617
__launch_bounds__() void TestNoArgs(void); // expected-error {{'launch_bounds' attribute takes at least 1 argument}}
@@ -48,4 +49,4 @@ __launch_bounds__(Args) void TestTemplateVariadicArgs(void) {} // expected-error
4849
template <int... Args>
4950
__launch_bounds__(1, Args) void TestTemplateVariadicArgs2(void) {} // expected-error {{expression contains unexpanded parameter pack 'Args'}}
5051

51-
__launch_bounds__(1, 2, 3) void Test3Args(void); // expected-warning {{maxclusterrank requires sm_90 or higher, CUDA arch provided: unknown, ignoring 'launch_bounds' attribute}}
52+
__launch_bounds__(1, 2, 3) void Test3Args(void); // expected-warning {{maxclusterrank requires sm_90 or higher, CUDA arch provided: sm_75, ignoring 'launch_bounds' attribute}}

clang/test/SemaCUDA/launch_bounds_sm_90.cu

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple nvptx-unknown-unknown -target-cpu sm_90 -verify %s
1+
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple nvptx-unknown-unknown -target-cpu sm_90 -verify %s
22

33
#include "Inputs/cuda.h"
44

@@ -12,7 +12,19 @@ __launch_bounds__(1, 1, 0x10000000000000000) void TestWayTooBigArg(void); // exp
1212

1313
__launch_bounds__(-128, 7) void TestNegArg1(void); // expected-warning {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
1414
__launch_bounds__(128, -7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}
15+
__launch_bounds__(-128, 1, 7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
16+
__launch_bounds__(128, -1, 7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}
1517
__launch_bounds__(128, 1, -7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 2 is negative and will be ignored}}
18+
// expected-warning@20 {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
19+
// expected-warning@20 {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}
20+
__launch_bounds__(-128, -1, 7) void TestNegArg2(void);
21+
// expected-warning@23 {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
22+
// expected-warning@23 {{'launch_bounds' attribute parameter 2 is negative and will be ignored}}
23+
__launch_bounds__(-128, 1, -7) void TestNegArg2(void);
24+
// expected-warning@27 {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
25+
// expected-warning@27 {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}
26+
// expected-warning@27 {{'launch_bounds' attribute parameter 2 is negative and will be ignored}}
27+
__launch_bounds__(-128, -1, -7) void TestNegArg2(void);
1628

1729

1830
__launch_bounds__(1, 2, 3, 4) void Test4Args(void); // expected-error {{'launch_bounds' attribute takes no more than 3 arguments}}

0 commit comments

Comments
 (0)