tint: Deprecated module-scope 'let' for 'const'

Enable the parsing of 'const'.
Warn on use of module-scope 'let', and automatically replace with 'const'.

Fixed: tint:1580
Change-Id: I214aabca80686dc6b60ae21a7a57fbfb4898ea83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93786
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-06-29 00:55:36 +00:00
committed by Dawn LUCI CQ
parent 03f88e6f49
commit c64ca23d94
224 changed files with 1443 additions and 2495 deletions

View File

@@ -2,8 +2,8 @@
void tint_symbol() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
vec3 v = vec3(4.0f, 5.0f, 6.0f);
float f = 5.0f;
vec3 v = m[1];
float f = v[1];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,7 +1,7 @@
[numthreads(1, 1, 1)]
void main() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
const float3 v = float3(4.0f, 5.0f, 6.0f);
const float f = 5.0f;
const float3 v = m[1];
const float f = v[1];
return;
}

View File

@@ -3,8 +3,8 @@
using namespace metal;
kernel void tint_symbol() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
float3 const v = float3(4.0f, 5.0f, 6.0f);
float const f = 5.0f;
float3 const v = m[1];
float const f = v[1];
return;
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -26,7 +26,11 @@
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
%23 = OpCompositeExtract %v3float %20 1
%24 = OpCompositeExtract %float %23 1
OpReturn
OpFunctionEnd

View File

@@ -1,5 +1,5 @@
let slen = 4;
let ulen = 4u;
const slen = 4;
const ulen = 4u;
@fragment
fn main() {

View File

@@ -1,8 +1,6 @@
#version 310 es
precision mediump float;
const int slen = 4;
const uint ulen = 4u;
void tint_symbol() {
float signed_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
float unsigned_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);

View File

@@ -1,6 +1,3 @@
static const int slen = 4;
static const uint ulen = 4u;
void main() {
float signed_literal[4] = (float[4])0;
float unsigned_literal[4] = (float[4])0;

View File

@@ -14,10 +14,6 @@ struct tint_array {
T elements[N];
};
constant int slen = 4;
constant uint ulen = 4u;
fragment void tint_symbol() {
tint_array<float, 4> signed_literal = {};
tint_array<float, 4> unsigned_literal = {};

View File

@@ -1,39 +1,35 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 19
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpName %slen "slen"
OpName %ulen "ulen"
OpName %main "main"
OpName %signed_literal "signed_literal"
OpName %unsigned_literal "unsigned_literal"
OpName %signed_constant "signed_constant"
OpName %unsigned_constant "unsigned_constant"
OpDecorate %_arr_float_ulen ArrayStride 4
%int = OpTypeInt 32 1
%slen = OpConstant %int 4
%uint = OpTypeInt 32 0
%ulen = OpConstant %uint 4
OpDecorate %_arr_float_uint_4 ArrayStride 4
%void = OpTypeVoid
%5 = OpTypeFunction %void
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%_arr_float_ulen = OpTypeArray %float %ulen
%_ptr_Function__arr_float_ulen = OpTypePointer Function %_arr_float_ulen
%13 = OpConstantNull %_arr_float_ulen
%main = OpFunction %void None %5
%8 = OpLabel
%signed_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
%unsigned_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
%signed_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
%unsigned_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
%17 = OpLoad %_arr_float_ulen %unsigned_constant
OpStore %signed_literal %17
%18 = OpLoad %_arr_float_ulen %unsigned_literal
OpStore %signed_constant %18
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_float_uint_4 = OpTypeArray %float %uint_4
%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4
%11 = OpConstantNull %_arr_float_uint_4
%main = OpFunction %void None %1
%4 = OpLabel
%signed_literal = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
%unsigned_literal = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
%signed_constant = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
%unsigned_constant = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
%15 = OpLoad %_arr_float_uint_4 %unsigned_constant
OpStore %signed_literal %15
%16 = OpLoad %_arr_float_uint_4 %unsigned_literal
OpStore %signed_constant %16
OpReturn
OpFunctionEnd

View File

@@ -1,6 +1,6 @@
let slen = 4;
const slen = 4;
let ulen = 4u;
const ulen = 4u;
@fragment
fn main() {

View File

@@ -4,35 +4,35 @@ void tint_symbol() {
int x = 42;
int empty[4] = int[4](0, 0, 0, 0);
int nonempty[4] = int[4](1, 2, 3, 4);
int nonempty_with_expr[4] = int[4](1, x, (x + 1), 4);
int nonempty_with_expr[4] = int[4](1, x, (x + 1), nonempty[3]);
int nested_empty[2][3][4] = int[2][3][4](int[3][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0), int[4](0, 0, 0, 0)), int[3][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0), int[4](0, 0, 0, 0)));
int tint_symbol_1[4] = int[4](1, 2, 3, 4);
int tint_symbol_2[4] = int[4](5, 6, 7, 8);
int tint_symbol_3[4] = int[4](9, 10, 11, 12);
int tint_symbol_4[3][4] = int[3][4](int[4](1, 2, 3, 4), int[4](5, 6, 7, 8), int[4](9, 10, 11, 12));
int tint_symbol_4[3][4] = int[3][4](tint_symbol_1, tint_symbol_2, tint_symbol_3);
int tint_symbol_5[4] = int[4](13, 14, 15, 16);
int tint_symbol_6[4] = int[4](17, 18, 19, 20);
int tint_symbol_7[4] = int[4](21, 22, 23, 24);
int tint_symbol_8[3][4] = int[3][4](int[4](13, 14, 15, 16), int[4](17, 18, 19, 20), int[4](21, 22, 23, 24));
int nested_nonempty[2][3][4] = int[2][3][4](int[3][4](int[4](1, 2, 3, 4), int[4](5, 6, 7, 8), int[4](9, 10, 11, 12)), int[3][4](int[4](13, 14, 15, 16), int[4](17, 18, 19, 20), int[4](21, 22, 23, 24)));
int tint_symbol_8[3][4] = int[3][4](tint_symbol_5, tint_symbol_6, tint_symbol_7);
int nested_nonempty[2][3][4] = int[2][3][4](tint_symbol_4, tint_symbol_8);
int tint_symbol_9[4] = int[4](1, 2, x, (x + 1));
int tint_symbol_10[4] = int[4](5, 6, 3, (4 + 1));
int tint_symbol_10[4] = int[4](5, 6, nonempty[2], (nonempty[3] + 1));
int tint_symbol_11[3][4] = int[3][4](tint_symbol_9, tint_symbol_10, nonempty);
int nested_nonempty_with_expr[2][3][4] = int[2][3][4](tint_symbol_11, int[3][4](int[4](13, 14, 15, 16), int[4](17, 18, 19, 20), int[4](21, 22, 23, 24)));
int nested_nonempty_with_expr[2][3][4] = int[2][3][4](tint_symbol_11, nested_nonempty[1]);
int tint_symbol_12[4] = int[4](0, 0, 0, 0);
int subexpr_empty = 0;
int subexpr_empty = tint_symbol_12[1];
int tint_symbol_13[4] = int[4](1, 2, 3, 4);
int subexpr_nonempty = 3;
int tint_symbol_14[4] = int[4](1, x, (x + 1), 4);
int subexpr_nonempty = tint_symbol_13[2];
int tint_symbol_14[4] = int[4](1, x, (x + 1), nonempty[3]);
int subexpr_nonempty_with_expr = tint_symbol_14[2];
int tint_symbol_15[2][4] = int[2][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0));
int subexpr_nested_empty[4] = int[4](0, 0, 0, 0);
int subexpr_nested_empty[4] = tint_symbol_15[1];
int tint_symbol_16[4] = int[4](1, 2, 3, 4);
int tint_symbol_17[4] = int[4](5, 6, 7, 8);
int tint_symbol_18[2][4] = int[2][4](int[4](1, 2, 3, 4), int[4](5, 6, 7, 8));
int subexpr_nested_nonempty[4] = int[4](5, 6, 7, 8);
int tint_symbol_19[4] = int[4](1, x, (x + 1), 4);
int tint_symbol_20[2][4] = int[2][4](tint_symbol_19, int[4](21, 22, 23, 24));
int tint_symbol_18[2][4] = int[2][4](tint_symbol_16, tint_symbol_17);
int subexpr_nested_nonempty[4] = tint_symbol_18[1];
int tint_symbol_19[4] = int[4](1, x, (x + 1), nonempty[3]);
int tint_symbol_20[2][4] = int[2][4](tint_symbol_19, nested_nonempty[1][2]);
int subexpr_nested_nonempty_with_expr[4] = tint_symbol_20[1];
}

View File

@@ -3,35 +3,35 @@ void main() {
const int x = 42;
const int empty[4] = (int[4])0;
const int nonempty[4] = {1, 2, 3, 4};
const int nonempty_with_expr[4] = {1, x, (x + 1), 4};
const int nonempty_with_expr[4] = {1, x, (x + 1), nonempty[3]};
const int nested_empty[2][3][4] = (int[2][3][4])0;
const int tint_symbol[4] = {1, 2, 3, 4};
const int tint_symbol_1[4] = {5, 6, 7, 8};
const int tint_symbol_2[4] = {9, 10, 11, 12};
const int tint_symbol_3[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
const int tint_symbol_3[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2};
const int tint_symbol_4[4] = {13, 14, 15, 16};
const int tint_symbol_5[4] = {17, 18, 19, 20};
const int tint_symbol_6[4] = {21, 22, 23, 24};
const int tint_symbol_7[3][4] = {{13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}};
const int nested_nonempty[2][3][4] = {{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}, {{13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}}};
const int tint_symbol_7[3][4] = {tint_symbol_4, tint_symbol_5, tint_symbol_6};
const int nested_nonempty[2][3][4] = {tint_symbol_3, tint_symbol_7};
const int tint_symbol_8[4] = {1, 2, x, (x + 1)};
const int tint_symbol_9[4] = {5, 6, 3, (4 + 1)};
const int tint_symbol_9[4] = {5, 6, nonempty[2], (nonempty[3] + 1)};
const int tint_symbol_10[3][4] = {tint_symbol_8, tint_symbol_9, nonempty};
const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, {{13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}}};
const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, nested_nonempty[1]};
const int tint_symbol_11[4] = (int[4])0;
const int subexpr_empty = 0;
const int subexpr_empty = tint_symbol_11[1];
const int tint_symbol_12[4] = {1, 2, 3, 4};
const int subexpr_nonempty = 3;
const int tint_symbol_13[4] = {1, x, (x + 1), 4};
const int subexpr_nonempty = tint_symbol_12[2];
const int tint_symbol_13[4] = {1, x, (x + 1), nonempty[3]};
const int subexpr_nonempty_with_expr = tint_symbol_13[2];
const int tint_symbol_14[2][4] = (int[2][4])0;
const int subexpr_nested_empty[4] = (int[4])0;
const int subexpr_nested_empty[4] = tint_symbol_14[1];
const int tint_symbol_15[4] = {1, 2, 3, 4};
const int tint_symbol_16[4] = {5, 6, 7, 8};
const int tint_symbol_17[2][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}};
const int subexpr_nested_nonempty[4] = {5, 6, 7, 8};
const int tint_symbol_18[4] = {1, x, (x + 1), 4};
const int tint_symbol_19[2][4] = {tint_symbol_18, {21, 22, 23, 24}};
const int tint_symbol_17[2][4] = {tint_symbol_15, tint_symbol_16};
const int subexpr_nested_nonempty[4] = tint_symbol_17[1];
const int tint_symbol_18[4] = {1, x, (x + 1), nonempty[3]};
const int tint_symbol_19[2][4] = {tint_symbol_18, nested_nonempty[1][2]};
const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1];
return;
}

View File

@@ -18,35 +18,35 @@ kernel void tint_symbol() {
int const x = 42;
tint_array<int, 4> const empty = tint_array<int, 4>{};
tint_array<int, 4> const nonempty = tint_array<int, 4>{1, 2, 3, 4};
tint_array<int, 4> const nonempty_with_expr = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), 4};
tint_array<int, 4> const nonempty_with_expr = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty[3]};
tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_empty = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{};
tint_array<int, 4> const tint_symbol_1 = tint_array<int, 4>{1, 2, 3, 4};
tint_array<int, 4> const tint_symbol_2 = tint_array<int, 4>{5, 6, 7, 8};
tint_array<int, 4> const tint_symbol_3 = tint_array<int, 4>{9, 10, 11, 12};
tint_array<tint_array<int, 4>, 3> const tint_symbol_4 = tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{1, 2, 3, 4}, tint_array<int, 4>{5, 6, 7, 8}, tint_array<int, 4>{9, 10, 11, 12}};
tint_array<tint_array<int, 4>, 3> const tint_symbol_4 = tint_array<tint_array<int, 4>, 3>{tint_symbol_1, tint_symbol_2, tint_symbol_3};
tint_array<int, 4> const tint_symbol_5 = tint_array<int, 4>{13, 14, 15, 16};
tint_array<int, 4> const tint_symbol_6 = tint_array<int, 4>{17, 18, 19, 20};
tint_array<int, 4> const tint_symbol_7 = tint_array<int, 4>{21, 22, 23, 24};
tint_array<tint_array<int, 4>, 3> const tint_symbol_8 = tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{13, 14, 15, 16}, tint_array<int, 4>{17, 18, 19, 20}, tint_array<int, 4>{21, 22, 23, 24}};
tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{1, 2, 3, 4}, tint_array<int, 4>{5, 6, 7, 8}, tint_array<int, 4>{9, 10, 11, 12}}, tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{13, 14, 15, 16}, tint_array<int, 4>{17, 18, 19, 20}, tint_array<int, 4>{21, 22, 23, 24}}};
tint_array<tint_array<int, 4>, 3> const tint_symbol_8 = tint_array<tint_array<int, 4>, 3>{tint_symbol_5, tint_symbol_6, tint_symbol_7};
tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_symbol_4, tint_symbol_8};
tint_array<int, 4> const tint_symbol_9 = tint_array<int, 4>{1, 2, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1)))};
tint_array<int, 4> const tint_symbol_10 = tint_array<int, 4>{5, 6, 3, as_type<int>((as_type<uint>(4) + as_type<uint>(1)))};
tint_array<int, 4> const tint_symbol_10 = tint_array<int, 4>{5, 6, nonempty[2], as_type<int>((as_type<uint>(nonempty[3]) + as_type<uint>(1)))};
tint_array<tint_array<int, 4>, 3> const tint_symbol_11 = tint_array<tint_array<int, 4>, 3>{tint_symbol_9, tint_symbol_10, nonempty};
tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty_with_expr = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_symbol_11, tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{13, 14, 15, 16}, tint_array<int, 4>{17, 18, 19, 20}, tint_array<int, 4>{21, 22, 23, 24}}};
tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty_with_expr = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_symbol_11, nested_nonempty[1]};
tint_array<int, 4> const tint_symbol_12 = tint_array<int, 4>{};
int const subexpr_empty = 0;
int const subexpr_empty = tint_symbol_12[1];
tint_array<int, 4> const tint_symbol_13 = tint_array<int, 4>{1, 2, 3, 4};
int const subexpr_nonempty = 3;
tint_array<int, 4> const tint_symbol_14 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), 4};
int const subexpr_nonempty = tint_symbol_13[2];
tint_array<int, 4> const tint_symbol_14 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty[3]};
int const subexpr_nonempty_with_expr = tint_symbol_14[2];
tint_array<tint_array<int, 4>, 2> const tint_symbol_15 = tint_array<tint_array<int, 4>, 2>{};
tint_array<int, 4> const subexpr_nested_empty = tint_array<int, 4>{};
tint_array<int, 4> const subexpr_nested_empty = tint_symbol_15[1];
tint_array<int, 4> const tint_symbol_16 = tint_array<int, 4>{1, 2, 3, 4};
tint_array<int, 4> const tint_symbol_17 = tint_array<int, 4>{5, 6, 7, 8};
tint_array<tint_array<int, 4>, 2> const tint_symbol_18 = tint_array<tint_array<int, 4>, 2>{tint_array<int, 4>{1, 2, 3, 4}, tint_array<int, 4>{5, 6, 7, 8}};
tint_array<int, 4> const subexpr_nested_nonempty = tint_array<int, 4>{5, 6, 7, 8};
tint_array<int, 4> const tint_symbol_19 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), 4};
tint_array<tint_array<int, 4>, 2> const tint_symbol_20 = tint_array<tint_array<int, 4>, 2>{tint_symbol_19, tint_array<int, 4>{21, 22, 23, 24}};
tint_array<tint_array<int, 4>, 2> const tint_symbol_18 = tint_array<tint_array<int, 4>, 2>{tint_symbol_16, tint_symbol_17};
tint_array<int, 4> const subexpr_nested_nonempty = tint_symbol_18[1];
tint_array<int, 4> const tint_symbol_19 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty[3]};
tint_array<tint_array<int, 4>, 2> const tint_symbol_20 = tint_array<tint_array<int, 4>, 2>{tint_symbol_19, nested_nonempty[1][2]};
tint_array<int, 4> const subexpr_nested_nonempty_with_expr = tint_symbol_20[1];
return;
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 66
; Bound: 74
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -29,53 +29,61 @@
%_arr__arr_int_uint_4_uint_3 = OpTypeArray %_arr_int_uint_4 %uint_3
%uint_2 = OpConstant %uint 2
%_arr__arr__arr_int_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_int_uint_4_uint_3 %uint_2
%22 = OpConstantNull %_arr__arr__arr_int_uint_4_uint_3_uint_2
%23 = OpConstantNull %_arr__arr__arr_int_uint_4_uint_3_uint_2
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%27 = OpConstantComposite %_arr_int_uint_4 %int_5 %int_6 %int_7 %int_8
%28 = OpConstantComposite %_arr_int_uint_4 %int_5 %int_6 %int_7 %int_8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%int_11 = OpConstant %int 11
%int_12 = OpConstant %int 12
%32 = OpConstantComposite %_arr_int_uint_4 %int_9 %int_10 %int_11 %int_12
%33 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %15 %27 %32
%33 = OpConstantComposite %_arr_int_uint_4 %int_9 %int_10 %int_11 %int_12
%34 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %15 %28 %33
%int_13 = OpConstant %int 13
%int_14 = OpConstant %int 14
%int_15 = OpConstant %int 15
%int_16 = OpConstant %int 16
%38 = OpConstantComposite %_arr_int_uint_4 %int_13 %int_14 %int_15 %int_16
%39 = OpConstantComposite %_arr_int_uint_4 %int_13 %int_14 %int_15 %int_16
%int_17 = OpConstant %int 17
%int_18 = OpConstant %int 18
%int_19 = OpConstant %int 19
%int_20 = OpConstant %int 20
%43 = OpConstantComposite %_arr_int_uint_4 %int_17 %int_18 %int_19 %int_20
%44 = OpConstantComposite %_arr_int_uint_4 %int_17 %int_18 %int_19 %int_20
%int_21 = OpConstant %int 21
%int_22 = OpConstant %int 22
%int_23 = OpConstant %int 23
%int_24 = OpConstant %int 24
%48 = OpConstantComposite %_arr_int_uint_4 %int_21 %int_22 %int_23 %int_24
%49 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %38 %43 %48
%50 = OpConstantComposite %_arr__arr__arr_int_uint_4_uint_3_uint_2 %33 %49
%57 = OpConstantNull %int
%49 = OpConstantComposite %_arr_int_uint_4 %int_21 %int_22 %int_23 %int_24
%50 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %39 %44 %49
%51 = OpConstantComposite %_arr__arr__arr_int_uint_4_uint_3_uint_2 %34 %50
%61 = OpConstantNull %int
%_arr__arr_int_uint_4_uint_2 = OpTypeArray %_arr_int_uint_4 %uint_2
%main = OpFunction %void None %1
%4 = OpLabel
%16 = OpIAdd %int %int_42 %int_1
%17 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %16 %int_4
%51 = OpIAdd %int %int_42 %int_1
%52 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_2 %int_42 %51
%53 = OpIAdd %int %int_4 %int_1
%54 = OpCompositeConstruct %_arr_int_uint_4 %int_5 %int_6 %int_3 %53
%55 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_3 %52 %54 %15
%56 = OpCompositeConstruct %_arr__arr__arr_int_uint_4_uint_3_uint_2 %55 %49
%58 = OpIAdd %int %int_42 %int_1
%59 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %58 %int_4
%60 = OpCompositeExtract %int %59 2
%17 = OpCompositeExtract %int %15 3
%18 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %16 %17
%52 = OpIAdd %int %int_42 %int_1
%53 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_2 %int_42 %52
%54 = OpCompositeExtract %int %15 2
%55 = OpCompositeExtract %int %15 3
%56 = OpIAdd %int %55 %int_1
%57 = OpCompositeConstruct %_arr_int_uint_4 %int_5 %int_6 %54 %56
%58 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_3 %53 %57 %15
%59 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1
%60 = OpCompositeConstruct %_arr__arr__arr_int_uint_4_uint_3_uint_2 %58 %59
%62 = OpIAdd %int %int_42 %int_1
%63 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %62 %int_4
%64 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %63 %48
%65 = OpCompositeExtract %_arr_int_uint_4 %64 1
%63 = OpCompositeExtract %int %15 3
%64 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %62 %63
%65 = OpCompositeExtract %int %64 2
%67 = OpIAdd %int %int_42 %int_1
%68 = OpCompositeExtract %int %15 3
%69 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %67 %68
%70 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1
%71 = OpCompositeExtract %_arr_int_uint_4 %70 2
%72 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %69 %71
%73 = OpCompositeExtract %_arr_int_uint_4 %72 1
OpReturn
OpFunctionEnd

View File

@@ -1,4 +1,4 @@
let bloomDir = vec2(0.0, 1.0);
const bloomDir = vec2(0.0, 1.0);
var<private> offsets : array<f32, 3> = array<f32, 3>(0.0, 1.384615421, 3.230769157);

View File

@@ -53,7 +53,7 @@ struct GlobalLights {
@group(0) @binding(3) var<storage, read> globalLights : GlobalLights;
let tileCount = vec3(32u, 18u, 48u);
const tileCount = vec3(32u, 18u, 48u);
fn linearDepth(depthSample : f32) -> f32 {
return ((camera.zFar * camera.zNear) / fma(depthSample, (camera.zNear - camera.zFar), camera.zFar));

View File

@@ -21,9 +21,9 @@ struct FragmentInput {
fragNorm : vec3<f32>,
}
let albedo : vec3<f32> = vec3<f32>(0.899999976, 0.899999976, 0.899999976);
const albedo : vec3<f32> = vec3<f32>(0.899999976, 0.899999976, 0.899999976);
let ambientFactor : f32 = 0.200000003;
const ambientFactor : f32 = 0.200000003;
@fragment
fn main(input : FragmentInput) -> @location(0) vec4<f32> {

View File

@@ -1,4 +1,4 @@
let GAMMA = 2.200000048;
const GAMMA = 2.200000048;
fn linearTosRGB(linear : vec3<f32>) -> vec3<f32> {
let INV_GAMMA = (1.0 / GAMMA);
@@ -53,7 +53,7 @@ struct GlobalLights {
@binding(2) @group(0) var<storage, read> globalLights : GlobalLights;
let tileCount = vec3(32u, 18u, 48u);
const tileCount = vec3(32u, 18u, 48u);
fn linearDepth(depthSample : f32) -> f32 {
return ((camera.zFar * camera.zNear) / fma(depthSample, (camera.zNear - camera.zFar), camera.zFar));
@@ -85,7 +85,7 @@ struct LightShadowTable {
var<private> shadowSampleOffsets : array<vec2<f32>, 16> = array<vec2<f32>, 16>(vec2(-1.5, -1.5), vec2(-1.5, -0.5), vec2(-1.5, 0.5), vec2(-1.5, 1.5), vec2(-0.5, -1.5), vec2(-0.5, -0.5), vec2(-0.5, 0.5), vec2(-0.5, 1.5), vec2(0.5, -1.5), vec2(0.5, -0.5), vec2(0.5, 0.5), vec2(0.5, 1.5), vec2(1.5, -1.5), vec2(1.5, -0.5), vec2(1.5, 0.5), vec2(1.5, 1.5));
let shadowSampleCount = 16u;
const shadowSampleCount = 16u;
struct ShadowProperties {
viewport : vec4<f32>,
@@ -249,13 +249,13 @@ fn GetSurfaceInfo(input : VertexOutput) -> SurfaceInfo {
return surface;
}
let PI = 3.141592741;
const PI = 3.141592741;
let LightType_Point = 0u;
const LightType_Point = 0u;
let LightType_Spot = 1u;
const LightType_Spot = 1u;
let LightType_Directional = 2u;
const LightType_Directional = 2u;
struct PuctualLight {
lightType : u32,

View File

@@ -1,2 +1,2 @@
let
const
H=1;

View File

@@ -4,4 +4,3 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
const int H = 1;

View File

@@ -3,4 +3,3 @@ void unused_entry_point() {
return;
}
static const int H = 1;

View File

@@ -1,5 +1,3 @@
#include <metal_stdlib>
using namespace metal;
constant int H = 1;

View File

@@ -1,19 +1,16 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 7
; Bound: 5
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %H "H"
OpName %unused_entry_point "unused_entry_point"
%int = OpTypeInt 32 1
%H = OpConstant %int 1
%void = OpTypeVoid
%3 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %3
%6 = OpLabel
%1 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -1 +1 @@
let H = 1;
const H = 1;

View File

@@ -84,7 +84,7 @@ void tint_symbol_2(uvec3 GlobalInvocationID) {
for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
ivec2 tilePixel0Idx = ivec2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.fullScreenSize.xy) - vec2(1.0f));
vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(16)))) / uniforms.fullScreenSize.xy) - vec2(1.0f));
vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.fullScreenSize.xy) - vec2(1.0f));
vec2 viewFloorCoord = vec2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
vec2 viewCeilCoord = vec2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = vec4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);

View File

@@ -58,7 +58,7 @@ void main_inner(uint3 GlobalInvocationID) {
[loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
int2 tilePixel0Idx = int2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / asfloat(uniforms[10]).xy) - (1.0f).xx);
float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + (16).xx))) / asfloat(uniforms[10]).xy) - (1.0f).xx);
float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - (1.0f).xx);
float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);

View File

@@ -88,7 +88,7 @@ void tint_symbol_inner(uint3 GlobalInvocationID, const constant Config* const ti
for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = as_type<int>((as_type<uint>(x_1) + as_type<uint>(1)))) {
int2 tilePixel0Idx = int2(as_type<int>((as_type<uint>(x_1) * as_type<uint>(TILE_SIZE))), as_type<int>((as_type<uint>(y_1) * as_type<uint>(TILE_SIZE))));
float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f));
float2 ceilCoord = (((2.0f * float2(as_type<int2>((as_type<uint2>(tilePixel0Idx) + as_type<uint2>(int2(16)))))) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f));
float2 ceilCoord = (((2.0f * float2(as_type<int2>((as_type<uint2>(tilePixel0Idx) + as_type<uint2>(int2(TILE_SIZE)))))) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f));
float2 viewFloorCoord = float2((((-(viewNear) * floorCoord[0]) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord[1]) - (M[2][1] * viewNear)) / M[1][1]));
float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord[0]) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord[1]) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord[0]) / viewNear), 0.0f);

View File

@@ -175,7 +175,6 @@
%207 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%211 = OpConstantNull %v2float
%214 = OpConstantComposite %v2int %int_16 %int_16
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
@@ -358,6 +357,7 @@
%208 = OpFSub %v2float %206 %207
OpStore %floorCoord %208
%213 = OpLoad %v2int %tilePixel0Idx
%214 = OpCompositeConstruct %v2int %int_16 %int_16
%215 = OpIAdd %v2int %213 %214
%212 = OpConvertSToF %v2float %215
%216 = OpVectorTimesScalar %v2float %212 %float_2

View File

@@ -6,7 +6,7 @@ void unused_entry_point() {
}
void f() {
mat4 m = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
vec4 v1 = vec4(1.0f);
float a = 1.0f;
vec4 v1 = m[0];
float a = v1[0];
}

View File

@@ -5,6 +5,6 @@ void unused_entry_point() {
void f() {
const float4x4 m = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx);
const float4 v1 = (1.0f).xxxx;
const float a = 1.0f;
const float4 v1 = m[0];
const float a = v1[0];
}

View File

@@ -3,7 +3,7 @@
using namespace metal;
void f() {
float4x4 const m = float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f));
float4 const v1 = float4(1.0f);
float const a = 1.0f;
float4 const v1 = m[0];
float const a = v1[0];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -17,11 +17,15 @@
%float_1 = OpConstant %float 1
%11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%12 = OpConstantComposite %mat4v4float %11 %11 %11 %11
%int = OpTypeInt 32 1
%14 = OpConstantNull %int
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
%15 = OpCompositeExtract %v4float %12 0
%16 = OpCompositeExtract %float %15 0
OpReturn
OpFunctionEnd

View File

@@ -2,7 +2,7 @@
values : array<f32>,
};
let width : u32 = 128u;
const width : u32 = 128u;
@group(0) @binding(0) var tex : texture_depth_2d;
@group(0) @binding(1) var<storage, read_write> result : Result;

View File

@@ -1,12 +1,11 @@
#version 310 es
const uint width = 128u;
layout(binding = 1, std430) buffer Result_1 {
float values[];
} result;
uniform highp sampler2D tex_1;
void tint_symbol(uvec3 GlobalInvocationId) {
result.values[((GlobalInvocationId.y * width) + GlobalInvocationId.x)] = texelFetch(tex_1, ivec2(int(GlobalInvocationId.x), int(GlobalInvocationId.y)), 0).x;
result.values[((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)] = texelFetch(tex_1, ivec2(int(GlobalInvocationId.x), int(GlobalInvocationId.y)), 0).x;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,5 +1,3 @@
static const uint width = 128u;
Texture2D tex : register(t0, space0);
RWByteAddressBuffer result : register(u1, space0);
@@ -8,7 +6,7 @@ struct tint_symbol_1 {
};
void main_inner(uint3 GlobalInvocationId) {
result.Store((4u * ((GlobalInvocationId.y * width) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x));
result.Store((4u * ((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x));
}
[numthreads(1, 1, 1)]

View File

@@ -18,10 +18,8 @@ struct Result {
/* 0x0000 */ tint_array<float, 1> values;
};
constant uint width = 128u;
void tint_symbol_inner(uint3 GlobalInvocationId, device Result* const tint_symbol_1, depth2d<float, access::sample> tint_symbol_2) {
(*(tint_symbol_1)).values[((GlobalInvocationId[1] * width) + GlobalInvocationId[0])] = tint_symbol_2.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0);
(*(tint_symbol_1)).values[((GlobalInvocationId[1] * 128u) + GlobalInvocationId[0])] = tint_symbol_2.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0);
}
kernel void tint_symbol(device Result* tint_symbol_3 [[buffer(0)]], depth2d<float, access::sample> tint_symbol_4 [[texture(0)]], uint3 GlobalInvocationId [[thread_position_in_grid]]) {

View File

@@ -8,7 +8,6 @@
OpEntryPoint GLCompute %main "main" %GlobalInvocationId_1
OpExecutionMode %main LocalSize 1 1 1
OpName %GlobalInvocationId_1 "GlobalInvocationId_1"
OpName %width "width"
OpName %tex "tex"
OpName %Result "Result"
OpMemberName %Result 0 "values"
@@ -28,33 +27,33 @@
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%GlobalInvocationId_1 = OpVariable %_ptr_Input_v3uint Input
%width = OpConstant %uint 128
%float = OpTypeFloat 32
%8 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8
%tex = OpVariable %_ptr_UniformConstant_8 UniformConstant
%7 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
%tex = OpVariable %_ptr_UniformConstant_7 UniformConstant
%_runtimearr_float = OpTypeRuntimeArray %float
%Result = OpTypeStruct %_runtimearr_float
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void %v3uint
%13 = OpTypeFunction %void %v3uint
%uint_0 = OpConstant %uint 0
%uint_128 = OpConstant %uint 128
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%v4float = OpTypeVector %float 4
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%37 = OpConstantNull %int
%38 = OpTypeFunction %void
%main_inner = OpFunction %void None %14
%main_inner = OpFunction %void None %13
%GlobalInvocationId = OpFunctionParameter %v3uint
%18 = OpLabel
%20 = OpCompositeExtract %uint %GlobalInvocationId 1
%21 = OpIMul %uint %20 %width
%17 = OpLabel
%19 = OpCompositeExtract %uint %GlobalInvocationId 1
%21 = OpIMul %uint %19 %uint_128
%22 = OpCompositeExtract %uint %GlobalInvocationId 0
%23 = OpIAdd %uint %21 %22
%25 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %23
%29 = OpLoad %8 %tex
%29 = OpLoad %7 %tex
%33 = OpCompositeExtract %uint %GlobalInvocationId 0
%32 = OpBitcast %int %33
%35 = OpCompositeExtract %uint %GlobalInvocationId 1

View File

@@ -2,7 +2,7 @@ struct Result {
values : array<f32>,
}
let width : u32 = 128u;
const width : u32 = 128u;
@group(0) @binding(0) var tex : texture_depth_2d;

View File

@@ -38,11 +38,11 @@ fn mm_write(row : u32, col : u32, value : f32) {
}
}
let RowPerThread : u32 = 4u;
let ColPerThread : u32 = 4u;
let TileAOuter : u32 = 64u;
let TileBOuter : u32 = 64u;
let TileInner : u32 = 64u;
const RowPerThread : u32 = 4u;
const ColPerThread : u32 = 4u;
const TileAOuter : u32 = 64u;
const TileBOuter : u32 = 64u;
const TileInner : u32 = 64u;
var<workgroup> mm_Asub : array<array<f32, 64>, 64>;
var<workgroup> mm_Bsub : array<array<f32, 64>, 64>;
@compute @workgroup_size(16, 16, 1)

View File

@@ -56,9 +56,6 @@ void mm_write(uint row, uint col, float value) {
}
}
const uint RowPerThread = 4u;
const uint ColPerThread = 4u;
const uint TileInner = 64u;
shared float mm_Asub[64][64];
shared float mm_Bsub[64][64];
void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
@@ -71,32 +68,32 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
}
}
barrier();
uint tileRow = (local_id.y * RowPerThread);
uint tileCol = (local_id.x * ColPerThread);
uint globalRow = (global_id.y * RowPerThread);
uint globalCol = (global_id.x * ColPerThread);
uint numTiles = (((uniforms.dimInner - 1u) / TileInner) + 1u);
uint tileRow = (local_id.y * 4u);
uint tileCol = (local_id.x * 4u);
uint globalRow = (global_id.y * 4u);
uint globalCol = (global_id.x * 4u);
uint numTiles = (((uniforms.dimInner - 1u) / 64u) + 1u);
float acc[16] = float[16](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float ACached = 0.0f;
float BCached[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
{
for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) {
acc[index] = 0.0f;
}
}
uint ColPerThreadA = (TileInner / 16u);
uint ColPerThreadA = (64u / 16u);
uint tileColA = (local_id.x * ColPerThreadA);
uint RowPerThreadB = (TileInner / 16u);
uint RowPerThreadB = (64u / 16u);
uint tileRowB = (local_id.y * RowPerThreadB);
{
for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
{
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
uint inputRow = (tileRow + innerRow);
uint inputCol = (tileColA + innerCol);
float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol));
mm_Asub[inputRow][inputCol] = tint_symbol_1;
}
}
@@ -105,10 +102,10 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
{
for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
{
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint inputRow = (tileRowB + innerRow);
uint inputCol = (tileCol + innerCol);
float tint_symbol_2 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
float tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol));
mm_Bsub[innerCol][inputCol] = tint_symbol_2;
}
}
@@ -116,18 +113,18 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
}
barrier();
{
for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
for(uint k = 0u; (k < 64u); k = (k + 1u)) {
{
for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) {
BCached[inner] = mm_Bsub[k][(tileCol + inner)];
}
}
{
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
ACached = mm_Asub[(tileRow + innerRow)][k];
{
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
uint index = ((innerRow * ColPerThread) + innerCol);
for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint index = ((innerRow * 4u) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
}
@@ -139,10 +136,10 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
}
}
{
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
uint index = ((innerRow * ColPerThread) + innerCol);
for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint index = ((innerRow * 4u) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
}
}

View File

@@ -40,12 +40,6 @@ void mm_write(uint row, uint col, float value) {
}
}
static const uint RowPerThread = 4u;
static const uint ColPerThread = 4u;
static const uint TileAOuter = 64u;
static const uint TileBOuter = 64u;
static const uint TileInner = 64u;
groupshared float mm_Asub[64][64];
groupshared float mm_Bsub[64][64];
@@ -65,32 +59,32 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
}
}
GroupMemoryBarrierWithGroupSync();
const uint tileRow = (local_id.y * RowPerThread);
const uint tileCol = (local_id.x * ColPerThread);
const uint globalRow = (global_id.y * RowPerThread);
const uint globalCol = (global_id.x * ColPerThread);
const uint numTiles = (((uniforms[0].y - 1u) / TileInner) + 1u);
const uint tileRow = (local_id.y * 4u);
const uint tileCol = (local_id.x * 4u);
const uint globalRow = (global_id.y * 4u);
const uint globalCol = (global_id.x * 4u);
const uint numTiles = (((uniforms[0].y - 1u) / 64u) + 1u);
float acc[16] = (float[16])0;
float ACached = 0.0f;
float BCached[4] = (float[4])0;
{
[loop] for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
[loop] for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) {
acc[index] = 0.0f;
}
}
const uint ColPerThreadA = (TileInner / 16u);
const uint ColPerThreadA = (64u / 16u);
const uint tileColA = (local_id.x * ColPerThreadA);
const uint RowPerThreadB = (TileInner / 16u);
const uint RowPerThreadB = (64u / 16u);
const uint tileRowB = (local_id.y * RowPerThreadB);
{
[loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
[loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRow + innerRow);
const uint inputCol = (tileColA + innerCol);
const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol));
mm_Asub[inputRow][inputCol] = tint_symbol_2;
}
}
@@ -99,10 +93,10 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
[loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRowB + innerRow);
const uint inputCol = (tileCol + innerCol);
const float tint_symbol_3 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
const float tint_symbol_3 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol));
mm_Bsub[innerCol][inputCol] = tint_symbol_3;
}
}
@@ -110,18 +104,18 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
}
GroupMemoryBarrierWithGroupSync();
{
[loop] for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
[loop] for(uint k = 0u; (k < 64u); k = (k + 1u)) {
{
[loop] for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
[loop] for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) {
BCached[inner] = mm_Bsub[k][(tileCol + inner)];
}
}
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
[loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
ACached = mm_Asub[(tileRow + innerRow)][k];
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol);
[loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * 4u) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
}
@@ -133,10 +127,10 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
}
}
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
[loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol);
[loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * 4u) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
}
}

View File

@@ -47,16 +47,6 @@ void mm_write(uint row, uint col, float value, const constant Uniforms* const ti
}
}
constant uint RowPerThread = 4u;
constant uint ColPerThread = 4u;
constant uint TileAOuter = 64u;
constant uint TileBOuter = 64u;
constant uint TileInner = 64u;
void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_9, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_10, const constant Uniforms* const tint_symbol_11, const device Matrix* const tint_symbol_12, const device Matrix* const tint_symbol_13, device Matrix* const tint_symbol_14) {
for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
uint const i = (idx / 64u);
@@ -65,56 +55,56 @@ void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_in
(*(tint_symbol_10))[i][i_1] = 0.0f;
}
threadgroup_barrier(mem_flags::mem_threadgroup);
uint const tileRow = (local_id[1] * RowPerThread);
uint const tileCol = (local_id[0] * ColPerThread);
uint const globalRow = (global_id[1] * RowPerThread);
uint const globalCol = (global_id[0] * ColPerThread);
uint const numTiles = ((((*(tint_symbol_11)).dimInner - 1u) / TileInner) + 1u);
uint const tileRow = (local_id[1] * 4u);
uint const tileCol = (local_id[0] * 4u);
uint const globalRow = (global_id[1] * 4u);
uint const globalCol = (global_id[0] * 4u);
uint const numTiles = ((((*(tint_symbol_11)).dimInner - 1u) / 64u) + 1u);
tint_array<float, 16> acc = {};
float ACached = 0.0f;
tint_array<float, 4> BCached = {};
for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) {
acc[index] = 0.0f;
}
uint const ColPerThreadA = (TileInner / 16u);
uint const ColPerThreadA = (64u / 16u);
uint const tileColA = (local_id[0] * ColPerThreadA);
uint const RowPerThreadB = (TileInner / 16u);
uint const RowPerThreadB = (64u / 16u);
uint const tileRowB = (local_id[1] * RowPerThreadB);
for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
uint const inputRow = (tileRow + innerRow);
uint const inputCol = (tileColA + innerCol);
float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol), tint_symbol_11, tint_symbol_12);
float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol), tint_symbol_11, tint_symbol_12);
(*(tint_symbol_9))[inputRow][inputCol] = tint_symbol_1;
}
}
for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint const inputRow = (tileRowB + innerRow);
uint const inputCol = (tileCol + innerCol);
float const tint_symbol_2 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13);
float const tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13);
(*(tint_symbol_10))[innerCol][inputCol] = tint_symbol_2;
}
}
threadgroup_barrier(mem_flags::mem_threadgroup);
for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
for(uint k = 0u; (k < 64u); k = (k + 1u)) {
for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) {
BCached[inner] = (*(tint_symbol_10))[k][(tileCol + inner)];
}
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
ACached = (*(tint_symbol_9))[(tileRow + innerRow)][k];
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
uint const index = ((innerRow * ColPerThread) + innerCol);
for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint const index = ((innerRow * 4u) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
}
}
threadgroup_barrier(mem_flags::mem_threadgroup);
}
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
uint const index = ((innerRow * ColPerThread) + innerCol);
for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint const index = ((innerRow * 4u) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index], tint_symbol_11, tint_symbol_14);
}
}

View File

@@ -20,11 +20,6 @@
OpMemberName %Uniforms 1 "dimInner"
OpMemberName %Uniforms 2 "dimBOuter"
OpName %uniforms "uniforms"
OpName %RowPerThread "RowPerThread"
OpName %RowPerThread "ColPerThread"
OpName %TileAOuter "TileAOuter"
OpName %TileAOuter "TileBOuter"
OpName %TileAOuter "TileInner"
OpName %mm_Asub "mm_Asub"
OpName %mm_Bsub "mm_Bsub"
OpName %mm_readA "mm_readA"
@@ -80,10 +75,10 @@
OpDecorate %uniforms NonWritable
OpDecorate %uniforms DescriptorSet 0
OpDecorate %uniforms Binding 3
OpDecorate %_arr_float_TileAOuter ArrayStride 4
OpDecorate %_arr__arr_float_TileAOuter_TileAOuter ArrayStride 256
OpDecorate %_arr_float_uint_64 ArrayStride 4
OpDecorate %_arr__arr_float_uint_64_uint_64 ArrayStride 256
OpDecorate %_arr_float_uint_16 ArrayStride 4
OpDecorate %_arr_float_RowPerThread ArrayStride 4
OpDecorate %_arr_float_uint_4 ArrayStride 4
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
@@ -101,199 +96,199 @@
%Uniforms = OpTypeStruct %uint %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%RowPerThread = OpConstant %uint 4
%TileAOuter = OpConstant %uint 64
%_arr_float_TileAOuter = OpTypeArray %float %TileAOuter
%_arr__arr_float_TileAOuter_TileAOuter = OpTypeArray %_arr_float_TileAOuter %TileAOuter
%_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter = OpTypePointer Workgroup %_arr__arr_float_TileAOuter_TileAOuter
%mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter Workgroup
%mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter Workgroup
%25 = OpTypeFunction %float %uint %uint
%uint_64 = OpConstant %uint 64
%_arr_float_uint_64 = OpTypeArray %float %uint_64
%_arr__arr_float_uint_64_uint_64 = OpTypeArray %_arr_float_uint_64 %uint_64
%_ptr_Workgroup__arr__arr_float_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_float_uint_64_uint_64
%mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup
%mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup
%24 = OpTypeFunction %float %uint %uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%52 = OpConstantNull %float
%51 = OpConstantNull %float
%uint_2 = OpConstant %uint 2
%void = OpTypeVoid
%75 = OpTypeFunction %void %uint %uint %float
%98 = OpTypeFunction %void %v3uint %v3uint %uint
%74 = OpTypeFunction %void %uint %uint %float
%97 = OpTypeFunction %void %v3uint %v3uint %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%106 = OpConstantNull %uint
%105 = OpConstantNull %uint
%uint_4096 = OpConstant %uint 4096
%_ptr_Workgroup_float = OpTypePointer Workgroup %float
%uint_256 = OpConstant %uint 256
%uint_264 = OpConstant %uint 264
%uint_4 = OpConstant %uint 4
%uint_16 = OpConstant %uint 16
%_arr_float_uint_16 = OpTypeArray %float %uint_16
%_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16
%146 = OpConstantNull %_arr_float_uint_16
%_ptr_Function_float = OpTypePointer Function %float
%_arr_float_RowPerThread = OpTypeArray %float %RowPerThread
%_ptr_Function__arr_float_RowPerThread = OpTypePointer Function %_arr_float_RowPerThread
%152 = OpConstantNull %_arr_float_RowPerThread
%_arr_float_uint_4 = OpTypeArray %float %uint_4
%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4
%152 = OpConstantNull %_arr_float_uint_4
%367 = OpTypeFunction %void
%mm_readA = OpFunction %float None %25
%mm_readA = OpFunction %float None %24
%row = OpFunctionParameter %uint
%col = OpFunctionParameter %uint
%29 = OpLabel
%32 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%33 = OpLoad %uint %32
%34 = OpULessThan %bool %row %33
OpSelectionMerge %36 None
OpBranchConditional %34 %37 %36
%37 = OpLabel
%39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%40 = OpLoad %uint %39
%41 = OpULessThan %bool %col %40
OpBranch %36
%28 = OpLabel
%31 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%32 = OpLoad %uint %31
%33 = OpULessThan %bool %row %32
OpSelectionMerge %35 None
OpBranchConditional %33 %36 %35
%36 = OpLabel
%42 = OpPhi %bool %34 %29 %41 %37
OpSelectionMerge %43 None
OpBranchConditional %42 %44 %43
%44 = OpLabel
%45 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%46 = OpLoad %uint %45
%47 = OpIMul %uint %row %46
%48 = OpIAdd %uint %47 %col
%50 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %48
%51 = OpLoad %float %50
OpReturnValue %51
%38 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%39 = OpLoad %uint %38
%40 = OpULessThan %bool %col %39
OpBranch %35
%35 = OpLabel
%41 = OpPhi %bool %33 %28 %40 %36
OpSelectionMerge %42 None
OpBranchConditional %41 %43 %42
%43 = OpLabel
OpReturnValue %52
%44 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%45 = OpLoad %uint %44
%46 = OpIMul %uint %row %45
%47 = OpIAdd %uint %46 %col
%49 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %47
%50 = OpLoad %float %49
OpReturnValue %50
%42 = OpLabel
OpReturnValue %51
OpFunctionEnd
%mm_readB = OpFunction %float None %25
%mm_readB = OpFunction %float None %24
%row_0 = OpFunctionParameter %uint
%col_0 = OpFunctionParameter %uint
%56 = OpLabel
%57 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%58 = OpLoad %uint %57
%59 = OpULessThan %bool %row_0 %58
OpSelectionMerge %60 None
OpBranchConditional %59 %61 %60
%61 = OpLabel
%63 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%64 = OpLoad %uint %63
%65 = OpULessThan %bool %col_0 %64
OpBranch %60
%55 = OpLabel
%56 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%57 = OpLoad %uint %56
%58 = OpULessThan %bool %row_0 %57
OpSelectionMerge %59 None
OpBranchConditional %58 %60 %59
%60 = OpLabel
%66 = OpPhi %bool %59 %56 %65 %61
OpSelectionMerge %67 None
OpBranchConditional %66 %68 %67
%68 = OpLabel
%69 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%70 = OpLoad %uint %69
%71 = OpIMul %uint %row_0 %70
%72 = OpIAdd %uint %71 %col_0
%73 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %72
%74 = OpLoad %float %73
OpReturnValue %74
%62 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%63 = OpLoad %uint %62
%64 = OpULessThan %bool %col_0 %63
OpBranch %59
%59 = OpLabel
%65 = OpPhi %bool %58 %55 %64 %60
OpSelectionMerge %66 None
OpBranchConditional %65 %67 %66
%67 = OpLabel
OpReturnValue %52
%68 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%69 = OpLoad %uint %68
%70 = OpIMul %uint %row_0 %69
%71 = OpIAdd %uint %70 %col_0
%72 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %71
%73 = OpLoad %float %72
OpReturnValue %73
%66 = OpLabel
OpReturnValue %51
OpFunctionEnd
%mm_write = OpFunction %void None %75
%mm_write = OpFunction %void None %74
%row_1 = OpFunctionParameter %uint
%col_1 = OpFunctionParameter %uint
%value = OpFunctionParameter %float
%81 = OpLabel
%82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%83 = OpLoad %uint %82
%84 = OpULessThan %bool %row_1 %83
OpSelectionMerge %85 None
OpBranchConditional %84 %86 %85
%86 = OpLabel
%87 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%88 = OpLoad %uint %87
%89 = OpULessThan %bool %col_1 %88
OpBranch %85
%80 = OpLabel
%81 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%82 = OpLoad %uint %81
%83 = OpULessThan %bool %row_1 %82
OpSelectionMerge %84 None
OpBranchConditional %83 %85 %84
%85 = OpLabel
%90 = OpPhi %bool %84 %81 %89 %86
OpSelectionMerge %91 None
OpBranchConditional %90 %92 %91
%92 = OpLabel
%93 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%94 = OpLoad %uint %93
%95 = OpIMul %uint %row_1 %94
%96 = OpIAdd %uint %col_1 %95
%97 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %96
OpStore %97 %value
OpBranch %91
%86 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%87 = OpLoad %uint %86
%88 = OpULessThan %bool %col_1 %87
OpBranch %84
%84 = OpLabel
%89 = OpPhi %bool %83 %80 %88 %85
OpSelectionMerge %90 None
OpBranchConditional %89 %91 %90
%91 = OpLabel
%92 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
%93 = OpLoad %uint %92
%94 = OpIMul %uint %row_1 %93
%95 = OpIAdd %uint %col_1 %94
%96 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %95
OpStore %96 %value
OpBranch %90
%90 = OpLabel
OpReturn
OpFunctionEnd
%main_inner = OpFunction %void None %98
%main_inner = OpFunction %void None %97
%local_id = OpFunctionParameter %v3uint
%global_id = OpFunctionParameter %v3uint
%local_invocation_index = OpFunctionParameter %uint
%103 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %106
%102 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %105
%acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %146
%ACached = OpVariable %_ptr_Function_float Function %52
%BCached = OpVariable %_ptr_Function__arr_float_RowPerThread Function %152
%index = OpVariable %_ptr_Function_uint Function %106
%t = OpVariable %_ptr_Function_uint Function %106
%innerRow = OpVariable %_ptr_Function_uint Function %106
%innerCol = OpVariable %_ptr_Function_uint Function %106
%innerRow_0 = OpVariable %_ptr_Function_uint Function %106
%innerCol_0 = OpVariable %_ptr_Function_uint Function %106
%k = OpVariable %_ptr_Function_uint Function %106
%inner = OpVariable %_ptr_Function_uint Function %106
%innerRow_1 = OpVariable %_ptr_Function_uint Function %106
%innerCol_1 = OpVariable %_ptr_Function_uint Function %106
%innerRow_2 = OpVariable %_ptr_Function_uint Function %106
%innerCol_2 = OpVariable %_ptr_Function_uint Function %106
%ACached = OpVariable %_ptr_Function_float Function %51
%BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %152
%index = OpVariable %_ptr_Function_uint Function %105
%t = OpVariable %_ptr_Function_uint Function %105
%innerRow = OpVariable %_ptr_Function_uint Function %105
%innerCol = OpVariable %_ptr_Function_uint Function %105
%innerRow_0 = OpVariable %_ptr_Function_uint Function %105
%innerCol_0 = OpVariable %_ptr_Function_uint Function %105
%k = OpVariable %_ptr_Function_uint Function %105
%inner = OpVariable %_ptr_Function_uint Function %105
%innerRow_1 = OpVariable %_ptr_Function_uint Function %105
%innerCol_1 = OpVariable %_ptr_Function_uint Function %105
%innerRow_2 = OpVariable %_ptr_Function_uint Function %105
%innerCol_2 = OpVariable %_ptr_Function_uint Function %105
OpStore %idx %local_invocation_index
OpBranch %107
%107 = OpLabel
OpLoopMerge %108 %109 None
OpBranch %110
%110 = OpLabel
%112 = OpLoad %uint %idx
%114 = OpULessThan %bool %112 %uint_4096
%111 = OpLogicalNot %bool %114
OpSelectionMerge %115 None
OpBranchConditional %111 %116 %115
%116 = OpLabel
OpBranch %108
%115 = OpLabel
%117 = OpLoad %uint %idx
%118 = OpUDiv %uint %117 %TileAOuter
%119 = OpLoad %uint %idx
%120 = OpUMod %uint %119 %TileAOuter
%122 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %118 %120
OpStore %122 %52
%123 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %118 %120
OpStore %123 %52
OpBranch %106
%106 = OpLabel
OpLoopMerge %107 %108 None
OpBranch %109
%109 = OpLabel
%124 = OpLoad %uint %idx
%126 = OpIAdd %uint %124 %uint_256
OpStore %idx %126
%111 = OpLoad %uint %idx
%113 = OpULessThan %bool %111 %uint_4096
%110 = OpLogicalNot %bool %113
OpSelectionMerge %114 None
OpBranchConditional %110 %115 %114
%115 = OpLabel
OpBranch %107
%114 = OpLabel
%116 = OpLoad %uint %idx
%117 = OpUDiv %uint %116 %uint_64
%118 = OpLoad %uint %idx
%119 = OpUMod %uint %118 %uint_64
%121 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %117 %119
OpStore %121 %51
%122 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %117 %119
OpStore %122 %51
OpBranch %108
%108 = OpLabel
%123 = OpLoad %uint %idx
%125 = OpIAdd %uint %123 %uint_256
OpStore %idx %125
OpBranch %106
%107 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%129 = OpCompositeExtract %uint %local_id 1
%130 = OpIMul %uint %129 %RowPerThread
%128 = OpCompositeExtract %uint %local_id 1
%130 = OpIMul %uint %128 %uint_4
%131 = OpCompositeExtract %uint %local_id 0
%132 = OpIMul %uint %131 %RowPerThread
%132 = OpIMul %uint %131 %uint_4
%133 = OpCompositeExtract %uint %global_id 1
%134 = OpIMul %uint %133 %RowPerThread
%134 = OpIMul %uint %133 %uint_4
%135 = OpCompositeExtract %uint %global_id 0
%136 = OpIMul %uint %135 %RowPerThread
%136 = OpIMul %uint %135 %uint_4
%137 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%138 = OpLoad %uint %137
%139 = OpISub %uint %138 %uint_1
%140 = OpUDiv %uint %139 %TileAOuter
%140 = OpUDiv %uint %139 %uint_64
%141 = OpIAdd %uint %140 %uint_1
OpStore %index %106
OpStore %index %105
OpBranch %154
%154 = OpLabel
OpLoopMerge %155 %156 None
OpBranch %157
%157 = OpLabel
%159 = OpLoad %uint %index
%160 = OpIMul %uint %RowPerThread %RowPerThread
%160 = OpIMul %uint %uint_4 %uint_4
%161 = OpULessThan %bool %159 %160
%158 = OpLogicalNot %bool %161
OpSelectionMerge %162 None
@@ -303,7 +298,7 @@
%162 = OpLabel
%164 = OpLoad %uint %index
%165 = OpAccessChain %_ptr_Function_float %acc %164
OpStore %165 %52
OpStore %165 %51
OpBranch %156
%156 = OpLabel
%166 = OpLoad %uint %index
@@ -311,13 +306,13 @@
OpStore %index %167
OpBranch %154
%155 = OpLabel
%168 = OpUDiv %uint %TileAOuter %uint_16
%168 = OpUDiv %uint %uint_64 %uint_16
%169 = OpCompositeExtract %uint %local_id 0
%170 = OpIMul %uint %169 %168
%171 = OpUDiv %uint %TileAOuter %uint_16
%171 = OpUDiv %uint %uint_64 %uint_16
%172 = OpCompositeExtract %uint %local_id 1
%173 = OpIMul %uint %172 %171
OpStore %t %106
OpStore %t %105
OpBranch %175
%175 = OpLabel
OpLoopMerge %176 %177 None
@@ -331,21 +326,21 @@
%183 = OpLabel
OpBranch %176
%182 = OpLabel
OpStore %innerRow %106
OpStore %innerRow %105
OpBranch %185
%185 = OpLabel
OpLoopMerge %186 %187 None
OpBranch %188
%188 = OpLabel
%190 = OpLoad %uint %innerRow
%191 = OpULessThan %bool %190 %RowPerThread
%191 = OpULessThan %bool %190 %uint_4
%189 = OpLogicalNot %bool %191
OpSelectionMerge %192 None
OpBranchConditional %189 %193 %192
%193 = OpLabel
OpBranch %186
%192 = OpLabel
OpStore %innerCol %106
OpStore %innerCol %105
OpBranch %195
%195 = OpLabel
OpLoopMerge %196 %197 None
@@ -366,7 +361,7 @@
%209 = OpLoad %uint %innerRow
%210 = OpIAdd %uint %134 %209
%211 = OpLoad %uint %t
%212 = OpIMul %uint %211 %TileAOuter
%212 = OpIMul %uint %211 %uint_64
%213 = OpIAdd %uint %212 %207
%208 = OpFunctionCall %float %mm_readA %210 %213
%214 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %205 %207
@@ -385,7 +380,7 @@
OpStore %innerRow %218
OpBranch %185
%186 = OpLabel
OpStore %innerRow_0 %106
OpStore %innerRow_0 %105
OpBranch %220
%220 = OpLabel
OpLoopMerge %221 %222 None
@@ -399,14 +394,14 @@
%228 = OpLabel
OpBranch %221
%227 = OpLabel
OpStore %innerCol_0 %106
OpStore %innerCol_0 %105
OpBranch %230
%230 = OpLabel
OpLoopMerge %231 %232 None
OpBranch %233
%233 = OpLabel
%235 = OpLoad %uint %innerCol_0
%236 = OpULessThan %bool %235 %RowPerThread
%236 = OpULessThan %bool %235 %uint_4
%234 = OpLogicalNot %bool %236
OpSelectionMerge %237 None
OpBranchConditional %234 %238 %237
@@ -418,7 +413,7 @@
%241 = OpLoad %uint %innerCol_0
%242 = OpIAdd %uint %132 %241
%244 = OpLoad %uint %t
%245 = OpIMul %uint %244 %TileAOuter
%245 = OpIMul %uint %244 %uint_64
%246 = OpIAdd %uint %245 %240
%247 = OpLoad %uint %innerCol_0
%248 = OpIAdd %uint %136 %247
@@ -441,28 +436,28 @@
OpBranch %220
%221 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
OpStore %k %106
OpStore %k %105
OpBranch %257
%257 = OpLabel
OpLoopMerge %258 %259 None
OpBranch %260
%260 = OpLabel
%262 = OpLoad %uint %k
%263 = OpULessThan %bool %262 %TileAOuter
%263 = OpULessThan %bool %262 %uint_64
%261 = OpLogicalNot %bool %263
OpSelectionMerge %264 None
OpBranchConditional %261 %265 %264
%265 = OpLabel
OpBranch %258
%264 = OpLabel
OpStore %inner %106
OpStore %inner %105
OpBranch %267
%267 = OpLabel
OpLoopMerge %268 %269 None
OpBranch %270
%270 = OpLabel
%272 = OpLoad %uint %inner
%273 = OpULessThan %bool %272 %RowPerThread
%273 = OpULessThan %bool %272 %uint_4
%271 = OpLogicalNot %bool %273
OpSelectionMerge %274 None
OpBranchConditional %271 %275 %274
@@ -484,14 +479,14 @@
OpStore %inner %284
OpBranch %267
%268 = OpLabel
OpStore %innerRow_1 %106
OpStore %innerRow_1 %105
OpBranch %286
%286 = OpLabel
OpLoopMerge %287 %288 None
OpBranch %289
%289 = OpLabel
%291 = OpLoad %uint %innerRow_1
%292 = OpULessThan %bool %291 %RowPerThread
%292 = OpULessThan %bool %291 %uint_4
%290 = OpLogicalNot %bool %292
OpSelectionMerge %293 None
OpBranchConditional %290 %294 %293
@@ -504,14 +499,14 @@
%298 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %296 %297
%299 = OpLoad %float %298
OpStore %ACached %299
OpStore %innerCol_1 %106
OpStore %innerCol_1 %105
OpBranch %301
%301 = OpLabel
OpLoopMerge %302 %303 None
OpBranch %304
%304 = OpLabel
%306 = OpLoad %uint %innerCol_1
%307 = OpULessThan %bool %306 %RowPerThread
%307 = OpULessThan %bool %306 %uint_4
%305 = OpLogicalNot %bool %307
OpSelectionMerge %308 None
OpBranchConditional %305 %309 %308
@@ -519,7 +514,7 @@
OpBranch %302
%308 = OpLabel
%310 = OpLoad %uint %innerRow_1
%311 = OpIMul %uint %310 %RowPerThread
%311 = OpIMul %uint %310 %uint_4
%312 = OpLoad %uint %innerCol_1
%313 = OpIAdd %uint %311 %312
%314 = OpAccessChain %_ptr_Function_float %acc %313
@@ -561,28 +556,28 @@
OpStore %t %331
OpBranch %175
%176 = OpLabel
OpStore %innerRow_2 %106
OpStore %innerRow_2 %105
OpBranch %333
%333 = OpLabel
OpLoopMerge %334 %335 None
OpBranch %336
%336 = OpLabel
%338 = OpLoad %uint %innerRow_2
%339 = OpULessThan %bool %338 %RowPerThread
%339 = OpULessThan %bool %338 %uint_4
%337 = OpLogicalNot %bool %339
OpSelectionMerge %340 None
OpBranchConditional %337 %341 %340
%341 = OpLabel
OpBranch %334
%340 = OpLabel
OpStore %innerCol_2 %106
OpStore %innerCol_2 %105
OpBranch %343
%343 = OpLabel
OpLoopMerge %344 %345 None
OpBranch %346
%346 = OpLabel
%348 = OpLoad %uint %innerCol_2
%349 = OpULessThan %bool %348 %RowPerThread
%349 = OpULessThan %bool %348 %uint_4
%347 = OpLogicalNot %bool %349
OpSelectionMerge %350 None
OpBranchConditional %347 %351 %350
@@ -590,7 +585,7 @@
OpBranch %344
%350 = OpLabel
%352 = OpLoad %uint %innerRow_2
%353 = OpIMul %uint %352 %RowPerThread
%353 = OpIMul %uint %352 %uint_4
%354 = OpLoad %uint %innerCol_2
%355 = OpIAdd %uint %353 %354
%357 = OpLoad %uint %innerRow_2

View File

@@ -39,15 +39,15 @@ fn mm_write(row : u32, col : u32, value : f32) {
}
}
let RowPerThread : u32 = 4u;
const RowPerThread : u32 = 4u;
let ColPerThread : u32 = 4u;
const ColPerThread : u32 = 4u;
let TileAOuter : u32 = 64u;
const TileAOuter : u32 = 64u;
let TileBOuter : u32 = 64u;
const TileBOuter : u32 = 64u;
let TileInner : u32 = 64u;
const TileInner : u32 = 64u;
var<workgroup> mm_Asub : array<array<f32, 64>, 64>;

View File

@@ -0,0 +1,27 @@
type MyArray = array<f32, 10>;
// Global consts
const c1 = 1;
const c2 = 1u;
const c3 = 1.0;
const c4 = vec3<i32>(1, 1, 1);
const c5 = vec3<u32>(1u, 1u, 1u);
const c6 = vec3<f32>(1.0, 1.0, 1.0);
const c7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
const c9 = MyArray();
@fragment
fn main() -> @location(0) vec4<f32> {
var v1 = c1;
var v2 = c2;
var v3 = c3;
var v4 = c4;
var v5 = c5;
var v6 = c6;
var v7 = c7;
var v9 = c9;
return vec4<f32>(0.0,0.0,0.0,0.0);
}

View File

@@ -0,0 +1,21 @@
#version 310 es
precision mediump float;
layout(location = 0) out vec4 value;
vec4 tint_symbol() {
int v1 = 1;
uint v2 = 1u;
float v3 = 1.0f;
ivec3 v4 = ivec3(1);
uvec3 v5 = uvec3(1u);
vec3 v6 = vec3(1.0f);
mat3 v7 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
float v9[10] = float[10](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
return vec4(0.0f);
}
void main() {
vec4 inner_result = tint_symbol();
value = inner_result;
return;
}

View File

@@ -0,0 +1,22 @@
struct tint_symbol {
float4 value : SV_Target0;
};
float4 main_inner() {
int v1 = 1;
uint v2 = 1u;
float v3 = 1.0f;
int3 v4 = (1).xxx;
uint3 v5 = (1u).xxx;
float3 v6 = (1.0f).xxx;
float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
float v9[10] = (float[10])0;
return (0.0f).xxxx;
}
tint_symbol main() {
const float4 inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@@ -14,33 +14,19 @@ struct tint_array {
T elements[N];
};
struct MyStruct {
float f1;
};
constant int v1 = 1;
constant uint v2 = 1u;
constant float v3 = 1.0f;
constant int3 v4 = int3(1);
constant uint3 v5 = uint3(1u);
constant float3 v6 = float3(1.0f);
constant float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
constant MyStruct v8 = {};
constant tint_array<float, 10> v9 = tint_array<float, 10>{};
struct tint_symbol_1 {
float4 value [[color(0)]];
};
float4 tint_symbol_inner() {
int v1 = 1;
uint v2 = 1u;
float v3 = 1.0f;
int3 v4 = int3(1);
uint3 v5 = uint3(1u);
float3 v6 = float3(1.0f);
float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
tint_array<float, 10> v9 = tint_array<float, 10>{};
return float4(0.0f);
}

View File

@@ -0,0 +1,87 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 53
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %value
OpExecutionMode %main OriginUpperLeft
OpName %value "value"
OpName %main_inner "main_inner"
OpName %v1 "v1"
OpName %v2 "v2"
OpName %v3 "v3"
OpName %v4 "v4"
OpName %v5 "v5"
OpName %v6 "v6"
OpName %v7 "v7"
OpName %v9 "v9"
OpName %main "main"
OpDecorate %value Location 0
OpDecorate %_arr_float_uint_10 ArrayStride 4
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%6 = OpTypeFunction %v4float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%13 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_uint = OpTypePointer Function %uint
%18 = OpConstantNull %uint
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%22 = OpConstantNull %float
%v3int = OpTypeVector %int 3
%24 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v3int = OpTypePointer Function %v3int
%27 = OpConstantNull %v3int
%v3uint = OpTypeVector %uint 3
%29 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%32 = OpConstantNull %v3uint
%v3float = OpTypeVector %float 3
%34 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%37 = OpConstantNull %v3float
%mat3v3float = OpTypeMatrix %v3float 3
%39 = OpConstantComposite %mat3v3float %34 %34 %34
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%42 = OpConstantNull %mat3v3float
%uint_10 = OpConstant %uint 10
%_arr_float_uint_10 = OpTypeArray %float %uint_10
%45 = OpConstantNull %_arr_float_uint_10
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
%void = OpTypeVoid
%48 = OpTypeFunction %void
%main_inner = OpFunction %v4float None %6
%8 = OpLabel
%v1 = OpVariable %_ptr_Function_int Function %13
%v2 = OpVariable %_ptr_Function_uint Function %18
%v3 = OpVariable %_ptr_Function_float Function %22
%v4 = OpVariable %_ptr_Function_v3int Function %27
%v5 = OpVariable %_ptr_Function_v3uint Function %32
%v6 = OpVariable %_ptr_Function_v3float Function %37
%v7 = OpVariable %_ptr_Function_mat3v3float Function %42
%v9 = OpVariable %_ptr_Function__arr_float_uint_10 Function %45
OpStore %v1 %int_1
OpStore %v2 %uint_1
OpStore %v3 %float_1
OpStore %v4 %24
OpStore %v5 %29
OpStore %v6 %34
OpStore %v7 %39
OpStore %v9 %45
OpReturnValue %5
OpFunctionEnd
%main = OpFunction %void None %48
%51 = OpLabel
%52 = OpFunctionCall %v4float %main_inner
OpStore %value %52
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,30 @@
type MyArray = array<f32, 10>;
const c1 = 1;
const c2 = 1u;
const c3 = 1.0;
const c4 = vec3<i32>(1, 1, 1);
const c5 = vec3<u32>(1u, 1u, 1u);
const c6 = vec3<f32>(1.0, 1.0, 1.0);
const c7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
const c9 = MyArray();
@fragment
fn main() -> @location(0) vec4<f32> {
var v1 = c1;
var v2 = c2;
var v3 = c3;
var v4 = c4;
var v5 = c5;
var v6 = c6;
var v7 = c7;
var v9 = c9;
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}

View File

@@ -0,0 +1,21 @@
type MyArray = array<f32, 10>;
// Function-scope consts
fn const_decls() {
const v1 = 1;
const v2 = 1u;
const v3 = 1.0;
const v4 = vec3<i32>(1, 1, 1);
const v5 = vec3<u32>(1u, 1u, 1u);
const v6 = vec3<f32>(1.0, 1.0, 1.0);
const v7 = mat3x3<f32>(v6, v6, v6);
const v8 = MyArray();
}
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.0,0.0,0.0,0.0);
}

View File

@@ -2,10 +2,6 @@
precision mediump float;
layout(location = 0) out vec4 value;
struct MyStruct {
float f1;
};
vec4 tint_symbol() {
return vec4(0.0f);
}

View File

@@ -0,0 +1,17 @@
void const_decls() {
}
struct tint_symbol {
float4 value : SV_Target0;
};
float4 main_inner() {
return (0.0f).xxxx;
}
tint_symbol main() {
const float4 inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@@ -0,0 +1,21 @@
#include <metal_stdlib>
using namespace metal;
void const_decls() {
}
struct tint_symbol_1 {
float4 value [[color(0)]];
};
float4 tint_symbol_inner() {
return float4(0.0f);
}
fragment tint_symbol_1 tint_symbol() {
float4 const inner_result = tint_symbol_inner();
tint_symbol_1 wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@@ -0,0 +1,36 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %value
OpExecutionMode %main OriginUpperLeft
OpName %value "value"
OpName %const_decls "const_decls"
OpName %main_inner "main_inner"
OpName %main "main"
OpDecorate %value Location 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%void = OpTypeVoid
%6 = OpTypeFunction %void
%10 = OpTypeFunction %v4float
%const_decls = OpFunction %void None %6
%9 = OpLabel
OpReturn
OpFunctionEnd
%main_inner = OpFunction %v4float None %10
%12 = OpLabel
OpReturnValue %5
OpFunctionEnd
%main = OpFunction %void None %6
%14 = OpLabel
%15 = OpFunctionCall %v4float %main_inner
OpStore %value %15
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,17 @@
type MyArray = array<f32, 10>;
fn const_decls() {
const v1 = 1;
const v2 = 1u;
const v3 = 1.0;
const v4 = vec3<i32>(1, 1, 1);
const v5 = vec3<u32>(1u, 1u, 1u);
const v6 = vec3<f32>(1.0, 1.0, 1.0);
const v7 = mat3x3<f32>(v6, v6, v6);
const v8 = MyArray();
}
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}

View File

@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(1, 2, 3);
const int3 r = (a / b);
const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(1u, 2u, 3u);
const uint3 r = (a / b);
const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(4, 5, 6);
const int3 r = (a / b);
const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(4u, 5u, 6u);
const uint3 r = (a / b);
const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(0, 2, 0);
const int3 r = (a / int3(1, 2, 1));
const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(0u, 2u, 0u);
const uint3 r = (a / uint3(1u, 2u, 1u));
const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(0, 5, 0);
const int3 r = (a / int3(1, 5, 1));
const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(0u, 5u, 0u);
const uint3 r = (a / uint3(1u, 5u, 1u));
const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(1, 2, 3);
const int3 r = (a % b);
const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(1u, 2u, 3u);
const uint3 r = (a % b);
const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(4, 5, 6);
const int3 r = (a % b);
const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(4u, 5u, 6u);
const uint3 r = (a % b);
const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(0, 2, 0);
const int3 r = (a % int3(1, 2, 1));
const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(0u, 2u, 0u);
const uint3 r = (a % uint3(1u, 2u, 1u));
const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(0, 5, 0);
const int3 r = (a % int3(1, 5, 1));
const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}

View File

@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(0u, 5u, 0u);
const uint3 r = (a % uint3(1u, 5u, 1u));
const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
int f() {
int a[8] = int[8](1, 2, 3, 4, 5, 6, 7, 8);
return 2;
return a[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
int f() {
const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8};
return 2;
return a[1];
}

View File

@@ -17,6 +17,6 @@ struct tint_array {
int f() {
tint_array<int, 8> const a = tint_array<int, 8>{1, 2, 3, 4, 5, 6, 7, 8};
int const i = 1;
return 2;
return a[i];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Bound: 27
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -9,6 +9,7 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
OpName %var_for_index "var_for_index"
OpDecorate %_arr_int_uint_8 ArrayStride 4
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -26,11 +27,18 @@
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%20 = OpConstantComposite %_arr_int_uint_8 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8
%_ptr_Function__arr_int_uint_8 = OpTypePointer Function %_arr_int_uint_8
%23 = OpConstantNull %_arr_int_uint_8
%_ptr_Function_int = OpTypePointer Function %int
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %int None %5
%8 = OpLabel
OpReturnValue %int_2
%var_for_index = OpVariable %_ptr_Function__arr_int_uint_8 Function %23
OpStore %var_for_index %20
%25 = OpAccessChain %_ptr_Function_int %var_for_index %int_1
%26 = OpLoad %int %25
OpReturnValue %26
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
vec3 f() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
return vec3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
float3 f() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
return float3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -4,6 +4,6 @@ using namespace metal;
float3 f() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
int const i = 1;
return float3(4.0f, 5.0f, 6.0f);
return m[i];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 26
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -9,6 +9,7 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
OpName %var_for_index "var_for_index"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -30,11 +31,18 @@
%23 = OpConstantComposite %mat3v3float %14 %18 %22
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%28 = OpConstantNull %mat3v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %v3float None %5
%9 = OpLabel
OpReturnValue %18
%var_for_index = OpVariable %_ptr_Function_mat3v3float Function %28
OpStore %var_for_index %23
%30 = OpAccessChain %_ptr_Function_v3float %var_for_index %int_1
%31 = OpLoad %v3float %30
OpReturnValue %31
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
float f() {
vec3 v = vec3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
float f() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -4,6 +4,6 @@ using namespace metal;
float f() {
float3 const v = float3(1.0f, 2.0f, 3.0f);
int const i = 1;
return 2.0f;
return v[i];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -26,5 +26,6 @@
OpFunctionEnd
%f = OpFunction %float None %5
%8 = OpLabel
OpReturnValue %float_2
%16 = OpVectorExtractDynamic %float %13 %int_1
OpReturnValue %16
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
int f() {
int a[8] = int[8](1, 2, 3, 4, 5, 6, 7, 8);
return 2;
return a[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
int f() {
const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8};
return 2;
return a[1];
}

View File

@@ -16,6 +16,6 @@ struct tint_array {
int f() {
tint_array<int, 8> const a = tint_array<int, 8>{1, 2, 3, 4, 5, 6, 7, 8};
return 2;
return a[1];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -32,5 +32,6 @@
OpFunctionEnd
%f = OpFunction %int None %5
%8 = OpLabel
OpReturnValue %int_2
%21 = OpCompositeExtract %int %20 1
OpReturnValue %21
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
vec3 f() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
return vec3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
float3 f() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
return float3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -3,6 +3,6 @@
using namespace metal;
float3 f() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
return float3(4.0f, 5.0f, 6.0f);
return m[1];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 27
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -28,11 +28,14 @@
%float_9 = OpConstant %float 9
%22 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%23 = OpConstantComposite %mat3v3float %14 %18 %22
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %v3float None %5
%9 = OpLabel
OpReturnValue %18
%26 = OpCompositeExtract %v3float %23 1
OpReturnValue %26
OpFunctionEnd

View File

@@ -6,6 +6,6 @@ void unused_entry_point() {
}
float f() {
vec3 v = vec3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -5,5 +5,5 @@ void unused_entry_point() {
float f() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -3,6 +3,6 @@
using namespace metal;
float f() {
float3 const v = float3(1.0f, 2.0f, 3.0f);
return 2.0f;
return v[1];
}

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -18,11 +18,14 @@
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%13 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %float None %5
%8 = OpLabel
OpReturnValue %float_2
%16 = OpCompositeExtract %float %13 1
OpReturnValue %16
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
const a : i32 = 1;
const a__ : i32 = 2;
fn f() {
const b = a;
const b__ = a__;
}

View File

@@ -0,0 +1,9 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f() {
}

View File

@@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
}

View File

@@ -0,0 +1,6 @@
#include <metal_stdlib>
using namespace metal;
void f() {
}

Some files were not shown because too many files have changed in this diff Show More