Updated glslang.

This commit is contained in:
Бранимир Караџић
2024-12-28 22:40:35 -08:00
parent fc70df0941
commit eb31b53dcd
37 changed files with 8835 additions and 6748 deletions

View File

@@ -90,4 +90,10 @@ const char* const E_SPV_NV_displacement_micromap = "SPV_NV_displacement_micromap
//SPV_NV_shader_atomic_fp16_vector
const char* const E_SPV_NV_shader_atomic_fp16_vector = "SPV_NV_shader_atomic_fp16_vector";
//SPV_NV_tensor_addressing
const char* const E_SPV_NV_tensor_addressing = "SPV_NV_tensor_addressing";
//SPV_NV_cooperative_matrix2
const char* const E_SPV_NV_cooperative_matrix2 = "SPV_NV_cooperative_matrix2";
#endif // #ifndef GLSLextNV_H

View File

@@ -173,7 +173,7 @@ protected:
spv::LinkageType convertGlslangLinkageToSpv(glslang::TLinkType glslangLinkType);
void decorateStructType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::TLayoutPacking,
const glslang::TQualifier&, spv::Id, const std::vector<spv::Id>& spvMembers);
spv::Id makeArraySizeId(const glslang::TArraySizes&, int dim, bool allowZero = false);
spv::Id makeArraySizeId(const glslang::TArraySizes&, int dim, bool allowZero = false, bool boolType = false);
spv::Id accessChainLoad(const glslang::TType& type);
void accessChainStore(const glslang::TType& type, spv::Id rvalue);
void multiTypeStore(const glslang::TType&, spv::Id rValue);
@@ -209,8 +209,9 @@ protected:
spv::Id createUnaryMatrixOperation(spv::Op op, OpDecorations&, spv::Id typeId, spv::Id operand,
glslang::TBasicType typeProxy);
spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operand,
glslang::TBasicType typeProxy);
spv::Id createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize, spv::Id destType);
glslang::TBasicType resultBasicType, glslang::TBasicType operandBasicType);
spv::Id createIntWidthConversion(spv::Id operand, int vectorSize, spv::Id destType,
glslang::TBasicType resultBasicType, glslang::TBasicType operandBasicType);
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId,
std::vector<spv::Id>& operands, glslang::TBasicType typeProxy,
@@ -2040,6 +2041,10 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
builder.setDebugSourceLocation(symbol->getLoc().line, symbol->getLoc().getFilename());
}
if (symbol->getBasicType() == glslang::EbtFunction) {
return;
}
SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
if (symbol->getType().isStruct())
glslangTypeToIdMap[symbol->getType().getStruct()] = symbol->getId();
@@ -2682,9 +2687,18 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
TranslateNonUniformDecoration(node->getType().getQualifier()) };
// it could be a conversion
if (! result)
if (! result) {
result = createConversion(node->getOp(), decorations, resultType(), operand,
node->getOperand()->getBasicType());
node->getType().getBasicType(), node->getOperand()->getBasicType());
if (result) {
if (node->getType().isCoopMatKHR() && node->getOperand()->getAsTyped()->getType().isCoopMatKHR() &&
!node->getAsTyped()->getType().sameCoopMatUse(node->getOperand()->getAsTyped()->getType())) {
// Conversions that change use need CapabilityCooperativeMatrixConversionsNV
builder.addCapability(spv::CapabilityCooperativeMatrixConversionsNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
}
}
}
// if not, then possibly an operation
if (! result)
@@ -2806,6 +2820,18 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
builder.createNoResultOp(spv::OpHitObjectRecordEmptyNV, operand);
return false;
case glslang::EOpCreateTensorLayoutNV:
result = builder.createOp(spv::OpCreateTensorLayoutNV, resultType(), std::vector<spv::Id>{});
builder.clearAccessChain();
builder.setAccessChainRValue(result);
return false;
case glslang::EOpCreateTensorViewNV:
result = builder.createOp(spv::OpCreateTensorViewNV, resultType(), std::vector<spv::Id>{});
builder.clearAccessChain();
builder.setAccessChainRValue(result);
return false;
default:
logger->missingFunctionality("unknown glslang unary");
return true; // pick up operand as placeholder result
@@ -3131,6 +3157,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
constructed = arguments[0];
} else
constructed = builder.createOp(spv::OpSampledImage, resultType(), arguments);
} else if (node->getOp() == glslang::EOpConstructCooperativeMatrixKHR &&
node->getType().isCoopMatKHR() && node->getSequence()[0]->getAsTyped()->getType().isCoopMatKHR()) {
builder.addCapability(spv::CapabilityCooperativeMatrixConversionsNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
constructed = builder.createCooperativeMatrixConversion(resultType(), arguments[0]);
} else if (node->getOp() == glslang::EOpConstructStruct ||
node->getOp() == glslang::EOpConstructCooperativeMatrixNV ||
node->getOp() == glslang::EOpConstructCooperativeMatrixKHR ||
@@ -3315,6 +3346,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case glslang::EOpCooperativeMatrixStore:
case glslang::EOpCooperativeMatrixLoadNV:
case glslang::EOpCooperativeMatrixStoreNV:
case glslang::EOpCooperativeMatrixLoadTensorNV:
case glslang::EOpCooperativeMatrixStoreTensorNV:
case glslang::EOpCooperativeMatrixReduceNV:
case glslang::EOpCooperativeMatrixPerElementOpNV:
case glslang::EOpCooperativeMatrixTransposeNV:
noReturnValue = true;
break;
case glslang::EOpBeginInvocationInterlock:
@@ -3561,14 +3597,22 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
break;
case glslang::EOpCooperativeMatrixLoad:
case glslang::EOpCooperativeMatrixLoadNV:
case glslang::EOpCooperativeMatrixLoadTensorNV:
if (arg == 0 || arg == 1)
lvalue = true;
break;
case glslang::EOpCooperativeMatrixStore:
case glslang::EOpCooperativeMatrixStoreNV:
case glslang::EOpCooperativeMatrixStoreTensorNV:
if (arg == 1)
lvalue = true;
break;
case glslang::EOpCooperativeMatrixReduceNV:
case glslang::EOpCooperativeMatrixPerElementOpNV:
case glslang::EOpCooperativeMatrixTransposeNV:
if (arg == 0)
lvalue = true;
break;
case glslang::EOpSpirvInst:
if (glslangOperands[arg]->getAsTyped()->getQualifier().isSpirvByReference())
lvalue = true;
@@ -3594,7 +3638,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (node->getOp() == glslang::EOpCooperativeMatrixLoad ||
node->getOp() == glslang::EOpCooperativeMatrixStore ||
node->getOp() == glslang::EOpCooperativeMatrixLoadNV ||
node->getOp() == glslang::EOpCooperativeMatrixStoreNV) {
node->getOp() == glslang::EOpCooperativeMatrixStoreNV ||
node->getOp() == glslang::EOpCooperativeMatrixLoadTensorNV ||
node->getOp() == glslang::EOpCooperativeMatrixStoreTensorNV) {
if (arg == 1) {
// fold "element" parameter into the access chain
@@ -3616,10 +3662,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
int memoryAccess = TranslateMemoryAccess(coherentFlags);
if (node->getOp() == glslang::EOpCooperativeMatrixLoad ||
node->getOp() == glslang::EOpCooperativeMatrixLoadNV)
node->getOp() == glslang::EOpCooperativeMatrixLoadNV ||
node->getOp() == glslang::EOpCooperativeMatrixLoadTensorNV)
memoryAccess &= ~spv::MemoryAccessMakePointerAvailableKHRMask;
if (node->getOp() == glslang::EOpCooperativeMatrixStore ||
node->getOp() == glslang::EOpCooperativeMatrixStoreNV)
node->getOp() == glslang::EOpCooperativeMatrixStoreNV ||
node->getOp() == glslang::EOpCooperativeMatrixStoreTensorNV)
memoryAccess &= ~spv::MemoryAccessMakePointerVisibleKHRMask;
if (builder.getStorageClass(builder.getAccessChain().base) ==
spv::StorageClassPhysicalStorageBufferEXT) {
@@ -3706,6 +3754,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
} else if (glslangOperands[arg]->getAsTyped()->getQualifier().isSpirvLiteral()) {
// Will be translated to a literal value, make a placeholder here
operands.push_back(spv::NoResult);
} else if (glslangOperands[arg]->getAsTyped()->getBasicType() == glslang::EbtFunction) {
spv::Function* function = functionMap[glslangOperands[arg]->getAsSymbolNode()->getMangledName().c_str()];
assert(function);
operands.push_back(function->getId());
} else {
operands.push_back(accessChainLoad(glslangOperands[arg]->getAsTyped()->getType()));
}
@@ -3713,8 +3765,45 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
}
builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
if (node->getOp() == glslang::EOpCooperativeMatrixLoad ||
node->getOp() == glslang::EOpCooperativeMatrixLoadNV) {
if (node->getOp() == glslang::EOpCooperativeMatrixLoadTensorNV) {
std::vector<spv::IdImmediate> idImmOps;
builder.addCapability(spv::CapabilityCooperativeMatrixTensorAddressingNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
spv::Id object = builder.createLoad(operands[0], spv::NoPrecision);
idImmOps.push_back(spv::IdImmediate(true, operands[1])); // Pointer
idImmOps.push_back(spv::IdImmediate(true, object)); // Object
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // tensorLayout
idImmOps.insert(idImmOps.end(), memoryAccessOperands.begin(), memoryAccessOperands.end()); // memoryaccess
// initialize tensor operands to zero, then OR in flags based on the operands
size_t tensorOpIdx = idImmOps.size();
idImmOps.push_back(spv::IdImmediate(false, 0));
for (uint32_t i = 3; i < operands.size(); ++i) {
if (builder.isTensorView(operands[i])) {
idImmOps[tensorOpIdx].word |= spv::TensorAddressingOperandsTensorViewMask;
} else {
// must be the decode func
idImmOps[tensorOpIdx].word |= spv::TensorAddressingOperandsDecodeFuncMask;
builder.addCapability(spv::CapabilityCooperativeMatrixBlockLoadsNV);
}
idImmOps.push_back(spv::IdImmediate(true, operands[i])); // tensorView or decodeFunc
}
// get the pointee type
spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0]));
assert(builder.isCooperativeMatrixType(typeId));
// do the op
spv::Id result = builder.createOp(spv::OpCooperativeMatrixLoadTensorNV, typeId, idImmOps);
// store the result to the pointer (out param 'm')
builder.createStore(result, operands[0]);
result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixLoad ||
node->getOp() == glslang::EOpCooperativeMatrixLoadNV) {
std::vector<spv::IdImmediate> idImmOps;
idImmOps.push_back(spv::IdImmediate(true, operands[1])); // buf
@@ -3742,6 +3831,28 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
// store the result to the pointer (out param 'm')
builder.createStore(result, operands[0]);
result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixStoreTensorNV) {
std::vector<spv::IdImmediate> idImmOps;
idImmOps.push_back(spv::IdImmediate(true, operands[1])); // buf
idImmOps.push_back(spv::IdImmediate(true, operands[0])); // object
builder.addCapability(spv::CapabilityCooperativeMatrixTensorAddressingNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // tensorLayout
idImmOps.insert(idImmOps.end(), memoryAccessOperands.begin(), memoryAccessOperands.end()); // memoryaccess
if (operands.size() > 3) {
idImmOps.push_back(spv::IdImmediate(false, spv::TensorAddressingOperandsTensorViewMask));
idImmOps.push_back(spv::IdImmediate(true, operands[3])); // tensorView
} else {
idImmOps.push_back(spv::IdImmediate(false, 0));
}
builder.createNoResultOp(spv::OpCooperativeMatrixStoreTensorNV, idImmOps);
result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixStore ||
node->getOp() == glslang::EOpCooperativeMatrixStoreNV) {
std::vector<spv::IdImmediate> idImmOps;
@@ -3810,6 +3921,43 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
idImmOps.push_back(spv::IdImmediate(false, matrixOperands));
result = builder.createOp(spv::OpCooperativeMatrixMulAddKHR, resultType(), idImmOps);
} else if (node->getOp() == glslang::EOpCooperativeMatrixReduceNV) {
builder.addCapability(spv::CapabilityCooperativeMatrixReductionsNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
spv::Op opcode = spv::OpCooperativeMatrixReduceNV;
unsigned mask = glslangOperands[2]->getAsConstantUnion()->getConstArray()[0].getUConst();
spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0]));
assert(builder.isCooperativeMatrixType(typeId));
result = builder.createCooperativeMatrixReduce(opcode, typeId, operands[1], mask, operands[3]);
// store the result to the pointer (out param 'm')
builder.createStore(result, operands[0]);
result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixPerElementOpNV) {
builder.addCapability(spv::CapabilityCooperativeMatrixPerElementOperationsNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0]));
assert(builder.isCooperativeMatrixType(typeId));
result = builder.createCooperativeMatrixPerElementOp(typeId, operands);
// store the result to the pointer
builder.createStore(result, operands[0]);
result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixTransposeNV) {
builder.addCapability(spv::CapabilityCooperativeMatrixConversionsNV);
builder.addExtension(spv::E_SPV_NV_cooperative_matrix2);
spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0]));
assert(builder.isCooperativeMatrixType(typeId));
result = builder.createUnaryOp(spv::OpCooperativeMatrixTransposeNV, typeId, operands[1]);
// store the result to the pointer
builder.createStore(result, operands[0]);
result = 0;
} else if (atomic) {
// Handle all atomics
glslang::TBasicType typeProxy = (node->getOp() == glslang::EOpAtomicStore)
@@ -4691,6 +4839,32 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
break;
}
case glslang::EbtTensorLayoutNV:
{
builder.addCapability(spv::CapabilityTensorAddressingNV);
builder.addExtension(spv::E_SPV_NV_tensor_addressing);
std::vector<spv::IdImmediate> operands;
for (uint32_t i = 0; i < 2; ++i) {
operands.push_back({true, makeArraySizeId(*type.getTypeParameters()->arraySizes, i, true)});
}
spvType = builder.makeGenericType(spv::OpTypeTensorLayoutNV, operands);
break;
}
case glslang::EbtTensorViewNV:
{
builder.addCapability(spv::CapabilityTensorAddressingNV);
builder.addExtension(spv::E_SPV_NV_tensor_addressing);
uint32_t dim = type.getTypeParameters()->arraySizes->getDimSize(0);
assert(dim >= 1 && dim <= 5);
std::vector<spv::IdImmediate> operands;
for (uint32_t i = 0; i < dim + 2; ++i) {
operands.push_back({true, makeArraySizeId(*type.getTypeParameters()->arraySizes, i, true, i==1)});
}
spvType = builder.makeGenericType(spv::OpTypeTensorViewNV, operands);
break;
}
default:
assert(0);
break;
@@ -5113,7 +5287,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
// This is not quite trivial, because of specialization constants.
// Sometimes, a raw constant is turned into an Id, and sometimes
// a specialization constant expression is.
spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arraySizes, int dim, bool allowZero)
spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arraySizes, int dim, bool allowZero, bool boolType)
{
// First, see if this is sized with a node, meaning a specialization constant:
glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim);
@@ -5131,7 +5305,11 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra
if (!allowZero)
assert(size > 0);
return builder.makeUintConstant(size);
if (boolType) {
return builder.makeBoolConstant(size);
} else {
return builder.makeUintConstant(size);
}
}
// Wrap the builder's accessChainLoad to:
@@ -7485,73 +7663,22 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, OpDecorat
// for the signedness conversion.
// destType is the final type that will be converted to, but this function
// may only be doing part of that conversion.
spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize, spv::Id destType)
spv::Id TGlslangToSpvTraverser::createIntWidthConversion(spv::Id operand, int vectorSize, spv::Id destType,
glslang::TBasicType resultBasicType, glslang::TBasicType operandBasicType)
{
// Get the result type width, based on the type to convert to.
int width = 32;
switch(op) {
case glslang::EOpConvInt16ToUint8:
case glslang::EOpConvIntToUint8:
case glslang::EOpConvInt64ToUint8:
case glslang::EOpConvUint16ToInt8:
case glslang::EOpConvUintToInt8:
case glslang::EOpConvUint64ToInt8:
width = 8;
break;
case glslang::EOpConvInt8ToUint16:
case glslang::EOpConvIntToUint16:
case glslang::EOpConvInt64ToUint16:
case glslang::EOpConvUint8ToInt16:
case glslang::EOpConvUintToInt16:
case glslang::EOpConvUint64ToInt16:
width = 16;
break;
case glslang::EOpConvInt8ToUint:
case glslang::EOpConvInt16ToUint:
case glslang::EOpConvInt64ToUint:
case glslang::EOpConvUint8ToInt:
case glslang::EOpConvUint16ToInt:
case glslang::EOpConvUint64ToInt:
width = 32;
break;
case glslang::EOpConvInt8ToUint64:
case glslang::EOpConvInt16ToUint64:
case glslang::EOpConvIntToUint64:
case glslang::EOpConvUint8ToInt64:
case glslang::EOpConvUint16ToInt64:
case glslang::EOpConvUintToInt64:
width = 64;
break;
default:
assert(false && "Default missing");
break;
}
int width = GetNumBits(resultBasicType);
// Get the conversion operation and result type,
// based on the target width, but the source type.
spv::Id type = spv::NoType;
spv::Op convOp = spv::OpNop;
switch(op) {
case glslang::EOpConvInt8ToUint16:
case glslang::EOpConvInt8ToUint:
case glslang::EOpConvInt8ToUint64:
case glslang::EOpConvInt16ToUint8:
case glslang::EOpConvInt16ToUint:
case glslang::EOpConvInt16ToUint64:
case glslang::EOpConvIntToUint8:
case glslang::EOpConvIntToUint16:
case glslang::EOpConvIntToUint64:
case glslang::EOpConvInt64ToUint8:
case glslang::EOpConvInt64ToUint16:
case glslang::EOpConvInt64ToUint:
if (isTypeSignedInt(operandBasicType)) {
convOp = spv::OpSConvert;
type = builder.makeIntType(width);
break;
default:
} else {
convOp = spv::OpUConvert;
type = builder.makeUintType(width);
break;
}
if (vectorSize > 0)
@@ -7566,7 +7693,7 @@ spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op,
}
spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecorations& decorations, spv::Id destType,
spv::Id operand, glslang::TBasicType typeProxy)
spv::Id operand, glslang::TBasicType resultBasicType, glslang::TBasicType operandBasicType)
{
spv::Op convOp = spv::OpNop;
spv::Id zero = 0;
@@ -7574,317 +7701,124 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora
int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0;
switch (op) {
case glslang::EOpConvIntToBool:
case glslang::EOpConvUintToBool:
zero = builder.makeUintConstant(0);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpINotEqual, destType, operand, zero);
case glslang::EOpConvFloatToBool:
zero = builder.makeFloatConstant(0.0F);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpFUnordNotEqual, destType, operand, zero);
case glslang::EOpConvBoolToFloat:
convOp = spv::OpSelect;
zero = builder.makeFloatConstant(0.0F);
one = builder.makeFloatConstant(1.0F);
break;
case glslang::EOpConvBoolToInt:
case glslang::EOpConvBoolToInt64:
if (op == glslang::EOpConvBoolToInt64) {
zero = builder.makeInt64Constant(0);
one = builder.makeInt64Constant(1);
} else {
zero = builder.makeIntConstant(0);
one = builder.makeIntConstant(1);
if (IsOpNumericConv(op)) {
if (isTypeSignedInt(operandBasicType) && isTypeFloat(resultBasicType)) {
convOp = spv::OpConvertSToF;
}
convOp = spv::OpSelect;
break;
case glslang::EOpConvBoolToUint:
case glslang::EOpConvBoolToUint64:
if (op == glslang::EOpConvBoolToUint64) {
zero = builder.makeUint64Constant(0);
one = builder.makeUint64Constant(1);
} else {
zero = builder.makeUintConstant(0);
one = builder.makeUintConstant(1);
if (isTypeUnsignedInt(operandBasicType) && isTypeFloat(resultBasicType)) {
convOp = spv::OpConvertUToF;
}
if (isTypeFloat(operandBasicType) && isTypeSignedInt(resultBasicType)) {
convOp = spv::OpConvertFToS;
}
if (isTypeFloat(operandBasicType) && isTypeUnsignedInt(resultBasicType)) {
convOp = spv::OpConvertFToU;
}
if (isTypeSignedInt(operandBasicType) && isTypeSignedInt(resultBasicType)) {
convOp = spv::OpSConvert;
}
if (isTypeUnsignedInt(operandBasicType) && isTypeUnsignedInt(resultBasicType)) {
convOp = spv::OpUConvert;
}
if (isTypeFloat(operandBasicType) && isTypeFloat(resultBasicType)) {
convOp = spv::OpFConvert;
if (builder.isMatrixType(destType))
return createUnaryMatrixOperation(convOp, decorations, destType, operand, operandBasicType);
}
if (isTypeInt(operandBasicType) && isTypeInt(resultBasicType) &&
isTypeUnsignedInt(operandBasicType) != isTypeUnsignedInt(resultBasicType)) {
convOp = spv::OpSelect;
break;
if (GetNumBits(operandBasicType) != GetNumBits(resultBasicType)) {
// OpSConvert/OpUConvert + OpBitCast
operand = createIntWidthConversion(operand, vectorSize, destType, resultBasicType, operandBasicType);
}
case glslang::EOpConvInt8ToFloat16:
case glslang::EOpConvInt8ToFloat:
case glslang::EOpConvInt8ToDouble:
case glslang::EOpConvInt16ToFloat16:
case glslang::EOpConvInt16ToFloat:
case glslang::EOpConvInt16ToDouble:
case glslang::EOpConvIntToFloat16:
case glslang::EOpConvIntToFloat:
case glslang::EOpConvIntToDouble:
case glslang::EOpConvInt64ToFloat:
case glslang::EOpConvInt64ToDouble:
case glslang::EOpConvInt64ToFloat16:
convOp = spv::OpConvertSToF;
break;
case glslang::EOpConvUint8ToFloat16:
case glslang::EOpConvUint8ToFloat:
case glslang::EOpConvUint8ToDouble:
case glslang::EOpConvUint16ToFloat16:
case glslang::EOpConvUint16ToFloat:
case glslang::EOpConvUint16ToDouble:
case glslang::EOpConvUintToFloat16:
case glslang::EOpConvUintToFloat:
case glslang::EOpConvUintToDouble:
case glslang::EOpConvUint64ToFloat:
case glslang::EOpConvUint64ToDouble:
case glslang::EOpConvUint64ToFloat16:
convOp = spv::OpConvertUToF;
break;
case glslang::EOpConvFloat16ToInt8:
case glslang::EOpConvFloatToInt8:
case glslang::EOpConvDoubleToInt8:
case glslang::EOpConvFloat16ToInt16:
case glslang::EOpConvFloatToInt16:
case glslang::EOpConvDoubleToInt16:
case glslang::EOpConvFloat16ToInt:
case glslang::EOpConvFloatToInt:
case glslang::EOpConvDoubleToInt:
case glslang::EOpConvFloat16ToInt64:
case glslang::EOpConvFloatToInt64:
case glslang::EOpConvDoubleToInt64:
convOp = spv::OpConvertFToS;
break;
case glslang::EOpConvUint8ToInt8:
case glslang::EOpConvInt8ToUint8:
case glslang::EOpConvUint16ToInt16:
case glslang::EOpConvInt16ToUint16:
case glslang::EOpConvUintToInt:
case glslang::EOpConvIntToUint:
case glslang::EOpConvUint64ToInt64:
case glslang::EOpConvInt64ToUint64:
if (builder.isInSpecConstCodeGenMode()) {
// Build zero scalar or vector for OpIAdd.
if(op == glslang::EOpConvUint8ToInt8 || op == glslang::EOpConvInt8ToUint8) {
zero = builder.makeUint8Constant(0);
} else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) {
zero = builder.makeUint16Constant(0);
} else if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) {
zero = builder.makeUint64Constant(0);
if (builder.isInSpecConstCodeGenMode()) {
uint32_t bits = GetNumBits(resultBasicType);
spv::Id zeroType = builder.makeUintType(bits);
if (bits == 64) {
zero = builder.makeInt64Constant(zeroType, 0, false);
} else {
zero = builder.makeIntConstant(zeroType, 0, false);
}
zero = makeSmearedConstant(zero, vectorSize);
// Use OpIAdd, instead of OpBitcast to do the conversion when
// generating for OpSpecConstantOp instruction.
return builder.createBinOp(spv::OpIAdd, destType, operand, zero);
}
// For normal run-time conversion instruction, use OpBitcast.
convOp = spv::OpBitcast;
}
if (resultBasicType == glslang::EbtBool) {
uint32_t bits = GetNumBits(operandBasicType);
if (isTypeInt(operandBasicType)) {
spv::Id zeroType = builder.makeUintType(bits);
if (bits == 64) {
zero = builder.makeInt64Constant(zeroType, 0, false);
} else {
zero = builder.makeIntConstant(zeroType, 0, false);
}
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpINotEqual, destType, operand, zero);
} else {
zero = builder.makeUintConstant(0);
assert(isTypeFloat(operandBasicType));
if (bits == 64) {
zero = builder.makeDoubleConstant(0.0);
} else if (bits == 32) {
zero = builder.makeFloatConstant(0.0);
} else {
assert(bits == 16);
zero = builder.makeFloat16Constant(0.0);
}
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpFUnordNotEqual, destType, operand, zero);
}
zero = makeSmearedConstant(zero, vectorSize);
// Use OpIAdd, instead of OpBitcast to do the conversion when
// generating for OpSpecConstantOp instruction.
return builder.createBinOp(spv::OpIAdd, destType, operand, zero);
}
// For normal run-time conversion instruction, use OpBitcast.
convOp = spv::OpBitcast;
break;
case glslang::EOpConvFloat16ToUint8:
case glslang::EOpConvFloatToUint8:
case glslang::EOpConvDoubleToUint8:
case glslang::EOpConvFloat16ToUint16:
case glslang::EOpConvFloatToUint16:
case glslang::EOpConvDoubleToUint16:
case glslang::EOpConvFloat16ToUint:
case glslang::EOpConvFloatToUint:
case glslang::EOpConvDoubleToUint:
case glslang::EOpConvFloatToUint64:
case glslang::EOpConvDoubleToUint64:
case glslang::EOpConvFloat16ToUint64:
convOp = spv::OpConvertFToU;
break;
case glslang::EOpConvInt8ToBool:
case glslang::EOpConvUint8ToBool:
zero = builder.makeUint8Constant(0);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpINotEqual, destType, operand, zero);
case glslang::EOpConvInt16ToBool:
case glslang::EOpConvUint16ToBool:
zero = builder.makeUint16Constant(0);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpINotEqual, destType, operand, zero);
case glslang::EOpConvInt64ToBool:
case glslang::EOpConvUint64ToBool:
zero = builder.makeUint64Constant(0);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpINotEqual, destType, operand, zero);
case glslang::EOpConvDoubleToBool:
zero = builder.makeDoubleConstant(0.0);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpFUnordNotEqual, destType, operand, zero);
case glslang::EOpConvFloat16ToBool:
zero = builder.makeFloat16Constant(0.0F);
zero = makeSmearedConstant(zero, vectorSize);
return builder.createBinOp(spv::OpFUnordNotEqual, destType, operand, zero);
case glslang::EOpConvBoolToDouble:
convOp = spv::OpSelect;
zero = builder.makeDoubleConstant(0.0);
one = builder.makeDoubleConstant(1.0);
break;
case glslang::EOpConvBoolToFloat16:
convOp = spv::OpSelect;
zero = builder.makeFloat16Constant(0.0F);
one = builder.makeFloat16Constant(1.0F);
break;
case glslang::EOpConvBoolToInt8:
zero = builder.makeInt8Constant(0);
one = builder.makeInt8Constant(1);
convOp = spv::OpSelect;
break;
case glslang::EOpConvBoolToUint8:
zero = builder.makeUint8Constant(0);
one = builder.makeUint8Constant(1);
convOp = spv::OpSelect;
break;
case glslang::EOpConvBoolToInt16:
zero = builder.makeInt16Constant(0);
one = builder.makeInt16Constant(1);
convOp = spv::OpSelect;
break;
case glslang::EOpConvBoolToUint16:
zero = builder.makeUint16Constant(0);
one = builder.makeUint16Constant(1);
convOp = spv::OpSelect;
break;
case glslang::EOpConvDoubleToFloat:
case glslang::EOpConvFloatToDouble:
case glslang::EOpConvDoubleToFloat16:
case glslang::EOpConvFloat16ToDouble:
case glslang::EOpConvFloatToFloat16:
case glslang::EOpConvFloat16ToFloat:
convOp = spv::OpFConvert;
if (builder.isMatrixType(destType))
return createUnaryMatrixOperation(convOp, decorations, destType, operand, typeProxy);
break;
case glslang::EOpConvInt8ToInt16:
case glslang::EOpConvInt8ToInt:
case glslang::EOpConvInt8ToInt64:
case glslang::EOpConvInt16ToInt8:
case glslang::EOpConvInt16ToInt:
case glslang::EOpConvInt16ToInt64:
case glslang::EOpConvIntToInt8:
case glslang::EOpConvIntToInt16:
case glslang::EOpConvIntToInt64:
case glslang::EOpConvInt64ToInt8:
case glslang::EOpConvInt64ToInt16:
case glslang::EOpConvInt64ToInt:
convOp = spv::OpSConvert;
break;
case glslang::EOpConvUint8ToUint16:
case glslang::EOpConvUint8ToUint:
case glslang::EOpConvUint8ToUint64:
case glslang::EOpConvUint16ToUint8:
case glslang::EOpConvUint16ToUint:
case glslang::EOpConvUint16ToUint64:
case glslang::EOpConvUintToUint8:
case glslang::EOpConvUintToUint16:
case glslang::EOpConvUintToUint64:
case glslang::EOpConvUint64ToUint8:
case glslang::EOpConvUint64ToUint16:
case glslang::EOpConvUint64ToUint:
convOp = spv::OpUConvert;
break;
case glslang::EOpConvInt8ToUint16:
case glslang::EOpConvInt8ToUint:
case glslang::EOpConvInt8ToUint64:
case glslang::EOpConvInt16ToUint8:
case glslang::EOpConvInt16ToUint:
case glslang::EOpConvInt16ToUint64:
case glslang::EOpConvIntToUint8:
case glslang::EOpConvIntToUint16:
case glslang::EOpConvIntToUint64:
case glslang::EOpConvInt64ToUint8:
case glslang::EOpConvInt64ToUint16:
case glslang::EOpConvInt64ToUint:
case glslang::EOpConvUint8ToInt16:
case glslang::EOpConvUint8ToInt:
case glslang::EOpConvUint8ToInt64:
case glslang::EOpConvUint16ToInt8:
case glslang::EOpConvUint16ToInt:
case glslang::EOpConvUint16ToInt64:
case glslang::EOpConvUintToInt8:
case glslang::EOpConvUintToInt16:
case glslang::EOpConvUintToInt64:
case glslang::EOpConvUint64ToInt8:
case glslang::EOpConvUint64ToInt16:
case glslang::EOpConvUint64ToInt:
// OpSConvert/OpUConvert + OpBitCast
operand = createIntWidthConversion(op, operand, vectorSize, destType);
if (builder.isInSpecConstCodeGenMode()) {
// Build zero scalar or vector for OpIAdd.
switch(op) {
case glslang::EOpConvInt16ToUint8:
case glslang::EOpConvIntToUint8:
case glslang::EOpConvInt64ToUint8:
case glslang::EOpConvUint16ToInt8:
case glslang::EOpConvUintToInt8:
case glslang::EOpConvUint64ToInt8:
zero = builder.makeUint8Constant(0);
break;
case glslang::EOpConvInt8ToUint16:
case glslang::EOpConvIntToUint16:
case glslang::EOpConvInt64ToUint16:
case glslang::EOpConvUint8ToInt16:
case glslang::EOpConvUintToInt16:
case glslang::EOpConvUint64ToInt16:
zero = builder.makeUint16Constant(0);
break;
case glslang::EOpConvInt8ToUint:
case glslang::EOpConvInt16ToUint:
case glslang::EOpConvInt64ToUint:
case glslang::EOpConvUint8ToInt:
case glslang::EOpConvUint16ToInt:
case glslang::EOpConvUint64ToInt:
zero = builder.makeUintConstant(0);
break;
case glslang::EOpConvInt8ToUint64:
case glslang::EOpConvInt16ToUint64:
case glslang::EOpConvIntToUint64:
case glslang::EOpConvUint8ToInt64:
case glslang::EOpConvUint16ToInt64:
case glslang::EOpConvUintToInt64:
zero = builder.makeUint64Constant(0);
break;
default:
assert(false && "Default missing");
break;
if (operandBasicType == glslang::EbtBool) {
uint32_t bits = GetNumBits(resultBasicType);
convOp = spv::OpSelect;
if (isTypeInt(resultBasicType)) {
spv::Id zeroType = isTypeSignedInt(resultBasicType) ? builder.makeIntType(bits) : builder.makeUintType(bits);
if (bits == 64) {
zero = builder.makeInt64Constant(zeroType, 0, false);
one = builder.makeInt64Constant(zeroType, 1, false);
} else {
zero = builder.makeIntConstant(zeroType, 0, false);
one = builder.makeIntConstant(zeroType, 1, false);
}
} else {
assert(isTypeFloat(resultBasicType));
if (bits == 64) {
zero = builder.makeDoubleConstant(0.0);
one = builder.makeDoubleConstant(1.0);
} else if (bits == 32) {
zero = builder.makeFloatConstant(0.0);
one = builder.makeFloatConstant(1.0);
} else {
assert(bits == 16);
zero = builder.makeFloat16Constant(0.0);
one = builder.makeFloat16Constant(1.0);
}
}
zero = makeSmearedConstant(zero, vectorSize);
// Use OpIAdd, instead of OpBitcast to do the conversion when
// generating for OpSpecConstantOp instruction.
return builder.createBinOp(spv::OpIAdd, destType, operand, zero);
}
// For normal run-time conversion instruction, use OpBitcast.
convOp = spv::OpBitcast;
break;
case glslang::EOpConvUint64ToPtr:
convOp = spv::OpConvertUToPtr;
break;
case glslang::EOpConvPtrToUint64:
convOp = spv::OpConvertPtrToU;
break;
case glslang::EOpConvPtrToUvec2:
case glslang::EOpConvUvec2ToPtr:
convOp = spv::OpBitcast;
break;
}
default:
break;
if (convOp == spv::OpNop) {
switch (op) {
case glslang::EOpConvUint64ToPtr:
convOp = spv::OpConvertUToPtr;
break;
case glslang::EOpConvPtrToUint64:
convOp = spv::OpConvertPtrToU;
break;
case glslang::EOpConvPtrToUvec2:
case glslang::EOpConvUvec2ToPtr:
convOp = spv::OpBitcast;
break;
default:
break;
}
}
spv::Id result = 0;
@@ -8805,7 +8739,13 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
builder.promoteScalar(precision, operands.front(), operands.back());
break;
case glslang::EOpModf:
libCall = spv::GLSLstd450Modf;
{
libCall = spv::GLSLstd450ModfStruct;
assert(builder.isFloatType(builder.getScalarTypeId(typeId0)));
// The returned struct has two members of the same type as the first argument
typeId = builder.makeStructResultType(typeId0, typeId0);
consumedOperands = 1;
}
break;
case glslang::EOpMax:
if (isFloat)
@@ -9373,6 +9313,34 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
addImageProcessing2QCOMDecoration(operands[0], true);
addImageProcessing2QCOMDecoration(operands[2], true);
break;
case glslang::EOpCreateTensorLayoutNV:
return builder.createOp(spv::OpCreateTensorLayoutNV, typeId, std::vector<spv::Id>{});
case glslang::EOpCreateTensorViewNV:
return builder.createOp(spv::OpCreateTensorViewNV, typeId, std::vector<spv::Id>{});
case glslang::EOpTensorLayoutSetBlockSizeNV:
opCode = spv::OpTensorLayoutSetBlockSizeNV;
break;
case glslang::EOpTensorLayoutSetDimensionNV:
opCode = spv::OpTensorLayoutSetDimensionNV;
break;
case glslang::EOpTensorLayoutSetStrideNV:
opCode = spv::OpTensorLayoutSetStrideNV;
break;
case glslang::EOpTensorLayoutSliceNV:
opCode = spv::OpTensorLayoutSliceNV;
break;
case glslang::EOpTensorLayoutSetClampValueNV:
opCode = spv::OpTensorLayoutSetClampValueNV;
break;
case glslang::EOpTensorViewSetDimensionNV:
opCode = spv::OpTensorViewSetDimensionNV;
break;
case glslang::EOpTensorViewSetStrideNV:
opCode = spv::OpTensorViewSetStrideNV;
break;
case glslang::EOpTensorViewSetClipNV:
opCode = spv::OpTensorViewSetClipNV;
break;
default:
return 0;
}
@@ -9428,6 +9396,13 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
builder.createStore(builder.createCompositeExtract(id, typeId0, 0), operands[3]);
builder.createStore(builder.createCompositeExtract(id, typeId0, 1), operands[2]);
break;
case glslang::EOpModf:
{
assert(operands.size() == 2);
builder.createStore(builder.createCompositeExtract(id, typeId0, 1), operands[1]);
id = builder.createCompositeExtract(id, typeId0, 0);
}
break;
case glslang::EOpFrexp:
{
assert(operands.size() == 2);
@@ -9672,6 +9647,10 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
}
}
if (symbol->getBasicType() == glslang::EbtFunction) {
return 0;
}
id = createSpvVariable(symbol, forcedType.first);
if (mayNeedToReuseBuiltIn) {
@@ -10228,12 +10207,13 @@ bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
return false;
}
if (IsOpNumericConv(node->getAsOperator()->getOp()) &&
node->getType().getBasicType() == glslang::EbtBool) {
return true;
}
switch (node->getAsOperator()->getOp()) {
case glslang::EOpLogicalNot:
case glslang::EOpConvIntToBool:
case glslang::EOpConvUintToBool:
case glslang::EOpConvFloatToBool:
case glslang::EOpConvDoubleToBool:
case glslang::EOpEqual:
case glslang::EOpNotEqual:
case glslang::EOpLessThan:

View File

@@ -650,6 +650,40 @@ namespace spv {
case spv::OperandExecutionMode:
return nextInst;
case spv::OperandMemoryAccess:
{
uint32_t mask = spv[word];
if (mask & uint32_t(spv::MemoryAccessMask::MemoryAccessAlignedMask)) {
++word;
--numOperands;
}
if (mask & uint32_t(spv::MemoryAccessMask::MemoryAccessMakePointerAvailableMask |
spv::MemoryAccessMask::MemoryAccessMakePointerVisibleMask)) {
idFn(asId(word+1));
++word;
--numOperands;
}
++word;
}
break;
case spv::OperandTensorAddressingOperands:
{
uint32_t mask = spv[word];
if (mask & uint32_t(spv::TensorAddressingOperandsMask::TensorAddressingOperandsTensorViewMask)) {
idFn(asId(word+1));
++word;
--numOperands;
}
if (mask & uint32_t(spv::TensorAddressingOperandsMask::TensorAddressingOperandsDecodeFuncMask)) {
idFn(asId(word+1));
++word;
--numOperands;
}
++word;
}
break;
// Single word operands we simply ignore, as they hold no IDs
case spv::OperandLiteralNumber:
case spv::OperandSource:
@@ -674,7 +708,6 @@ namespace spv {
case spv::OperandSelect:
case spv::OperandLoop:
case spv::OperandFunction:
case spv::OperandMemoryAccess:
case spv::OperandGroupOperation:
case spv::OperandKernelEnqueueFlags:
case spv::OperandKernelProfilingInfo:

View File

@@ -3466,6 +3466,41 @@ Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constitue
return op->getResultId();
}
// coopmat conversion
Id Builder::createCooperativeMatrixConversion(Id typeId, Id source)
{
Instruction* op = new Instruction(getUniqueId(), typeId, OpCooperativeMatrixConvertNV);
op->addIdOperand(source);
addInstruction(std::unique_ptr<Instruction>(op));
return op->getResultId();
}
// coopmat reduce
Id Builder::createCooperativeMatrixReduce(Op opcode, Id typeId, Id source, unsigned int mask, Id func)
{
Instruction* op = new Instruction(getUniqueId(), typeId, opcode);
op->addIdOperand(source);
op->addImmediateOperand(mask);
op->addIdOperand(func);
addInstruction(std::unique_ptr<Instruction>(op));
return op->getResultId();
}
// coopmat per-element operation
Id Builder::createCooperativeMatrixPerElementOp(Id typeId, const std::vector<Id>& operands)
{
Instruction* op = new Instruction(getUniqueId(), typeId, spv::OpCooperativeMatrixPerElementOpNV);
// skip operand[0], which is where the result is stored
for (uint32_t i = 1; i < operands.size(); ++i) {
op->addIdOperand(operands[i]);
}
addInstruction(std::unique_ptr<Instruction>(op));
return op->getResultId();
}
// Vector or scalar constructor
Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId)
{

View File

@@ -288,6 +288,7 @@ public:
bool isCooperativeMatrix(Id resultId)const { return isCooperativeMatrixType(getTypeId(resultId)); }
bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); }
bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
bool isTensorView(Id resultId)const { return isTensorViewType(getTypeId(resultId)); }
bool isBoolType(Id typeId)
{ return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
@@ -308,6 +309,7 @@ public:
{
return getTypeClass(typeId) == OpTypeCooperativeMatrixKHR || getTypeClass(typeId) == OpTypeCooperativeMatrixNV;
}
bool isTensorViewType(Id typeId) const { return getTypeClass(typeId) == OpTypeTensorViewNV; }
bool isAggregateType(Id typeId) const
{ return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
@@ -372,6 +374,8 @@ public:
// For making new constants (will return old constant if the requested one was already made).
Id makeNullConstant(Id typeId);
Id makeBoolConstant(bool b, bool specConstant = false);
Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant);
Id makeInt8Constant(int i, bool specConstant = false)
{ return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
Id makeUint8Constant(unsigned u, bool specConstant = false)
@@ -609,6 +613,11 @@ public:
// matrix constructor
Id createMatrixConstructor(Decoration precision, const std::vector<Id>& sources, Id constructee);
// coopmat conversion
Id createCooperativeMatrixConversion(Id typeId, Id source);
Id createCooperativeMatrixReduce(Op opcode, Id typeId, Id source, unsigned int mask, Id func);
Id createCooperativeMatrixPerElementOp(Id typeId, const std::vector<Id>& operands);
// Helper to use for building nested control flow with if-then-else.
class If {
public:
@@ -887,8 +896,6 @@ public:
void setUseReplicatedComposites(bool use) { useReplicatedComposites = use; }
protected:
Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant);
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value);
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2);
Id findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps);

View File

@@ -71,6 +71,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
return spv_target_env::SPV_ENV_VULKAN_1_2;
case glslang::EShTargetVulkan_1_3:
return spv_target_env::SPV_ENV_VULKAN_1_3;
case glslang::EShTargetVulkan_1_4:
return spv_target_env::SPV_ENV_VULKAN_1_4;
default:
break;
}

View File

@@ -36,6 +36,7 @@
// Disassembler for SPIR-V.
//
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <cassert>
@@ -338,6 +339,18 @@ int SpirvStream::disassembleString()
return decoderes.first;
}
static uint32_t popcount(uint32_t mask)
{
uint32_t count = 0;
while (mask) {
if (mask & 1) {
count++;
}
mask >>= 1;
}
return count;
}
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
{
// Process the opcode
@@ -552,18 +565,41 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
numOperands -= disassembleString();
return;
case OperandMemoryAccess:
outputMask(OperandMemoryAccess, stream[word++]);
--numOperands;
// Aligned is the only memory access operand that uses an immediate
// value, and it is also the first operand that uses a value at all.
if (stream[word-1] & MemoryAccessAlignedMask) {
disassembleImmediates(1);
numOperands--;
if (numOperands)
{
outputMask(OperandMemoryAccess, stream[word++]);
--numOperands;
// Put a space after "None" if there are any remaining operands
if (numOperands && stream[word-1] == 0) {
out << " ";
}
uint32_t mask = stream[word-1];
// Aligned is the only memory access operand that uses an immediate
// value, and it is also the first operand that uses a value at all.
if (mask & MemoryAccessAlignedMask) {
disassembleImmediates(1);
numOperands--;
if (numOperands)
out << " ";
}
uint32_t bitCount = popcount(mask & (MemoryAccessMakePointerAvailableMask | MemoryAccessMakePointerVisibleMask));
disassembleIds(bitCount);
numOperands -= bitCount;
}
disassembleIds(numOperands);
return;
break;
case OperandTensorAddressingOperands:
{
outputMask(OperandTensorAddressingOperands, stream[word++]);
--numOperands;
// Put a space after "None" if there are any remaining operands
if (numOperands && stream[word-1] == 0) {
out << " ";
}
uint32_t bitCount = popcount(stream[word-1]);
disassembleIds(bitCount);
numOperands -= bitCount;
}
break;
default:
assert(operandClass >= OperandSource && operandClass < OperandOpcode);

View File

@@ -818,6 +818,18 @@ const char* CooperativeMatrixOperandsString(int op)
}
}
const int TensorAddressingOperandsCeiling = 3;
const char* TensorAddressingOperandsString(int op)
{
switch (op) {
case TensorAddressingOperandsTensorViewShift: return "TensorView";
case TensorAddressingOperandsDecodeFuncShift: return "DecodeFunc";
default: return "Bad";
}
}
const char* ScopeString(int mem)
{
switch (mem) {
@@ -1025,6 +1037,13 @@ const char* CapabilityString(int info)
case CapabilityCooperativeMatrixNV: return "CooperativeMatrixNV";
case CapabilityCooperativeMatrixKHR: return "CooperativeMatrixKHR";
case CapabilityCooperativeMatrixReductionsNV: return "CooperativeMatrixReductionsNV";
case CapabilityCooperativeMatrixConversionsNV: return "CooperativeMatrixConversionsNV";
case CapabilityCooperativeMatrixPerElementOperationsNV: return "CooperativeMatrixPerElementOperationsNV";
case CapabilityCooperativeMatrixTensorAddressingNV: return "CooperativeMatrixTensorAddressingNV";
case CapabilityCooperativeMatrixBlockLoadsNV: return "CooperativeMatrixBlockLoadsNV";
case CapabilityTensorAddressingNV: return "TensorAddressingNV";
case CapabilityShaderSMBuiltinsNV: return "ShaderSMBuiltinsNV";
case CapabilityFragmentShaderSampleInterlockEXT: return "CapabilityFragmentShaderSampleInterlockEXT";
@@ -1536,6 +1555,25 @@ const char* OpcodeString(int op)
case OpDemoteToHelperInvocationEXT: return "OpDemoteToHelperInvocationEXT";
case OpIsHelperInvocationEXT: return "OpIsHelperInvocationEXT";
case OpCooperativeMatrixConvertNV: return "OpCooperativeMatrixConvertNV";
case OpCooperativeMatrixTransposeNV: return "OpCooperativeMatrixTransposeNV";
case OpCooperativeMatrixReduceNV: return "OpCooperativeMatrixReduceNV";
case OpCooperativeMatrixLoadTensorNV: return "OpCooperativeMatrixLoadTensorNV";
case OpCooperativeMatrixStoreTensorNV: return "OpCooperativeMatrixStoreTensorNV";
case OpCooperativeMatrixPerElementOpNV: return "OpCooperativeMatrixPerElementOpNV";
case OpTypeTensorLayoutNV: return "OpTypeTensorLayoutNV";
case OpTypeTensorViewNV: return "OpTypeTensorViewNV";
case OpCreateTensorLayoutNV: return "OpCreateTensorLayoutNV";
case OpTensorLayoutSetBlockSizeNV: return "OpTensorLayoutSetBlockSizeNV";
case OpTensorLayoutSetDimensionNV: return "OpTensorLayoutSetDimensionNV";
case OpTensorLayoutSetStrideNV: return "OpTensorLayoutSetStrideNV";
case OpTensorLayoutSliceNV: return "OpTensorLayoutSliceNV";
case OpTensorLayoutSetClampValueNV: return "OpTensorLayoutSetClampValueNV";
case OpCreateTensorViewNV: return "OpCreateTensorViewNV";
case OpTensorViewSetDimensionNV: return "OpTensorViewSetDimensionNV";
case OpTensorViewSetStrideNV: return "OpTensorViewSetStrideNV";
case OpTensorViewSetClipNV: return "OpTensorViewSetClipNV";
case OpBeginInvocationInterlockEXT: return "OpBeginInvocationInterlockEXT";
case OpEndInvocationInterlockEXT: return "OpEndInvocationInterlockEXT";
@@ -1613,6 +1651,7 @@ EnumParameters SelectionControlParams[SelectControlCeiling];
EnumParameters FunctionControlParams[FunctionControlCeiling];
EnumParameters MemoryAccessParams[MemoryAccessCeiling];
EnumParameters CooperativeMatrixOperandsParams[CooperativeMatrixOperandsCeiling];
EnumParameters TensorAddressingOperandsParams[TensorAddressingOperandsCeiling];
// Set up all the parameterizing descriptions of the opcodes, operands, etc.
void Parameterize()
@@ -1712,6 +1751,9 @@ void Parameterize()
InstructionDesc[OpBeginInvocationInterlockEXT].setResultAndType(false, false);
InstructionDesc[OpEndInvocationInterlockEXT].setResultAndType(false, false);
InstructionDesc[OpAssumeTrueKHR].setResultAndType(false, false);
InstructionDesc[OpTypeTensorLayoutNV].setResultAndType(true, false);
InstructionDesc[OpTypeTensorViewNV].setResultAndType(true, false);
InstructionDesc[OpCooperativeMatrixStoreTensorNV].setResultAndType(false, false);
// Specific additional context-dependent operands
ExecutionModeOperands[ExecutionModeInvocations].push(OperandLiteralNumber, "'Number of <<Invocation,invocations>>'");
@@ -1781,6 +1823,7 @@ void Parameterize()
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true);
OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr);
OperandClassParams[OperandCooperativeMatrixOperands].set(CooperativeMatrixOperandsCeiling, CooperativeMatrixOperandsString, CooperativeMatrixOperandsParams, true);
OperandClassParams[OperandTensorAddressingOperands].set(TensorAddressingOperandsCeiling, TensorAddressingOperandsString, TensorAddressingOperandsParams, true);
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, nullptr);
// set name of operator, an initial set of <id> style operands, and the description
@@ -3488,6 +3531,67 @@ void Parameterize()
InstructionDesc[OpConstantCompositeReplicateEXT].operands.push(OperandId, "'Value'");
InstructionDesc[OpSpecConstantCompositeReplicateEXT].operands.push(OperandId, "'Value'");
InstructionDesc[OpCompositeConstructReplicateEXT].operands.push(OperandId, "'Value'");
InstructionDesc[OpCooperativeMatrixConvertNV].operands.push(OperandId, "'Value'");
InstructionDesc[OpCooperativeMatrixTransposeNV].operands.push(OperandId, "'Matrix'");
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandId, "'Matrix'");
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandLiteralNumber, "'ReduceMask'");
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandId, "'CombineFunc'");
InstructionDesc[OpCooperativeMatrixPerElementOpNV].operands.push(OperandId, "'Matrix'");
InstructionDesc[OpCooperativeMatrixPerElementOpNV].operands.push(OperandId, "'Operation'");
InstructionDesc[OpCooperativeMatrixPerElementOpNV].operands.push(OperandVariableIds, "'Operands'");
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandId, "'Pointer'");
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandId, "'Object'");
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandMemoryAccess, "'Memory Access'");
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandTensorAddressingOperands, "'Tensor Addressing Operands'");
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandId, "'Pointer'");
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandId, "'Object'");
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandMemoryAccess, "'Memory Access'");
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandTensorAddressingOperands, "'Tensor Addressing Operands'");
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandId, "'Matrix'");
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandLiteralNumber, "'ReduceMask'");
InstructionDesc[OpTypeTensorLayoutNV].operands.push(OperandId, "'Dim'");
InstructionDesc[OpTypeTensorLayoutNV].operands.push(OperandId, "'ClampMode'");
InstructionDesc[OpTypeTensorViewNV].operands.push(OperandId, "'Dim'");
InstructionDesc[OpTypeTensorViewNV].operands.push(OperandId, "'HasDimensions'");
InstructionDesc[OpTypeTensorViewNV].operands.push(OperandVariableIds, "'p'");
InstructionDesc[OpTensorLayoutSetBlockSizeNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpTensorLayoutSetBlockSizeNV].operands.push(OperandVariableIds, "'BlockSize'");
InstructionDesc[OpTensorLayoutSetDimensionNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpTensorLayoutSetDimensionNV].operands.push(OperandVariableIds, "'Dim'");
InstructionDesc[OpTensorLayoutSetStrideNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpTensorLayoutSetStrideNV].operands.push(OperandVariableIds, "'Stride'");
InstructionDesc[OpTensorLayoutSliceNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpTensorLayoutSliceNV].operands.push(OperandVariableIds, "'Operands'");
InstructionDesc[OpTensorLayoutSetClampValueNV].operands.push(OperandId, "'TensorLayout'");
InstructionDesc[OpTensorLayoutSetClampValueNV].operands.push(OperandId, "'Value'");
InstructionDesc[OpTensorViewSetDimensionNV].operands.push(OperandId, "'TensorView'");
InstructionDesc[OpTensorViewSetDimensionNV].operands.push(OperandVariableIds, "'Dim'");
InstructionDesc[OpTensorViewSetStrideNV].operands.push(OperandId, "'TensorView'");
InstructionDesc[OpTensorViewSetStrideNV].operands.push(OperandVariableIds, "'Stride'");
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'TensorView'");
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipRowOffset'");
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipRowSpan'");
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipColOffset'");
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipColSpan'");
});
}

View File

@@ -157,6 +157,7 @@ enum OperandClass {
OperandKernelProfilingInfo,
OperandCapability,
OperandCooperativeMatrixOperands,
OperandTensorAddressingOperands,
OperandOpcode,

File diff suppressed because it is too large Load Diff

View File

@@ -842,6 +842,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else if (strcmp(argv[1], "vulkan1.3") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_3;
} else if (strcmp(argv[1], "vulkan1.4") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_4;
} else if (strcmp(argv[1], "opengl") == 0) {
setOpenGlSpv();
ClientVersion = glslang::EShTargetOpenGL_450;
@@ -1121,6 +1124,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_6;
break;
case glslang::EShTargetVulkan_1_4:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_6;
break;
case glslang::EShTargetOpenGL_450:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_0;

View File

@@ -35,7 +35,7 @@
#define GLSLANG_BUILD_INFO
#define GLSLANG_VERSION_MAJOR 15
#define GLSLANG_VERSION_MINOR 0
#define GLSLANG_VERSION_MINOR 1
#define GLSLANG_VERSION_PATCH 0
#define GLSLANG_VERSION_FLAVOR ""

View File

@@ -270,6 +270,8 @@ static glslang::EShTargetClientVersion c_shader_client_version(glslang_target_cl
return glslang::EShTargetVulkan_1_2;
case GLSLANG_TARGET_VULKAN_1_3:
return glslang::EShTargetVulkan_1_3;
case GLSLANG_TARGET_VULKAN_1_4:
return glslang::EShTargetVulkan_1_4;
case GLSLANG_TARGET_OPENGL_450:
return glslang::EShTargetOpenGL_450;
default:

View File

@@ -1396,7 +1396,7 @@ TIntermTyped* HlslParseContext::flattenAccess(long long uniqueId, int member, TS
// If this is not the final flattening, accumulate the position and return
// an object of the partially dereferenced type.
subsetSymbol = new TIntermSymbol(uniqueId, "flattenShadow", dereferencedType);
subsetSymbol = new TIntermSymbol(uniqueId, "flattenShadow", getLanguage(), dereferencedType);
subsetSymbol->setFlattenSubset(newSubset);
}
@@ -5806,6 +5806,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
internalAggregate->getWritableType().getQualifier().makeTemporary();
TIntermSymbol* internalSymbolNode = new TIntermSymbol(internalAggregate->getUniqueId(),
internalAggregate->getName(),
getLanguage(),
internalAggregate->getType());
internalSymbolNode->setLoc(arg->getLoc());
// This makes the deepest level, the member-wise copy

View File

@@ -67,6 +67,9 @@ enum TBasicType {
EbtRayQuery,
EbtHitObjectNV,
EbtCoopmat,
EbtFunction,
EbtTensorLayoutNV,
EbtTensorViewNV,
// SPIR-V type defined by spirv_type
EbtSpirvType,
@@ -588,6 +591,30 @@ __inline bool isTypeFloat(TBasicType type)
}
}
__inline uint32_t GetNumBits(TBasicType type)
{
switch (type) {
case EbtInt8:
case EbtUint8:
return 8;
case EbtFloat16:
case EbtInt16:
case EbtUint16:
return 16;
case EbtInt:
case EbtUint:
case EbtFloat:
return 32;
case EbtDouble:
case EbtInt64:
case EbtUint64:
return 64;
default:
assert(false);
return 0;
}
}
__inline int getTypeRank(TBasicType type)
{
int res = -1;

View File

@@ -1471,6 +1471,9 @@ public:
bool isCoopmatNV() const { return coopmatNV; }
bool isCoopmatKHR() const { return coopmatKHR; }
bool isTensorLayoutNV() const { return basicType == EbtTensorLayoutNV; }
bool isTensorViewNV() const { return basicType == EbtTensorViewNV; }
void initType(const TSourceLoc& l)
{
basicType = EbtVoid;
@@ -1625,7 +1628,6 @@ public:
assert(dimSize >= 0);
coopmatKHRuse = static_cast<uint32_t>(dimSize) & 0b111;
coopmatKHRUseValid = true;
p.typeParameters->arraySizes->removeLastSize();
}
}
}
@@ -1881,6 +1883,9 @@ public:
bool isSpirvType() const { return getBasicType() == EbtSpirvType; }
int getCoopMatKHRuse() const { return static_cast<int>(coopmatKHRuse); }
bool isTensorLayoutNV() const { return getBasicType() == EbtTensorLayoutNV; }
bool isTensorViewNV() const { return getBasicType() == EbtTensorViewNV; }
// return true if this type contains any subtype which satisfies the given predicate.
template <typename P>
bool contains(P predicate) const
@@ -2106,6 +2111,8 @@ public:
case EbtString: return "string";
case EbtSpirvType: return "spirv_type";
case EbtCoopmat: return "coopmat";
case EbtTensorLayoutNV: return "tensorLayoutNV";
case EbtTensorViewNV: return "tensorViewNV";
default: return "unknown type";
}
}
@@ -2416,6 +2423,14 @@ public:
appendStr(" ");
appendStr("coopmat");
}
if (isTensorLayoutNV()) {
appendStr(" ");
appendStr("tensorLayoutNV");
}
if (isTensorViewNV()) {
appendStr(" ");
appendStr("tensorViewNV");
}
appendStr("<");
for (int i = 0; i < (int)typeParameters->arraySizes->getNumDims(); ++i) {
@@ -2423,10 +2438,6 @@ public:
if (i != (int)typeParameters->arraySizes->getNumDims() - 1)
appendStr(", ");
}
if (coopmatKHRUseValid) {
appendStr(", ");
appendInt(coopmatKHRuse);
}
appendStr(">");
}
if (getPrecision && qualifier.precision != EpqNone) {
@@ -2752,24 +2763,44 @@ public:
return rv;
}
bool tensorParameterOK(const TType& right) const
{
if (isTensorLayoutNV()) {
return right.isTensorLayoutNV() && right.typeParameters == nullptr && typeParameters != nullptr;
}
if (isTensorViewNV()) {
return right.isTensorViewNV() && right.typeParameters == nullptr && typeParameters != nullptr;
}
return false;
}
bool sameCoopMatUse(const TType &right) const {
return coopmatKHRuse == right.coopmatKHRuse;
}
bool sameCoopMatShapeAndUse(const TType &right) const
bool sameCoopMatShape(const TType &right) const
{
if (!isCoopMat() || !right.isCoopMat() || isCoopMatKHR() != right.isCoopMatKHR())
return false;
// Skip bit width type parameter (first array size) for coopmatNV
int firstArrayDimToCompare = isCoopMatNV() ? 1 : 0;
int lastArrayDimToCompare = typeParameters->arraySizes->getNumDims() - (isCoopMatKHR() ? 1 : 0);
for (int i = firstArrayDimToCompare; i < lastArrayDimToCompare; ++i) {
if (typeParameters->arraySizes->getDimSize(i) != right.typeParameters->arraySizes->getDimSize(i))
return false;
}
return true;
}
bool sameCoopMatShapeAndUse(const TType &right) const
{
if (!sameCoopMatShape(right))
return false;
if (coopmatKHRuse != right.coopmatKHRuse)
return false;
// Skip bit width type parameter (first array size) for coopmatNV
int firstArrayDimToCompare = isCoopMatNV() ? 1 : 0;
for (int i = firstArrayDimToCompare; i < typeParameters->arraySizes->getNumDims(); ++i) {
if (typeParameters->arraySizes->getDimSize(i) != right.typeParameters->arraySizes->getDimSize(i))
return false;
}
return true;
}
@@ -2827,7 +2858,9 @@ protected:
typeParameters = new TTypeParameters;
typeParameters->arraySizes = new TArraySizes;
*typeParameters->arraySizes = *copyOf.typeParameters->arraySizes;
*typeParameters->spirvType = *copyOf.typeParameters->spirvType;
if (copyOf.typeParameters->spirvType) {
*typeParameters->spirvType = *copyOf.typeParameters->spirvType;
}
typeParameters->basicType = copyOf.basicType;
}

View File

@@ -118,8 +118,9 @@ typedef enum {
GLSLANG_TARGET_VULKAN_1_1 = (1 << 22) | (1 << 12),
GLSLANG_TARGET_VULKAN_1_2 = (1 << 22) | (2 << 12),
GLSLANG_TARGET_VULKAN_1_3 = (1 << 22) | (3 << 12),
GLSLANG_TARGET_VULKAN_1_4 = (1 << 22) | (4 << 12),
GLSLANG_TARGET_OPENGL_450 = 450,
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 5),
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 6),
} glslang_target_client_version_t;
/* SH_TARGET_LanguageVersion counterpart */

View File

@@ -87,189 +87,9 @@ enum TOperator {
EOpDeclare, // Used by debugging to force declaration of variable in correct scope
// (u)int* -> bool
EOpConvInt8ToBool,
EOpConvUint8ToBool,
EOpConvInt16ToBool,
EOpConvUint16ToBool,
EOpConvIntToBool,
EOpConvUintToBool,
EOpConvInt64ToBool,
EOpConvUint64ToBool,
// float* -> bool
EOpConvFloat16ToBool,
EOpConvFloatToBool,
EOpConvDoubleToBool,
// bool -> (u)int*
EOpConvBoolToInt8,
EOpConvBoolToUint8,
EOpConvBoolToInt16,
EOpConvBoolToUint16,
EOpConvBoolToInt,
EOpConvBoolToUint,
EOpConvBoolToInt64,
EOpConvBoolToUint64,
// bool -> float*
EOpConvBoolToFloat16,
EOpConvBoolToFloat,
EOpConvBoolToDouble,
// int8_t -> (u)int*
EOpConvInt8ToInt16,
EOpConvInt8ToInt,
EOpConvInt8ToInt64,
EOpConvInt8ToUint8,
EOpConvInt8ToUint16,
EOpConvInt8ToUint,
EOpConvInt8ToUint64,
// uint8_t -> (u)int*
EOpConvUint8ToInt8,
EOpConvUint8ToInt16,
EOpConvUint8ToInt,
EOpConvUint8ToInt64,
EOpConvUint8ToUint16,
EOpConvUint8ToUint,
EOpConvUint8ToUint64,
// int8_t -> float*
EOpConvInt8ToFloat16,
EOpConvInt8ToFloat,
EOpConvInt8ToDouble,
// uint8_t -> float*
EOpConvUint8ToFloat16,
EOpConvUint8ToFloat,
EOpConvUint8ToDouble,
// int16_t -> (u)int*
EOpConvInt16ToInt8,
EOpConvInt16ToInt,
EOpConvInt16ToInt64,
EOpConvInt16ToUint8,
EOpConvInt16ToUint16,
EOpConvInt16ToUint,
EOpConvInt16ToUint64,
// uint16_t -> (u)int*
EOpConvUint16ToInt8,
EOpConvUint16ToInt16,
EOpConvUint16ToInt,
EOpConvUint16ToInt64,
EOpConvUint16ToUint8,
EOpConvUint16ToUint,
EOpConvUint16ToUint64,
// int16_t -> float*
EOpConvInt16ToFloat16,
EOpConvInt16ToFloat,
EOpConvInt16ToDouble,
// uint16_t -> float*
EOpConvUint16ToFloat16,
EOpConvUint16ToFloat,
EOpConvUint16ToDouble,
// int32_t -> (u)int*
EOpConvIntToInt8,
EOpConvIntToInt16,
EOpConvIntToInt64,
EOpConvIntToUint8,
EOpConvIntToUint16,
EOpConvIntToUint,
EOpConvIntToUint64,
// uint32_t -> (u)int*
EOpConvUintToInt8,
EOpConvUintToInt16,
EOpConvUintToInt,
EOpConvUintToInt64,
EOpConvUintToUint8,
EOpConvUintToUint16,
EOpConvUintToUint64,
// int32_t -> float*
EOpConvIntToFloat16,
EOpConvIntToFloat,
EOpConvIntToDouble,
// uint32_t -> float*
EOpConvUintToFloat16,
EOpConvUintToFloat,
EOpConvUintToDouble,
// int64_t -> (u)int*
EOpConvInt64ToInt8,
EOpConvInt64ToInt16,
EOpConvInt64ToInt,
EOpConvInt64ToUint8,
EOpConvInt64ToUint16,
EOpConvInt64ToUint,
EOpConvInt64ToUint64,
// uint64_t -> (u)int*
EOpConvUint64ToInt8,
EOpConvUint64ToInt16,
EOpConvUint64ToInt,
EOpConvUint64ToInt64,
EOpConvUint64ToUint8,
EOpConvUint64ToUint16,
EOpConvUint64ToUint,
// int64_t -> float*
EOpConvInt64ToFloat16,
EOpConvInt64ToFloat,
EOpConvInt64ToDouble,
// uint64_t -> float*
EOpConvUint64ToFloat16,
EOpConvUint64ToFloat,
EOpConvUint64ToDouble,
// float16_t -> (u)int*
EOpConvFloat16ToInt8,
EOpConvFloat16ToInt16,
EOpConvFloat16ToInt,
EOpConvFloat16ToInt64,
EOpConvFloat16ToUint8,
EOpConvFloat16ToUint16,
EOpConvFloat16ToUint,
EOpConvFloat16ToUint64,
// float16_t -> float*
EOpConvFloat16ToFloat,
EOpConvFloat16ToDouble,
// float -> (u)int*
EOpConvFloatToInt8,
EOpConvFloatToInt16,
EOpConvFloatToInt,
EOpConvFloatToInt64,
EOpConvFloatToUint8,
EOpConvFloatToUint16,
EOpConvFloatToUint,
EOpConvFloatToUint64,
// float -> float*
EOpConvFloatToFloat16,
EOpConvFloatToDouble,
// float64 _t-> (u)int*
EOpConvDoubleToInt8,
EOpConvDoubleToInt16,
EOpConvDoubleToInt,
EOpConvDoubleToInt64,
EOpConvDoubleToUint8,
EOpConvDoubleToUint16,
EOpConvDoubleToUint,
EOpConvDoubleToUint64,
// float64_t -> float*
EOpConvDoubleToFloat16,
EOpConvDoubleToFloat,
// Operator used to represent all conversions between int, float, and bool.
// The specific types are inferred from TBasicType.
EOpConvNumeric,
// uint64_t <-> pointer
EOpConvUint64ToPtr,
@@ -628,7 +448,24 @@ enum TOperator {
EOpCooperativeMatrixMulAdd,
EOpCooperativeMatrixLoadNV,
EOpCooperativeMatrixStoreNV,
EOpCooperativeMatrixLoadTensorNV,
EOpCooperativeMatrixStoreTensorNV,
EOpCooperativeMatrixMulAddNV,
EOpCooperativeMatrixReduceNV,
EOpCooperativeMatrixPerElementOpNV,
EOpCooperativeMatrixTransposeNV,
EOpCreateTensorLayoutNV,
EOpTensorLayoutSetBlockSizeNV,
EOpTensorLayoutSetDimensionNV,
EOpTensorLayoutSetStrideNV,
EOpTensorLayoutSliceNV,
EOpTensorLayoutSetClampValueNV,
EOpCreateTensorViewNV,
EOpTensorViewSetDimensionNV,
EOpTensorViewSetStrideNV,
EOpTensorViewSetClipNV,
EOpBeginInvocationInterlock, // Fragment only
EOpEndInvocationInterlock, // Fragment only
@@ -1119,6 +956,10 @@ enum TOperator {
EOpImageBlockMatchGatherSADQCOM,
};
inline bool IsOpNumericConv(const TOperator op) {
return op == EOpConvNumeric;
}
enum TLinkType {
ELinkNone,
ELinkExport,
@@ -1356,11 +1197,19 @@ public:
// if symbol is initialized as symbol(sym), the memory comes from the pool allocator of sym. If sym comes from
// per process threadPoolAllocator, then it causes increased memory usage per compile
// it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(long long i, const TString& n, const TType& t)
: TIntermTyped(t), id(i), flattenSubset(-1), constSubtree(nullptr) { name = n; }
TIntermSymbol(long long i, const TString& n, EShLanguage s, const TType& t, const TString* mn = nullptr)
: TIntermTyped(t), id(i), flattenSubset(-1), stage(s), constSubtree(nullptr) {
name = n;
if (mn) {
mangledName = *mn;
} else {
mangledName = n;
}
}
virtual long long getId() const { return id; }
virtual void changeId(long long i) { id = i; }
virtual const TString& getName() const { return name; }
virtual const TString& getMangledName() const { return mangledName; }
virtual void traverse(TIntermTraverser*);
virtual TIntermSymbol* getAsSymbolNode() { return this; }
virtual const TIntermSymbol* getAsSymbolNode() const { return this; }
@@ -1376,11 +1225,14 @@ public:
// This is meant for cases where a node has already been constructed, and
// later on, it becomes necessary to switch to a different symbol.
virtual void switchId(long long newId) { id = newId; }
EShLanguage getStage() const { return stage; }
protected:
long long id; // the unique id of the symbol this node represents
int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced
TString name; // the name of the symbol this node represents
EShLanguage stage;
TString mangledName; // mangled function name, or a copy of name if not a function
TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value
TIntermTyped* constSubtree;
};

View File

@@ -490,6 +490,163 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
// Process component-wise operations
for (int i = 0; i < objectSize; i++) {
// First read the value and convert to i64/u64/f64/bool, then convert
// to the destination type (still 64b), then convert down to the
// destination size.
if (IsOpNumericConv(op)) {
enum ConvType { CONV_FLOAT, CONV_INT, CONV_UINT, CONV_BOOL };
ConvType srcType = CONV_UINT, dstType = CONV_UINT;
double valf = 0.0;
uint64_t valu = 0;
int64_t vali = 0;
bool valb = false;
switch (getType().getBasicType()) {
case EbtDouble:
case EbtFloat16:
case EbtFloat:
valf = unionArray[i].getDConst();
srcType = CONV_FLOAT;
break;
case EbtInt8:
vali = unionArray[i].getI8Const();
srcType = CONV_INT;
break;
case EbtInt16:
vali = unionArray[i].getI16Const();
srcType = CONV_INT;
break;
case EbtInt:
vali = unionArray[i].getIConst();
srcType = CONV_INT;
break;
case EbtInt64:
vali = unionArray[i].getI64Const();
srcType = CONV_INT;
break;
case EbtUint8:
valu = unionArray[i].getU8Const();
srcType = CONV_UINT;
break;
case EbtUint16:
valu = unionArray[i].getU16Const();
srcType = CONV_UINT;
break;
case EbtUint:
valu = unionArray[i].getUConst();
srcType = CONV_UINT;
break;
case EbtUint64:
valu = unionArray[i].getU64Const();
srcType = CONV_UINT;
break;
case EbtBool:
valb = unionArray[i].getBConst();
srcType = CONV_BOOL;
break;
default:
assert(0);
break;
}
switch (returnType.getBasicType()) {
case EbtDouble:
case EbtFloat16:
case EbtFloat:
dstType = CONV_FLOAT;
break;
case EbtInt8:
case EbtInt16:
case EbtInt:
case EbtInt64:
dstType = CONV_INT;
break;
case EbtUint8:
case EbtUint16:
case EbtUint:
case EbtUint64:
dstType = CONV_UINT;
break;
case EbtBool:
dstType = CONV_BOOL;
break;
default:
assert(0);
break;
}
if (dstType == CONV_BOOL) {
switch (srcType) {
case CONV_FLOAT:
valb = (valf != 0.0); break;
case CONV_INT:
valb = (vali != 0.0); break;
case CONV_UINT:
valb = (valu != 0.0); break;
default:
break;
}
} else if (dstType == CONV_FLOAT) {
switch (srcType) {
case CONV_BOOL:
valf = (double)valb; break;
case CONV_INT:
valf = (double)vali; break;
case CONV_UINT:
valf = (double)valu; break;
default:
break;
}
} else if (dstType == CONV_INT) {
switch (srcType) {
case CONV_BOOL:
vali = (int64_t)valb; break;
case CONV_FLOAT:
vali = (int64_t)valf; break;
case CONV_UINT:
vali = (int64_t)valu; break;
default:
break;
}
} else if (dstType == CONV_UINT) {
switch (srcType) {
case CONV_BOOL:
valu = (uint64_t)valb; break;
case CONV_FLOAT:
valu = (uint64_t)valf; break;
case CONV_INT:
valu = (uint64_t)vali; break;
default:
break;
}
}
switch (returnType.getBasicType()) {
case EbtDouble:
case EbtFloat16:
case EbtFloat:
newConstArray[i].setDConst(valf); break;
case EbtInt8:
newConstArray[i].setI8Const(static_cast<int8_t>(vali)); break;
case EbtInt16:
newConstArray[i].setI16Const(static_cast<int16_t>(vali)); break;
case EbtInt:
newConstArray[i].setIConst(static_cast<int32_t>(vali)); break;
case EbtInt64:
newConstArray[i].setI64Const(vali); break;
case EbtUint8:
newConstArray[i].setU8Const(static_cast<uint8_t>(valu)); break;
case EbtUint16:
newConstArray[i].setU16Const(static_cast<uint16_t>(valu)); break;
case EbtUint:
newConstArray[i].setUConst(static_cast<uint32_t>(valu)); break;
case EbtUint64:
newConstArray[i].setU64Const(valu); break;
case EbtBool:
newConstArray[i].setBConst(valb); break;
default:
assert(0);
break;
}
continue;
}
switch (op) {
case EOpNegative:
switch (getType().getBasicType()) {
@@ -641,277 +798,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
break;
}
case EOpConvIntToBool:
newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break;
case EOpConvUintToBool:
newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break;
case EOpConvBoolToInt:
newConstArray[i].setIConst(unionArray[i].getBConst()); break;
case EOpConvBoolToUint:
newConstArray[i].setUConst(unionArray[i].getBConst()); break;
case EOpConvIntToUint:
newConstArray[i].setUConst(unionArray[i].getIConst()); break;
case EOpConvUintToInt:
newConstArray[i].setIConst(unionArray[i].getUConst()); break;
case EOpConvFloatToBool:
case EOpConvDoubleToBool:
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
case EOpConvBoolToFloat:
case EOpConvBoolToDouble:
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
case EOpConvIntToFloat:
case EOpConvIntToDouble:
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
case EOpConvUintToFloat:
case EOpConvUintToDouble:
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
case EOpConvDoubleToFloat:
case EOpConvFloatToDouble:
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
case EOpConvFloatToUint:
case EOpConvDoubleToUint:
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
case EOpConvFloatToInt:
case EOpConvDoubleToInt:
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
case EOpConvInt8ToBool:
newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break;
case EOpConvUint8ToBool:
newConstArray[i].setBConst(unionArray[i].getU8Const() != 0); break;
case EOpConvInt16ToBool:
newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break;
case EOpConvUint16ToBool:
newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break;
case EOpConvInt64ToBool:
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
case EOpConvUint64ToBool:
newConstArray[i].setBConst(unionArray[i].getU64Const() != 0); break;
case EOpConvFloat16ToBool:
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
case EOpConvBoolToInt8:
newConstArray[i].setI8Const(unionArray[i].getBConst()); break;
case EOpConvBoolToUint8:
newConstArray[i].setU8Const(unionArray[i].getBConst()); break;
case EOpConvBoolToInt16:
newConstArray[i].setI16Const(unionArray[i].getBConst()); break;
case EOpConvBoolToUint16:
newConstArray[i].setU16Const(unionArray[i].getBConst()); break;
case EOpConvBoolToInt64:
newConstArray[i].setI64Const(unionArray[i].getBConst()); break;
case EOpConvBoolToUint64:
newConstArray[i].setU64Const(unionArray[i].getBConst()); break;
case EOpConvBoolToFloat16:
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
case EOpConvInt8ToInt16:
newConstArray[i].setI16Const(unionArray[i].getI8Const()); break;
case EOpConvInt8ToInt:
newConstArray[i].setIConst(unionArray[i].getI8Const()); break;
case EOpConvInt8ToInt64:
newConstArray[i].setI64Const(unionArray[i].getI8Const()); break;
case EOpConvInt8ToUint8:
newConstArray[i].setU8Const(unionArray[i].getI8Const()); break;
case EOpConvInt8ToUint16:
newConstArray[i].setU16Const(unionArray[i].getI8Const()); break;
case EOpConvInt8ToUint:
newConstArray[i].setUConst(unionArray[i].getI8Const()); break;
case EOpConvInt8ToUint64:
newConstArray[i].setU64Const(unionArray[i].getI8Const()); break;
case EOpConvUint8ToInt8:
newConstArray[i].setI8Const(unionArray[i].getU8Const()); break;
case EOpConvUint8ToInt16:
newConstArray[i].setI16Const(unionArray[i].getU8Const()); break;
case EOpConvUint8ToInt:
newConstArray[i].setIConst(unionArray[i].getU8Const()); break;
case EOpConvUint8ToInt64:
newConstArray[i].setI64Const(unionArray[i].getU8Const()); break;
case EOpConvUint8ToUint16:
newConstArray[i].setU16Const(unionArray[i].getU8Const()); break;
case EOpConvUint8ToUint:
newConstArray[i].setUConst(unionArray[i].getU8Const()); break;
case EOpConvUint8ToUint64:
newConstArray[i].setU64Const(unionArray[i].getU8Const()); break;
case EOpConvInt8ToFloat16:
newConstArray[i].setDConst(unionArray[i].getI8Const()); break;
case EOpConvInt8ToFloat:
newConstArray[i].setDConst(unionArray[i].getI8Const()); break;
case EOpConvInt8ToDouble:
newConstArray[i].setDConst(unionArray[i].getI8Const()); break;
case EOpConvUint8ToFloat16:
newConstArray[i].setDConst(unionArray[i].getU8Const()); break;
case EOpConvUint8ToFloat:
newConstArray[i].setDConst(unionArray[i].getU8Const()); break;
case EOpConvUint8ToDouble:
newConstArray[i].setDConst(unionArray[i].getU8Const()); break;
case EOpConvInt16ToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI16Const())); break;
case EOpConvInt16ToInt:
newConstArray[i].setIConst(unionArray[i].getI16Const()); break;
case EOpConvInt16ToInt64:
newConstArray[i].setI64Const(unionArray[i].getI16Const()); break;
case EOpConvInt16ToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getI16Const())); break;
case EOpConvInt16ToUint16:
newConstArray[i].setU16Const(unionArray[i].getI16Const()); break;
case EOpConvInt16ToUint:
newConstArray[i].setUConst(unionArray[i].getI16Const()); break;
case EOpConvInt16ToUint64:
newConstArray[i].setU64Const(unionArray[i].getI16Const()); break;
case EOpConvUint16ToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getU16Const())); break;
case EOpConvUint16ToInt16:
newConstArray[i].setI16Const(unionArray[i].getU16Const()); break;
case EOpConvUint16ToInt:
newConstArray[i].setIConst(unionArray[i].getU16Const()); break;
case EOpConvUint16ToInt64:
newConstArray[i].setI64Const(unionArray[i].getU16Const()); break;
case EOpConvUint16ToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getU16Const())); break;
case EOpConvUint16ToUint:
newConstArray[i].setUConst(unionArray[i].getU16Const()); break;
case EOpConvUint16ToUint64:
newConstArray[i].setU64Const(unionArray[i].getU16Const()); break;
case EOpConvInt16ToFloat16:
newConstArray[i].setDConst(unionArray[i].getI16Const()); break;
case EOpConvInt16ToFloat:
newConstArray[i].setDConst(unionArray[i].getI16Const()); break;
case EOpConvInt16ToDouble:
newConstArray[i].setDConst(unionArray[i].getI16Const()); break;
case EOpConvUint16ToFloat16:
newConstArray[i].setDConst(unionArray[i].getU16Const()); break;
case EOpConvUint16ToFloat:
newConstArray[i].setDConst(unionArray[i].getU16Const()); break;
case EOpConvUint16ToDouble:
newConstArray[i].setDConst(unionArray[i].getU16Const()); break;
case EOpConvIntToInt8:
newConstArray[i].setI8Const((signed char)unionArray[i].getIConst()); break;
case EOpConvIntToInt16:
newConstArray[i].setI16Const((signed short)unionArray[i].getIConst()); break;
case EOpConvIntToInt64:
newConstArray[i].setI64Const(unionArray[i].getIConst()); break;
case EOpConvIntToUint8:
newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break;
case EOpConvIntToUint16:
newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break;
case EOpConvIntToUint64:
newConstArray[i].setU64Const(unionArray[i].getIConst()); break;
case EOpConvUintToInt8:
newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break;
case EOpConvUintToInt16:
newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break;
case EOpConvUintToInt64:
newConstArray[i].setI64Const(unionArray[i].getUConst()); break;
case EOpConvUintToUint8:
newConstArray[i].setU8Const((unsigned char)unionArray[i].getUConst()); break;
case EOpConvUintToUint16:
newConstArray[i].setU16Const((unsigned short)unionArray[i].getUConst()); break;
case EOpConvUintToUint64:
newConstArray[i].setU64Const(unionArray[i].getUConst()); break;
case EOpConvIntToFloat16:
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
case EOpConvUintToFloat16:
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
case EOpConvInt64ToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToInt16:
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToInt:
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToUint16:
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToUint:
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToUint64:
newConstArray[i].setU64Const(unionArray[i].getI64Const()); break;
case EOpConvUint64ToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToInt16:
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToInt:
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToInt64:
newConstArray[i].setI64Const(unionArray[i].getU64Const()); break;
case EOpConvUint64ToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToUint16:
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToUint:
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getU64Const())); break;
case EOpConvInt64ToFloat16:
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToFloat:
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getI64Const())); break;
case EOpConvInt64ToDouble:
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getI64Const())); break;
case EOpConvUint64ToFloat16:
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToFloat:
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getU64Const())); break;
case EOpConvUint64ToDouble:
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getU64Const())); break;
case EOpConvFloat16ToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToInt16:
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToInt:
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToInt64:
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToUint16:
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToUint:
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToUint64:
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
case EOpConvFloat16ToFloat:
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
case EOpConvFloat16ToDouble:
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
case EOpConvFloatToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
case EOpConvFloatToInt16:
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
case EOpConvFloatToInt64:
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
case EOpConvFloatToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
case EOpConvFloatToUint16:
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
case EOpConvFloatToUint64:
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
case EOpConvFloatToFloat16:
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
case EOpConvDoubleToInt8:
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
case EOpConvDoubleToInt16:
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
case EOpConvDoubleToInt64:
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
case EOpConvDoubleToUint8:
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
case EOpConvDoubleToUint16:
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
case EOpConvDoubleToUint64:
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
case EOpConvDoubleToFloat16:
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
case EOpConvPtrToUint64:
case EOpConvUint64ToPtr:
case EOpConstructReference:

View File

@@ -52,6 +52,7 @@
//
#include <array>
#include <sstream>
#include "Initialize.h"
#include "span.h"
@@ -4473,83 +4474,41 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n"
);
std::string cooperativeMatrixFuncs =
"void coopMatLoad(out coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n"
std::stringstream cooperativeMatrixFuncs;
"void coopMatLoad(out coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatLoad(out coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
"void coopMatStore(coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
{
static const char *allTypes[] =
{
"float", "vec2", "vec4",
"float16_t", "f16vec2", "f16vec4",
"double", "dvec2", "dvec4",
"int8_t", "i8vec2", "i8vec4",
"int16_t", "i16vec2", "i16vec4",
"int", "ivec2", "ivec4",
"int64_t", "i64vec2", "i64vec4",
"uint8_t", "u8vec2", "u8vec4",
"uint16_t", "u16vec2", "u16vec4",
"uint", "uvec2", "uvec4",
"uint64_t", "u64vec2", "u64vec4",
};
for (auto t : allTypes) {
cooperativeMatrixFuncs << "void coopMatLoad(out coopmat m, volatile coherent " << t << "[] buf, uint element, uint stride, int matrixLayout);\n";
cooperativeMatrixFuncs << "void coopMatStore(coopmat m, volatile coherent " << t << "[] buf, uint element, uint stride, int matrixLayout);\n";
}
// Just use uint8_t for buffer type, we have special matching rules to allow any conversion
cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent uint8_t[] buf, uint element, tensorLayoutNV t);\n";
cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent uint8_t[] buf, uint element, tensorLayoutNV t, tensorViewNV v);\n";
cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent uint8_t[] buf, uint element, tensorLayoutNV t, __function f);\n";
cooperativeMatrixFuncs << "void coopMatLoadTensorNV(inout coopmat m, volatile coherent uint8_t[] buf, uint element, tensorLayoutNV t, tensorViewNV v, __function f);\n";
cooperativeMatrixFuncs << "void coopMatStoreTensorNV(coopmat m, volatile coherent uint8_t[] buf, uint element, tensorLayoutNV t);\n";
cooperativeMatrixFuncs << "void coopMatStoreTensorNV(coopmat m, volatile coherent uint8_t[] buf, uint element, tensorLayoutNV t, tensorViewNV v);\n";
}
cooperativeMatrixFuncs <<
"coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C);\n"
"coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C, int matrixOperands);\n";
commonBuiltins.append(cooperativeMatrixFuncs.c_str());
commonBuiltins.append(cooperativeMatrixFuncs.str().c_str());
commonBuiltins.append(
"const int gl_MatrixUseA = 0;\n"
@@ -4562,6 +4521,83 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"const int gl_CooperativeMatrixLayoutColumnBlockedInterleavedARM = 4203;\n"
"\n"
);
commonBuiltins.append(
"void coopMatTransposeNV(out coopmat, coopmat);"
"void coopMatReduceNV(out coopmat, coopmat, int, __function);"
"void coopMatPerElementNV();"
);
commonBuiltins.append(
"const int gl_CooperativeMatrixReduceRowNV = 0x1;\n"
"const int gl_CooperativeMatrixReduceColumnNV = 0x2;\n"
"const int gl_CooperativeMatrixReduceRowAndColumnNV = 0x3;\n"
"const int gl_CooperativeMatrixReduce2x2NV = 0x4;\n"
"\n"
);
commonBuiltins.append(
"const int gl_CooperativeMatrixClampModeUndefinedNV = 0x0;\n"
"const int gl_CooperativeMatrixClampModeConstantNV = 0x1;\n"
"const int gl_CooperativeMatrixClampModeClampToEdgeNV = 0x2;\n"
"const int gl_CooperativeMatrixClampModeRepeatNV = 0x3;\n"
"const int gl_CooperativeMatrixClampModeMirrorRepeatNV = 0x4;\n"
"\n"
);
commonBuiltins.append(
"tensorLayoutNV createTensorLayoutNV(uint Dim);\n"
"tensorLayoutNV createTensorLayoutNV(uint Dim, uint Mode);\n"
"tensorLayoutNV setTensorLayoutBlockSizeNV(tensorLayoutNV t, uint blockSize0);\n"
"tensorLayoutNV setTensorLayoutBlockSizeNV(tensorLayoutNV t, uint blockSize0, uint blockSize1);\n"
"tensorLayoutNV setTensorLayoutBlockSizeNV(tensorLayoutNV t, uint blockSize0, uint blockSize1, uint blockSize2);\n"
"tensorLayoutNV setTensorLayoutBlockSizeNV(tensorLayoutNV t, uint blockSize0, uint blockSize1, uint blockSize2, uint blockSize3);\n"
"tensorLayoutNV setTensorLayoutBlockSizeNV(tensorLayoutNV t, uint blockSize0, uint blockSize1, uint blockSize2, uint blockSize3, uint blockSize4);\n"
"tensorLayoutNV setTensorLayoutDimensionNV(tensorLayoutNV t, uint dim0);\n"
"tensorLayoutNV setTensorLayoutDimensionNV(tensorLayoutNV t, uint dim0, uint dim1);\n"
"tensorLayoutNV setTensorLayoutDimensionNV(tensorLayoutNV t, uint dim0, uint dim1, uint dim2);\n"
"tensorLayoutNV setTensorLayoutDimensionNV(tensorLayoutNV t, uint dim0, uint dim1, uint dim2, uint dim3);\n"
"tensorLayoutNV setTensorLayoutDimensionNV(tensorLayoutNV t, uint dim0, uint dim1, uint dim2, uint dim3, uint dim4);\n"
"tensorLayoutNV setTensorLayoutStrideNV(tensorLayoutNV t, uint stride0);\n"
"tensorLayoutNV setTensorLayoutStrideNV(tensorLayoutNV t, uint stride0, uint stride1);\n"
"tensorLayoutNV setTensorLayoutStrideNV(tensorLayoutNV t, uint stride0, uint stride1, uint stride2);\n"
"tensorLayoutNV setTensorLayoutStrideNV(tensorLayoutNV t, uint stride0, uint stride1, uint stride2, uint stride3);\n"
"tensorLayoutNV setTensorLayoutStrideNV(tensorLayoutNV t, uint stride0, uint stride1, uint stride2, uint stride3, uint stride4);\n"
"tensorLayoutNV sliceTensorLayoutNV(tensorLayoutNV t, uint offset0, uint span0);\n"
"tensorLayoutNV sliceTensorLayoutNV(tensorLayoutNV t, uint offset0, uint span0, uint offset1, uint span1);\n"
"tensorLayoutNV sliceTensorLayoutNV(tensorLayoutNV t, uint offset0, uint span0, uint offset1, uint span1, uint offset2, uint span2);\n"
"tensorLayoutNV sliceTensorLayoutNV(tensorLayoutNV t, uint offset0, uint span0, uint offset1, uint span1, uint offset2, uint span2, uint offset3, uint span3);\n"
"tensorLayoutNV sliceTensorLayoutNV(tensorLayoutNV t, uint offset0, uint span0, uint offset1, uint span1, uint offset2, uint span2, uint offset3, uint span3, uint offset4, uint span4);\n"
"tensorLayoutNV setTensorLayoutClampValueNV(tensorLayoutNV t, uint value);\n"
"tensorViewNV createTensorViewNV(uint Dim);\n"
"tensorViewNV createTensorViewNV(uint Dim, bool HasDimensions);\n"
"tensorViewNV createTensorViewNV(uint Dim, bool HasDimensions, uint p0);\n"
"tensorViewNV createTensorViewNV(uint Dim, bool HasDimensions, uint p0, uint p1);\n"
"tensorViewNV createTensorViewNV(uint Dim, bool HasDimensions, uint p0, uint p1, uint p2);\n"
"tensorViewNV createTensorViewNV(uint Dim, bool HasDimensions, uint p0, uint p1, uint p2, uint p3);\n"
"tensorViewNV createTensorViewNV(uint Dim, bool HasDimensions, uint p0, uint p1, uint p2, uint p3, uint p4);\n"
"tensorViewNV setTensorViewDimensionsNV(tensorViewNV v, uint dim0);\n"
"tensorViewNV setTensorViewDimensionsNV(tensorViewNV v, uint dim0, uint dim1);\n"
"tensorViewNV setTensorViewDimensionsNV(tensorViewNV v, uint dim0, uint dim1, uint dim2);\n"
"tensorViewNV setTensorViewDimensionsNV(tensorViewNV v, uint dim0, uint dim1, uint dim2, uint dim3);\n"
"tensorViewNV setTensorViewDimensionsNV(tensorViewNV v, uint dim0, uint dim1, uint dim2, uint dim3, uint dim4);\n"
"tensorViewNV setTensorViewStrideNV(tensorViewNV v, uint stride0);\n"
"tensorViewNV setTensorViewStrideNV(tensorViewNV v, uint stride0, uint stride1);\n"
"tensorViewNV setTensorViewStrideNV(tensorViewNV v, uint stride0, uint stride1, uint stride2);\n"
"tensorViewNV setTensorViewStrideNV(tensorViewNV v, uint stride0, uint stride1, uint stride2, uint stride3);\n"
"tensorViewNV setTensorViewStrideNV(tensorViewNV v, uint stride0, uint stride1, uint stride2, uint stride3, uint stride4);\n"
"tensorViewNV setTensorViewClipNV(tensorViewNV v, uint clipRowOffset, uint clipRowSpan, uint clipColOffset, uint clipColSpan);\n"
"\n"
);
}
//============================================================================
@@ -9066,6 +9102,22 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("coopMatLoad", 1, &E_GL_KHR_cooperative_matrix);
symbolTable.setFunctionExtensions("coopMatStore", 1, &E_GL_KHR_cooperative_matrix);
symbolTable.setFunctionExtensions("coopMatMulAdd", 1, &E_GL_KHR_cooperative_matrix);
symbolTable.setFunctionExtensions("coopMatReduceNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("coopMatPerElementNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("coopMatTransposeNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("createTensorLayoutNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorLayoutBlockSizeNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorLayoutDimensionNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorLayoutStrideNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("sliceTensorLayoutNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorLayoutClampValueNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("createTensorViewNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorViewDimensionsNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorViewStrideNV", 1, &E_GL_NV_cooperative_matrix2);
symbolTable.setFunctionExtensions("setTensorViewClipNV", 1, &E_GL_NV_cooperative_matrix2);
}
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
@@ -10241,6 +10293,25 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("coopMatStore", EOpCooperativeMatrixStore);
symbolTable.relateToOperator("coopMatMulAdd", EOpCooperativeMatrixMulAdd);
symbolTable.relateToOperator("coopMatLoadTensorNV", EOpCooperativeMatrixLoadTensorNV);
symbolTable.relateToOperator("coopMatStoreTensorNV", EOpCooperativeMatrixStoreTensorNV);
symbolTable.relateToOperator("coopMatReduceNV", EOpCooperativeMatrixReduceNV);
symbolTable.relateToOperator("coopMatPerElementNV", EOpCooperativeMatrixPerElementOpNV);
symbolTable.relateToOperator("coopMatTransposeNV", EOpCooperativeMatrixTransposeNV);
symbolTable.relateToOperator("createTensorLayoutNV", EOpCreateTensorLayoutNV);
symbolTable.relateToOperator("setTensorLayoutBlockSizeNV", EOpTensorLayoutSetBlockSizeNV);
symbolTable.relateToOperator("setTensorLayoutDimensionNV", EOpTensorLayoutSetDimensionNV);
symbolTable.relateToOperator("setTensorLayoutStrideNV", EOpTensorLayoutSetStrideNV);
symbolTable.relateToOperator("sliceTensorLayoutNV", EOpTensorLayoutSliceNV);
symbolTable.relateToOperator("setTensorLayoutClampValueNV", EOpTensorLayoutSetClampValueNV);
symbolTable.relateToOperator("createTensorViewNV", EOpCreateTensorViewNV);
symbolTable.relateToOperator("setTensorViewDimensionsNV", EOpTensorViewSetDimensionNV);
symbolTable.relateToOperator("setTensorViewStrideNV", EOpTensorViewSetStrideNV);
symbolTable.relateToOperator("setTensorViewClipNV", EOpTensorViewSetClipNV);
if (profile != EEsProfile && version >= 460) {
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);

View File

@@ -65,10 +65,10 @@ namespace glslang {
// Returns the added node.
//
TIntermSymbol* TIntermediate::addSymbol(long long id, const TString& name, const TType& type, const TConstUnionArray& constArray,
TIntermSymbol* TIntermediate::addSymbol(long long id, const TString& name, const TString& mangledName, const TType& type, const TConstUnionArray& constArray,
TIntermTyped* constSubtree, const TSourceLoc& loc)
{
TIntermSymbol* node = new TIntermSymbol(id, name, type);
TIntermSymbol* node = new TIntermSymbol(id, name, getStage(), type, &mangledName);
node->setLoc(loc);
node->setConstArray(constArray);
node->setConstSubtree(constSubtree);
@@ -80,6 +80,7 @@ TIntermSymbol* TIntermediate::addSymbol(const TIntermSymbol& intermSymbol)
{
return addSymbol(intermSymbol.getId(),
intermSymbol.getName(),
intermSymbol.getMangledName(),
intermSymbol.getType(),
intermSymbol.getConstArray(),
intermSymbol.getConstSubtree(),
@@ -96,14 +97,14 @@ TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable)
TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable, const TSourceLoc& loc)
{
return addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), variable.getConstArray(), variable.getConstSubtree(), loc);
return addSymbol(variable.getUniqueId(), variable.getName(), variable.getMangledName(), variable.getType(), variable.getConstArray(), variable.getConstSubtree(), loc);
}
TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc)
{
TConstUnionArray unionArray; // just a null constant
return addSymbol(0, "", type, unionArray, nullptr, loc);
return addSymbol(0, "", "", type, unionArray, nullptr, loc);
}
//
@@ -163,8 +164,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
left = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, left, TType(EbtInt64));
right = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, right, TType(EbtInt64));
left = addBuiltInFunctionCall(loc, EOpConvNumeric, true, left, TType(EbtInt64));
right = addBuiltInFunctionCall(loc, EOpConvNumeric, true, right, TType(EbtInt64));
left = addBinaryMath(EOpSub, left, right, loc);
@@ -567,222 +568,12 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const
{
switch (dst) {
case EbtDouble:
switch (src) {
case EbtUint: newOp = EOpConvUintToDouble; break;
case EbtBool: newOp = EOpConvBoolToDouble; break;
case EbtFloat: newOp = EOpConvFloatToDouble; break;
case EbtInt: newOp = EOpConvIntToDouble; break;
case EbtInt8: newOp = EOpConvInt8ToDouble; break;
case EbtUint8: newOp = EOpConvUint8ToDouble; break;
case EbtInt16: newOp = EOpConvInt16ToDouble; break;
case EbtUint16: newOp = EOpConvUint16ToDouble; break;
case EbtFloat16: newOp = EOpConvFloat16ToDouble; break;
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
default:
return false;
}
break;
case EbtFloat:
switch (src) {
case EbtInt: newOp = EOpConvIntToFloat; break;
case EbtUint: newOp = EOpConvUintToFloat; break;
case EbtBool: newOp = EOpConvBoolToFloat; break;
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
case EbtInt8: newOp = EOpConvInt8ToFloat; break;
case EbtUint8: newOp = EOpConvUint8ToFloat; break;
case EbtInt16: newOp = EOpConvInt16ToFloat; break;
case EbtUint16: newOp = EOpConvUint16ToFloat; break;
case EbtFloat16: newOp = EOpConvFloat16ToFloat; break;
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
default:
return false;
}
break;
case EbtFloat16:
switch (src) {
case EbtInt8: newOp = EOpConvInt8ToFloat16; break;
case EbtUint8: newOp = EOpConvUint8ToFloat16; break;
case EbtInt16: newOp = EOpConvInt16ToFloat16; break;
case EbtUint16: newOp = EOpConvUint16ToFloat16; break;
case EbtInt: newOp = EOpConvIntToFloat16; break;
case EbtUint: newOp = EOpConvUintToFloat16; break;
case EbtBool: newOp = EOpConvBoolToFloat16; break;
case EbtFloat: newOp = EOpConvFloatToFloat16; break;
case EbtDouble: newOp = EOpConvDoubleToFloat16; break;
case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
default:
return false;
}
break;
case EbtBool:
switch (src) {
case EbtInt: newOp = EOpConvIntToBool; break;
case EbtUint: newOp = EOpConvUintToBool; break;
case EbtFloat: newOp = EOpConvFloatToBool; break;
case EbtDouble: newOp = EOpConvDoubleToBool; break;
case EbtInt8: newOp = EOpConvInt8ToBool; break;
case EbtUint8: newOp = EOpConvUint8ToBool; break;
case EbtInt16: newOp = EOpConvInt16ToBool; break;
case EbtUint16: newOp = EOpConvUint16ToBool; break;
case EbtFloat16: newOp = EOpConvFloat16ToBool; break;
case EbtInt64: newOp = EOpConvInt64ToBool; break;
case EbtUint64: newOp = EOpConvUint64ToBool; break;
default:
return false;
}
break;
case EbtInt8:
switch (src) {
case EbtUint8: newOp = EOpConvUint8ToInt8; break;
case EbtInt16: newOp = EOpConvInt16ToInt8; break;
case EbtUint16: newOp = EOpConvUint16ToInt8; break;
case EbtInt: newOp = EOpConvIntToInt8; break;
case EbtUint: newOp = EOpConvUintToInt8; break;
case EbtInt64: newOp = EOpConvInt64ToInt8; break;
case EbtUint64: newOp = EOpConvUint64ToInt8; break;
case EbtBool: newOp = EOpConvBoolToInt8; break;
case EbtFloat: newOp = EOpConvFloatToInt8; break;
case EbtDouble: newOp = EOpConvDoubleToInt8; break;
case EbtFloat16: newOp = EOpConvFloat16ToInt8; break;
default:
return false;
}
break;
case EbtUint8:
switch (src) {
case EbtInt8: newOp = EOpConvInt8ToUint8; break;
case EbtInt16: newOp = EOpConvInt16ToUint8; break;
case EbtUint16: newOp = EOpConvUint16ToUint8; break;
case EbtInt: newOp = EOpConvIntToUint8; break;
case EbtUint: newOp = EOpConvUintToUint8; break;
case EbtInt64: newOp = EOpConvInt64ToUint8; break;
case EbtUint64: newOp = EOpConvUint64ToUint8; break;
case EbtBool: newOp = EOpConvBoolToUint8; break;
case EbtFloat: newOp = EOpConvFloatToUint8; break;
case EbtDouble: newOp = EOpConvDoubleToUint8; break;
case EbtFloat16: newOp = EOpConvFloat16ToUint8; break;
default:
return false;
}
break;
case EbtInt16:
switch (src) {
case EbtUint8: newOp = EOpConvUint8ToInt16; break;
case EbtInt8: newOp = EOpConvInt8ToInt16; break;
case EbtUint16: newOp = EOpConvUint16ToInt16; break;
case EbtInt: newOp = EOpConvIntToInt16; break;
case EbtUint: newOp = EOpConvUintToInt16; break;
case EbtInt64: newOp = EOpConvInt64ToInt16; break;
case EbtUint64: newOp = EOpConvUint64ToInt16; break;
case EbtBool: newOp = EOpConvBoolToInt16; break;
case EbtFloat: newOp = EOpConvFloatToInt16; break;
case EbtDouble: newOp = EOpConvDoubleToInt16; break;
case EbtFloat16: newOp = EOpConvFloat16ToInt16; break;
default:
return false;
}
break;
case EbtUint16:
switch (src) {
case EbtInt8: newOp = EOpConvInt8ToUint16; break;
case EbtUint8: newOp = EOpConvUint8ToUint16; break;
case EbtInt16: newOp = EOpConvInt16ToUint16; break;
case EbtInt: newOp = EOpConvIntToUint16; break;
case EbtUint: newOp = EOpConvUintToUint16; break;
case EbtInt64: newOp = EOpConvInt64ToUint16; break;
case EbtUint64: newOp = EOpConvUint64ToUint16; break;
case EbtBool: newOp = EOpConvBoolToUint16; break;
case EbtFloat: newOp = EOpConvFloatToUint16; break;
case EbtDouble: newOp = EOpConvDoubleToUint16; break;
case EbtFloat16: newOp = EOpConvFloat16ToUint16; break;
default:
return false;
}
break;
case EbtInt:
switch (src) {
case EbtUint: newOp = EOpConvUintToInt; break;
case EbtBool: newOp = EOpConvBoolToInt; break;
case EbtFloat: newOp = EOpConvFloatToInt; break;
case EbtInt8: newOp = EOpConvInt8ToInt; break;
case EbtUint8: newOp = EOpConvUint8ToInt; break;
case EbtInt16: newOp = EOpConvInt16ToInt; break;
case EbtUint16: newOp = EOpConvUint16ToInt; break;
case EbtDouble: newOp = EOpConvDoubleToInt; break;
case EbtFloat16: newOp = EOpConvFloat16ToInt; break;
case EbtInt64: newOp = EOpConvInt64ToInt; break;
case EbtUint64: newOp = EOpConvUint64ToInt; break;
default:
return false;
}
break;
case EbtUint:
switch (src) {
case EbtInt: newOp = EOpConvIntToUint; break;
case EbtBool: newOp = EOpConvBoolToUint; break;
case EbtFloat: newOp = EOpConvFloatToUint; break;
case EbtInt8: newOp = EOpConvInt8ToUint; break;
case EbtUint8: newOp = EOpConvUint8ToUint; break;
case EbtInt16: newOp = EOpConvInt16ToUint; break;
case EbtUint16: newOp = EOpConvUint16ToUint; break;
case EbtDouble: newOp = EOpConvDoubleToUint; break;
case EbtFloat16: newOp = EOpConvFloat16ToUint; break;
case EbtInt64: newOp = EOpConvInt64ToUint; break;
case EbtUint64: newOp = EOpConvUint64ToUint; break;
// For bindless texture type conversion, add a dummy convert op, just
// to generate a new TIntermTyped
// uvec2(any sampler type)
// uvec2(any image type)
case EbtSampler: newOp = EOpConvIntToUint; break;
default:
return false;
}
break;
case EbtInt64:
switch (src) {
case EbtInt8: newOp = EOpConvInt8ToInt64; break;
case EbtUint8: newOp = EOpConvUint8ToInt64; break;
case EbtInt16: newOp = EOpConvInt16ToInt64; break;
case EbtUint16: newOp = EOpConvUint16ToInt64; break;
case EbtInt: newOp = EOpConvIntToInt64; break;
case EbtUint: newOp = EOpConvUintToInt64; break;
case EbtBool: newOp = EOpConvBoolToInt64; break;
case EbtFloat: newOp = EOpConvFloatToInt64; break;
case EbtDouble: newOp = EOpConvDoubleToInt64; break;
case EbtFloat16: newOp = EOpConvFloat16ToInt64; break;
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
default:
return false;
}
break;
case EbtUint64:
switch (src) {
case EbtInt8: newOp = EOpConvInt8ToUint64; break;
case EbtUint8: newOp = EOpConvUint8ToUint64; break;
case EbtInt16: newOp = EOpConvInt16ToUint64; break;
case EbtUint16: newOp = EOpConvUint16ToUint64; break;
case EbtInt: newOp = EOpConvIntToUint64; break;
case EbtUint: newOp = EOpConvUintToUint64; break;
case EbtBool: newOp = EOpConvBoolToUint64; break;
case EbtFloat: newOp = EOpConvFloatToUint64; break;
case EbtDouble: newOp = EOpConvDoubleToUint64; break;
case EbtFloat16: newOp = EOpConvFloat16ToUint64; break;
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
default:
return false;
}
break;
default:
return false;
if ((isTypeInt(dst) || isTypeFloat(dst) || dst == EbtBool) &&
(isTypeInt(src) || isTypeFloat(src) || src == EbtBool)) {
newOp = EOpConvNumeric;
return true;
}
return true;
return false;
}
// This is 'mechanism' here, it does any conversion told.
@@ -1034,6 +825,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
op != EOpConstructCooperativeMatrixKHR)
return nullptr;
if (node->getType().isTensorLayoutNV() ||
node->getType().isTensorViewNV())
return nullptr;
// Note: callers are responsible for other aspects of shape,
// like vector and matrix sizes.
@@ -2962,17 +2757,16 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
// (However, some floating-point operations result in bool, like ">",
// so are handled later.)
if (node.getType().isFloatingDomain()) {
if (IsOpNumericConv(node.getOp()) &&
isTypeFloat(node.getType().getBasicType()) &&
isTypeFloat(node.getAsUnaryNode()->getOperand()->getAsTyped()->getType().getBasicType())) {
return true;
}
switch (node.getOp()) {
case EOpIndexDirect:
case EOpIndexIndirect:
case EOpIndexDirectStruct:
case EOpVectorSwizzle:
case EOpConvFloatToDouble:
case EOpConvDoubleToFloat:
case EOpConvFloat16ToFloat:
case EOpConvFloatToFloat16:
case EOpConvFloat16ToDouble:
case EOpConvDoubleToFloat16:
return true;
default:
return false;
@@ -2987,6 +2781,15 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
// So, for now, we can assume everything left is non-floating-point...
if (IsOpNumericConv(node.getOp())) {
TBasicType srcType = node.getAsUnaryNode()->getOperand()->getAsTyped()->getType().getBasicType();
TBasicType dstType = node.getType().getBasicType();
if ((isTypeInt(srcType) || srcType == EbtBool) &&
(isTypeInt(dstType) || dstType == EbtBool)) {
return true;
}
}
// Now check for integer/bool-based operations
switch (node.getOp()) {
@@ -2996,98 +2799,6 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
case EOpIndexDirectStruct:
case EOpVectorSwizzle:
// (u)int* -> bool
case EOpConvInt8ToBool:
case EOpConvInt16ToBool:
case EOpConvIntToBool:
case EOpConvInt64ToBool:
case EOpConvUint8ToBool:
case EOpConvUint16ToBool:
case EOpConvUintToBool:
case EOpConvUint64ToBool:
// bool -> (u)int*
case EOpConvBoolToInt8:
case EOpConvBoolToInt16:
case EOpConvBoolToInt:
case EOpConvBoolToInt64:
case EOpConvBoolToUint8:
case EOpConvBoolToUint16:
case EOpConvBoolToUint:
case EOpConvBoolToUint64:
// int8_t -> (u)int*
case EOpConvInt8ToInt16:
case EOpConvInt8ToInt:
case EOpConvInt8ToInt64:
case EOpConvInt8ToUint8:
case EOpConvInt8ToUint16:
case EOpConvInt8ToUint:
case EOpConvInt8ToUint64:
// int16_t -> (u)int*
case EOpConvInt16ToInt8:
case EOpConvInt16ToInt:
case EOpConvInt16ToInt64:
case EOpConvInt16ToUint8:
case EOpConvInt16ToUint16:
case EOpConvInt16ToUint:
case EOpConvInt16ToUint64:
// int32_t -> (u)int*
case EOpConvIntToInt8:
case EOpConvIntToInt16:
case EOpConvIntToInt64:
case EOpConvIntToUint8:
case EOpConvIntToUint16:
case EOpConvIntToUint:
case EOpConvIntToUint64:
// int64_t -> (u)int*
case EOpConvInt64ToInt8:
case EOpConvInt64ToInt16:
case EOpConvInt64ToInt:
case EOpConvInt64ToUint8:
case EOpConvInt64ToUint16:
case EOpConvInt64ToUint:
case EOpConvInt64ToUint64:
// uint8_t -> (u)int*
case EOpConvUint8ToInt8:
case EOpConvUint8ToInt16:
case EOpConvUint8ToInt:
case EOpConvUint8ToInt64:
case EOpConvUint8ToUint16:
case EOpConvUint8ToUint:
case EOpConvUint8ToUint64:
// uint16_t -> (u)int*
case EOpConvUint16ToInt8:
case EOpConvUint16ToInt16:
case EOpConvUint16ToInt:
case EOpConvUint16ToInt64:
case EOpConvUint16ToUint8:
case EOpConvUint16ToUint:
case EOpConvUint16ToUint64:
// uint32_t -> (u)int*
case EOpConvUintToInt8:
case EOpConvUintToInt16:
case EOpConvUintToInt:
case EOpConvUintToInt64:
case EOpConvUintToUint8:
case EOpConvUintToUint16:
case EOpConvUintToUint64:
// uint64_t -> (u)int*
case EOpConvUint64ToInt8:
case EOpConvUint64ToInt16:
case EOpConvUint64ToInt:
case EOpConvUint64ToInt64:
case EOpConvUint64ToUint8:
case EOpConvUint64ToUint16:
case EOpConvUint64ToUint:
// unary operations
case EOpNegative:
case EOpLogicalNot:

View File

@@ -506,8 +506,18 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb
}
// Recovery, if it wasn't found or was not a variable.
if (! variable)
variable = new TVariable(string, TType(EbtVoid));
if (! variable) {
bool builtIn = false;
TVector<const TFunction*> candidateList;
symbolTable.findFunctionNameList(*string + "(", candidateList, builtIn);
// If it's a function, pass the name/mangledName
if (!candidateList.empty() && !builtIn) {
variable = new TVariable(&candidateList[0]->getName(), &candidateList[0]->getMangledName(), TType(EbtFunction));
} else {
variable = new TVariable(string, TType(EbtVoid));
}
}
if (variable->getType().getQualifier().isFrontEndConstant())
node = intermediate.addConstantUnion(variable->getConstArray(), variable->getType(), loc);
@@ -1489,13 +1499,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
result = addOutputArgumentConversions(*fnCandidate, *result->getAsAggregate());
}
if (result->getAsTyped()->getType().isCoopMat() &&
!result->getAsTyped()->getType().isParameterized()) {
assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAddNV);
result->setType(result->getAsAggregate()->getSequence()[2]->getAsTyped()->getType());
}
handleCoopMat2FunctionCall(loc, fnCandidate, result, arguments);
}
}
@@ -1507,6 +1511,224 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
return result;
}
void TParseContext::handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFunction* fnCandidate, TIntermTyped* result, TIntermNode* arguments)
{
if (arguments && arguments->getAsAggregate()) {
auto &sequence = arguments->getAsAggregate()->getSequence();
for (uint32_t i = 0; i < sequence.size(); ++i) {
auto param = sequence[i];
if (param->getAsTyped()->getBasicType() == EbtFunction) {
// Add the function to the callgraph
intermediate.addToCallGraph(infoSink, currentCaller, param->getAsSymbolNode()->getMangledName());
// error checking that all parameters are 'const in'
if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixLoadTensorNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixPerElementOpNV) {
const TFunction* func = symbolTable.find(param->getAsSymbolNode()->getMangledName())->getAsFunction();
for (int i = 0; i < func->getParamCount(); ++i) {
const TParameter& arg = (*func)[i];
const TQualifier& formalQualifier = arg.type->getQualifier();
if (formalQualifier.storage != EvqConstReadOnly) {
error(loc, "function parameters must all be qualified 'const in'", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
}
}
// error checking decodeFunc parameters are (reference, uint32_t[], uint32_t[])
if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixLoadTensorNV) {
const TFunction* decodeFunc = symbolTable.find(param->getAsSymbolNode()->getMangledName())->getAsFunction();
if (decodeFunc->getParamCount() != 3) {
error(loc, "must have three parameters", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
if ((*decodeFunc)[0].type->getBasicType() != EbtReference) {
error(loc, "first parameter must be buffer reference type", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
if ((*decodeFunc)[1].type->getBasicType() != EbtUint || (*decodeFunc)[2].type->getBasicType() != EbtUint) {
error(loc, "coordinate parameters must be uint32_t", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
if (!(*decodeFunc)[1].type->isArray() || !(*decodeFunc)[2].type->isArray()) {
error(loc, "coordinate parameters must be uint32_t", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
}
// error checking reduce function has matching parameters
if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV) {
const TFunction* combineOp = symbolTable.find(param->getAsSymbolNode()->getMangledName())->getAsFunction();
if (combineOp->getParamCount() != 2) {
error(loc, "must have two parameters", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
for (int i = 0; i < combineOp->getParamCount(); ++i) {
const TParameter& arg = (*combineOp)[i];
if (sequence[1]->getAsTyped()->getType().getBasicType() != arg.type->getBasicType()) {
error(loc, "parameter types must match cooperative matrix component type", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
}
if (sequence[1]->getAsTyped()->getType().getBasicType() != combineOp->getType().getBasicType()) {
error(loc, "return type must match cooperative matrix component type", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
}
// error checking perelement op has correct parameters
if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixPerElementOpNV) {
const TFunction* elemOp = symbolTable.find(param->getAsSymbolNode()->getMangledName())->getAsFunction();
if (sequence[1]->getAsTyped()->getType() != sequence[0]->getAsTyped()->getType()) {
error(loc, "cooperative matrix input and result types must match", "", "");
}
if (elemOp->getParamCount() < 3) {
error(loc, "not enough parameters", param->getAsSymbolNode()->getMangledName().c_str(), "");
} else if (elemOp->getParamCount() != (int)sequence.size()) {
error(loc, "number of parameters must match call to coopMatPerElementNV", param->getAsSymbolNode()->getMangledName().c_str(), "");
} else {
if ((*elemOp)[0].type->getBasicType() != EbtUint || (*elemOp)[1].type->getBasicType() != EbtUint) {
error(loc, "row/column parameters must be uint32_t", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
const TParameter& matArg = (*elemOp)[2];
if (sequence[1]->getAsTyped()->getType().getBasicType() != matArg.type->getBasicType()) {
error(loc, "third parameter must match cooperative matrix component type", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
for (int i = 3; i < elemOp->getParamCount(); ++i) {
const TParameter& arg = (*elemOp)[i];
if (sequence[i]->getAsTyped()->getType().getBasicType() != arg.type->getBasicType()) {
error(loc, "parameter types must match or be cooperative matrix component type", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
}
if (sequence[1]->getAsTyped()->getType().getBasicType() != elemOp->getType().getBasicType()) {
error(loc, "return type must match cooperative matrix component type", param->getAsSymbolNode()->getMangledName().c_str(), "");
}
}
}
}
}
}
if ((result->getAsTyped()->getType().isCoopMat() ||
result->getAsTyped()->getType().isTensorLayoutNV() ||
result->getAsTyped()->getType().isTensorViewNV()) &&
!result->getAsTyped()->getType().isParameterized()) {
assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAddNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixPerElementOpNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixTransposeNV ||
fnCandidate->getBuiltInOp() == EOpCreateTensorLayoutNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetDimensionNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetBlockSizeNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetStrideNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSliceNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetClampValueNV ||
fnCandidate->getBuiltInOp() == EOpCreateTensorViewNV ||
fnCandidate->getBuiltInOp() == EOpTensorViewSetDimensionNV ||
fnCandidate->getBuiltInOp() == EOpTensorViewSetStrideNV ||
fnCandidate->getBuiltInOp() == EOpTensorViewSetClipNV);
if (fnCandidate->getBuiltInOp() == EOpCreateTensorLayoutNV) {
// Convert template parameters to arraySizes/typeParameters
TArraySizes *arraySizes = new TArraySizes;
for (uint32_t i = 0; i < 2; ++i) {
TIntermNode *param {};
if (arguments->getAsConstantUnion()) {
if (i == 0) {
param = arguments;
}
} else {
assert(arguments->getAsAggregate());
auto &sequence = arguments->getAsAggregate()->getSequence();
if (i < sequence.size()) {
param = sequence[i];
}
}
if (param) {
if (param->getAsTyped()->getType().getQualifier().isSpecConstant()) {
uint32_t value = param->getAsSymbolNode()->getConstArray()[0].getIConst();
arraySizes->addInnerSize(value, param->getAsTyped());
} else {
uint32_t value = param->getAsConstantUnion()->getConstArray()[0].getIConst();
arraySizes->addInnerSize(value);
}
} else {
// gl_CooperativeMatrixClampModeUndefined
arraySizes->addInnerSize(0);
}
}
TTypeParameters typeParameters;
typeParameters.arraySizes = arraySizes;
TType resultType;
resultType.deepCopy(result->getAsTyped()->getType());
resultType.copyTypeParameters(typeParameters);
result->setType(resultType);
} else if (fnCandidate->getBuiltInOp() == EOpCreateTensorViewNV) {
// Convert template parameters to arraySizes/typeParameters
TArraySizes *arraySizes = new TArraySizes;
for (uint32_t i = 0; i < 7; ++i) {
TIntermNode *param {};
if (arguments->getAsConstantUnion()) {
if (i == 0) {
param = arguments;
}
} else {
assert(arguments->getAsAggregate());
auto &sequence = arguments->getAsAggregate()->getSequence();
if (i < sequence.size()) {
param = sequence[i];
}
}
if (param) {
if (param->getAsTyped()->getType().getQualifier().isSpecConstant()) {
uint32_t value = param->getAsSymbolNode()->getConstArray()[0].getIConst();
arraySizes->addInnerSize(value, param->getAsTyped());
} else {
uint32_t value = param->getAsConstantUnion()->getConstArray()[0].getIConst();
arraySizes->addInnerSize(value);
}
} else {
uint32_t value = 0;
if (i >= 2) {
// default permutation values are an increasing sequence
value = i - 2;
}
arraySizes->addInnerSize(value);
}
}
TTypeParameters typeParameters;
typeParameters.arraySizes = arraySizes;
TType resultType;
resultType.deepCopy(result->getAsTyped()->getType());
resultType.copyTypeParameters(typeParameters);
result->setType(resultType);
} else if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixPerElementOpNV ||
fnCandidate->getBuiltInOp() == EOpCooperativeMatrixTransposeNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetDimensionNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetBlockSizeNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetStrideNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSliceNV ||
fnCandidate->getBuiltInOp() == EOpTensorLayoutSetClampValueNV ||
fnCandidate->getBuiltInOp() == EOpTensorViewSetDimensionNV ||
fnCandidate->getBuiltInOp() == EOpTensorViewSetStrideNV ||
fnCandidate->getBuiltInOp() == EOpTensorViewSetClipNV) {
// Set result type to match type of first parameter
result->setType(result->getAsAggregate()->getSequence()[0]->getAsTyped()->getType());
} else {
// For MulAdd, set result type to match type of C parameter
result->setType(result->getAsAggregate()->getSequence()[2]->getAsTyped()->getType());
}
}
}
TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNode* arguments,
const TFunction& function)
{
@@ -1622,6 +1844,8 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction
numArgs = 1;
break;
case EOpDebugPrintf:
case EOpCooperativeMatrixPerElementOpNV:
case EOpCooperativeMatrixReduceNV:
numArgs = 0;
break;
default:
@@ -1903,6 +2127,13 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct
}
TVariable* tempArg = makeInternalVariable("tempArg", paramType);
tempArg->getWritableType().getQualifier().makeTemporary();
if (function[i].type->getQualifier().isParamInput()) {
// If the parameter is also an input, copy-in.
TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc());
TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, tempArgNode, intermediate.addSymbol(*arguments[i]->getAsTyped()->getAsSymbolNode()), arguments[i]->getLoc());
conversionTree = intermediate.mergeAggregate(tempAssign, conversionTree, intermNode.getLoc());
}
TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc());
TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, arguments[i]->getAsTyped(), tempArgNode, arguments[i]->getLoc());
conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc());
@@ -2348,7 +2579,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
TSampler s = arg0->getType().getSampler();
if (s.is2D() && s.isArrayed() && s.isShadow()) {
if (
((*argp)[1]->getAsTyped()->getType().getBasicType() == EbtFloat) &&
((*argp)[1]->getAsTyped()->getType().getBasicType() == EbtFloat) &&
((*argp)[1]->getAsTyped()->getType().getVectorSize() == 4) &&
(fnCandidate.getParamCount() == 4)) {
featureString = fnCandidate.getName() + " for sampler2DArrayShadow";
@@ -2532,7 +2763,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
error(loc, "only supported on image with format r64i", fnCandidate.getName().c_str(), "");
else if (callNode.getType().getBasicType() == EbtUint64 && imageType.getQualifier().getFormat() != ElfR64ui)
error(loc, "only supported on image with format r64ui", fnCandidate.getName().c_str(), "");
} else if(callNode.getType().getBasicType() == EbtFloat16 &&
} else if(callNode.getType().getBasicType() == EbtFloat16 &&
((callNode.getType().getVectorSize() == 2 && arg0->getType().getQualifier().getFormat() == ElfRg16f) ||
(callNode.getType().getVectorSize() == 4 && arg0->getType().getQualifier().getFormat() == ElfRgba16f))) {
if (StartsWith(fnCandidate.getName(), "imageAtomicAdd") ||
@@ -2603,7 +2834,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
requireExtensions(loc, 2, extensions, fnCandidate.getName().c_str());
} else if ((callNode.getOp() == EOpAtomicAdd || callNode.getOp() == EOpAtomicExchange ||
callNode.getOp() == EOpAtomicMin || callNode.getOp() == EOpAtomicMax) &&
arg0->getType().getBasicType() == EbtFloat16 &&
arg0->getType().getBasicType() == EbtFloat16 &&
(arg0->getType().getVectorSize() == 2 || arg0->getType().getVectorSize() == 4 )) {
requireExtensions(loc, 1, &E_GL_NV_shader_atomic_fp16_vector, fnCandidate.getName().c_str());
} else if ((callNode.getOp() == EOpAtomicAdd || callNode.getOp() == EOpAtomicExchange) &&
@@ -3728,7 +3959,8 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
TIntermTyped* typed = node->getAsTyped();
if (type.isCoopMat() && typed->getType().isCoopMat() &&
!type.sameCoopMatShapeAndUse(typed->getType())) {
((extensionTurnedOn(E_GL_NV_cooperative_matrix2) && !type.sameCoopMatShape(typed->getType())) ||
(!extensionTurnedOn(E_GL_NV_cooperative_matrix2) && !type.sameCoopMatShapeAndUse(typed->getType())))) {
error(loc, "Cooperative matrix type parameters mismatch", constructorString.c_str(), "");
return true;
}
@@ -4460,7 +4692,7 @@ bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType bas
// Do size checking for an array type's size.
//
void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair,
const char* sizeType, const bool allowZero)
const char* sizeType, const bool isTypeParameter)
{
bool isConst = false;
sizePair.node = nullptr;
@@ -4490,17 +4722,27 @@ void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TA
sizePair.size = size;
if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint)) {
error(loc, sizeType, "", "must be a constant integer expression");
return;
}
if (allowZero) {
if (isTypeParameter) {
if (extensionTurnedOn(E_GL_NV_cooperative_matrix2)) {
if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint && expr->getBasicType() != EbtBool)) {
error(loc, sizeType, "", "must be a constant integer or boolean expression");
return;
}
} else {
if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint)) {
error(loc, sizeType, "", "must be a constant integer expression");
return;
}
}
if (size < 0) {
error(loc, sizeType, "", "must be a non-negative integer");
return;
}
} else {
if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint)) {
error(loc, sizeType, "", "must be a constant integer expression");
return;
}
if (size <= 0) {
error(loc, sizeType, "", "must be a positive integer");
return;
@@ -7036,6 +7278,14 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunct
return symbol->getAsFunction();
}
// coopMatPerElementNV is variadic. There is some function signature error
// checking in handleCoopMat2FunctionCall.
if (call.getName() == "coopMatPerElementNV") {
TSymbol* symbol = symbolTable.find("coopMatPerElementNV(", &builtIn);
if (symbol)
return symbol->getAsFunction();
}
bool explicitTypesEnabled = extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8) ||
extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
@@ -7201,15 +7451,25 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu
symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn);
// can 'from' convert to 'to'?
const auto convertible = [this,builtIn](const TType& from, const TType& to, TOperator, int) -> bool {
const auto convertible = [this,builtIn](const TType& from, const TType& to, TOperator op, int param) -> bool {
if (from == to)
return true;
if (from.coopMatParameterOK(to))
return true;
if (from.tensorParameterOK(to))
return true;
if (from.getBasicType() == EbtFunction && to.getBasicType() == EbtFunction)
return true;
// Allow a sized array to be passed through an unsized array parameter, for coopMatLoad/Store functions
if (builtIn && from.isArray() && to.isUnsizedArray()) {
TType fromElementType(from, 0);
TType toElementType(to, 0);
// Load/store tensor functions allow any element type for the pointer
if ((op == EOpCooperativeMatrixLoadTensorNV || op == EOpCooperativeMatrixStoreTensorNV) &&
param == 1 &&
(from.getQualifier().storage == EvqBuffer || from.getQualifier().storage == EvqShared)) {
return true;
}
if (fromElementType == toElementType)
return true;
}
@@ -7277,15 +7537,25 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc,
symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn);
// can 'from' convert to 'to'?
const auto convertible = [this,builtIn](const TType& from, const TType& to, TOperator, int) -> bool {
const auto convertible = [this,builtIn](const TType& from, const TType& to, TOperator op, int param) -> bool {
if (from == to)
return true;
if (from.coopMatParameterOK(to))
return true;
if (from.tensorParameterOK(to))
return true;
if (from.getBasicType() == EbtFunction && to.getBasicType() == EbtFunction)
return true;
// Allow a sized array to be passed through an unsized array parameter, for coopMatLoad/Store functions
if (builtIn && from.isArray() && to.isUnsizedArray()) {
TType fromElementType(from, 0);
TType toElementType(to, 0);
// Load/store tensor functions allow any element type for the pointer
if ((op == EOpCooperativeMatrixLoadTensorNV || op == EOpCooperativeMatrixStoreTensorNV) &&
param == 1 &&
(from.getQualifier().storage == EvqBuffer || from.getQualifier().storage == EvqShared)) {
return true;
}
if (fromElementType == toElementType)
return true;
}
@@ -7462,6 +7732,40 @@ void TParseContext::coopMatTypeParametersCheck(const TSourceLoc& loc, const TPub
return;
}
}
if (publicType.isTensorLayoutNV()) {
if (publicType.typeParameters == nullptr) {
error(loc, "tensorLayout missing type parameters", "", "");
return;
}
if (publicType.typeParameters->arraySizes->getNumDims() > 2) {
error(loc, "tensorLayout incorrect number of type parameters", "", "");
return;
}
if (publicType.typeParameters && publicType.typeParameters->arraySizes->getNumDims() < 2) {
while (publicType.typeParameters->arraySizes->getNumDims() < 2) {
publicType.typeParameters->arraySizes->addInnerSize(0);
}
}
}
if (publicType.isTensorViewNV()) {
if (publicType.typeParameters == nullptr) {
error(loc, "tensorView missing type parameters", "", "");
return;
}
if (publicType.typeParameters->arraySizes->getNumDims() < 1 ||
publicType.typeParameters->arraySizes->getNumDims() > 7) {
error(loc, "tensorView incorrect number of type parameters", "", "");
return;
}
if (publicType.typeParameters && publicType.typeParameters->arraySizes->getNumDims() < 7) {
uint32_t numDims = publicType.typeParameters->arraySizes->getNumDims();
while (numDims < 7) {
uint32_t dim = (numDims == 1) ? 0 : (numDims - 2);
publicType.typeParameters->arraySizes->addInnerSize(dim);
numDims++;
}
}
}
}
bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString& identifier, const TPublicType& publicType,
@@ -7837,7 +8141,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
intermediate.setUseStorageBuffer();
if (!publicType.typeParameters || !publicType.typeParameters->arraySizes ||
publicType.typeParameters->arraySizes->getNumDims() != 3) {
publicType.typeParameters->arraySizes->getNumDims() != 4) {
error(loc, "unexpected number type parameters", identifier.c_str(), "");
}
if (publicType.typeParameters) {
@@ -7868,6 +8172,14 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
error(loc, "expected 8, 16, or 32 bits for first type parameter", identifier.c_str(), "");
}
}
} else if (type.isTensorLayoutNV()) {
if (!publicType.typeParameters || publicType.typeParameters->arraySizes->getNumDims() > 2) {
error(loc, "expected 1-2 type parameters", identifier.c_str(), "");
}
} else if (type.isTensorViewNV()) {
if (!publicType.typeParameters || publicType.typeParameters->arraySizes->getNumDims() > 7) {
error(loc, "expected 1-7 type parameters", identifier.c_str(), "");
}
} else {
if (publicType.typeParameters && publicType.typeParameters->arraySizes->getNumDims() != 0) {
error(loc, "unexpected type parameters", identifier.c_str(), "");
@@ -8723,109 +9035,11 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
return nullptr;
}
node = intermediate.setAggregateOperator(node, op, type, node->getLoc());
} else if (type.sameCoopMatShape(node->getType()) && !type.sameCoopMatUse(node->getType()) &&
type.getBasicType() == node->getType().getBasicType()) {
node = intermediate.setAggregateOperator(node, op, type, node->getLoc());
} else {
TOperator op = EOpNull;
switch (type.getBasicType()) {
default:
assert(0);
break;
case EbtInt:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt; break;
case EbtFloat16: op = EOpConvFloat16ToInt; break;
case EbtUint8: op = EOpConvUint8ToInt; break;
case EbtInt8: op = EOpConvInt8ToInt; break;
case EbtUint16: op = EOpConvUint16ToInt; break;
case EbtInt16: op = EOpConvInt16ToInt; break;
case EbtUint: op = EOpConvUintToInt; break;
default: assert(0);
}
break;
case EbtUint:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint; break;
case EbtFloat16: op = EOpConvFloat16ToUint; break;
case EbtUint8: op = EOpConvUint8ToUint; break;
case EbtInt8: op = EOpConvInt8ToUint; break;
case EbtUint16: op = EOpConvUint16ToUint; break;
case EbtInt16: op = EOpConvInt16ToUint; break;
case EbtInt: op = EOpConvIntToUint; break;
default: assert(0);
}
break;
case EbtInt16:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt16; break;
case EbtFloat16: op = EOpConvFloat16ToInt16; break;
case EbtUint8: op = EOpConvUint8ToInt16; break;
case EbtInt8: op = EOpConvInt8ToInt16; break;
case EbtUint16: op = EOpConvUint16ToInt16; break;
case EbtInt: op = EOpConvIntToInt16; break;
case EbtUint: op = EOpConvUintToInt16; break;
default: assert(0);
}
break;
case EbtUint16:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint16; break;
case EbtFloat16: op = EOpConvFloat16ToUint16; break;
case EbtUint8: op = EOpConvUint8ToUint16; break;
case EbtInt8: op = EOpConvInt8ToUint16; break;
case EbtInt16: op = EOpConvInt16ToUint16; break;
case EbtInt: op = EOpConvIntToUint16; break;
case EbtUint: op = EOpConvUintToUint16; break;
default: assert(0);
}
break;
case EbtInt8:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt8; break;
case EbtFloat16: op = EOpConvFloat16ToInt8; break;
case EbtUint8: op = EOpConvUint8ToInt8; break;
case EbtInt16: op = EOpConvInt16ToInt8; break;
case EbtUint16: op = EOpConvUint16ToInt8; break;
case EbtInt: op = EOpConvIntToInt8; break;
case EbtUint: op = EOpConvUintToInt8; break;
default: assert(0);
}
break;
case EbtUint8:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint8; break;
case EbtFloat16: op = EOpConvFloat16ToUint8; break;
case EbtInt8: op = EOpConvInt8ToUint8; break;
case EbtInt16: op = EOpConvInt16ToUint8; break;
case EbtUint16: op = EOpConvUint16ToUint8; break;
case EbtInt: op = EOpConvIntToUint8; break;
case EbtUint: op = EOpConvUintToUint8; break;
default: assert(0);
}
break;
case EbtFloat:
switch (node->getType().getBasicType()) {
case EbtFloat16: op = EOpConvFloat16ToFloat; break;
case EbtInt8: op = EOpConvInt8ToFloat; break;
case EbtUint8: op = EOpConvUint8ToFloat; break;
case EbtInt16: op = EOpConvInt16ToFloat; break;
case EbtUint16: op = EOpConvUint16ToFloat; break;
case EbtInt: op = EOpConvIntToFloat; break;
case EbtUint: op = EOpConvUintToFloat; break;
default: assert(0);
}
break;
case EbtFloat16:
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToFloat16; break;
case EbtInt8: op = EOpConvInt8ToFloat16; break;
case EbtUint8: op = EOpConvUint8ToFloat16; break;
case EbtInt16: op = EOpConvInt16ToFloat16; break;
case EbtUint16: op = EOpConvUint16ToFloat16; break;
case EbtInt: op = EOpConvIntToFloat16; break;
case EbtUint: op = EOpConvUintToFloat16; break;
default: assert(0);
}
break;
}
TOperator op = EOpConvNumeric;
node = intermediate.addUnaryNode(op, node, node->getLoc(), type);
// If it's a (non-specialization) constant, it must be folded.
@@ -9605,6 +9819,15 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua
// type with an empty type list, which will be filled in later in
// TParseContext::declareBlock.
if (!symbol && qualifier.hasBufferReference()) {
// The layout qualifiers are ignored in forward declaration, give warning for the most probable to be seen
if (qualifier.hasBufferReferenceAlign()) {
warn(loc, "the buffer_reference_align layout is ignored when defined in forward declaration",
identifier.c_str(), "");
}
if (qualifier.hasPacking()) {
warn(loc, "the packing layout (scalar, std430, etc) is ignored when defined in forward declaration",
identifier.c_str(), "");
}
TTypeList typeList;
TType blockType(&typeList, identifier, qualifier);
TType blockNameType(EbtReference, blockType, identifier);

View File

@@ -384,7 +384,7 @@ public:
void globalCheck(const TSourceLoc&, const char* token);
bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&);
bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&);
void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&, const char *sizeType, const bool allowZero = false);
void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&, const char *sizeType, const bool isTypeParameter = false);
bool arrayQualifierError(const TSourceLoc&, const TQualifier&);
bool arrayError(const TSourceLoc&, const TType&);
void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&);
@@ -509,6 +509,7 @@ protected:
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
void finish() override;
void handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFunction* fnCandidate, TIntermTyped* result, TIntermNode* arguments);
virtual const char* getGlobalUniformBlockName() const override;
virtual void finalizeGlobalUniformBlockLayout(TVariable&) override;

View File

@@ -752,6 +752,10 @@ const std::unordered_map<const char*, int, str_hash, str_eq> KeywordMap {
{"hitObjectNV",HITOBJECTNV},
{"hitObjectAttributeNV",HITOBJECTATTRNV},
{"__function",FUNCTION},
{"tensorLayoutNV",TENSORLAYOUTNV},
{"tensorViewNV",TENSORVIEWNV},
};
const std::unordered_set<const char*, str_hash, str_eq> ReservedSet {
"common",
@@ -1807,6 +1811,15 @@ int TScanContext::tokenizeIdentifier()
return keyword;
return identifierOrType();
case FUNCTION:
case TENSORLAYOUTNV:
case TENSORVIEWNV:
afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() ||
parseContext.extensionTurnedOn(E_GL_NV_cooperative_matrix2))
return keyword;
return identifierOrType();
default:
parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc);
return 0;

View File

@@ -78,6 +78,8 @@ void TType::buildMangledName(TString& mangledName) const
case EbtRayQuery: mangledName += "rq"; break;
case EbtSpirvType: mangledName += "spv-t"; break;
case EbtHitObjectNV: mangledName += "ho"; break;
case EbtTensorLayoutNV: mangledName += "tl"; break;
case EbtTensorViewNV: mangledName += "tv"; break;
case EbtSampler:
switch (sampler.type) {
case EbtFloat16: mangledName += "f16"; break;
@@ -344,6 +346,7 @@ void TSymbolTableLevel::readOnly()
TSymbol::TSymbol(const TSymbol& copyOf)
{
name = NewPoolTString(copyOf.name->c_str());
mangledName = NewPoolTString(copyOf.mangledName->c_str());
uniqueId = copyOf.uniqueId;
writable = true;
}

View File

@@ -84,7 +84,8 @@ typedef TVector<const char*> TExtensionList;
class TSymbol {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { }
explicit TSymbol(const TString *n, const TString *mn) : name(n), mangledName(mn), uniqueId(0), extensions(nullptr), writable(true) { }
explicit TSymbol(const TString *n) : TSymbol(n, n) { }
virtual TSymbol* clone() const = 0;
virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool
@@ -96,7 +97,7 @@ public:
newName.append(*name);
changeName(NewPoolTString(newName.c_str()));
}
virtual const TString& getMangledName() const { return getName(); }
virtual const TString& getMangledName() const { return *mangledName; }
virtual TFunction* getAsFunction() { return nullptr; }
virtual const TFunction* getAsFunction() const { return nullptr; }
virtual TVariable* getAsVariable() { return nullptr; }
@@ -128,6 +129,7 @@ protected:
TSymbol& operator=(const TSymbol&);
const TString *name;
const TString *mangledName;
unsigned long long uniqueId; // For cross-scope comparing during code generation
// For tracking what extensions must be present
@@ -154,7 +156,9 @@ protected:
class TVariable : public TSymbol {
public:
TVariable(const TString *name, const TType& t, bool uT = false )
: TSymbol(name),
: TVariable(name, name, t, uT) {}
TVariable(const TString *name, const TString *mangledName, const TType& t, bool uT = false )
: TSymbol(name, mangledName),
userType(uT),
constSubtree(nullptr),
memberExtensions(nullptr),

View File

@@ -165,7 +165,8 @@ void TParseVersions::initializeExtensionBehavior()
const extensionData exts[] = { {E_GL_EXT_ray_tracing, EShTargetSpv_1_4},
{E_GL_NV_ray_tracing_motion_blur, EShTargetSpv_1_4},
{E_GL_EXT_mesh_shader, EShTargetSpv_1_4}
{E_GL_EXT_mesh_shader, EShTargetSpv_1_4},
{E_GL_NV_cooperative_matrix2, EShTargetSpv_1_6}
};
for (size_t ii = 0; ii < sizeof(exts) / sizeof(exts[0]); ii++) {
@@ -310,6 +311,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_NV_shader_invocation_reorder] = EBhDisable;
extensionBehavior[E_GL_NV_displacement_micromap] = EBhDisable;
extensionBehavior[E_GL_NV_shader_atomic_fp16_vector] = EBhDisable;
extensionBehavior[E_GL_NV_cooperative_matrix2] = EBhDisable;
// ARM
extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable;
@@ -574,6 +576,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_cooperative_matrix 1\n"
"#define GL_NV_integer_cooperative_matrix 1\n"
"#define GL_NV_shader_invocation_reorder 1\n"
"#define GL_NV_cooperative_matrix2 1\n"
"#define GL_QCOM_image_processing 1\n"
"#define GL_QCOM_image_processing2 1\n"
@@ -1021,6 +1024,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
else if (strcmp(extension, "GL_NV_integer_cooperative_matrix") == 0)
updateExtensionBehavior(line, "GL_NV_cooperative_matrix", behaviorString);
else if (strcmp(extension, "GL_NV_cooperative_matrix2") == 0)
updateExtensionBehavior(line, "GL_KHR_cooperative_matrix", behaviorString);
// subgroup extended types to explicit types
else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_int8") == 0)
updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int8", behaviorString);
@@ -1381,6 +1386,14 @@ void TParseVersions::coopmatCheck(const TSourceLoc& loc, const char* op, bool bu
}
}
void TParseVersions::tensorLayoutViewCheck(const TSourceLoc& loc, const char* op, bool builtIn)
{
if (!builtIn) {
const char* const extensions[] = {E_GL_NV_cooperative_matrix2};
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
}
}
// Call for any operation removed because SPIR-V is in use.
void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
{

View File

@@ -282,6 +282,7 @@ const char* const E_GL_NV_shader_invocation_reorder = "GL_NV_shader_
const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch";
const char* const E_GL_NV_displacement_micromap = "GL_NV_displacement_micromap";
const char* const E_GL_NV_shader_atomic_fp16_vector = "GL_NV_shader_atomic_fp16_vector";
const char* const E_GL_NV_cooperative_matrix2 = "GL_NV_cooperative_matrix2";
// ARM
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins";

View File

@@ -179,6 +179,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
%token <lex> COOPMAT
%token <lex> HITOBJECTNV HITOBJECTATTRNV
%token <lex> TENSORLAYOUTNV TENSORVIEWNV
// combined image/sampler
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
@@ -275,7 +276,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
%token <lex> INT64CONSTANT UINT64CONSTANT
%token <lex> SUBROUTINE DEMOTE
%token <lex> SUBROUTINE DEMOTE FUNCTION
%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
%token <lex> PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT
%token <lex> PATCH SAMPLE NONUNIFORM
@@ -3535,6 +3536,20 @@ type_specifier_nonarray
$$.coopmatNV = false;
$$.coopmatKHR = true;
}
| TENSORLAYOUTNV {
parseContext.tensorLayoutViewCheck($1.loc, "tensorLayoutNV", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtTensorLayoutNV;
}
| TENSORVIEWNV {
parseContext.tensorLayoutViewCheck($1.loc, "tensorViewNV", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtTensorViewNV;
}
| FUNCTION {
$$.init($1.loc);
$$.basicType = EbtFunction;
}
| spirv_type_specifier {
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
$$ = $1;

File diff suppressed because it is too large Load Diff

View File

@@ -220,302 +220,305 @@ extern int yydebug;
COOPMAT = 421, /* COOPMAT */
HITOBJECTNV = 422, /* HITOBJECTNV */
HITOBJECTATTRNV = 423, /* HITOBJECTATTRNV */
SAMPLERCUBEARRAY = 424, /* SAMPLERCUBEARRAY */
SAMPLERCUBEARRAYSHADOW = 425, /* SAMPLERCUBEARRAYSHADOW */
ISAMPLERCUBEARRAY = 426, /* ISAMPLERCUBEARRAY */
USAMPLERCUBEARRAY = 427, /* USAMPLERCUBEARRAY */
SAMPLER1D = 428, /* SAMPLER1D */
SAMPLER1DARRAY = 429, /* SAMPLER1DARRAY */
SAMPLER1DARRAYSHADOW = 430, /* SAMPLER1DARRAYSHADOW */
ISAMPLER1D = 431, /* ISAMPLER1D */
SAMPLER1DSHADOW = 432, /* SAMPLER1DSHADOW */
SAMPLER2DRECT = 433, /* SAMPLER2DRECT */
SAMPLER2DRECTSHADOW = 434, /* SAMPLER2DRECTSHADOW */
ISAMPLER2DRECT = 435, /* ISAMPLER2DRECT */
USAMPLER2DRECT = 436, /* USAMPLER2DRECT */
SAMPLERBUFFER = 437, /* SAMPLERBUFFER */
ISAMPLERBUFFER = 438, /* ISAMPLERBUFFER */
USAMPLERBUFFER = 439, /* USAMPLERBUFFER */
SAMPLER2DMS = 440, /* SAMPLER2DMS */
ISAMPLER2DMS = 441, /* ISAMPLER2DMS */
USAMPLER2DMS = 442, /* USAMPLER2DMS */
SAMPLER2DMSARRAY = 443, /* SAMPLER2DMSARRAY */
ISAMPLER2DMSARRAY = 444, /* ISAMPLER2DMSARRAY */
USAMPLER2DMSARRAY = 445, /* USAMPLER2DMSARRAY */
SAMPLEREXTERNALOES = 446, /* SAMPLEREXTERNALOES */
SAMPLEREXTERNAL2DY2YEXT = 447, /* SAMPLEREXTERNAL2DY2YEXT */
ISAMPLER1DARRAY = 448, /* ISAMPLER1DARRAY */
USAMPLER1D = 449, /* USAMPLER1D */
USAMPLER1DARRAY = 450, /* USAMPLER1DARRAY */
F16SAMPLER1D = 451, /* F16SAMPLER1D */
F16SAMPLER2D = 452, /* F16SAMPLER2D */
F16SAMPLER3D = 453, /* F16SAMPLER3D */
F16SAMPLER2DRECT = 454, /* F16SAMPLER2DRECT */
F16SAMPLERCUBE = 455, /* F16SAMPLERCUBE */
F16SAMPLER1DARRAY = 456, /* F16SAMPLER1DARRAY */
F16SAMPLER2DARRAY = 457, /* F16SAMPLER2DARRAY */
F16SAMPLERCUBEARRAY = 458, /* F16SAMPLERCUBEARRAY */
F16SAMPLERBUFFER = 459, /* F16SAMPLERBUFFER */
F16SAMPLER2DMS = 460, /* F16SAMPLER2DMS */
F16SAMPLER2DMSARRAY = 461, /* F16SAMPLER2DMSARRAY */
F16SAMPLER1DSHADOW = 462, /* F16SAMPLER1DSHADOW */
F16SAMPLER2DSHADOW = 463, /* F16SAMPLER2DSHADOW */
F16SAMPLER1DARRAYSHADOW = 464, /* F16SAMPLER1DARRAYSHADOW */
F16SAMPLER2DARRAYSHADOW = 465, /* F16SAMPLER2DARRAYSHADOW */
F16SAMPLER2DRECTSHADOW = 466, /* F16SAMPLER2DRECTSHADOW */
F16SAMPLERCUBESHADOW = 467, /* F16SAMPLERCUBESHADOW */
F16SAMPLERCUBEARRAYSHADOW = 468, /* F16SAMPLERCUBEARRAYSHADOW */
IMAGE1D = 469, /* IMAGE1D */
IIMAGE1D = 470, /* IIMAGE1D */
UIMAGE1D = 471, /* UIMAGE1D */
IMAGE2D = 472, /* IMAGE2D */
IIMAGE2D = 473, /* IIMAGE2D */
UIMAGE2D = 474, /* UIMAGE2D */
IMAGE3D = 475, /* IMAGE3D */
IIMAGE3D = 476, /* IIMAGE3D */
UIMAGE3D = 477, /* UIMAGE3D */
IMAGE2DRECT = 478, /* IMAGE2DRECT */
IIMAGE2DRECT = 479, /* IIMAGE2DRECT */
UIMAGE2DRECT = 480, /* UIMAGE2DRECT */
IMAGECUBE = 481, /* IMAGECUBE */
IIMAGECUBE = 482, /* IIMAGECUBE */
UIMAGECUBE = 483, /* UIMAGECUBE */
IMAGEBUFFER = 484, /* IMAGEBUFFER */
IIMAGEBUFFER = 485, /* IIMAGEBUFFER */
UIMAGEBUFFER = 486, /* UIMAGEBUFFER */
IMAGE1DARRAY = 487, /* IMAGE1DARRAY */
IIMAGE1DARRAY = 488, /* IIMAGE1DARRAY */
UIMAGE1DARRAY = 489, /* UIMAGE1DARRAY */
IMAGE2DARRAY = 490, /* IMAGE2DARRAY */
IIMAGE2DARRAY = 491, /* IIMAGE2DARRAY */
UIMAGE2DARRAY = 492, /* UIMAGE2DARRAY */
IMAGECUBEARRAY = 493, /* IMAGECUBEARRAY */
IIMAGECUBEARRAY = 494, /* IIMAGECUBEARRAY */
UIMAGECUBEARRAY = 495, /* UIMAGECUBEARRAY */
IMAGE2DMS = 496, /* IMAGE2DMS */
IIMAGE2DMS = 497, /* IIMAGE2DMS */
UIMAGE2DMS = 498, /* UIMAGE2DMS */
IMAGE2DMSARRAY = 499, /* IMAGE2DMSARRAY */
IIMAGE2DMSARRAY = 500, /* IIMAGE2DMSARRAY */
UIMAGE2DMSARRAY = 501, /* UIMAGE2DMSARRAY */
F16IMAGE1D = 502, /* F16IMAGE1D */
F16IMAGE2D = 503, /* F16IMAGE2D */
F16IMAGE3D = 504, /* F16IMAGE3D */
F16IMAGE2DRECT = 505, /* F16IMAGE2DRECT */
F16IMAGECUBE = 506, /* F16IMAGECUBE */
F16IMAGE1DARRAY = 507, /* F16IMAGE1DARRAY */
F16IMAGE2DARRAY = 508, /* F16IMAGE2DARRAY */
F16IMAGECUBEARRAY = 509, /* F16IMAGECUBEARRAY */
F16IMAGEBUFFER = 510, /* F16IMAGEBUFFER */
F16IMAGE2DMS = 511, /* F16IMAGE2DMS */
F16IMAGE2DMSARRAY = 512, /* F16IMAGE2DMSARRAY */
I64IMAGE1D = 513, /* I64IMAGE1D */
U64IMAGE1D = 514, /* U64IMAGE1D */
I64IMAGE2D = 515, /* I64IMAGE2D */
U64IMAGE2D = 516, /* U64IMAGE2D */
I64IMAGE3D = 517, /* I64IMAGE3D */
U64IMAGE3D = 518, /* U64IMAGE3D */
I64IMAGE2DRECT = 519, /* I64IMAGE2DRECT */
U64IMAGE2DRECT = 520, /* U64IMAGE2DRECT */
I64IMAGECUBE = 521, /* I64IMAGECUBE */
U64IMAGECUBE = 522, /* U64IMAGECUBE */
I64IMAGEBUFFER = 523, /* I64IMAGEBUFFER */
U64IMAGEBUFFER = 524, /* U64IMAGEBUFFER */
I64IMAGE1DARRAY = 525, /* I64IMAGE1DARRAY */
U64IMAGE1DARRAY = 526, /* U64IMAGE1DARRAY */
I64IMAGE2DARRAY = 527, /* I64IMAGE2DARRAY */
U64IMAGE2DARRAY = 528, /* U64IMAGE2DARRAY */
I64IMAGECUBEARRAY = 529, /* I64IMAGECUBEARRAY */
U64IMAGECUBEARRAY = 530, /* U64IMAGECUBEARRAY */
I64IMAGE2DMS = 531, /* I64IMAGE2DMS */
U64IMAGE2DMS = 532, /* U64IMAGE2DMS */
I64IMAGE2DMSARRAY = 533, /* I64IMAGE2DMSARRAY */
U64IMAGE2DMSARRAY = 534, /* U64IMAGE2DMSARRAY */
TEXTURECUBEARRAY = 535, /* TEXTURECUBEARRAY */
ITEXTURECUBEARRAY = 536, /* ITEXTURECUBEARRAY */
UTEXTURECUBEARRAY = 537, /* UTEXTURECUBEARRAY */
TEXTURE1D = 538, /* TEXTURE1D */
ITEXTURE1D = 539, /* ITEXTURE1D */
UTEXTURE1D = 540, /* UTEXTURE1D */
TEXTURE1DARRAY = 541, /* TEXTURE1DARRAY */
ITEXTURE1DARRAY = 542, /* ITEXTURE1DARRAY */
UTEXTURE1DARRAY = 543, /* UTEXTURE1DARRAY */
TEXTURE2DRECT = 544, /* TEXTURE2DRECT */
ITEXTURE2DRECT = 545, /* ITEXTURE2DRECT */
UTEXTURE2DRECT = 546, /* UTEXTURE2DRECT */
TEXTUREBUFFER = 547, /* TEXTUREBUFFER */
ITEXTUREBUFFER = 548, /* ITEXTUREBUFFER */
UTEXTUREBUFFER = 549, /* UTEXTUREBUFFER */
TEXTURE2DMS = 550, /* TEXTURE2DMS */
ITEXTURE2DMS = 551, /* ITEXTURE2DMS */
UTEXTURE2DMS = 552, /* UTEXTURE2DMS */
TEXTURE2DMSARRAY = 553, /* TEXTURE2DMSARRAY */
ITEXTURE2DMSARRAY = 554, /* ITEXTURE2DMSARRAY */
UTEXTURE2DMSARRAY = 555, /* UTEXTURE2DMSARRAY */
F16TEXTURE1D = 556, /* F16TEXTURE1D */
F16TEXTURE2D = 557, /* F16TEXTURE2D */
F16TEXTURE3D = 558, /* F16TEXTURE3D */
F16TEXTURE2DRECT = 559, /* F16TEXTURE2DRECT */
F16TEXTURECUBE = 560, /* F16TEXTURECUBE */
F16TEXTURE1DARRAY = 561, /* F16TEXTURE1DARRAY */
F16TEXTURE2DARRAY = 562, /* F16TEXTURE2DARRAY */
F16TEXTURECUBEARRAY = 563, /* F16TEXTURECUBEARRAY */
F16TEXTUREBUFFER = 564, /* F16TEXTUREBUFFER */
F16TEXTURE2DMS = 565, /* F16TEXTURE2DMS */
F16TEXTURE2DMSARRAY = 566, /* F16TEXTURE2DMSARRAY */
SUBPASSINPUT = 567, /* SUBPASSINPUT */
SUBPASSINPUTMS = 568, /* SUBPASSINPUTMS */
ISUBPASSINPUT = 569, /* ISUBPASSINPUT */
ISUBPASSINPUTMS = 570, /* ISUBPASSINPUTMS */
USUBPASSINPUT = 571, /* USUBPASSINPUT */
USUBPASSINPUTMS = 572, /* USUBPASSINPUTMS */
F16SUBPASSINPUT = 573, /* F16SUBPASSINPUT */
F16SUBPASSINPUTMS = 574, /* F16SUBPASSINPUTMS */
SPIRV_INSTRUCTION = 575, /* SPIRV_INSTRUCTION */
SPIRV_EXECUTION_MODE = 576, /* SPIRV_EXECUTION_MODE */
SPIRV_EXECUTION_MODE_ID = 577, /* SPIRV_EXECUTION_MODE_ID */
SPIRV_DECORATE = 578, /* SPIRV_DECORATE */
SPIRV_DECORATE_ID = 579, /* SPIRV_DECORATE_ID */
SPIRV_DECORATE_STRING = 580, /* SPIRV_DECORATE_STRING */
SPIRV_TYPE = 581, /* SPIRV_TYPE */
SPIRV_STORAGE_CLASS = 582, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 583, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 584, /* SPIRV_LITERAL */
ATTACHMENTEXT = 585, /* ATTACHMENTEXT */
IATTACHMENTEXT = 586, /* IATTACHMENTEXT */
UATTACHMENTEXT = 587, /* UATTACHMENTEXT */
LEFT_OP = 588, /* LEFT_OP */
RIGHT_OP = 589, /* RIGHT_OP */
INC_OP = 590, /* INC_OP */
DEC_OP = 591, /* DEC_OP */
LE_OP = 592, /* LE_OP */
GE_OP = 593, /* GE_OP */
EQ_OP = 594, /* EQ_OP */
NE_OP = 595, /* NE_OP */
AND_OP = 596, /* AND_OP */
OR_OP = 597, /* OR_OP */
XOR_OP = 598, /* XOR_OP */
MUL_ASSIGN = 599, /* MUL_ASSIGN */
DIV_ASSIGN = 600, /* DIV_ASSIGN */
ADD_ASSIGN = 601, /* ADD_ASSIGN */
MOD_ASSIGN = 602, /* MOD_ASSIGN */
LEFT_ASSIGN = 603, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 604, /* RIGHT_ASSIGN */
AND_ASSIGN = 605, /* AND_ASSIGN */
XOR_ASSIGN = 606, /* XOR_ASSIGN */
OR_ASSIGN = 607, /* OR_ASSIGN */
SUB_ASSIGN = 608, /* SUB_ASSIGN */
STRING_LITERAL = 609, /* STRING_LITERAL */
LEFT_PAREN = 610, /* LEFT_PAREN */
RIGHT_PAREN = 611, /* RIGHT_PAREN */
LEFT_BRACKET = 612, /* LEFT_BRACKET */
RIGHT_BRACKET = 613, /* RIGHT_BRACKET */
LEFT_BRACE = 614, /* LEFT_BRACE */
RIGHT_BRACE = 615, /* RIGHT_BRACE */
DOT = 616, /* DOT */
COMMA = 617, /* COMMA */
COLON = 618, /* COLON */
EQUAL = 619, /* EQUAL */
SEMICOLON = 620, /* SEMICOLON */
BANG = 621, /* BANG */
DASH = 622, /* DASH */
TILDE = 623, /* TILDE */
PLUS = 624, /* PLUS */
STAR = 625, /* STAR */
SLASH = 626, /* SLASH */
PERCENT = 627, /* PERCENT */
LEFT_ANGLE = 628, /* LEFT_ANGLE */
RIGHT_ANGLE = 629, /* RIGHT_ANGLE */
VERTICAL_BAR = 630, /* VERTICAL_BAR */
CARET = 631, /* CARET */
AMPERSAND = 632, /* AMPERSAND */
QUESTION = 633, /* QUESTION */
INVARIANT = 634, /* INVARIANT */
HIGH_PRECISION = 635, /* HIGH_PRECISION */
MEDIUM_PRECISION = 636, /* MEDIUM_PRECISION */
LOW_PRECISION = 637, /* LOW_PRECISION */
PRECISION = 638, /* PRECISION */
PACKED = 639, /* PACKED */
RESOURCE = 640, /* RESOURCE */
SUPERP = 641, /* SUPERP */
FLOATCONSTANT = 642, /* FLOATCONSTANT */
INTCONSTANT = 643, /* INTCONSTANT */
UINTCONSTANT = 644, /* UINTCONSTANT */
BOOLCONSTANT = 645, /* BOOLCONSTANT */
IDENTIFIER = 646, /* IDENTIFIER */
TYPE_NAME = 647, /* TYPE_NAME */
CENTROID = 648, /* CENTROID */
IN = 649, /* IN */
OUT = 650, /* OUT */
INOUT = 651, /* INOUT */
STRUCT = 652, /* STRUCT */
VOID = 653, /* VOID */
WHILE = 654, /* WHILE */
BREAK = 655, /* BREAK */
CONTINUE = 656, /* CONTINUE */
DO = 657, /* DO */
ELSE = 658, /* ELSE */
FOR = 659, /* FOR */
IF = 660, /* IF */
DISCARD = 661, /* DISCARD */
RETURN = 662, /* RETURN */
SWITCH = 663, /* SWITCH */
CASE = 664, /* CASE */
DEFAULT = 665, /* DEFAULT */
TERMINATE_INVOCATION = 666, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 667, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 668, /* IGNORE_INTERSECTION */
UNIFORM = 669, /* UNIFORM */
SHARED = 670, /* SHARED */
BUFFER = 671, /* BUFFER */
TILEIMAGEEXT = 672, /* TILEIMAGEEXT */
FLAT = 673, /* FLAT */
SMOOTH = 674, /* SMOOTH */
LAYOUT = 675, /* LAYOUT */
DOUBLECONSTANT = 676, /* DOUBLECONSTANT */
INT16CONSTANT = 677, /* INT16CONSTANT */
UINT16CONSTANT = 678, /* UINT16CONSTANT */
FLOAT16CONSTANT = 679, /* FLOAT16CONSTANT */
INT32CONSTANT = 680, /* INT32CONSTANT */
UINT32CONSTANT = 681, /* UINT32CONSTANT */
INT64CONSTANT = 682, /* INT64CONSTANT */
UINT64CONSTANT = 683, /* UINT64CONSTANT */
SUBROUTINE = 684, /* SUBROUTINE */
DEMOTE = 685, /* DEMOTE */
PAYLOADNV = 686, /* PAYLOADNV */
PAYLOADINNV = 687, /* PAYLOADINNV */
HITATTRNV = 688, /* HITATTRNV */
CALLDATANV = 689, /* CALLDATANV */
CALLDATAINNV = 690, /* CALLDATAINNV */
PAYLOADEXT = 691, /* PAYLOADEXT */
PAYLOADINEXT = 692, /* PAYLOADINEXT */
HITATTREXT = 693, /* HITATTREXT */
CALLDATAEXT = 694, /* CALLDATAEXT */
CALLDATAINEXT = 695, /* CALLDATAINEXT */
PATCH = 696, /* PATCH */
SAMPLE = 697, /* SAMPLE */
NONUNIFORM = 698, /* NONUNIFORM */
COHERENT = 699, /* COHERENT */
VOLATILE = 700, /* VOLATILE */
RESTRICT = 701, /* RESTRICT */
READONLY = 702, /* READONLY */
WRITEONLY = 703, /* WRITEONLY */
DEVICECOHERENT = 704, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 705, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 706, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 707, /* SUBGROUPCOHERENT */
NONPRIVATE = 708, /* NONPRIVATE */
SHADERCALLCOHERENT = 709, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 710, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 711, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 712, /* PERVERTEXEXT */
PERVERTEXNV = 713, /* PERVERTEXNV */
PERPRIMITIVENV = 714, /* PERPRIMITIVENV */
PERVIEWNV = 715, /* PERVIEWNV */
PERTASKNV = 716, /* PERTASKNV */
PERPRIMITIVEEXT = 717, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 718, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 719 /* PRECISE */
TENSORLAYOUTNV = 424, /* TENSORLAYOUTNV */
TENSORVIEWNV = 425, /* TENSORVIEWNV */
SAMPLERCUBEARRAY = 426, /* SAMPLERCUBEARRAY */
SAMPLERCUBEARRAYSHADOW = 427, /* SAMPLERCUBEARRAYSHADOW */
ISAMPLERCUBEARRAY = 428, /* ISAMPLERCUBEARRAY */
USAMPLERCUBEARRAY = 429, /* USAMPLERCUBEARRAY */
SAMPLER1D = 430, /* SAMPLER1D */
SAMPLER1DARRAY = 431, /* SAMPLER1DARRAY */
SAMPLER1DARRAYSHADOW = 432, /* SAMPLER1DARRAYSHADOW */
ISAMPLER1D = 433, /* ISAMPLER1D */
SAMPLER1DSHADOW = 434, /* SAMPLER1DSHADOW */
SAMPLER2DRECT = 435, /* SAMPLER2DRECT */
SAMPLER2DRECTSHADOW = 436, /* SAMPLER2DRECTSHADOW */
ISAMPLER2DRECT = 437, /* ISAMPLER2DRECT */
USAMPLER2DRECT = 438, /* USAMPLER2DRECT */
SAMPLERBUFFER = 439, /* SAMPLERBUFFER */
ISAMPLERBUFFER = 440, /* ISAMPLERBUFFER */
USAMPLERBUFFER = 441, /* USAMPLERBUFFER */
SAMPLER2DMS = 442, /* SAMPLER2DMS */
ISAMPLER2DMS = 443, /* ISAMPLER2DMS */
USAMPLER2DMS = 444, /* USAMPLER2DMS */
SAMPLER2DMSARRAY = 445, /* SAMPLER2DMSARRAY */
ISAMPLER2DMSARRAY = 446, /* ISAMPLER2DMSARRAY */
USAMPLER2DMSARRAY = 447, /* USAMPLER2DMSARRAY */
SAMPLEREXTERNALOES = 448, /* SAMPLEREXTERNALOES */
SAMPLEREXTERNAL2DY2YEXT = 449, /* SAMPLEREXTERNAL2DY2YEXT */
ISAMPLER1DARRAY = 450, /* ISAMPLER1DARRAY */
USAMPLER1D = 451, /* USAMPLER1D */
USAMPLER1DARRAY = 452, /* USAMPLER1DARRAY */
F16SAMPLER1D = 453, /* F16SAMPLER1D */
F16SAMPLER2D = 454, /* F16SAMPLER2D */
F16SAMPLER3D = 455, /* F16SAMPLER3D */
F16SAMPLER2DRECT = 456, /* F16SAMPLER2DRECT */
F16SAMPLERCUBE = 457, /* F16SAMPLERCUBE */
F16SAMPLER1DARRAY = 458, /* F16SAMPLER1DARRAY */
F16SAMPLER2DARRAY = 459, /* F16SAMPLER2DARRAY */
F16SAMPLERCUBEARRAY = 460, /* F16SAMPLERCUBEARRAY */
F16SAMPLERBUFFER = 461, /* F16SAMPLERBUFFER */
F16SAMPLER2DMS = 462, /* F16SAMPLER2DMS */
F16SAMPLER2DMSARRAY = 463, /* F16SAMPLER2DMSARRAY */
F16SAMPLER1DSHADOW = 464, /* F16SAMPLER1DSHADOW */
F16SAMPLER2DSHADOW = 465, /* F16SAMPLER2DSHADOW */
F16SAMPLER1DARRAYSHADOW = 466, /* F16SAMPLER1DARRAYSHADOW */
F16SAMPLER2DARRAYSHADOW = 467, /* F16SAMPLER2DARRAYSHADOW */
F16SAMPLER2DRECTSHADOW = 468, /* F16SAMPLER2DRECTSHADOW */
F16SAMPLERCUBESHADOW = 469, /* F16SAMPLERCUBESHADOW */
F16SAMPLERCUBEARRAYSHADOW = 470, /* F16SAMPLERCUBEARRAYSHADOW */
IMAGE1D = 471, /* IMAGE1D */
IIMAGE1D = 472, /* IIMAGE1D */
UIMAGE1D = 473, /* UIMAGE1D */
IMAGE2D = 474, /* IMAGE2D */
IIMAGE2D = 475, /* IIMAGE2D */
UIMAGE2D = 476, /* UIMAGE2D */
IMAGE3D = 477, /* IMAGE3D */
IIMAGE3D = 478, /* IIMAGE3D */
UIMAGE3D = 479, /* UIMAGE3D */
IMAGE2DRECT = 480, /* IMAGE2DRECT */
IIMAGE2DRECT = 481, /* IIMAGE2DRECT */
UIMAGE2DRECT = 482, /* UIMAGE2DRECT */
IMAGECUBE = 483, /* IMAGECUBE */
IIMAGECUBE = 484, /* IIMAGECUBE */
UIMAGECUBE = 485, /* UIMAGECUBE */
IMAGEBUFFER = 486, /* IMAGEBUFFER */
IIMAGEBUFFER = 487, /* IIMAGEBUFFER */
UIMAGEBUFFER = 488, /* UIMAGEBUFFER */
IMAGE1DARRAY = 489, /* IMAGE1DARRAY */
IIMAGE1DARRAY = 490, /* IIMAGE1DARRAY */
UIMAGE1DARRAY = 491, /* UIMAGE1DARRAY */
IMAGE2DARRAY = 492, /* IMAGE2DARRAY */
IIMAGE2DARRAY = 493, /* IIMAGE2DARRAY */
UIMAGE2DARRAY = 494, /* UIMAGE2DARRAY */
IMAGECUBEARRAY = 495, /* IMAGECUBEARRAY */
IIMAGECUBEARRAY = 496, /* IIMAGECUBEARRAY */
UIMAGECUBEARRAY = 497, /* UIMAGECUBEARRAY */
IMAGE2DMS = 498, /* IMAGE2DMS */
IIMAGE2DMS = 499, /* IIMAGE2DMS */
UIMAGE2DMS = 500, /* UIMAGE2DMS */
IMAGE2DMSARRAY = 501, /* IMAGE2DMSARRAY */
IIMAGE2DMSARRAY = 502, /* IIMAGE2DMSARRAY */
UIMAGE2DMSARRAY = 503, /* UIMAGE2DMSARRAY */
F16IMAGE1D = 504, /* F16IMAGE1D */
F16IMAGE2D = 505, /* F16IMAGE2D */
F16IMAGE3D = 506, /* F16IMAGE3D */
F16IMAGE2DRECT = 507, /* F16IMAGE2DRECT */
F16IMAGECUBE = 508, /* F16IMAGECUBE */
F16IMAGE1DARRAY = 509, /* F16IMAGE1DARRAY */
F16IMAGE2DARRAY = 510, /* F16IMAGE2DARRAY */
F16IMAGECUBEARRAY = 511, /* F16IMAGECUBEARRAY */
F16IMAGEBUFFER = 512, /* F16IMAGEBUFFER */
F16IMAGE2DMS = 513, /* F16IMAGE2DMS */
F16IMAGE2DMSARRAY = 514, /* F16IMAGE2DMSARRAY */
I64IMAGE1D = 515, /* I64IMAGE1D */
U64IMAGE1D = 516, /* U64IMAGE1D */
I64IMAGE2D = 517, /* I64IMAGE2D */
U64IMAGE2D = 518, /* U64IMAGE2D */
I64IMAGE3D = 519, /* I64IMAGE3D */
U64IMAGE3D = 520, /* U64IMAGE3D */
I64IMAGE2DRECT = 521, /* I64IMAGE2DRECT */
U64IMAGE2DRECT = 522, /* U64IMAGE2DRECT */
I64IMAGECUBE = 523, /* I64IMAGECUBE */
U64IMAGECUBE = 524, /* U64IMAGECUBE */
I64IMAGEBUFFER = 525, /* I64IMAGEBUFFER */
U64IMAGEBUFFER = 526, /* U64IMAGEBUFFER */
I64IMAGE1DARRAY = 527, /* I64IMAGE1DARRAY */
U64IMAGE1DARRAY = 528, /* U64IMAGE1DARRAY */
I64IMAGE2DARRAY = 529, /* I64IMAGE2DARRAY */
U64IMAGE2DARRAY = 530, /* U64IMAGE2DARRAY */
I64IMAGECUBEARRAY = 531, /* I64IMAGECUBEARRAY */
U64IMAGECUBEARRAY = 532, /* U64IMAGECUBEARRAY */
I64IMAGE2DMS = 533, /* I64IMAGE2DMS */
U64IMAGE2DMS = 534, /* U64IMAGE2DMS */
I64IMAGE2DMSARRAY = 535, /* I64IMAGE2DMSARRAY */
U64IMAGE2DMSARRAY = 536, /* U64IMAGE2DMSARRAY */
TEXTURECUBEARRAY = 537, /* TEXTURECUBEARRAY */
ITEXTURECUBEARRAY = 538, /* ITEXTURECUBEARRAY */
UTEXTURECUBEARRAY = 539, /* UTEXTURECUBEARRAY */
TEXTURE1D = 540, /* TEXTURE1D */
ITEXTURE1D = 541, /* ITEXTURE1D */
UTEXTURE1D = 542, /* UTEXTURE1D */
TEXTURE1DARRAY = 543, /* TEXTURE1DARRAY */
ITEXTURE1DARRAY = 544, /* ITEXTURE1DARRAY */
UTEXTURE1DARRAY = 545, /* UTEXTURE1DARRAY */
TEXTURE2DRECT = 546, /* TEXTURE2DRECT */
ITEXTURE2DRECT = 547, /* ITEXTURE2DRECT */
UTEXTURE2DRECT = 548, /* UTEXTURE2DRECT */
TEXTUREBUFFER = 549, /* TEXTUREBUFFER */
ITEXTUREBUFFER = 550, /* ITEXTUREBUFFER */
UTEXTUREBUFFER = 551, /* UTEXTUREBUFFER */
TEXTURE2DMS = 552, /* TEXTURE2DMS */
ITEXTURE2DMS = 553, /* ITEXTURE2DMS */
UTEXTURE2DMS = 554, /* UTEXTURE2DMS */
TEXTURE2DMSARRAY = 555, /* TEXTURE2DMSARRAY */
ITEXTURE2DMSARRAY = 556, /* ITEXTURE2DMSARRAY */
UTEXTURE2DMSARRAY = 557, /* UTEXTURE2DMSARRAY */
F16TEXTURE1D = 558, /* F16TEXTURE1D */
F16TEXTURE2D = 559, /* F16TEXTURE2D */
F16TEXTURE3D = 560, /* F16TEXTURE3D */
F16TEXTURE2DRECT = 561, /* F16TEXTURE2DRECT */
F16TEXTURECUBE = 562, /* F16TEXTURECUBE */
F16TEXTURE1DARRAY = 563, /* F16TEXTURE1DARRAY */
F16TEXTURE2DARRAY = 564, /* F16TEXTURE2DARRAY */
F16TEXTURECUBEARRAY = 565, /* F16TEXTURECUBEARRAY */
F16TEXTUREBUFFER = 566, /* F16TEXTUREBUFFER */
F16TEXTURE2DMS = 567, /* F16TEXTURE2DMS */
F16TEXTURE2DMSARRAY = 568, /* F16TEXTURE2DMSARRAY */
SUBPASSINPUT = 569, /* SUBPASSINPUT */
SUBPASSINPUTMS = 570, /* SUBPASSINPUTMS */
ISUBPASSINPUT = 571, /* ISUBPASSINPUT */
ISUBPASSINPUTMS = 572, /* ISUBPASSINPUTMS */
USUBPASSINPUT = 573, /* USUBPASSINPUT */
USUBPASSINPUTMS = 574, /* USUBPASSINPUTMS */
F16SUBPASSINPUT = 575, /* F16SUBPASSINPUT */
F16SUBPASSINPUTMS = 576, /* F16SUBPASSINPUTMS */
SPIRV_INSTRUCTION = 577, /* SPIRV_INSTRUCTION */
SPIRV_EXECUTION_MODE = 578, /* SPIRV_EXECUTION_MODE */
SPIRV_EXECUTION_MODE_ID = 579, /* SPIRV_EXECUTION_MODE_ID */
SPIRV_DECORATE = 580, /* SPIRV_DECORATE */
SPIRV_DECORATE_ID = 581, /* SPIRV_DECORATE_ID */
SPIRV_DECORATE_STRING = 582, /* SPIRV_DECORATE_STRING */
SPIRV_TYPE = 583, /* SPIRV_TYPE */
SPIRV_STORAGE_CLASS = 584, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 585, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 586, /* SPIRV_LITERAL */
ATTACHMENTEXT = 587, /* ATTACHMENTEXT */
IATTACHMENTEXT = 588, /* IATTACHMENTEXT */
UATTACHMENTEXT = 589, /* UATTACHMENTEXT */
LEFT_OP = 590, /* LEFT_OP */
RIGHT_OP = 591, /* RIGHT_OP */
INC_OP = 592, /* INC_OP */
DEC_OP = 593, /* DEC_OP */
LE_OP = 594, /* LE_OP */
GE_OP = 595, /* GE_OP */
EQ_OP = 596, /* EQ_OP */
NE_OP = 597, /* NE_OP */
AND_OP = 598, /* AND_OP */
OR_OP = 599, /* OR_OP */
XOR_OP = 600, /* XOR_OP */
MUL_ASSIGN = 601, /* MUL_ASSIGN */
DIV_ASSIGN = 602, /* DIV_ASSIGN */
ADD_ASSIGN = 603, /* ADD_ASSIGN */
MOD_ASSIGN = 604, /* MOD_ASSIGN */
LEFT_ASSIGN = 605, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 606, /* RIGHT_ASSIGN */
AND_ASSIGN = 607, /* AND_ASSIGN */
XOR_ASSIGN = 608, /* XOR_ASSIGN */
OR_ASSIGN = 609, /* OR_ASSIGN */
SUB_ASSIGN = 610, /* SUB_ASSIGN */
STRING_LITERAL = 611, /* STRING_LITERAL */
LEFT_PAREN = 612, /* LEFT_PAREN */
RIGHT_PAREN = 613, /* RIGHT_PAREN */
LEFT_BRACKET = 614, /* LEFT_BRACKET */
RIGHT_BRACKET = 615, /* RIGHT_BRACKET */
LEFT_BRACE = 616, /* LEFT_BRACE */
RIGHT_BRACE = 617, /* RIGHT_BRACE */
DOT = 618, /* DOT */
COMMA = 619, /* COMMA */
COLON = 620, /* COLON */
EQUAL = 621, /* EQUAL */
SEMICOLON = 622, /* SEMICOLON */
BANG = 623, /* BANG */
DASH = 624, /* DASH */
TILDE = 625, /* TILDE */
PLUS = 626, /* PLUS */
STAR = 627, /* STAR */
SLASH = 628, /* SLASH */
PERCENT = 629, /* PERCENT */
LEFT_ANGLE = 630, /* LEFT_ANGLE */
RIGHT_ANGLE = 631, /* RIGHT_ANGLE */
VERTICAL_BAR = 632, /* VERTICAL_BAR */
CARET = 633, /* CARET */
AMPERSAND = 634, /* AMPERSAND */
QUESTION = 635, /* QUESTION */
INVARIANT = 636, /* INVARIANT */
HIGH_PRECISION = 637, /* HIGH_PRECISION */
MEDIUM_PRECISION = 638, /* MEDIUM_PRECISION */
LOW_PRECISION = 639, /* LOW_PRECISION */
PRECISION = 640, /* PRECISION */
PACKED = 641, /* PACKED */
RESOURCE = 642, /* RESOURCE */
SUPERP = 643, /* SUPERP */
FLOATCONSTANT = 644, /* FLOATCONSTANT */
INTCONSTANT = 645, /* INTCONSTANT */
UINTCONSTANT = 646, /* UINTCONSTANT */
BOOLCONSTANT = 647, /* BOOLCONSTANT */
IDENTIFIER = 648, /* IDENTIFIER */
TYPE_NAME = 649, /* TYPE_NAME */
CENTROID = 650, /* CENTROID */
IN = 651, /* IN */
OUT = 652, /* OUT */
INOUT = 653, /* INOUT */
STRUCT = 654, /* STRUCT */
VOID = 655, /* VOID */
WHILE = 656, /* WHILE */
BREAK = 657, /* BREAK */
CONTINUE = 658, /* CONTINUE */
DO = 659, /* DO */
ELSE = 660, /* ELSE */
FOR = 661, /* FOR */
IF = 662, /* IF */
DISCARD = 663, /* DISCARD */
RETURN = 664, /* RETURN */
SWITCH = 665, /* SWITCH */
CASE = 666, /* CASE */
DEFAULT = 667, /* DEFAULT */
TERMINATE_INVOCATION = 668, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 669, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 670, /* IGNORE_INTERSECTION */
UNIFORM = 671, /* UNIFORM */
SHARED = 672, /* SHARED */
BUFFER = 673, /* BUFFER */
TILEIMAGEEXT = 674, /* TILEIMAGEEXT */
FLAT = 675, /* FLAT */
SMOOTH = 676, /* SMOOTH */
LAYOUT = 677, /* LAYOUT */
DOUBLECONSTANT = 678, /* DOUBLECONSTANT */
INT16CONSTANT = 679, /* INT16CONSTANT */
UINT16CONSTANT = 680, /* UINT16CONSTANT */
FLOAT16CONSTANT = 681, /* FLOAT16CONSTANT */
INT32CONSTANT = 682, /* INT32CONSTANT */
UINT32CONSTANT = 683, /* UINT32CONSTANT */
INT64CONSTANT = 684, /* INT64CONSTANT */
UINT64CONSTANT = 685, /* UINT64CONSTANT */
SUBROUTINE = 686, /* SUBROUTINE */
DEMOTE = 687, /* DEMOTE */
FUNCTION = 688, /* FUNCTION */
PAYLOADNV = 689, /* PAYLOADNV */
PAYLOADINNV = 690, /* PAYLOADINNV */
HITATTRNV = 691, /* HITATTRNV */
CALLDATANV = 692, /* CALLDATANV */
CALLDATAINNV = 693, /* CALLDATAINNV */
PAYLOADEXT = 694, /* PAYLOADEXT */
PAYLOADINEXT = 695, /* PAYLOADINEXT */
HITATTREXT = 696, /* HITATTREXT */
CALLDATAEXT = 697, /* CALLDATAEXT */
CALLDATAINEXT = 698, /* CALLDATAINEXT */
PATCH = 699, /* PATCH */
SAMPLE = 700, /* SAMPLE */
NONUNIFORM = 701, /* NONUNIFORM */
COHERENT = 702, /* COHERENT */
VOLATILE = 703, /* VOLATILE */
RESTRICT = 704, /* RESTRICT */
READONLY = 705, /* READONLY */
WRITEONLY = 706, /* WRITEONLY */
DEVICECOHERENT = 707, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 708, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 709, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 710, /* SUBGROUPCOHERENT */
NONPRIVATE = 711, /* NONPRIVATE */
SHADERCALLCOHERENT = 712, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 713, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 714, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 715, /* PERVERTEXEXT */
PERVERTEXNV = 716, /* PERVERTEXNV */
PERPRIMITIVENV = 717, /* PERPRIMITIVENV */
PERVIEWNV = 718, /* PERVIEWNV */
PERTASKNV = 719, /* PERTASKNV */
PERPRIMITIVEEXT = 720, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 721, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 722 /* PRECISE */
};
typedef enum yytokentype yytoken_kind_t;
#endif
@@ -563,7 +566,7 @@ union YYSTYPE
glslang::TTypeParameters* typeParameters;
} interm;
#line 567 "MachineIndependent/glslang_tab.cpp.h"
#line 570 "MachineIndependent/glslang_tab.cpp.h"
};
typedef union YYSTYPE YYSTYPE;

View File

@@ -204,6 +204,13 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
OutputTreeText(out, node, depth);
if (IsOpNumericConv(node->getAsOperator()->getOp())) {
out.debug << "Convert " << TType::getBasicString(node->getOperand()->getType().getBasicType()) << " to " << TType::getBasicString(node->getType().getBasicType());
out.debug << " (" << node->getCompleteString() << ")";
out.debug << "\n";
return true;
}
switch (node->getOp()) {
case EOpNegative: out.debug << "Negate value"; break;
case EOpVectorLogicalNot:
@@ -216,192 +223,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpPreDecrement: out.debug << "Pre-Decrement"; break;
case EOpCopyObject: out.debug << "copy object"; break;
// * -> bool
case EOpConvInt8ToBool: out.debug << "Convert int8_t to bool"; break;
case EOpConvUint8ToBool: out.debug << "Convert uint8_t to bool"; break;
case EOpConvInt16ToBool: out.debug << "Convert int16_t to bool"; break;
case EOpConvUint16ToBool: out.debug << "Convert uint16_t to bool";break;
case EOpConvIntToBool: out.debug << "Convert int to bool"; break;
case EOpConvUintToBool: out.debug << "Convert uint to bool"; break;
case EOpConvInt64ToBool: out.debug << "Convert int64 to bool"; break;
case EOpConvUint64ToBool: out.debug << "Convert uint64 to bool"; break;
case EOpConvFloat16ToBool: out.debug << "Convert float16_t to bool"; break;
case EOpConvFloatToBool: out.debug << "Convert float to bool"; break;
case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break;
// bool -> *
case EOpConvBoolToInt8: out.debug << "Convert bool to int8_t"; break;
case EOpConvBoolToUint8: out.debug << "Convert bool to uint8_t"; break;
case EOpConvBoolToInt16: out.debug << "Convert bool to in16t_t"; break;
case EOpConvBoolToUint16: out.debug << "Convert bool to uint16_t";break;
case EOpConvBoolToInt: out.debug << "Convert bool to int" ; break;
case EOpConvBoolToUint: out.debug << "Convert bool to uint"; break;
case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break;
case EOpConvBoolToUint64: out.debug << "Convert bool to uint64";break;
case EOpConvBoolToFloat16: out.debug << "Convert bool to float16_t"; break;
case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break;
case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break;
// int8_t -> (u)int*
case EOpConvInt8ToInt16: out.debug << "Convert int8_t to int16_t";break;
case EOpConvInt8ToInt: out.debug << "Convert int8_t to int"; break;
case EOpConvInt8ToInt64: out.debug << "Convert int8_t to int64"; break;
case EOpConvInt8ToUint8: out.debug << "Convert int8_t to uint8_t";break;
case EOpConvInt8ToUint16: out.debug << "Convert int8_t to uint16_t";break;
case EOpConvInt8ToUint: out.debug << "Convert int8_t to uint"; break;
case EOpConvInt8ToUint64: out.debug << "Convert int8_t to uint64"; break;
// uint8_t -> (u)int*
case EOpConvUint8ToInt8: out.debug << "Convert uint8_t to int8_t";break;
case EOpConvUint8ToInt16: out.debug << "Convert uint8_t to int16_t";break;
case EOpConvUint8ToInt: out.debug << "Convert uint8_t to int"; break;
case EOpConvUint8ToInt64: out.debug << "Convert uint8_t to int64"; break;
case EOpConvUint8ToUint16: out.debug << "Convert uint8_t to uint16_t";break;
case EOpConvUint8ToUint: out.debug << "Convert uint8_t to uint"; break;
case EOpConvUint8ToUint64: out.debug << "Convert uint8_t to uint64"; break;
// int8_t -> float*
case EOpConvInt8ToFloat16: out.debug << "Convert int8_t to float16_t";break;
case EOpConvInt8ToFloat: out.debug << "Convert int8_t to float"; break;
case EOpConvInt8ToDouble: out.debug << "Convert int8_t to double"; break;
// uint8_t -> float*
case EOpConvUint8ToFloat16: out.debug << "Convert uint8_t to float16_t";break;
case EOpConvUint8ToFloat: out.debug << "Convert uint8_t to float"; break;
case EOpConvUint8ToDouble: out.debug << "Convert uint8_t to double"; break;
// int16_t -> (u)int*
case EOpConvInt16ToInt8: out.debug << "Convert int16_t to int8_t";break;
case EOpConvInt16ToInt: out.debug << "Convert int16_t to int"; break;
case EOpConvInt16ToInt64: out.debug << "Convert int16_t to int64"; break;
case EOpConvInt16ToUint8: out.debug << "Convert int16_t to uint8_t";break;
case EOpConvInt16ToUint16: out.debug << "Convert int16_t to uint16_t";break;
case EOpConvInt16ToUint: out.debug << "Convert int16_t to uint"; break;
case EOpConvInt16ToUint64: out.debug << "Convert int16_t to uint64"; break;
// int16_t -> float*
case EOpConvInt16ToFloat16: out.debug << "Convert int16_t to float16_t";break;
case EOpConvInt16ToFloat: out.debug << "Convert int16_t to float"; break;
case EOpConvInt16ToDouble: out.debug << "Convert int16_t to double"; break;
// uint16_t -> (u)int*
case EOpConvUint16ToInt8: out.debug << "Convert uint16_t to int8_t";break;
case EOpConvUint16ToInt16: out.debug << "Convert uint16_t to int16_t";break;
case EOpConvUint16ToInt: out.debug << "Convert uint16_t to int"; break;
case EOpConvUint16ToInt64: out.debug << "Convert uint16_t to int64"; break;
case EOpConvUint16ToUint8: out.debug << "Convert uint16_t to uint8_t";break;
case EOpConvUint16ToUint: out.debug << "Convert uint16_t to uint"; break;
case EOpConvUint16ToUint64: out.debug << "Convert uint16_t to uint64"; break;
// uint16_t -> float*
case EOpConvUint16ToFloat16: out.debug << "Convert uint16_t to float16_t";break;
case EOpConvUint16ToFloat: out.debug << "Convert uint16_t to float"; break;
case EOpConvUint16ToDouble: out.debug << "Convert uint16_t to double"; break;
// int32_t -> (u)int*
case EOpConvIntToInt8: out.debug << "Convert int to int8_t";break;
case EOpConvIntToInt16: out.debug << "Convert int to int16_t";break;
case EOpConvIntToInt64: out.debug << "Convert int to int64"; break;
case EOpConvIntToUint8: out.debug << "Convert int to uint8_t";break;
case EOpConvIntToUint16: out.debug << "Convert int to uint16_t";break;
case EOpConvIntToUint: out.debug << "Convert int to uint"; break;
case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break;
// int32_t -> float*
case EOpConvIntToFloat16: out.debug << "Convert int to float16_t";break;
case EOpConvIntToFloat: out.debug << "Convert int to float"; break;
case EOpConvIntToDouble: out.debug << "Convert int to double"; break;
// uint32_t -> (u)int*
case EOpConvUintToInt8: out.debug << "Convert uint to int8_t";break;
case EOpConvUintToInt16: out.debug << "Convert uint to int16_t";break;
case EOpConvUintToInt: out.debug << "Convert uint to int";break;
case EOpConvUintToInt64: out.debug << "Convert uint to int64"; break;
case EOpConvUintToUint8: out.debug << "Convert uint to uint8_t";break;
case EOpConvUintToUint16: out.debug << "Convert uint to uint16_t";break;
case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break;
// uint32_t -> float*
case EOpConvUintToFloat16: out.debug << "Convert uint to float16_t";break;
case EOpConvUintToFloat: out.debug << "Convert uint to float"; break;
case EOpConvUintToDouble: out.debug << "Convert uint to double"; break;
// int64 -> (u)int*
case EOpConvInt64ToInt8: out.debug << "Convert int64 to int8_t"; break;
case EOpConvInt64ToInt16: out.debug << "Convert int64 to int16_t"; break;
case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break;
case EOpConvInt64ToUint8: out.debug << "Convert int64 to uint8_t";break;
case EOpConvInt64ToUint16: out.debug << "Convert int64 to uint16_t";break;
case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break;
case EOpConvInt64ToUint64: out.debug << "Convert int64 to uint64"; break;
// int64 -> float*
case EOpConvInt64ToFloat16: out.debug << "Convert int64 to float16_t";break;
case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break;
case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break;
// uint64 -> (u)int*
case EOpConvUint64ToInt8: out.debug << "Convert uint64 to int8_t";break;
case EOpConvUint64ToInt16: out.debug << "Convert uint64 to int16_t";break;
case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break;
case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break;
case EOpConvUint64ToUint8: out.debug << "Convert uint64 to uint8_t";break;
case EOpConvUint64ToUint16: out.debug << "Convert uint64 to uint16"; break;
case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break;
// uint64 -> float*
case EOpConvUint64ToFloat16: out.debug << "Convert uint64 to float16_t";break;
case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break;
case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break;
// float16_t -> int*
case EOpConvFloat16ToInt8: out.debug << "Convert float16_t to int8_t"; break;
case EOpConvFloat16ToInt16: out.debug << "Convert float16_t to int16_t"; break;
case EOpConvFloat16ToInt: out.debug << "Convert float16_t to int"; break;
case EOpConvFloat16ToInt64: out.debug << "Convert float16_t to int64"; break;
// float16_t -> uint*
case EOpConvFloat16ToUint8: out.debug << "Convert float16_t to uint8_t"; break;
case EOpConvFloat16ToUint16: out.debug << "Convert float16_t to uint16_t"; break;
case EOpConvFloat16ToUint: out.debug << "Convert float16_t to uint"; break;
case EOpConvFloat16ToUint64: out.debug << "Convert float16_t to uint64"; break;
// float16_t -> float*
case EOpConvFloat16ToFloat: out.debug << "Convert float16_t to float"; break;
case EOpConvFloat16ToDouble: out.debug << "Convert float16_t to double"; break;
// float32 -> float*
case EOpConvFloatToFloat16: out.debug << "Convert float to float16_t"; break;
case EOpConvFloatToDouble: out.debug << "Convert float to double"; break;
// float32_t -> int*
case EOpConvFloatToInt8: out.debug << "Convert float to int8_t"; break;
case EOpConvFloatToInt16: out.debug << "Convert float to int16_t"; break;
case EOpConvFloatToInt: out.debug << "Convert float to int"; break;
case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break;
// float32_t -> uint*
case EOpConvFloatToUint8: out.debug << "Convert float to uint8_t"; break;
case EOpConvFloatToUint16: out.debug << "Convert float to uint16_t"; break;
case EOpConvFloatToUint: out.debug << "Convert float to uint"; break;
case EOpConvFloatToUint64: out.debug << "Convert float to uint64"; break;
// double -> float*
case EOpConvDoubleToFloat16: out.debug << "Convert double to float16_t"; break;
case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break;
// double -> int*
case EOpConvDoubleToInt8: out.debug << "Convert double to int8_t"; break;
case EOpConvDoubleToInt16: out.debug << "Convert double to int16_t"; break;
case EOpConvDoubleToInt: out.debug << "Convert double to int"; break;
case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break;
// float32_t -> uint*
case EOpConvDoubleToUint8: out.debug << "Convert double to uint8_t"; break;
case EOpConvDoubleToUint16: out.debug << "Convert double to uint16_t"; break;
case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break;
case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break;
case EOpConvUint64ToPtr: out.debug << "Convert uint64_t to pointer"; break;
case EOpConvPtrToUint64: out.debug << "Convert pointer to uint64_t"; break;
@@ -673,6 +494,17 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
case EOpCreateTensorLayoutNV: out.debug << "createTensorLayoutNV"; break;
case EOpTensorLayoutSetBlockSizeNV: out.debug << "setTensorLayoutBlockSizeNV"; break;
case EOpTensorLayoutSetDimensionNV: out.debug << "setTensorLayoutDimensionNV"; break;
case EOpTensorLayoutSetStrideNV: out.debug << "setTensorLayoutStrideNV"; break;
case EOpTensorLayoutSliceNV: out.debug << "sliceTensorLayoutNV"; break;
case EOpTensorLayoutSetClampValueNV: out.debug << "setTensorLayoutClampValueNV"; break;
case EOpCreateTensorViewNV: out.debug << "createTensorViewNV"; break;
case EOpTensorViewSetDimensionNV: out.debug << "setTensorViewDimensionsNV"; break;
case EOpTensorViewSetStrideNV: out.debug << "setTensorViewStrideNV"; break;
case EOpTensorViewSetClipNV: out.debug << "setTensorViewClipNV"; break;
default: out.debug.message(EPrefixError, "Bad unary op");
}
@@ -1113,7 +945,12 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpCooperativeMatrixMulAdd: out.debug << "MulAdd cooperative matrices KHR"; break;
case EOpCooperativeMatrixLoadNV: out.debug << "Load cooperative matrix NV"; break;
case EOpCooperativeMatrixStoreNV: out.debug << "Store cooperative matrix NV"; break;
case EOpCooperativeMatrixLoadTensorNV: out.debug << "Load cooperative matrix tensor NV"; break;
case EOpCooperativeMatrixStoreTensorNV: out.debug << "Store cooperative matrix tensor NV"; break;
case EOpCooperativeMatrixMulAddNV: out.debug << "MulAdd cooperative matrices NV"; break;
case EOpCooperativeMatrixReduceNV: out.debug << "Reduce cooperative matrices"; break;
case EOpCooperativeMatrixPerElementOpNV: out.debug << "cooperative matrix per element op"; break;
case EOpCooperativeMatrixTransposeNV: out.debug << "Transpose cooperative matrix"; break;
case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break;
case EOpDebugPrintf: out.debug << "Debug printf"; break;
@@ -1156,6 +993,17 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break;
case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break;
case EOpCreateTensorLayoutNV: out.debug << "createTensorLayout"; break;
case EOpTensorLayoutSetBlockSizeNV: out.debug << "setBlockSize"; break;
case EOpTensorLayoutSetDimensionNV: out.debug << "setDimension"; break;
case EOpTensorLayoutSetStrideNV: out.debug << "setStride"; break;
case EOpTensorLayoutSliceNV: out.debug << "slice"; break;
case EOpTensorLayoutSetClampValueNV: out.debug << "setClampValue"; break;
case EOpCreateTensorViewNV: out.debug << "createTensorView"; break;
case EOpTensorViewSetDimensionNV: out.debug << "setTensorViewDimensions"; break;
case EOpTensorViewSetStrideNV: out.debug << "setTensorViewStride"; break;
case EOpTensorViewSetClipNV: out.debug << "clipTensorView"; break;
default: out.debug.message(EPrefixError, "Bad aggregation op");
}

View File

@@ -65,7 +65,7 @@ struct TVarEntryInfo {
long long id;
TIntermSymbol* symbol;
bool live;
bool upgradedToPushConstant;
TLayoutPacking upgradedToPushConstantPacking; // ElpNone means it hasn't been upgraded
int newBinding;
int newSet;
int newLocation;
@@ -74,7 +74,7 @@ struct TVarEntryInfo {
EShLanguage stage;
void clearNewAssignments() {
upgradedToPushConstant = false;
upgradedToPushConstantPacking = ElpNone;
newBinding = -1;
newSet = -1;
newLocation = -1;
@@ -246,8 +246,11 @@ public:
base->getWritableType().getQualifier().layoutComponent = at->second.newComponent;
if (at->second.newIndex != -1)
base->getWritableType().getQualifier().layoutIndex = at->second.newIndex;
if (at->second.upgradedToPushConstant)
if (at->second.upgradedToPushConstantPacking != ElpNone) {
base->getWritableType().getQualifier().layoutPushConstant = true;
base->getWritableType().getQualifier().setBlockStorage(EbsPushConstant);
base->getWritableType().getQualifier().layoutPacking = at->second.upgradedToPushConstantPacking;
}
}
private:
@@ -1810,7 +1813,8 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
std::for_each(uniformVector.begin(), uniformVector.end(),
[this](TVarLivePair& p) {
if (p.first == autoPushConstantBlockName) {
p.second.upgradedToPushConstant = true;
p.second.upgradedToPushConstantPacking = autoPushConstantBlockPacking;
p.second.newSet = TQualifier::layoutSetEnd;
}
});
}
@@ -1823,8 +1827,8 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
std::for_each(uniformVector.begin(), uniformVector.end(), [pUniformVarMap, stage](TVarLivePair p) {
auto at = pUniformVarMap[stage]->find(p.second.symbol->getAccessName());
if (at != pUniformVarMap[stage]->end() && at->second.id == p.second.id){
if (p.second.upgradedToPushConstant) {
at->second.upgradedToPushConstant = true;
if (p.second.upgradedToPushConstantPacking != ElpNone) {
at->second.upgradedToPushConstantPacking = p.second.upgradedToPushConstantPacking;
} else {
int resolvedBinding = at->second.newBinding;
at->second = p.second;

View File

@@ -46,6 +46,7 @@
// even if no merging was done (i.e., the stage was only one compilation unit).
//
#include "glslang/Public/ShaderLang.h"
#include "localintermediate.h"
#include "../Include/InfoSink.h"
#include "SymbolTable.h"
@@ -59,10 +60,12 @@ namespace glslang {
void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage unitStage)
{
infoSink.info.prefix(EPrefixError);
if (unitStage < EShLangCount)
infoSink.info << "Linking " << StageName(getStage()) << " and " << StageName(unitStage) << " stages: " << message << "\n";
else
if (unitStage == EShLangCount)
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
else if (language == EShLangCount)
infoSink.info << "Linking " << StageName(unitStage) << " stage: " << message << "\n";
else
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
++numErrors;
}
@@ -71,10 +74,12 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage
void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage unitStage)
{
infoSink.info.prefix(EPrefixWarning);
if (unitStage < EShLangCount)
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
else
if (unitStage == EShLangCount)
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
else if (language == EShLangCount)
infoSink.info << "Linking " << StageName(unitStage) << " stage: " << message << "\n";
else
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
}
// TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block
@@ -114,7 +119,9 @@ void TIntermediate::mergeUniformObjects(TInfoSink& infoSink, TIntermediate& unit
mergeLinkerObjects(infoSink, linkerObjects, unitLinkerObjects, unit.getStage());
}
static inline bool isSameInterface(TIntermSymbol* symbol, EShLanguage stage, TIntermSymbol* unitSymbol, EShLanguage unitStage) {
static inline bool isSameInterface(TIntermSymbol* symbol, TIntermSymbol* unitSymbol) {
EShLanguage stage = symbol->getStage();
EShLanguage unitStage = unitSymbol->getStage();
return // 1) same stage and same shader interface
(stage == unitStage && symbol->getType().getShaderInterface() == unitSymbol->getType().getShaderInterface()) ||
// 2) accross stages and both are uniform or buffer
@@ -125,11 +132,11 @@ static inline bool isSameInterface(TIntermSymbol* symbol, EShLanguage stage, TIn
(unitStage < stage && symbol->getQualifier().storage == EvqVaryingIn && unitSymbol->getQualifier().storage == EvqVaryingOut);
}
static bool isSameSymbol(TIntermSymbol* symbol1, EShLanguage stage1, TIntermSymbol* symbol2, EShLanguage stage2) {
static bool isSameSymbol(TIntermSymbol* symbol1, TIntermSymbol* symbol2) {
// If they are both blocks in the same shader interface,
// match by the block-name, not the identifier name.
if (symbol1->getType().getBasicType() == EbtBlock && symbol2->getType().getBasicType() == EbtBlock) {
if (isSameInterface(symbol1, stage1, symbol2, stage2)) {
if (isSameInterface(symbol1, symbol2)) {
return symbol1->getType().getTypeName() == symbol2->getType().getTypeName();
}
} else if (symbol1->getName() == symbol2->getName())
@@ -168,7 +175,7 @@ void TIntermediate::checkStageIO(TInfoSink& infoSink, TIntermediate& unit) {
auto* nextStageSymbol = nextStageInterm->getAsSymbolNode();
bool found = false;
for (auto& curStageInterm : linkerObjects) {
if (isSameSymbol(curStageInterm->getAsSymbolNode(), getStage(), nextStageSymbol, unit.getStage())) {
if (isSameSymbol(curStageInterm->getAsSymbolNode(), nextStageSymbol)) {
found = true;
break;
}
@@ -749,10 +756,10 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl
// don't need as many checks as when merging symbols, since
// initializers and most qualifiers are stripped when the member is moved into the block
if ((*memberType) != (*unitMemberType)) {
error(infoSink, "Types must match:");
error(infoSink, "Types must match:", unitBlock->getStage());
infoSink.info << " " << memberType->getFieldName() << ": ";
infoSink.info << "\"" << memberType->getCompleteString() << "\" versus ";
infoSink.info << "\"" << unitMemberType->getCompleteString() << "\"\n";
infoSink.info << "\"" << memberType->getCompleteString() << "\" in stage " << StageName(block->getStage()) << " versus ";
infoSink.info << "\"" << unitMemberType->getCompleteString() << "\" in stage " << StageName(unitBlock->getStage()) << "\n";
}
memberIndexUpdates[i] = j;
@@ -856,7 +863,7 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
TIntermSymbol* symbol = linkerObjects[linkObj]->getAsSymbolNode();
assert(symbol && unitSymbol);
if (isSameSymbol(symbol, getStage(), unitSymbol, unitStage)) {
if (isSameSymbol(symbol, unitSymbol)) {
// filter out copy
merge = false;
@@ -893,7 +900,7 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
mergeImplicitArraySizes(symbol->getWritableType(), unitSymbol->getType());
// Check for consistent types/qualification/initializers etc.
mergeErrorCheck(infoSink, *symbol, *unitSymbol, unitStage);
mergeErrorCheck(infoSink, *symbol, *unitSymbol);
}
// If different symbols, verify they arn't push_constant since there can only be one per stage
else if (symbol->getQualifier().isPushConstant() && unitSymbol->getQualifier().isPushConstant() && getStage() == unitStage)
@@ -935,7 +942,7 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
}
};
if (isSameInterface(symbol, getStage(), unitSymbol, unitStage)) {
if (isSameInterface(symbol, unitSymbol)) {
checkName(symbol->getName());
// check members of other anonymous blocks
@@ -979,9 +986,11 @@ void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType)
//
// This function only does one of intra- or cross-stage matching per call.
//
void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, EShLanguage unitStage)
void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol)
{
bool crossStage = getStage() != unitStage;
EShLanguage stage = symbol.getStage();
EShLanguage unitStage = unitSymbol.getStage();
bool crossStage = stage != unitStage;
bool writeTypeComparison = false;
bool errorReported = false;
bool printQualifiers = false;
@@ -993,10 +1002,10 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
// but, we make an exception if one is an implicit array and the other is sized
// or if the array sizes differ because of the extra array dimension on some in/out boundaries
bool arraysMatch = false;
if (isIoResizeArray(symbol.getType(), getStage()) || isIoResizeArray(unitSymbol.getType(), unitStage)) {
if (isIoResizeArray(symbol.getType(), stage) || isIoResizeArray(unitSymbol.getType(), unitStage)) {
// if the arrays have an extra dimension because of the stage.
// compare dimensions while ignoring the outer dimension
unsigned int firstDim = isIoResizeArray(symbol.getType(), getStage()) ? 1 : 0;
unsigned int firstDim = isIoResizeArray(symbol.getType(), stage) ? 1 : 0;
unsigned int numDim = symbol.getArraySizes()
? symbol.getArraySizes()->getNumDims() : 0;
unsigned int unitFirstDim = isIoResizeArray(unitSymbol.getType(), unitStage) ? 1 : 0;
@@ -1025,7 +1034,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
if (lpidx >= 0 && rpidx >= 0) {
error(infoSink, "Member names and types must match:", unitStage);
infoSink.info << " Block: " << symbol.getType().getTypeName() << "\n";
infoSink.info << " " << StageName(getStage()) << " stage: \""
infoSink.info << " " << StageName(stage) << " stage: \""
<< (*symbol.getType().getStruct())[lpidx].type->getCompleteString(true, false, false, true,
(*symbol.getType().getStruct())[lpidx].type->getFieldName()) << "\"\n";
infoSink.info << " " << StageName(unitStage) << " stage: \""
@@ -1033,20 +1042,20 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
(*unitSymbol.getType().getStruct())[rpidx].type->getFieldName()) << "\"\n";
errorReported = true;
} else if (lpidx >= 0 && rpidx == -1) {
TString errmsg = StageName(getStage());
TString errmsg = StageName(stage);
errmsg.append(" block member has no corresponding member in ").append(StageName(unitStage)).append(" block:");
error(infoSink, errmsg.c_str(), unitStage);
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
<< (*symbol.getType().getStruct())[lpidx].type->getFieldName() << "\n";
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << ", Member: n/a \n";
errorReported = true;
} else if (lpidx == -1 && rpidx >= 0) {
TString errmsg = StageName(unitStage);
errmsg.append(" block member has no corresponding member in ").append(StageName(getStage())).append(" block:");
errmsg.append(" block member has no corresponding member in ").append(StageName(stage)).append(" block:");
error(infoSink, errmsg.c_str(), unitStage);
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << ", Member: "
<< (*unitSymbol.getType().getStruct())[rpidx].type->getFieldName() << "\n";
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: n/a \n";
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: n/a \n";
errorReported = true;
} else {
error(infoSink, "Types must match:", unitStage);
@@ -1103,7 +1112,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
layoutQualifierError = true;
}
if (layoutQualifierError) {
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
<< (*symbol.getType().getStruct())[li].type->getFieldName() << " \""
<< (*symbol.getType().getStruct())[li].type->getCompleteString(true, true, false, false) << "\"\n";
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << ", Member: "
@@ -1284,24 +1293,24 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
if (symbol.getType().getBasicType() == EbtBlock && unitSymbol.getType().getBasicType() == EbtBlock &&
symbol.getType().getStruct() && unitSymbol.getType().getStruct()) {
if (printType) {
infoSink.info << " " << StageName(getStage()) << " stage: \"" << symbol.getType().getCompleteString(true, printQualifiers, printPrecision,
infoSink.info << " " << StageName(stage) << " stage: \"" << symbol.getType().getCompleteString(true, printQualifiers, printPrecision,
printType, symbol.getName(), symbol.getType().getTypeName()) << "\"\n";
infoSink.info << " " << StageName(unitStage) << " stage: \"" << unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision,
printType, unitSymbol.getName(), unitSymbol.getType().getTypeName()) << "\"\n";
} else {
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << " Instance: " << symbol.getName()
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << " Instance: " << symbol.getName()
<< ": \"" << symbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << " Instance: " << unitSymbol.getName()
<< ": \"" << unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
}
} else {
if (printType) {
infoSink.info << " " << StageName(getStage()) << " stage: \""
infoSink.info << " " << StageName(stage) << " stage: \""
<< symbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType, symbol.getName()) << "\"\n";
infoSink.info << " " << StageName(unitStage) << " stage: \""
<< unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType, unitSymbol.getName()) << "\"\n";
} else {
infoSink.info << " " << StageName(getStage()) << " stage: " << symbol.getName() << " \""
infoSink.info << " " << StageName(stage) << " stage: " << symbol.getName() << " \""
<< symbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
infoSink.info << " " << StageName(unitStage) << " stage: " << unitSymbol.getName() << " \""
<< unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";

View File

@@ -439,6 +439,9 @@ public:
case EShTargetVulkan_1_3:
processes.addProcess("target-env vulkan1.3");
break;
case EShTargetVulkan_1_4:
processes.addProcess("target-env vulkan1.4");
break;
default:
processes.addProcess("target-env vulkanUnknown");
break;
@@ -1120,7 +1123,7 @@ public:
{ on ? numericFeatures.insert(f) : numericFeatures.erase(f); }
protected:
TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
TIntermSymbol* addSymbol(long long Id, const TString&, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
void error(TInfoSink& infoSink, const char*, EShLanguage unitStage = EShLangCount);
void warn(TInfoSink& infoSink, const char*, EShLanguage unitStage = EShLangCount);
void mergeCallGraphs(TInfoSink&, TIntermediate&);
@@ -1132,7 +1135,7 @@ protected:
void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects, EShLanguage);
void mergeBlockDefinitions(TInfoSink&, TIntermSymbol* block, TIntermSymbol* unitBlock, TIntermediate* unitRoot);
void mergeImplicitArraySizes(TType&, const TType&);
void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, EShLanguage);
void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&);
void checkCallGraphCycles(TInfoSink&);
void checkCallGraphBodies(TInfoSink&, bool keepUncalled);
void inOutLocationCheck(TInfoSink&);

View File

@@ -121,6 +121,7 @@ public:
virtual void fcoopmatCheckNV(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void intcoopmatCheckNV(const TSourceLoc&, const char *op, bool builtIn = false);
virtual void coopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void tensorLayoutViewCheck(const TSourceLoc&, const char* op, bool builtIn = false);
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
bool isForwardCompatible() const { return forwardCompatible; }

View File

@@ -156,8 +156,9 @@ typedef enum {
EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), // Vulkan 1.1
EShTargetVulkan_1_2 = (1 << 22) | (2 << 12), // Vulkan 1.2
EShTargetVulkan_1_3 = (1 << 22) | (3 << 12), // Vulkan 1.3
EShTargetVulkan_1_4 = (1 << 22) | (4 << 12), // Vulkan 1.4
EShTargetOpenGL_450 = 450, // OpenGL
LAST_ELEMENT_MARKER(EShTargetClientVersionCount = 5),
LAST_ELEMENT_MARKER(EShTargetClientVersionCount = 6),
} EShTargetClientVersion;
typedef EShTargetClientVersion EshTargetClientVersion;