Update execution scope rules for WebGPU (#2730)

Fixes #2722
This commit is contained in:
Ryan Harrison 2019-07-11 14:37:36 -04:00 committed by GitHub
parent 1a2de48a12
commit 55adf4cf70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -123,11 +123,11 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _,
// WebGPU Specific rules
if (spvIsWebGPUEnv(_.context()->target_env)) {
// Scope for execution must be limited to Workgroup or Subgroup
if (value != SpvScopeWorkgroup && value != SpvScopeSubgroup) {
if (value != SpvScopeWorkgroup) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< spvOpcodeString(opcode)
<< ": in WebGPU environment Execution Scope is limited to "
<< "Workgroup and Subgroup";
<< "Workgroup";
}
}

View File

@ -403,7 +403,7 @@ OpControlBarrier %device %workgroup %none
"is limited to Workgroup and Subgroup"));
}
TEST_F(ValidateBarriers, OpControlBarrierWebGPUExecutionScopeDevice) {
TEST_F(ValidateBarriers, OpControlBarrierWebGPUExecutionScopeDeviceBad) {
const std::string body = R"(
OpControlBarrier %device %workgroup %none
)";
@ -412,7 +412,19 @@ OpControlBarrier %device %workgroup %none
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0));
EXPECT_THAT(getDiagnosticString(),
HasSubstr("ControlBarrier: in WebGPU environment Execution Scope "
"is limited to Workgroup and Subgroup"));
"is limited to Workgroup"));
}
TEST_F(ValidateBarriers, OpControlBarrierWebGPUExecutionScopeSubgroupBad) {
const std::string body = R"(
OpControlBarrier %subgroup %workgroup %none
)";
CompileSuccessfully(GenerateWebGPUShaderCode(body), SPV_ENV_WEBGPU_0);
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0));
EXPECT_THAT(getDiagnosticString(),
HasSubstr("ControlBarrier: in WebGPU environment Execution Scope "
"is limited to Workgroup"));
}
TEST_F(ValidateBarriers, OpControlBarrierVulkanMemoryScopeSubgroup) {