diff --git a/source/val/validate_scopes.cpp b/source/val/validate_scopes.cpp index 791ada741..c607984e4 100644 --- a/source/val/validate_scopes.cpp +++ b/source/val/validate_scopes.cpp @@ -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"; } } diff --git a/test/val/val_barriers_test.cpp b/test/val/val_barriers_test.cpp index b28e51a85..221419766 100644 --- a/test/val/val_barriers_test.cpp +++ b/test/val/val_barriers_test.cpp @@ -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) {