spirv-reader: switch to HLSL-style pipeline IO

- When storing to sample_mask output, write to the 0th element
- Only make a return struct if it has members
- Adjust type signedness coercion when loading special builtins.
- Adapt tests

- Update expectations for end-to-end tests

- Handle sample_mask with stride
  Input variables normally don't have layout. But they can have it
  up through SPIR-V 1.4.
  Handle this case in the SPIR-V reader, by seeing through the
  intermediate alias type created for the strided array type.

Bug: tint:508
Change-Id: I0f19dc1305d3f250dbbc0698a602288c34245274
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54743
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
David Neto
2021-06-17 09:10:04 +00:00
committed by Tint LUCI CQ
parent c932b5535f
commit 1e19b55d19
102 changed files with 6487 additions and 3194 deletions

View File

@@ -1,8 +1,13 @@
static int I = 0;
[numthreads(1, 1, 1)]
void main() {
void main_1() {
I = 123;
I = ((100 + 20) + 3);
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
thread int tint_symbol_1 = 0;
tint_symbol_1 = 123;
tint_symbol_1 = ((100 + 20) + 3);
void main_1(thread int* const tint_symbol_1) {
*(tint_symbol_1) = 123;
*(tint_symbol_1) = ((100 + 20) + 3);
return;
}
kernel void tint_symbol() {
thread int tint_symbol_2 = 0;
main_1(&(tint_symbol_2));
return;
}

View File

@@ -1,13 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %I "I"
OpName %main_1 "main_1"
OpName %main "main"
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
@@ -19,7 +20,7 @@
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %5
%main_1 = OpFunction %void None %5
%8 = OpLabel
OpStore %I %int_123
%12 = OpIAdd %int %int_100 %int_20
@@ -27,3 +28,8 @@
OpStore %I %14
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%16 = OpLabel
%17 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,8 +1,12 @@
var<private> I : i32 = 0;
[[stage(compute)]]
fn main() {
fn main_1() {
I = 123;
I = ((100 + 20) + 3);
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -4,8 +4,13 @@ struct S {
static S V;
[numthreads(1, 1, 1)]
void main() {
void main_1() {
V.i = 5;
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -5,9 +5,14 @@ struct S {
int i;
};
kernel void tint_symbol() {
thread S tint_symbol_1 = {};
tint_symbol_1.i = 5;
void main_1(thread S* const tint_symbol_1) {
(*(tint_symbol_1)).i = 5;
return;
}
kernel void tint_symbol() {
thread S tint_symbol_2 = {};
main_1(&(tint_symbol_2));
return;
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -10,6 +10,7 @@
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpName %main_1 "main_1"
OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%int = OpTypeInt 32 1
@@ -23,9 +24,14 @@
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
%int_5 = OpConstant %int 5
%main = OpFunction %void None %6
%main_1 = OpFunction %void None %6
%9 = OpLabel
%13 = OpAccessChain %_ptr_Private_int %V %uint_0
OpStore %13 %int_5
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%16 = OpLabel
%17 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -4,8 +4,12 @@ struct S {
var<private> V : S;
[[stage(compute)]]
fn main() {
fn main_1() {
V.i = 5;
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -1,8 +1,13 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
int i = 0;
i = 123;
i = 123;
i = ((100 + 20) + 3);
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -1,7 +1,7 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
void main_1() {
int i = 0;
i = 123;
i = 123;
@@ -9,3 +9,8 @@ kernel void tint_symbol() {
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,14 +1,15 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %main_1 "main_1"
OpName %i "i"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
@@ -19,7 +20,7 @@
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_0
@@ -30,3 +31,8 @@
OpStore %i %15
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%17 = OpLabel
%18 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,8 +1,12 @@
[[stage(compute)]]
fn main() {
fn main_1() {
var i : i32 = 0;
i = 123;
i = 123;
i = ((100 + 20) + 3);
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -2,9 +2,14 @@ struct S {
int i;
};
[numthreads(1, 1, 1)]
void main() {
void main_1() {
S V = {0};
V.i = 5;
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -5,9 +5,14 @@ struct S {
int i;
};
kernel void tint_symbol() {
void main_1() {
S V = {};
V.i = 5;
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,16 +1,17 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %main_1 "main_1"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -22,10 +23,15 @@
%uint_0 = OpConstant %uint 0
%_ptr_Function_int = OpTypePointer Function %int
%int_5 = OpConstant %int 5
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%V = OpVariable %_ptr_Function_S Function %9
%13 = OpAccessChain %_ptr_Function_int %V %uint_0
OpStore %13 %int_5
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%16 = OpLabel
%17 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -2,9 +2,13 @@ struct S {
i : i32;
};
[[stage(compute)]]
fn main() {
fn main_1() {
var V : S;
V.i = 5;
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -3,10 +3,15 @@ void func(int value, inout int pointer) {
return;
}
[numthreads(1, 1, 1)]
void main() {
void main_1() {
int i = 0;
i = 123;
func(123, i);
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -6,10 +6,15 @@ void func(int value, thread int* const pointer) {
return;
}
kernel void tint_symbol() {
void main_1() {
int i = 0;
i = 123;
func(123, &(i));
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 19
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -10,8 +10,9 @@
OpName %func "func"
OpName %value "value"
OpName %pointer "pointer"
OpName %main "main"
OpName %main_1 "main_1"
OpName %i "i"
OpName %main "main"
%void = OpTypeVoid
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
@@ -27,7 +28,7 @@
OpStore %pointer %value
OpReturn
OpFunctionEnd
%main = OpFunction %void None %10
%main_1 = OpFunction %void None %10
%12 = OpLabel
%i = OpVariable %_ptr_Function_int Function %15
OpStore %i %int_0
@@ -35,3 +36,8 @@
%17 = OpFunctionCall %void %func %int_123 %i
OpReturn
OpFunctionEnd
%main = OpFunction %void None %10
%20 = OpLabel
%21 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -3,10 +3,14 @@ fn func(value : i32, pointer : ptr<function, i32>) {
return;
}
[[stage(compute)]]
fn main() {
fn main_1() {
var i : i32 = 0;
i = 123;
func(123, &(i));
return;
}
[[stage(compute)]]
fn main() {
main_1();
}