mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-09-14 06:28:17 +00:00
Updated spirv-tools.
This commit is contained in:
committed by
Branimir Karadžić
parent
1e2e22d983
commit
31ca235db8
@@ -87,8 +87,8 @@ spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) {
|
||||
spv::Op::OpGetKernelLocalSizeForSubgroupCount,
|
||||
spv::Op::OpGetKernelMaxNumSubgroups,
|
||||
spv::Op::OpName,
|
||||
spv::Op::OpCooperativeMatrixPerElementOpNV,
|
||||
spv::Op::OpCooperativeMatrixReduceNV,
|
||||
spv::Op::OpCooperativeMatrixPerElementOpEXT,
|
||||
spv::Op::OpCooperativeMatrixReduceEXT,
|
||||
spv::Op::OpCooperativeMatrixLoadTensorNV,
|
||||
spv::Op::OpConditionalEntryPointINTEL,
|
||||
spv::Op::OpConstantFunctionPointerINTEL};
|
||||
@@ -311,7 +311,7 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _,
|
||||
const auto function = _.FindDef(function_id);
|
||||
if (!function || spv::Op::OpFunction != function->opcode()) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV Function <id> "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT Function <id> "
|
||||
<< _.getIdName(function_id) << " is not a function.";
|
||||
}
|
||||
|
||||
@@ -320,14 +320,14 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _,
|
||||
const auto matrix_type_id = matrix->type_id();
|
||||
if (!_.IsCooperativeMatrixKHRType(matrix_type_id)) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV Matrix <id> "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT Matrix <id> "
|
||||
<< _.getIdName(matrix_id) << " is not a cooperative matrix.";
|
||||
}
|
||||
|
||||
const auto result_type_id = inst->GetOperandAs<uint32_t>(0);
|
||||
if (matrix_type_id != result_type_id) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV Result Type <id> "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT Result Type <id> "
|
||||
<< _.getIdName(result_type_id) << " must match matrix type <id> "
|
||||
<< _.getIdName(matrix_type_id) << ".";
|
||||
}
|
||||
@@ -339,7 +339,7 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _,
|
||||
auto return_type_id = function_type->GetOperandAs<uint32_t>(1);
|
||||
if (return_type_id != matrix_comp_type_id) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV function return type <id> "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function return type <id> "
|
||||
<< _.getIdName(return_type_id)
|
||||
<< " must match matrix component type <id> "
|
||||
<< _.getIdName(matrix_comp_type_id) << ".";
|
||||
@@ -347,9 +347,9 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _,
|
||||
|
||||
if (function_type->operands().size() < 5) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV function type <id> "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type <id> "
|
||||
<< _.getIdName(function_type_id)
|
||||
<< " must have a least three parameters.";
|
||||
<< " must have at least three parameters.";
|
||||
}
|
||||
|
||||
const auto param0_id = function_type->GetOperandAs<uint32_t>(2);
|
||||
@@ -357,25 +357,79 @@ spv_result_t ValidateCooperativeMatrixPerElementOp(ValidationState_t& _,
|
||||
const auto param2_id = function_type->GetOperandAs<uint32_t>(4);
|
||||
if (!_.IsIntScalarType(param0_id, 32)) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV function type first parameter "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type first "
|
||||
"parameter "
|
||||
"type <id> "
|
||||
<< _.getIdName(param0_id) << " must be a 32-bit integer.";
|
||||
}
|
||||
|
||||
if (!_.IsIntScalarType(param1_id, 32)) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV function type second "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type second "
|
||||
"parameter type <id> "
|
||||
<< _.getIdName(param1_id) << " must be a 32-bit integer.";
|
||||
}
|
||||
|
||||
if (param2_id != matrix_comp_type_id) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpNV function type third parameter "
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type third "
|
||||
"parameter "
|
||||
"type <id> "
|
||||
<< _.getIdName(param2_id) << " must match matrix component type.";
|
||||
}
|
||||
|
||||
const auto optional_operand_count = inst->operands().size() - 4;
|
||||
const auto expected_function_type_operands = 5 + optional_operand_count;
|
||||
if (function_type->operands().size() != expected_function_type_operands) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type <id> "
|
||||
<< _.getIdName(function_type_id) << " must have "
|
||||
<< (3 + optional_operand_count)
|
||||
<< " parameters to match the instruction operands.";
|
||||
}
|
||||
|
||||
for (uint32_t operand_index = 4; operand_index < inst->operands().size();
|
||||
++operand_index) {
|
||||
const auto optional_operand_id =
|
||||
inst->GetOperandAs<uint32_t>(operand_index);
|
||||
const auto optional_operand = _.FindDef(optional_operand_id);
|
||||
const auto optional_operand_type_id =
|
||||
optional_operand ? optional_operand->type_id() : 0;
|
||||
const auto param_id =
|
||||
function_type->GetOperandAs<uint32_t>(operand_index + 1);
|
||||
|
||||
if (!_.IsCooperativeMatrixType(optional_operand_type_id)) {
|
||||
if (param_id != optional_operand_type_id) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type optional "
|
||||
"parameter type <id> "
|
||||
<< _.getIdName(param_id)
|
||||
<< " must match optional operand type <id> "
|
||||
<< _.getIdName(optional_operand_type_id) << ".";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (optional_operand_type_id != matrix_type_id) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpEXT optional matrix operand "
|
||||
"type <id> "
|
||||
<< _.getIdName(optional_operand_type_id)
|
||||
<< " must match matrix type <id> " << _.getIdName(matrix_type_id)
|
||||
<< ".";
|
||||
}
|
||||
|
||||
const auto optional_matrix_comp_type_id =
|
||||
_.FindDef(optional_operand_type_id)->GetOperandAs<uint32_t>(1);
|
||||
if (param_id != optional_matrix_comp_type_id) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpCooperativeMatrixPerElementOpEXT function type optional "
|
||||
"parameter type <id> "
|
||||
<< _.getIdName(param_id)
|
||||
<< " must match optional matrix component type.";
|
||||
}
|
||||
}
|
||||
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -392,7 +446,7 @@ spv_result_t FunctionPass(ValidationState_t& _, const Instruction* inst) {
|
||||
case spv::Op::OpFunctionCall:
|
||||
if (auto error = ValidateFunctionCall(_, inst)) return error;
|
||||
break;
|
||||
case spv::Op::OpCooperativeMatrixPerElementOpNV:
|
||||
case spv::Op::OpCooperativeMatrixPerElementOpEXT:
|
||||
if (auto error = ValidateCooperativeMatrixPerElementOp(_, inst))
|
||||
return error;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user