update glslang, spirv-tools and spirv-opt to their latest version (#9845)

* update spirv-cross to a0fba56

* update spirv-tools to v2026.1

* update spirv-headers to 04f10f6

* update glslang to 16.2.0
This commit is contained in:
Mathias Agopian
2026-03-27 16:35:56 -07:00
committed by GitHub
parent 04270afb83
commit d7b10bdd3b
988 changed files with 92611 additions and 35181 deletions

View File

@@ -89,7 +89,10 @@ spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) {
spv::Op::OpName,
spv::Op::OpCooperativeMatrixPerElementOpNV,
spv::Op::OpCooperativeMatrixReduceNV,
spv::Op::OpCooperativeMatrixLoadTensorNV};
spv::Op::OpCooperativeMatrixLoadTensorNV,
spv::Op::OpConditionalEntryPointINTEL,
};
for (auto& pair : inst->uses()) {
const auto* use = pair.first;
if (std::find(acceptable.begin(), acceptable.end(), use->opcode()) ==
@@ -109,11 +112,6 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _,
// NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place.
size_t param_index = 0;
size_t inst_num = inst->LineNum() - 1;
if (inst_num == 0) {
return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
<< "Function parameter cannot be the first instruction.";
}
auto func_inst = &_.ordered_instructions()[inst_num];
while (--inst_num) {
func_inst = &_.ordered_instructions()[inst_num];
@@ -172,6 +170,34 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _,
<< "s type does not match Function <id> "
<< _.getIdName(return_type->id()) << "s return type.";
}
if (!_.options()->relax_logical_pointer &&
(_.addressing_model() == spv::AddressingModel::Logical ||
_.addressing_model() == spv::AddressingModel::PhysicalStorageBuffer64)) {
if (return_type->opcode() == spv::Op::OpTypePointer ||
return_type->opcode() == spv::Op::OpTypeUntypedPointerKHR) {
const auto sc = return_type->GetOperandAs<spv::StorageClass>(1);
if (sc != spv::StorageClass::PhysicalStorageBuffer) {
if (!_.HasCapability(spv::Capability::VariablePointersStorageBuffer) &&
sc == spv::StorageClass::StorageBuffer) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "In Logical addressing, functions may only return a "
"storage buffer pointer if the "
"VariablePointersStorageBuffer capability is declared";
} else if (!_.HasCapability(spv::Capability::VariablePointers) &&
sc == spv::StorageClass::Workgroup) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "In Logical addressing, functions may only return a "
"workgroup pointer if the VariablePointers capability is "
"declared";
} else if (sc != spv::StorageClass::StorageBuffer &&
sc != spv::StorageClass::Workgroup) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "In Logical addressing, functions may not return a pointer "
"in this storage class";
}
}
}
}
const auto function_type_id = function->GetOperandAs<uint32_t>(3);
const auto function_type = _.FindDef(function_type_id);
@@ -218,51 +244,59 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _,
}
}
if (_.addressing_model() == spv::AddressingModel::Logical) {
if (_.addressing_model() == spv::AddressingModel::Logical ||
_.addressing_model() == spv::AddressingModel::PhysicalStorageBuffer64) {
if ((parameter_type->opcode() == spv::Op::OpTypePointer ||
parameter_type->opcode() == spv::Op::OpTypeUntypedPointerKHR) &&
!_.options()->relax_logical_pointer) {
spv::StorageClass sc =
parameter_type->GetOperandAs<spv::StorageClass>(1u);
// Validate which storage classes can be pointer operands.
switch (sc) {
case spv::StorageClass::UniformConstant:
case spv::StorageClass::Function:
case spv::StorageClass::Private:
case spv::StorageClass::Workgroup:
case spv::StorageClass::AtomicCounter:
// These are always allowed.
break;
case spv::StorageClass::StorageBuffer:
if (!_.features().variable_pointers) {
if (sc != spv::StorageClass::PhysicalStorageBuffer) {
// Validate which storage classes can be pointer operands.
switch (sc) {
case spv::StorageClass::UniformConstant:
case spv::StorageClass::Function:
case spv::StorageClass::Private:
case spv::StorageClass::Workgroup:
case spv::StorageClass::AtomicCounter:
// SPV_EXT_tile_image
case spv::StorageClass::TileImageEXT:
// SPV_KHR_ray_tracing
case spv::StorageClass::ShaderRecordBufferKHR:
// These are always allowed.
break;
case spv::StorageClass::StorageBuffer:
if (!_.features().variable_pointers) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "StorageBuffer pointer operand "
<< _.getIdName(argument_id)
<< " requires a variable pointers capability";
}
break;
default:
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "StorageBuffer pointer operand "
<< _.getIdName(argument_id)
<< " requires a variable pointers capability";
}
break;
default:
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Invalid storage class for pointer operand "
<< _.getIdName(argument_id);
}
<< "Invalid storage class for pointer operand "
<< _.getIdName(argument_id);
}
// Validate memory object declaration requirements.
if (argument->opcode() != spv::Op::OpVariable &&
argument->opcode() != spv::Op::OpUntypedVariableKHR &&
argument->opcode() != spv::Op::OpFunctionParameter) {
const bool ssbo_vptr =
_.HasCapability(spv::Capability::VariablePointersStorageBuffer) &&
sc == spv::StorageClass::StorageBuffer;
const bool wg_vptr =
_.HasCapability(spv::Capability::VariablePointers) &&
sc == spv::StorageClass::Workgroup;
const bool uc_ptr = sc == spv::StorageClass::UniformConstant;
if (!_.options()->before_hlsl_legalization && !ssbo_vptr &&
!wg_vptr && !uc_ptr) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Pointer operand " << _.getIdName(argument_id)
<< " must be a memory object declaration";
// Validate memory object declaration requirements.
if (argument->opcode() != spv::Op::OpVariable &&
argument->opcode() != spv::Op::OpUntypedVariableKHR &&
argument->opcode() != spv::Op::OpFunctionParameter) {
const bool ssbo_vptr =
_.HasCapability(
spv::Capability::VariablePointersStorageBuffer) &&
sc == spv::StorageClass::StorageBuffer;
const bool wg_vptr =
_.HasCapability(spv::Capability::VariablePointers) &&
sc == spv::StorageClass::Workgroup;
const bool uc_ptr = sc == spv::StorageClass::UniformConstant;
if (!_.options()->before_hlsl_legalization && !ssbo_vptr &&
!wg_vptr && !uc_ptr) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Pointer operand " << _.getIdName(argument_id)
<< " must be a memory object declaration";
}
}
}
}
@@ -321,14 +355,14 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _,
const auto param0_id = function_type->GetOperandAs<uint32_t>(2);
const auto param1_id = function_type->GetOperandAs<uint32_t>(3);
const auto param2_id = function_type->GetOperandAs<uint32_t>(4);
if (!_.IsIntScalarType(param0_id) || _.GetBitWidth(param0_id) != 32) {
if (!_.IsIntScalarType(param0_id, 32)) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "OpCooperativeMatrixPerElementOpNV function type first parameter "
"type <id> "
<< _.getIdName(param0_id) << " must be a 32-bit integer.";
}
if (!_.IsIntScalarType(param1_id) || _.GetBitWidth(param1_id) != 32) {
if (!_.IsIntScalarType(param1_id, 32)) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "OpCooperativeMatrixPerElementOpNV function type second "
"parameter type <id> "