Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-baker committed Jun 28, 2023
1 parent 853299d commit cc75666
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
9 changes: 6 additions & 3 deletions source/val/validate_non_uniform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ spv_result_t ValidateGroupNonUniformBroadcastShuffle(ValidationState_t& _,
if (!spvOpcodeIsConstant(id_op)) {
std::string operand = GetOperandName(inst->opcode());
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Before SPIR-V 1.5, " << operand << " must be a constant instruction";
<< "Before SPIR-V 1.5, " << operand
<< " must be a constant instruction";
}
}

Expand Down Expand Up @@ -181,7 +182,8 @@ spv_result_t ValidateGroupNonUniformBallot(ValidationState_t& _,
spv_result_t ValidateGroupNonUniformInverseBallot(ValidationState_t& _,
const Instruction* inst) {
if (!_.IsBoolScalarType(inst->type_id())) {
return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Result must be a boolean scalar";
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Result must be a boolean scalar";
}

const auto value_type_id = _.GetOperandTypeId(inst, 3);
Expand All @@ -201,7 +203,8 @@ spv_result_t ValidateGroupNonUniformInverseBallot(ValidationState_t& _,
spv_result_t ValidateGroupNonUniformBallotBitExtract(ValidationState_t& _,
const Instruction* inst) {
if (!_.IsBoolScalarType(inst->type_id())) {
return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Result must be a boolean scalar";
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Result must be a boolean scalar";
}

const auto value_type_id = _.GetOperandTypeId(inst, 3);
Expand Down
12 changes: 8 additions & 4 deletions test/opt/amd_ext_to_khr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ using AmdExtToKhrTest = PassTest<::testing::Test>;

using ::testing::HasSubstr;

std::string GetTest(std::string op_code, std::string new_op_code, bool is_float = false) {
std::string GetTest(std::string op_code, std::string new_op_code,
bool is_float = false) {
const std::string text = R"(
; CHECK: OpCapability Shader
; CHECK-NOT: OpExtension "SPV_AMD_shader_ballot"
; CHECK: OpFunction
; CHECK-NEXT: OpLabel
; CHECK-NEXT: [[undef:%\w+]] = OpUndef %
; CHECK-NEXT: )" + new_op_code + " %" + (is_float ? "float" : "uint") +
; CHECK-NEXT: )" + new_op_code +
" %" + (is_float ? "float" : "uint") +
R"( %uint_3 Reduce [[undef]]
OpCapability Shader
OpCapability Groups
Expand All @@ -48,8 +50,10 @@ std::string GetTest(std::string op_code, std::string new_op_code, bool is_float
%uint_3 = OpConstant %uint 3
%1 = OpFunction %void None %3
%6 = OpLabel
%7 = OpUndef %)" + (is_float ? "float" : "uint") + R"(
%8 = )" + op_code + " %" + (is_float ? "float" : "uint") +
%7 = OpUndef %)" +
(is_float ? "float" : "uint") + R"(
%8 = )" + op_code +
" %" + (is_float ? "float" : "uint") +
R"( %uint_3 Reduce %7
OpReturn
OpFunctionEnd
Expand Down
9 changes: 4 additions & 5 deletions test/val/val_non_uniform_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ INSTANTIATE_TEST_SUITE_P(

INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotGood, GroupNonUniform,
Combine(Values("OpGroupNonUniformBallot"),
Values("%u32vec4"), Values(spv::Scope::Subgroup),
Values("%u32vec4"),
Values(spv::Scope::Subgroup),
Values("%true", "%false"), Values("")));

INSTANTIATE_TEST_SUITE_P(
Expand All @@ -506,8 +507,7 @@ INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBadOperand, GroupNonUniform,
"%struct_null", "%v4int_null"),
Values("Predicate must be a boolean scalar")));

INSTANTIATE_TEST_SUITE_P(GroupNonUniformInverseBallotGood,
GroupNonUniform,
INSTANTIATE_TEST_SUITE_P(GroupNonUniformInverseBallotGood, GroupNonUniform,
Combine(Values("OpGroupNonUniformInverseBallot"),
Values("%bool"), Values(spv::Scope::Subgroup),
Values("%u32vec4_null"), Values("")));
Expand All @@ -529,8 +529,7 @@ INSTANTIATE_TEST_SUITE_P(
"%struct_null", "%v4int_null"),
Values("Value must be a 4-component unsigned integer vector")));

INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBitExtractGood,
GroupNonUniform,
INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBitExtractGood, GroupNonUniform,
Combine(Values("OpGroupNonUniformBallotBitExtract"),
Values("%bool"), Values(spv::Scope::Subgroup),
Values("%u32vec4_null %u32_0"), Values("")));
Expand Down

0 comments on commit cc75666

Please sign in to comment.