Skip to content

Commit 993355c

Browse files
authored
Merge branch 'ROCm:amd-staging' into fix-swdev-519413-mi300
2 parents 5fefd6d + be9b8bf commit 993355c

File tree

138 files changed

+5764
-5199
lines changed

Some content is hidden

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

138 files changed

+5764
-5199
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,23 +1827,6 @@ Builtin type aliases
18271827

18281828
Clang provides a few builtin aliases to improve the throughput of certain metaprogramming facilities.
18291829

1830-
__builtin_common_reference
1831-
--------------------------
1832-
1833-
.. code-block:: c++
1834-
1835-
template <template <class, class, template <class> class, template <class> class> class BasicCommonReferenceT,
1836-
template <class... Args> CommonTypeT,
1837-
template <class> HasTypeMember,
1838-
class HasNoTypeMember,
1839-
class... Ts>
1840-
using __builtin_common_reference = ...;
1841-
1842-
This alias is used for implementing ``std::common_reference``. If ``std::common_reference`` should contain a ``type``
1843-
member, it is an alias to ``HasTypeMember<TheCommonReference>``. Otherwse it is an alias to ``HasNoTypeMember``. The
1844-
``CommonTypeT`` is usually ``std::common_type_t``. ``BasicCommonReferenceT`` is usually an alias template to
1845-
``basic_common_reference<T, U, TX, UX>::type``.
1846-
18471830
__builtin_common_type
18481831
---------------------
18491832

clang/include/clang/AST/OperationKinds.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ CAST_OPERATION(IntToOCLSampler)
364364
// Truncate a vector type by dropping elements from the end (HLSL only).
365365
CAST_OPERATION(HLSLVectorTruncation)
366366

367+
// Truncate a matrix type by dropping elements from the end (HLSL only).
368+
CAST_OPERATION(HLSLMatrixTruncation)
369+
367370
// Non-decaying array RValue cast (HLSL only).
368371
CAST_OPERATION(HLSLArrayRValue)
369372

clang/include/clang/Basic/BuiltinTemplates.td

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class TemplateArg<string name> {
1010
string Name = name;
1111
}
1212

13-
class Template<list<TemplateArg> args, string name = ""> : TemplateArg<name> {
13+
class Template<list<TemplateArg> args, string name> : TemplateArg<name> {
1414
list<TemplateArg> Args = args;
1515
}
1616

17-
class Class<string name = "", bit is_variadic = 0> : TemplateArg<name> {
17+
class Class<string name, bit is_variadic = 0> : TemplateArg<name> {
1818
bit IsVariadic = is_variadic;
1919
}
2020

@@ -56,32 +56,6 @@ def __builtin_common_type : CPlusPlusBuiltinTemplate<
5656
Class<"HasNoTypeMember">,
5757
Class<"Ts", /*is_variadic=*/1>]>;
5858

59-
// template <template <class,"
60-
// class,"
61-
// template <class> class,"
62-
// template <class> class> class BasicCommonReferenceT,"
63-
// template <class... Args> class CommonTypeT,"
64-
// template <class> class HasTypeMember,"
65-
// class HasNoTypeMember,"
66-
// class... Ts>"
67-
def __builtin_common_reference : CPlusPlusBuiltinTemplate<
68-
[Template<[Class<>,
69-
Class<>,
70-
Template<[Class<>]>,
71-
Template<[Class<>]>], "BasicCommonReferenceT">,
72-
Template<[Class<"Args", /*is_variadic=*/1>], "CommonTypeT">,
73-
Template<[Class<>], "HasTypeMember">,
74-
Class<"HasNoTypeMember">,
75-
Class<"Ts", /*is_variadic=*/1>]>;
76-
77-
foreach Ref = ["", "lvalue", "rvalue"] in {
78-
foreach Const = ["", "const"] in {
79-
foreach Volatile = ["", "volatile"] in {
80-
def __clang_internal_xref_#Ref#Const#Volatile : CPlusPlusBuiltinTemplate<[Class<>]>;
81-
}
82-
}
83-
}
84-
8559
// template <uint32_t Opcode,
8660
// uint32_t Size,
8761
// uint32_t Alignment,

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,7 @@ def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">;
10591059
def OverridingMethodMismatch : DiagGroup<"overriding-method-mismatch">;
10601060
def VariadicMacros : DiagGroup<"variadic-macros">;
10611061
def VectorConversion : DiagGroup<"vector-conversion">; // clang specific
1062+
def MatrixConversion : DiagGroup<"matrix-conversion">; // clang specific
10621063
def VexingParse : DiagGroup<"vexing-parse">;
10631064
def VLAUseStaticAssert : DiagGroup<"vla-extension-static-assert">;
10641065
def VLACxxExtension : DiagGroup<"vla-cxx-extension", [VLAUseStaticAssert]>;
@@ -1333,6 +1334,8 @@ def : DiagGroup<"int-conversions",
13331334
[IntConversion]>; // -Wint-conversions = -Wint-conversion
13341335
def : DiagGroup<"vector-conversions",
13351336
[VectorConversion]>; // -Wvector-conversions = -Wvector-conversion
1337+
def : DiagGroup<"matrix-conversions",
1338+
[MatrixConversion]>; // -Wmatrix-conversions = -Wmatrix-conversion
13361339
def : DiagGroup<"unused-local-typedefs", [UnusedLocalTypedef]>;
13371340
// -Wunused-local-typedefs = -Wunused-local-typedef
13381341

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4352,6 +4352,9 @@ def warn_param_typestate_mismatch : Warning<
43524352
def warn_unknown_sanitizer_ignored : Warning<
43534353
"unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
43544354

4355+
def warn_impcast_matrix_scalar : Warning<
4356+
"implicit conversion turns matrix to scalar: %0 to %1">,
4357+
InGroup<MatrixConversion>;
43554358
def warn_impcast_vector_scalar : Warning<
43564359
"implicit conversion turns vector to scalar: %0 to %1">,
43574360
InGroup<Conversion>, DefaultIgnore;
@@ -13282,7 +13285,10 @@ def err_hlsl_builtin_scalar_vector_mismatch
1328213285
"vector type with matching scalar element type%diff{: $ vs $|}2,3">;
1328313286

1328413287
def warn_hlsl_impcast_vector_truncation : Warning<
13285-
"implicit conversion truncates vector: %0 to %1">, InGroup<Conversion>;
13288+
"implicit conversion truncates vector: %0 to %1">, InGroup<VectorConversion>;
13289+
13290+
def warn_hlsl_impcast_matrix_truncation : Warning<
13291+
"implicit conversion truncates matrix: %0 to %1">, InGroup<MatrixConversion>;
1328613292

1328713293
def warn_hlsl_availability : Warning<
1328813294
"%0 is only available %select{|in %4 environment }3on %1 %2 or newer">,

clang/include/clang/Sema/Overload.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ class Sema;
198198
/// HLSL vector truncation.
199199
ICK_HLSL_Vector_Truncation,
200200

201+
/// HLSL Matrix truncation.
202+
ICK_HLSL_Matrix_Truncation,
203+
201204
/// HLSL non-decaying array rvalue cast.
202205
ICK_HLSL_Array_RValue,
203206

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15322,17 +15322,6 @@ class Sema final : public SemaBase {
1532215322
QualType BuiltinDecay(QualType BaseType, SourceLocation Loc);
1532315323
QualType BuiltinAddReference(QualType BaseType, UTTKind UKind,
1532415324
SourceLocation Loc);
15325-
15326-
QualType BuiltinAddRValueReference(QualType BaseType, SourceLocation Loc) {
15327-
return BuiltinAddReference(BaseType, UnaryTransformType::AddRvalueReference,
15328-
Loc);
15329-
}
15330-
15331-
QualType BuiltinAddLValueReference(QualType BaseType, SourceLocation Loc) {
15332-
return BuiltinAddReference(BaseType, UnaryTransformType::AddLvalueReference,
15333-
Loc);
15334-
}
15335-
1533615325
QualType BuiltinRemoveExtent(QualType BaseType, UTTKind UKind,
1533715326
SourceLocation Loc);
1533815327
QualType BuiltinRemoveReference(QualType BaseType, UTTKind UKind,
@@ -15347,9 +15336,6 @@ class Sema final : public SemaBase {
1534715336
QualType BuiltinChangeSignedness(QualType BaseType, UTTKind UKind,
1534815337
SourceLocation Loc);
1534915338

15350-
bool BuiltinIsConvertible(QualType From, QualType To, SourceLocation Loc,
15351-
bool CheckNothrow = false);
15352-
1535315339
bool BuiltinIsBaseOf(SourceLocation RhsTLoc, QualType LhsT, QualType RhsT);
1535415340

1535515341
/// Ensure that the type T is a literal type.

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,7 @@ bool CastExpr::CastConsistency() const {
19341934
case CK_FixedPointToBoolean:
19351935
case CK_HLSLArrayRValue:
19361936
case CK_HLSLVectorTruncation:
1937+
case CK_HLSLMatrixTruncation:
19371938
case CK_HLSLElementwiseCast:
19381939
case CK_HLSLAggregateSplatCast:
19391940
CheckNoBasePath:

clang/lib/AST/ExprConstant.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11770,6 +11770,10 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) {
1177011770
Elements.push_back(Val.getVectorElt(I));
1177111771
return Success(Elements, E);
1177211772
}
11773+
case CK_HLSLMatrixTruncation: {
11774+
// TODO: See #168935. Add matrix truncation support to expr constant.
11775+
return Error(E);
11776+
}
1177311777
case CK_HLSLAggregateSplatCast: {
1177411778
APValue Val;
1177511779
QualType ValTy;
@@ -18440,6 +18444,10 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1844018444
return Error(E);
1844118445
return Success(Val.getVectorElt(0), E);
1844218446
}
18447+
case CK_HLSLMatrixTruncation: {
18448+
// TODO: See #168935. Add matrix truncation support to expr constant.
18449+
return Error(E);
18450+
}
1844318451
case CK_HLSLElementwiseCast: {
1844418452
SmallVector<APValue> SrcVals;
1844518453
SmallVector<QualType> SrcTypes;
@@ -19033,6 +19041,10 @@ bool FloatExprEvaluator::VisitCastExpr(const CastExpr *E) {
1903319041
return Error(E);
1903419042
return Success(Val.getVectorElt(0), E);
1903519043
}
19044+
case CK_HLSLMatrixTruncation: {
19045+
// TODO: See #168935. Add matrix truncation support to expr constant.
19046+
return Error(E);
19047+
}
1903619048
case CK_HLSLElementwiseCast: {
1903719049
SmallVector<APValue> SrcVals;
1903819050
SmallVector<QualType> SrcTypes;
@@ -19190,6 +19202,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
1919019202
case CK_IntegralToFixedPoint:
1919119203
case CK_MatrixCast:
1919219204
case CK_HLSLVectorTruncation:
19205+
case CK_HLSLMatrixTruncation:
1919319206
case CK_HLSLElementwiseCast:
1919419207
case CK_HLSLAggregateSplatCast:
1919519208
llvm_unreachable("invalid cast kind for complex value");

clang/lib/Basic/Targets/AMDGPU.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
8484
return TT.getArch() == llvm::Triple::r600;
8585
}
8686

87+
bool hasFlatSupport() const {
88+
if (GPUKind >= llvm::AMDGPU::GK_GFX700)
89+
return true;
90+
91+
// Dummy target is assumed to be gfx700+ for amdhsa.
92+
if (GPUKind == llvm::AMDGPU::GK_NONE &&
93+
getTriple().getOS() == llvm::Triple::AMDHSA)
94+
return true;
95+
96+
return false;
97+
}
98+
8799
public:
88100
AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
89101

@@ -325,7 +337,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
325337
Opts["__opencl_c_atomic_order_seq_cst"] = true;
326338
Opts["__opencl_c_atomic_scope_all_devices"] = true;
327339

328-
if (GPUKind >= llvm::AMDGPU::GK_GFX700) {
340+
if (hasFlatSupport()) {
329341
Opts["__opencl_c_generic_address_space"] = true;
330342
Opts["__opencl_c_device_enqueue"] = true;
331343
}

0 commit comments

Comments
 (0)