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 <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2022-09-09 16:04:39 +00:00 committed by Dawn LUCI CQ
parent 93df967003
commit e214a130dd
19 changed files with 33 additions and 36 deletions

View File

@ -1,3 +1,5 @@
// flags: --transform substitute_override
@id(0) override x_dim = 2; @id(0) override x_dim = 2;
@compute @compute

View File

@ -1,9 +1,4 @@
#ifndef WGSL_SPEC_CONSTANT_0 [numthreads(3, 2, 3)]
#define WGSL_SPEC_CONSTANT_0 2
#endif
static const int x_dim = WGSL_SPEC_CONSTANT_0;
[numthreads(3, WGSL_SPEC_CONSTANT_0, 3)]
void main() { void main() {
return; return;
} }

View File

@ -1,9 +1,4 @@
#ifndef WGSL_SPEC_CONSTANT_0 [numthreads(3, 2, 3)]
#define WGSL_SPEC_CONSTANT_0 2
#endif
static const int x_dim = WGSL_SPEC_CONSTANT_0;
[numthreads(3, WGSL_SPEC_CONSTANT_0, 3)]
void main() { void main() {
return; return;
} }

View File

@ -1,13 +1,9 @@
#version 310 es #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() { 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() { void main() {
tint_symbol(); tint_symbol();
return; return;

View File

@ -1,8 +1,6 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
constant int x_dim [[function_constant(0)]];
kernel void tint_symbol() { kernel void tint_symbol() {
return; return;
} }

View File

@ -1,26 +1,16 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 12 ; Bound: 5
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpName %x_dim "x_dim" OpExecutionMode %main LocalSize 3 2 3
OpName %main "main" 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 %void = OpTypeVoid
%3 = OpTypeFunction %void %1 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %main = OpFunction %void None %1
%v3uint = OpTypeVector %uint 3 %4 = OpLabel
%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
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -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)) @compute @workgroup_size((1 + 2), x_dim, clamp(((1 - 2) + 4), 0, 5))
fn main() { fn main() {

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,4 @@
; flags: --transform substitute_override
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm ; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm ; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm ; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -1,3 +1,5 @@
; flags: --transform substitute_override
;
; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm ; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0

View File

@ -767,7 +767,7 @@ func invoke(wd, exe string, args ...string) (ok bool, output string) {
return true, str 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 // 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 // given path, returning each of the space delimited tokens that follow for the