spirv-val Update LocalSizeId VUID (#4602)

This commit is contained in:
sfricke-samsung 2021-10-29 08:58:02 -07:00 committed by GitHub
parent 6c7885dbde
commit c194bb2a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 10 deletions

View File

@ -235,11 +235,11 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) {
}
if (!ok) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< _.VkErrorID(4683)
<< _.VkErrorID(6426)
<< "In the Vulkan environment, GLCompute execution model "
"entry points require either the LocalSize execution "
"mode or an object decorated with WorkgroupSize must be "
"specified.";
"entry points require either the LocalSize or "
"LocalSizeId execution mode or an object decorated with "
"WorkgroupSize must be specified.";
}
}
break;

View File

@ -1845,8 +1845,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
return VUID_WRAP(VUID-StandaloneSpirv-Invariant-04677);
case 4682:
return VUID_WRAP(VUID-StandaloneSpirv-OpControlBarrier-04682);
case 4683:
return VUID_WRAP(VUID-StandaloneSpirv-LocalSize-04683);
case 6426:
return VUID_WRAP(VUID-StandaloneSpirv-LocalSize-06426); // formally 04683
case 4685:
return VUID_WRAP(VUID-StandaloneSpirv-OpGroupNonUniformBallotBitCount-04685);
case 4686:

View File

@ -63,12 +63,13 @@ OpEntryPoint GLCompute %main "main"
CompileSuccessfully(spirv, env);
EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env));
EXPECT_THAT(getDiagnosticString(),
AnyVUID("VUID-StandaloneSpirv-LocalSize-04683"));
AnyVUID("VUID-StandaloneSpirv-LocalSize-06426"));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("In the Vulkan environment, GLCompute execution model entry "
"points require either the LocalSize execution mode or an "
"object decorated with WorkgroupSize must be specified."));
HasSubstr(
"In the Vulkan environment, GLCompute execution model entry "
"points require either the LocalSize or LocalSizeId execution mode "
"or an object decorated with WorkgroupSize must be specified."));
}
TEST_F(ValidateMode, GLComputeNoModeVulkanWorkgroupSize) {
@ -101,6 +102,40 @@ OpExecutionMode %main LocalSize 1 1 1
EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(env));
}
TEST_F(ValidateMode, GLComputeVulkanLocalSizeIdBad) {
const std::string spirv = R"(
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionModeId %main LocalSizeId %int_1 %int_1 %int_1
%int = OpTypeInt 32 0
%int_1 = OpConstant %int 1
)" + kVoidFunction;
spv_target_env env = SPV_ENV_VULKAN_1_1; // need SPIR-V 1.2
CompileSuccessfully(spirv, env);
EXPECT_THAT(SPV_ERROR_INVALID_DATA, ValidateInstructions(env));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("LocalSizeId mode is not allowed by the current environment."));
}
TEST_F(ValidateMode, GLComputeVulkanLocalSizeIdGood) {
const std::string spirv = R"(
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionModeId %main LocalSizeId %int_1 %int_1 %int_1
%int = OpTypeInt 32 0
%int_1 = OpConstant %int 1
)" + kVoidFunction;
spv_target_env env = SPV_ENV_VULKAN_1_1; // need SPIR-V 1.2
CompileSuccessfully(spirv, env);
spvValidatorOptionsSetAllowLocalSizeId(getValidatorOptions(), true);
EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(env));
}
TEST_F(ValidateMode, FragmentOriginLowerLeftVulkan) {
const std::string spirv = R"(
OpCapability Shader