-
Notifications
You must be signed in to change notification settings - Fork 828
[SM6.10] Add built-in type for LinAlg Matrix handle #8090
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
base: main
Are you sure you want to change the base?
Conversation
Adds a built-in type `__builtin_LinAlg_Matrix` that will be used in LinAlg Matrix implementation.
You can test this locally with the following command:git-clang-format --diff e7346acd9d4000035d8383c713ee966a5abdd7cb be693b2661a6dafb438aadbf67f499a28a68e1ea -- tools/clang/include/clang/AST/ASTContext.h tools/clang/include/clang/AST/Type.h tools/clang/include/clang/Serialization/ASTBitCodes.h tools/clang/lib/AST/ASTContext.cpp tools/clang/lib/AST/ItaniumMangle.cpp tools/clang/lib/AST/MicrosoftMangle.cpp tools/clang/lib/AST/Type.cpp tools/clang/lib/AST/TypeLoc.cpp tools/clang/lib/CodeGen/CodeGenTypes.cpp tools/clang/lib/CodeGen/ItaniumCXXABI.cpp tools/clang/lib/Sema/Sema.cpp tools/clang/lib/Serialization/ASTCommon.cpp tools/clang/lib/Serialization/ASTReader.cpp tools/clang/tools/libclang/CIndex.cppView the diff from clang-format here.diff --git a/tools/clang/include/clang/AST/Type.h b/tools/clang/include/clang/AST/Type.h
index 1e70e858..5da576a7 100644
--- a/tools/clang/include/clang/AST/Type.h
+++ b/tools/clang/include/clang/AST/Type.h
@@ -1699,7 +1699,7 @@ public:
bool isOpenCLSpecificType() const; // Any OpenCL specific type
- bool isLinAlgMatrixType() const; // HLSL __builtin_LinAlg_Matrix
+ bool isLinAlgMatrixType() const; // HLSL __builtin_LinAlg_Matrix
/// Determines if this type, which must satisfy
/// isObjCLifetimeType(), is implicitly __unsafe_unretained rather
diff --git a/tools/clang/include/clang/Serialization/ASTBitCodes.h b/tools/clang/include/clang/Serialization/ASTBitCodes.h
index ff83cd4e..a3d30500 100644
--- a/tools/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/tools/clang/include/clang/Serialization/ASTBitCodes.h
@@ -687,73 +687,73 @@ namespace clang {
/// by the AST context when it is created.
enum PredefinedTypeIDs {
/// \brief The NULL type.
- PREDEF_TYPE_NULL_ID = 0,
+ PREDEF_TYPE_NULL_ID = 0,
/// \brief The void type.
- PREDEF_TYPE_VOID_ID = 1,
+ PREDEF_TYPE_VOID_ID = 1,
/// \brief The 'bool' or '_Bool' type.
- PREDEF_TYPE_BOOL_ID = 2,
+ PREDEF_TYPE_BOOL_ID = 2,
/// \brief The 'char' type, when it is unsigned.
- PREDEF_TYPE_CHAR_U_ID = 3,
+ PREDEF_TYPE_CHAR_U_ID = 3,
/// \brief The 'unsigned char' type.
- PREDEF_TYPE_UCHAR_ID = 4,
+ PREDEF_TYPE_UCHAR_ID = 4,
/// \brief The 'unsigned short' type.
- PREDEF_TYPE_USHORT_ID = 5,
+ PREDEF_TYPE_USHORT_ID = 5,
/// \brief The 'unsigned int' type.
- PREDEF_TYPE_UINT_ID = 6,
+ PREDEF_TYPE_UINT_ID = 6,
/// \brief The 'unsigned long' type.
- PREDEF_TYPE_ULONG_ID = 7,
+ PREDEF_TYPE_ULONG_ID = 7,
/// \brief The 'unsigned long long' type.
- PREDEF_TYPE_ULONGLONG_ID = 8,
+ PREDEF_TYPE_ULONGLONG_ID = 8,
/// \brief The 'char' type, when it is signed.
- PREDEF_TYPE_CHAR_S_ID = 9,
+ PREDEF_TYPE_CHAR_S_ID = 9,
/// \brief The 'signed char' type.
- PREDEF_TYPE_SCHAR_ID = 10,
+ PREDEF_TYPE_SCHAR_ID = 10,
/// \brief The C++ 'wchar_t' type.
- PREDEF_TYPE_WCHAR_ID = 11,
+ PREDEF_TYPE_WCHAR_ID = 11,
/// \brief The (signed) 'short' type.
- PREDEF_TYPE_SHORT_ID = 12,
+ PREDEF_TYPE_SHORT_ID = 12,
/// \brief The (signed) 'int' type.
- PREDEF_TYPE_INT_ID = 13,
+ PREDEF_TYPE_INT_ID = 13,
/// \brief The (signed) 'long' type.
- PREDEF_TYPE_LONG_ID = 14,
+ PREDEF_TYPE_LONG_ID = 14,
/// \brief The (signed) 'long long' type.
- PREDEF_TYPE_LONGLONG_ID = 15,
+ PREDEF_TYPE_LONGLONG_ID = 15,
/// \brief The 'float' type.
- PREDEF_TYPE_FLOAT_ID = 16,
+ PREDEF_TYPE_FLOAT_ID = 16,
/// \brief The 'double' type.
- PREDEF_TYPE_DOUBLE_ID = 17,
+ PREDEF_TYPE_DOUBLE_ID = 17,
/// \brief The 'long double' type.
PREDEF_TYPE_LONGDOUBLE_ID = 18,
/// \brief The placeholder type for overloaded function sets.
- PREDEF_TYPE_OVERLOAD_ID = 19,
+ PREDEF_TYPE_OVERLOAD_ID = 19,
/// \brief The placeholder type for dependent types.
- PREDEF_TYPE_DEPENDENT_ID = 20,
+ PREDEF_TYPE_DEPENDENT_ID = 20,
/// \brief The '__uint128_t' type.
- PREDEF_TYPE_UINT128_ID = 21,
+ PREDEF_TYPE_UINT128_ID = 21,
/// \brief The '__int128_t' type.
- PREDEF_TYPE_INT128_ID = 22,
+ PREDEF_TYPE_INT128_ID = 22,
/// \brief The type of 'nullptr'.
- PREDEF_TYPE_NULLPTR_ID = 23,
+ PREDEF_TYPE_NULLPTR_ID = 23,
/// \brief The C++ 'char16_t' type.
- PREDEF_TYPE_CHAR16_ID = 24,
+ PREDEF_TYPE_CHAR16_ID = 24,
/// \brief The C++ 'char32_t' type.
- PREDEF_TYPE_CHAR32_ID = 25,
+ PREDEF_TYPE_CHAR32_ID = 25,
/// \brief The ObjC 'id' type.
- PREDEF_TYPE_OBJC_ID = 26,
+ PREDEF_TYPE_OBJC_ID = 26,
/// \brief The ObjC 'Class' type.
- PREDEF_TYPE_OBJC_CLASS = 27,
+ PREDEF_TYPE_OBJC_CLASS = 27,
/// \brief The ObjC 'SEL' type.
- PREDEF_TYPE_OBJC_SEL = 28,
+ PREDEF_TYPE_OBJC_SEL = 28,
/// \brief The 'unknown any' placeholder type.
- PREDEF_TYPE_UNKNOWN_ANY = 29,
+ PREDEF_TYPE_UNKNOWN_ANY = 29,
/// \brief The placeholder type for bound member functions.
- PREDEF_TYPE_BOUND_MEMBER = 30,
+ PREDEF_TYPE_BOUND_MEMBER = 30,
/// \brief The "auto" deduction type.
- PREDEF_TYPE_AUTO_DEDUCT = 31,
+ PREDEF_TYPE_AUTO_DEDUCT = 31,
/// \brief The "auto &&" deduction type.
PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
/// \brief The OpenCL 'half' / ARM NEON __fp16 type.
- PREDEF_TYPE_HALF_ID = 33,
+ PREDEF_TYPE_HALF_ID = 33,
/// \brief ARC's unbridged-cast placeholder type.
PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
/// \brief The pseudo-object placeholder type.
@@ -763,21 +763,21 @@ namespace clang {
/// \brief The placeholder type for builtin functions.
PREDEF_TYPE_BUILTIN_FN = 37,
/// \brief OpenCL 1d image type.
- PREDEF_TYPE_IMAGE1D_ID = 38,
+ PREDEF_TYPE_IMAGE1D_ID = 38,
/// \brief OpenCL 1d image array type.
PREDEF_TYPE_IMAGE1D_ARR_ID = 39,
/// \brief OpenCL 1d image buffer type.
PREDEF_TYPE_IMAGE1D_BUFF_ID = 40,
/// \brief OpenCL 2d image type.
- PREDEF_TYPE_IMAGE2D_ID = 41,
+ PREDEF_TYPE_IMAGE2D_ID = 41,
/// \brief OpenCL 2d image array type.
PREDEF_TYPE_IMAGE2D_ARR_ID = 42,
/// \brief OpenCL 3d image type.
- PREDEF_TYPE_IMAGE3D_ID = 43,
+ PREDEF_TYPE_IMAGE3D_ID = 43,
/// \brief OpenCL event type.
- PREDEF_TYPE_EVENT_ID = 44,
+ PREDEF_TYPE_EVENT_ID = 44,
/// \brief OpenCL sampler type.
- PREDEF_TYPE_SAMPLER_ID = 45,
+ PREDEF_TYPE_SAMPLER_ID = 45,
/// \brief HLSL LinAlg Matrix type.
PREDEF_TYPE_LINALG_MATRIX_ID = 46
};
diff --git a/tools/clang/lib/AST/ItaniumMangle.cpp b/tools/clang/lib/AST/ItaniumMangle.cpp
index dbc1af71..1c41a9b5 100644
--- a/tools/clang/lib/AST/ItaniumMangle.cpp
+++ b/tools/clang/lib/AST/ItaniumMangle.cpp
@@ -2050,7 +2050,9 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
case BuiltinType::HalfFloat: Out << "half_float"; break;
case BuiltinType::Int8_4Packed: Out << "int8_t4_packed"; break;
case BuiltinType::UInt8_4Packed: Out << "uint8_t4_packed"; break;
- case BuiltinType::LinAlgMatrix: Out << "23__builtin_LinAlg_Matrix"; break;
+ case BuiltinType::LinAlgMatrix:
+ Out << "23__builtin_LinAlg_Matrix";
+ break;
// HLSL Change ends
}
}
diff --git a/tools/clang/lib/AST/Type.cpp b/tools/clang/lib/AST/Type.cpp
index 22188262..ac30674b 100644
--- a/tools/clang/lib/AST/Type.cpp
+++ b/tools/clang/lib/AST/Type.cpp
@@ -2548,8 +2548,9 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
case LitInt: return "literal int";
case Int8_4Packed: return "int8_t4_packed";
case UInt8_4Packed: return "uint8_t4_packed";
- case LinAlgMatrix: return "__builtin_LinAlg Matrix";
- // HLSL Change Ends
+ case LinAlgMatrix:
+ return "__builtin_LinAlg Matrix";
+ // HLSL Change Ends
}
llvm_unreachable("Invalid builtin type.");
diff --git a/tools/clang/lib/CodeGen/CodeGenTypes.cpp b/tools/clang/lib/CodeGen/CodeGenTypes.cpp
index bcd08f69..3c3680c6 100644
--- a/tools/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/tools/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -485,7 +485,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
case BuiltinType::LinAlgMatrix:
llvm_unreachable("LinAlgMatrix codegen is not supported yet");
break;
- // HLSL Change Ends
+ // HLSL Change Ends
case BuiltinType::Dependent:
#define BUILTIN_TYPE(Id, SingletonId)
diff --git a/tools/clang/lib/Serialization/ASTCommon.cpp b/tools/clang/lib/Serialization/ASTCommon.cpp
index e81ae853..dca4c3fc 100644
--- a/tools/clang/lib/Serialization/ASTCommon.cpp
+++ b/tools/clang/lib/Serialization/ASTCommon.cpp
@@ -70,7 +70,9 @@ serialization::TypeIdxFromBuiltin(const BuiltinType *BT) {
case BuiltinType::OCLImage3d: ID = PREDEF_TYPE_IMAGE3D_ID; break;
case BuiltinType::OCLSampler: ID = PREDEF_TYPE_SAMPLER_ID; break;
case BuiltinType::OCLEvent: ID = PREDEF_TYPE_EVENT_ID; break;
- case BuiltinType::LinAlgMatrix: ID = PREDEF_TYPE_LINALG_MATRIX_ID;break;
+ case BuiltinType::LinAlgMatrix:
+ ID = PREDEF_TYPE_LINALG_MATRIX_ID;
+ break;
case BuiltinType::BuiltinFn:
ID = PREDEF_TYPE_BUILTIN_FN; break;
diff --git a/tools/clang/lib/Serialization/ASTReader.cpp b/tools/clang/lib/Serialization/ASTReader.cpp
index 0c665204..68367fc5 100644
--- a/tools/clang/lib/Serialization/ASTReader.cpp
+++ b/tools/clang/lib/Serialization/ASTReader.cpp
@@ -5755,7 +5755,9 @@ QualType ASTReader::GetType(TypeID ID) {
case PREDEF_TYPE_IMAGE3D_ID: T = Context.OCLImage3dTy; break;
case PREDEF_TYPE_SAMPLER_ID: T = Context.OCLSamplerTy; break;
case PREDEF_TYPE_EVENT_ID: T = Context.OCLEventTy; break;
- case PREDEF_TYPE_LINALG_MATRIX_ID: T = Context.LinAlgMatrixTy; break;
+ case PREDEF_TYPE_LINALG_MATRIX_ID:
+ T = Context.LinAlgMatrixTy;
+ break;
case PREDEF_TYPE_AUTO_DEDUCT: T = Context.getAutoDeductType(); break;
case PREDEF_TYPE_AUTO_RREF_DEDUCT:
|
| break; | ||
| // HLSL Change Starts | ||
| case BuiltinType::LinAlgMatrix: | ||
| llvm_unreachable("LinAlgMatrix debug info not yet supported."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something coming in later parts for this issue? Or is this something else we should be tracking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the llvm_unreachable and let to fall back to default debug info handling. I am not sure if we need to do anything special here.
|
|
||
| // HLSL Change Starts | ||
| case BuiltinType::LinAlgMatrix: | ||
| llvm_unreachable("LinAlgMatrix codegen is not supported yet"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question - when do we plan to do this?
Adds a built-in type
__builtin_LinAlg_Matrixthat will be used in LinAlg Matrix implementation for SM 6.10.Part 1 of #8073