Fix issues of the interaction between cooperative_matrix and spirv_intrinsics
coopmat<> type definition allows type parameters. To make it accept types defined by spirv_type directive, we add spirvType info to the type parameters. This change is to support this case. And a test is added to show the missing usage.
This commit is contained in:
parent
10ee92feb0
commit
022aea431c
7 changed files with 1136 additions and 1022 deletions
|
|
@ -1435,13 +1435,25 @@ class TTypeParameters {
|
|||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
TTypeParameters() : basicType(EbtVoid), arraySizes(nullptr) {}
|
||||
TTypeParameters() : basicType(EbtVoid), arraySizes(nullptr), spirvType(nullptr) {}
|
||||
|
||||
TBasicType basicType;
|
||||
TArraySizes *arraySizes;
|
||||
TSpirvType *spirvType;
|
||||
|
||||
bool operator==(const TTypeParameters& rhs) const { return basicType == rhs.basicType && *arraySizes == *rhs.arraySizes; }
|
||||
bool operator!=(const TTypeParameters& rhs) const { return basicType != rhs.basicType || *arraySizes != *rhs.arraySizes; }
|
||||
bool operator==(const TTypeParameters& rhs) const
|
||||
{
|
||||
bool same = basicType == rhs.basicType && *arraySizes == *rhs.arraySizes;
|
||||
if (same && basicType == EbtSpirvType) {
|
||||
assert(spirvType && rhs.spirvType);
|
||||
return *spirvType == *rhs.spirvType;
|
||||
}
|
||||
return same;
|
||||
}
|
||||
bool operator!=(const TTypeParameters& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
|
|
@ -1618,6 +1630,10 @@ public:
|
|||
}
|
||||
if (p.isCoopmatKHR() && p.typeParameters && p.typeParameters->arraySizes->getNumDims() > 0) {
|
||||
basicType = p.typeParameters->basicType;
|
||||
if (isSpirvType()) {
|
||||
assert(p.typeParameters->spirvType);
|
||||
spirvType = p.typeParameters->spirvType;
|
||||
}
|
||||
|
||||
if (p.typeParameters->arraySizes->getNumDims() == 4) {
|
||||
const int dimSize = p.typeParameters->arraySizes->getDimSize(3);
|
||||
|
|
@ -2719,7 +2735,8 @@ public:
|
|||
if (isCoopMatKHR() && right.isCoopMatKHR()) {
|
||||
return ((getBasicType() == right.getBasicType()) || (getBasicType() == EbtCoopmat) ||
|
||||
(right.getBasicType() == EbtCoopmat)) &&
|
||||
typeParameters == nullptr && right.typeParameters != nullptr;
|
||||
((typeParameters == nullptr && right.typeParameters != nullptr) ||
|
||||
(typeParameters != nullptr && right.typeParameters == nullptr));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2825,6 +2842,7 @@ protected:
|
|||
typeParameters = new TTypeParameters;
|
||||
typeParameters->arraySizes = new TArraySizes;
|
||||
*typeParameters->arraySizes = *copyOf.typeParameters->arraySizes;
|
||||
*typeParameters->spirvType = *copyOf.typeParameters->spirvType;
|
||||
typeParameters->basicType = copyOf.basicType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7413,6 +7413,7 @@ void TParseContext::coopMatTypeParametersCheck(const TSourceLoc& loc, const TPub
|
|||
case EbtUint:
|
||||
case EbtUint8:
|
||||
case EbtUint16:
|
||||
case EbtSpirvType:
|
||||
break;
|
||||
default:
|
||||
error(loc, "coopmat invalid basic type", TType::getBasicString(publicType.typeParameters->basicType), "");
|
||||
|
|
@ -7795,7 +7796,8 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
|
|||
error(loc, "unexpected number type parameters", identifier.c_str(), "");
|
||||
}
|
||||
if (publicType.typeParameters) {
|
||||
if (!isTypeFloat(publicType.typeParameters->basicType) && !isTypeInt(publicType.typeParameters->basicType)) {
|
||||
if (!isTypeFloat(publicType.typeParameters->basicType) &&
|
||||
!isTypeInt(publicType.typeParameters->basicType) && publicType.typeParameters->basicType != EbtSpirvType) {
|
||||
error(loc, "expected 8, 16, 32, or 64 bit signed or unsigned integer or 16, 32, or 64 bit float type", identifier.c_str(), "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1756,6 +1756,7 @@ type_parameter_specifier_list
|
|||
: type_specifier {
|
||||
$$ = new TTypeParameters;
|
||||
$$->arraySizes = new TArraySizes;
|
||||
$$->spirvType = $1.spirvType;
|
||||
$$->basicType = $1.basicType;
|
||||
}
|
||||
| unary_expression {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue