From e214a130dddee6a0b7507e49bb31290929a363fc Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Fri, 9 Sep 2022 16:04:39 +0000 Subject: [PATCH] Run substitute_overrides for all tests. This CL updates all of the integration tests to run the substitute_override transform where needed. The test runner is updated to match comments in the spvasm files as well as the wgsl files. Bug: tint:1155 Change-Id: I8187d426970d056d744e530ed6447e4ec69db5f4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101661 Reviewed-by: Ben Clayton Commit-Queue: Dan Sinclair Kokoro: Kokoro --- .../compute_workgroup_expression.wgsl | 2 ++ ...orkgroup_expression.wgsl.expected.dxc.hlsl | 7 +------ ...orkgroup_expression.wgsl.expected.fxc.hlsl | 7 +------ ...te_workgroup_expression.wgsl.expected.glsl | 6 +----- ...ute_workgroup_expression.wgsl.expected.msl | 2 -- ..._workgroup_expression.wgsl.expected.spvasm | 20 +++++-------------- ...te_workgroup_expression.wgsl.expected.wgsl | 2 +- ...ScalarSpecConstant_DeclareConst_F32.spvasm | 2 ++ ...tant_DeclareConst_F32_WithoutSpecId.spvasm | 1 + ...alarSpecConstant_DeclareConst_False.spvasm | 2 ++ ...ScalarSpecConstant_DeclareConst_I32.spvasm | 2 ++ ...ecConstant_DeclareConst_Id_MaxValid.spvasm | 2 ++ ...calarSpecConstant_DeclareConst_True.spvasm | 2 ++ ...ScalarSpecConstant_DeclareConst_U32.spvasm | 2 ++ ...t_ScalarSpecConstant_UsedInFunction.spvasm | 2 ++ ...calSize_And_WGSBuiltin_SpecConstant.spvasm | 2 ++ ...kgroupSizeBuiltin_SpecConstant_Only.spvasm | 2 ++ ...groupSize_MixedConstantSpecConstant.spvasm | 2 ++ tools/src/cmd/test-runner/main.go | 2 +- 19 files changed, 33 insertions(+), 36 deletions(-) diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl b/test/tint/shader_io/compute_workgroup_expression.wgsl index a465a76db3..971debbefc 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl @@ -1,3 +1,5 @@ +// flags: --transform substitute_override + @id(0) override x_dim = 2; @compute diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl index 2098cb3336..c968d814cc 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl @@ -1,9 +1,4 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 2 -#endif -static const int x_dim = WGSL_SPEC_CONSTANT_0; - -[numthreads(3, WGSL_SPEC_CONSTANT_0, 3)] +[numthreads(3, 2, 3)] void main() { return; } diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl index 2098cb3336..c968d814cc 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl @@ -1,9 +1,4 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 2 -#endif -static const int x_dim = WGSL_SPEC_CONSTANT_0; - -[numthreads(3, WGSL_SPEC_CONSTANT_0, 3)] +[numthreads(3, 2, 3)] void main() { return; } diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl index 6ac96fa4aa..3b288f8a6c 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl @@ -1,13 +1,9 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 2 -#endif -const int x_dim = WGSL_SPEC_CONSTANT_0; void tint_symbol() { } -layout(local_size_x = 3, local_size_y = WGSL_SPEC_CONSTANT_0, local_size_z = 3) in; +layout(local_size_x = 3, local_size_y = 2, local_size_z = 3) in; void main() { tint_symbol(); return; diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl index d9f2428573..09c45a0548 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl @@ -1,8 +1,6 @@ #include using namespace metal; -constant int x_dim [[function_constant(0)]]; - kernel void tint_symbol() { return; } diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm index bcd4536dbf..3f6f6b56cb 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm @@ -1,26 +1,16 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 12 +; Bound: 5 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" - OpName %x_dim "x_dim" + OpExecutionMode %main LocalSize 3 2 3 OpName %main "main" - OpDecorate %x_dim SpecId 0 - OpDecorate %11 SpecId 0 - OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize - %int = OpTypeInt 32 1 - %x_dim = OpSpecConstant %int 2 %void = OpTypeVoid - %3 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %uint_3 = OpConstant %uint 3 - %11 = OpSpecConstant %uint 2 -%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %uint_3 %11 %uint_3 - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %main = OpFunction %void None %1 + %4 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl index c2b260b2f0..1bd5a1531a 100644 --- a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@id(0) override x_dim = 2; +const x_dim = 2; @compute @workgroup_size((1 + 2), x_dim, clamp(((1 - 2) + 4), 0, 5)) fn main() { diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm index 44957625af..2f5df01c11 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm index a4b993f657..dc7fac6b67 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm @@ -1,3 +1,4 @@ +; flags: --transform substitute_override ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm index ae487d5d71..c2cc35779f 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm index c955a79a35..04b2f5d29e 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm index c687c937f8..79706801b9 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm index 1f56e04127..4f300c76cc 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm index 2ab2c756ba..f7803c5a25 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm index 096d33f363..902b5d7a7e 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm b/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm index 5ffad5d3f4..a046d7d62d 100644 --- a/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm +++ b/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm b/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm index 839812e943..4c82be350c 100644 --- a/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm +++ b/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm ; SPIR-V ; Version: 1.0 diff --git a/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm b/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm index 0c89e6bec6..61d100d974 100644 --- a/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm +++ b/test/tint/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm @@ -1,3 +1,5 @@ +; flags: --transform substitute_override +; ; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm ; SPIR-V ; Version: 1.0 diff --git a/tools/src/cmd/test-runner/main.go b/tools/src/cmd/test-runner/main.go index 3700c9253d..e8ea9ddc2d 100644 --- a/tools/src/cmd/test-runner/main.go +++ b/tools/src/cmd/test-runner/main.go @@ -767,7 +767,7 @@ func invoke(wd, exe string, args ...string) (ok bool, output string) { return true, str } -var reFlags = regexp.MustCompile(` *\/\/ *flags:(.*)\n`) +var reFlags = regexp.MustCompile(`^ *(?:\/\/|;) *flags:(.*) *\n`) // parseFlags looks for a `// flags:` header at the start of the file with the // given path, returning each of the space delimited tokens that follow for the