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,5 +1,10 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -1,8 +1,13 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
void main_1() {
float const x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,12 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main_1 "main_1"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -28,9 +29,14 @@
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%23 = OpCompositeExtract %v3float %20 1
%24 = OpCompositeExtract %float %23 1
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%26 = OpLabel
%27 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,5 +1,9 @@
[[stage(compute)]]
fn main() {
fn main_1() {
let x_24 : f32 = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0))[1u].y;
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -1,7 +1,12 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
const float x_11 = float3(1.0f, 2.0f, 3.0f).y;
const float2 x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
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() {
void main_1() {
float const x_11 = float3(1.0f, 2.0f, 3.0f).y;
float2 const x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
float3 const x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,12 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 20
; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main_1 "main_1"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -17,7 +18,7 @@
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%11 = OpCompositeExtract %float %10 1
%13 = OpCompositeExtract %float %10 0
@@ -29,3 +30,8 @@
%19 = OpCompositeConstruct %v3float %16 %17 %18
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%21 = OpLabel
%22 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,11 @@
[[stage(compute)]]
fn main() {
fn main_1() {
let x_11 : f32 = vec3<f32>(1.0, 2.0, 3.0).y;
let x_13 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z);
let x_14 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).y);
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -1,7 +1,12 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
const float3 x_15 = m[1];
const float x_16 = x_15.y;
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() {
void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
float3 const x_15 = m[1];
float const x_16 = x_15.y;
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: 20
; Bound: 23
; 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 %m "m"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -22,7 +23,7 @@
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13
OpStore %m %10
@@ -31,3 +32,8 @@
%19 = OpCompositeExtract %float %18 1
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%21 = OpLabel
%22 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,11 @@
[[stage(compute)]]
fn main() {
fn main_1() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0));
let x_15 : vec3<f32> = m[1];
let x_16 : f32 = x_15.y;
return;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -1,5 +1,4 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
float3 v = float3(0.0f, 0.0f, 0.0f);
const float x_14 = v.y;
const float3 x_16 = v;
@@ -8,3 +7,9 @@ void main() {
const float3 x_19 = float3(x_18.x, x_18.z, x_18.y);
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() {
float3 v = float3(0.0f, 0.0f, 0.0f);
float const x_14 = v.y;
float3 const x_16 = v;
@@ -11,3 +11,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: 27
; Bound: 30
; 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 %v "v"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -21,7 +22,7 @@
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %11
OpStore %v %8
@@ -38,3 +39,8 @@
%26 = OpCompositeConstruct %v3float %23 %24 %25
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%28 = OpLabel
%29 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,5 +1,4 @@
[[stage(compute)]]
fn main() {
fn main_1() {
var v : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
let x_14 : f32 = v.y;
let x_16 : vec3<f32> = v;
@@ -8,3 +7,8 @@ fn main() {
let x_19 : vec3<f32> = vec3<f32>(x_18.x, x_18.z, x_18.y);
return;
}
[[stage(compute)]]
fn main() {
main_1();
}