Skip to content

Commit 361c313

Browse files
authored
Merge branch 'main' into constexpr_cmp
2 parents 8de6939 + bf2d84d commit 361c313

File tree

191 files changed

+58250
-29236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+58250
-29236
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ implementation.
193193
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
194194
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
195195
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
196-
| device | pointer attachment | :good:`done` | |
196+
| device | pointer attachment | :part:`being repaired` | @abhinavgaba (https://github.com/llvm/llvm-project/pull/153683) |
197197
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
198198
| atomic | hints for the atomic construct | :good:`done` | D51233 |
199199
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -627,6 +627,10 @@ implementation.
627627
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
628628
| loop grid/tile modifiers for sizes clause | :none:`unclaimed` | :none:`unclaimed` | |
629629
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
630+
| attach map-type modifier | :part:`In Progress` | :none:`unclaimed` | C/C++: @abhinavgaba; |
631+
| | | | RT: @abhinavgaba (https://github.com/llvm/llvm-project/pull/149036, |
632+
| | | | https://github.com/llvm/llvm-project/pull/158370) |
633+
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
630634

631635

632636
OpenMP Extensions

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ Non-comprehensive list of changes in this release
271271
allocation functions with a token ID can be enabled via the
272272
``-fsanitize=alloc-token`` flag.
273273

274+
- Clang now rejects the invalid use of ``constexpr`` with ``auto`` and an explicit type in C. (#GH163090)
275+
274276
New Compiler Flags
275277
------------------
276278
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).

clang/include/clang/Basic/Attr.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,23 @@ def HIPManaged : InheritableAttr {
15721572
let Documentation = [HIPManagedAttrDocs];
15731573
}
15741574

1575+
def CUDAClusterDims : InheritableAttr {
1576+
let Spellings = [GNU<"cluster_dims">];
1577+
let Args = [ExprArgument<"X">, ExprArgument<"Y", /*opt=*/1>, ExprArgument<"Z", /*opt=*/1>];
1578+
let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
1579+
let LangOpts = [CUDA];
1580+
let Documentation = [CUDAClusterDimsAttrDoc];
1581+
}
1582+
1583+
def CUDANoCluster : InheritableAttr {
1584+
let Spellings = [GNU<"no_cluster">];
1585+
let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
1586+
let LangOpts = [CUDA];
1587+
let Documentation = [CUDANoClusterAttrDoc];
1588+
}
1589+
1590+
def : MutualExclusions<[CUDAClusterDims, CUDANoCluster]>;
1591+
15751592
def CUDAInvalidTarget : InheritableAttr {
15761593
let Spellings = [];
15771594
let Subjects = SubjectList<[Function]>;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7545,6 +7545,45 @@ A managed variable can be accessed in both device and host code.
75457545
}];
75467546
}
75477547

7548+
def CUDAClusterDimsAttrDoc : Documentation {
7549+
let Category = DocCatDecl;
7550+
let Content = [{
7551+
In CUDA/HIP programming, the ``cluster_dims`` attribute, conventionally exposed as the
7552+
``__cluster_dims__`` macro, can be applied to a kernel function to set the dimensions of a
7553+
thread block cluster, which is an optional level of hierarchy and made up of thread blocks.
7554+
``__cluster_dims__`` defines the cluster size as ``(X, Y, Z)``, where each value is the number
7555+
of thread blocks in that dimension. The ``cluster_dims`` and `no_cluster`` attributes are
7556+
mutually exclusive.
7557+
7558+
.. code::
7559+
7560+
__global__ __cluster_dims__(2, 1, 1) void kernel(...) {
7561+
...
7562+
}
7563+
7564+
}];
7565+
}
7566+
7567+
def CUDANoClusterAttrDoc : Documentation {
7568+
let Category = DocCatDecl;
7569+
let Content = [{
7570+
In CUDA/HIP programming, a kernel function can still be launched with the cluster feature enabled
7571+
at runtime, even without being annotated with ``__cluster_dims__``. The LLVM/Clang-exclusive
7572+
``no_cluster`` attribute, conventionally exposed as the ``__no_cluster__`` macro, can be applied to
7573+
a kernel function to explicitly indicate that the cluster feature will not be enabled either at
7574+
compile time or at kernel launch time. This allows the compiler to apply certain optimizations
7575+
without assuming that clustering could be enabled at runtime. It is undefined behavior to launch a
7576+
kernel annotated with ``__no_cluster__`` if the cluster feature is enabled at runtime.
7577+
The ``cluster_dims`` and ``no_cluster`` attributes are mutually exclusive.
7578+
7579+
.. code::
7580+
7581+
__global__ __no_cluster__ void kernel(...) {
7582+
...
7583+
}
7584+
}];
7585+
}
7586+
75487587
def LifetimeOwnerDocs : Documentation {
75497588
let Category = DocCatDecl;
75507589
let Content = [{

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4957,6 +4957,18 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> {
49574957
let Prototype = "uint32_t(uint32_t)";
49584958
}
49594959

4960+
def HLSLResourceGetDimensionsX : LangBuiltin<"HLSL_LANG"> {
4961+
let Spellings = ["__builtin_hlsl_resource_getdimensions_x"];
4962+
let Attributes = [NoThrow];
4963+
let Prototype = "void(...)";
4964+
}
4965+
4966+
def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> {
4967+
let Spellings = ["__builtin_hlsl_resource_getstride"];
4968+
let Attributes = [NoThrow];
4969+
let Prototype = "void(...)";
4970+
}
4971+
49604972
def HLSLAll : LangBuiltin<"HLSL_LANG"> {
49614973
let Spellings = ["__builtin_hlsl_all"];
49624974
let Attributes = [NoThrow, Const];

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13070,6 +13070,12 @@ def warn_cuda_maxclusterrank_sm_90 : Warning<
1307013070
"maxclusterrank requires sm_90 or higher, CUDA arch provided: %0, ignoring "
1307113071
"%1 attribute">, InGroup<IgnoredAttributes>;
1307213072

13073+
def err_cluster_attr_not_supported : Error<
13074+
"%0 is not supported for this GPU architecture">;
13075+
13076+
def err_cluster_dims_too_large : Error<
13077+
"cluster does not support more than %0 thread blocks; %1 provided">;
13078+
1307313079
// VTable pointer authentication errors
1307413080
def err_non_polymorphic_vtable_pointer_auth : Error<
1307513081
"cannot set vtable pointer authentication on monomorphic type %0">;

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4408,12 +4408,12 @@ def CIR_TryOp : CIR_Op<"try",[
44084408
let arguments = (ins
44094409
UnitAttr:$synthetic,
44104410
UnitAttr:$cleanup,
4411-
CIR_TryHandlerArrayAttr:$handler_types
4411+
DefaultValuedAttr<CIR_TryHandlerArrayAttr, "{}">:$handler_types
44124412
);
44134413

44144414
let regions = (region
44154415
AnyRegion:$try_region,
4416-
VariadicRegion<MinSizedRegion<1>>:$handler_regions
4416+
VariadicRegion<AnyRegion>:$handler_regions
44174417
);
44184418

44194419
let assemblyFormat = [{

clang/include/clang/Sema/Sema.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5010,6 +5010,14 @@ class Sema final : public SemaBase {
50105010
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
50115011
Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks);
50125012

5013+
/// Add a cluster_dims attribute to a particular declaration.
5014+
CUDAClusterDimsAttr *createClusterDimsAttr(const AttributeCommonInfo &CI,
5015+
Expr *X, Expr *Y, Expr *Z);
5016+
void addClusterDimsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *X,
5017+
Expr *Y, Expr *Z);
5018+
/// Add a no_cluster attribute to a particular declaration.
5019+
void addNoClusterAttr(Decl *D, const AttributeCommonInfo &CI);
5020+
50135021
enum class RetainOwnershipKind { NS, CF, OS };
50145022

50155023
UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,14 +3341,14 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
33413341
case Builtin::BI__builtin_parityl:
33423342
case Builtin::BI__builtin_parityll:
33433343
return interp__builtin_elementwise_int_unaryop(
3344-
S, OpPC, Call, [](const APSInt &Val) -> APInt {
3344+
S, OpPC, Call, [](const APSInt &Val) {
33453345
return APInt(Val.getBitWidth(), Val.popcount() % 2);
33463346
});
33473347
case Builtin::BI__builtin_clrsb:
33483348
case Builtin::BI__builtin_clrsbl:
33493349
case Builtin::BI__builtin_clrsbll:
33503350
return interp__builtin_elementwise_int_unaryop(
3351-
S, OpPC, Call, [](const APSInt &Val) -> APInt {
3351+
S, OpPC, Call, [](const APSInt &Val) {
33523352
return APInt(Val.getBitWidth(),
33533353
Val.getBitWidth() - Val.getSignificantBits());
33543354
});
@@ -3357,8 +3357,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
33573357
case Builtin::BI__builtin_bitreverse32:
33583358
case Builtin::BI__builtin_bitreverse64:
33593359
return interp__builtin_elementwise_int_unaryop(
3360-
S, OpPC, Call,
3361-
[](const APSInt &Val) -> APInt { return Val.reverseBits(); });
3360+
S, OpPC, Call, [](const APSInt &Val) { return Val.reverseBits(); });
33623361

33633362
case Builtin::BI__builtin_classify_type:
33643363
return interp__builtin_classify_type(S, OpPC, Frame, Call);

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,7 @@ const char *vTableClassNameForType(const CIRGenModule &cgm, const Type *ty) {
950950
break;
951951

952952
case Type::Enum:
953-
cgm.errorNYI("VTableClassNameForType: Enum");
954-
break;
953+
return "_ZTVN10__cxxabiv116__enum_type_infoE";
955954

956955
case Type::Record: {
957956
const auto *rd = cast<CXXRecordDecl>(cast<RecordType>(ty)->getDecl())

0 commit comments

Comments
 (0)