tint/cmd: Add --rename-all flag

Renames all symbols

Add a test for tint:1725

Bug: tint:1725
Change-Id: Idac45c677d15361d76510068ad756e2f9bffacb0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106880
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-11-01 16:12:23 +00:00
committed by Dawn LUCI CQ
parent d336733c83
commit c02feff258
9 changed files with 226 additions and 44 deletions

View File

@@ -16,7 +16,7 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void tint_symbol() {
float tint_symbol_1 = tint_modf(1.0f).whole;
void i() {
float s = tint_modf(1.0f).whole;
}

View File

@@ -0,0 +1,10 @@
// flags: --transform robustness --rename-all
@group(0) @binding(0) var<storage> data : array<u32>;
@compute @workgroup_size(1)
fn main(@builtin(local_invocation_index) local_invocation_index : u32) {
let min = 0;
let max = 0;
let arrayLength = 0;
let x = data[local_invocation_index];
}

View File

@@ -0,0 +1,21 @@
ByteAddressBuffer tint_symbol : register(t0, space0);
struct tint_symbol_8 {
uint tint_symbol_2 : SV_GroupIndex;
};
void tint_symbol_1_inner(uint tint_symbol_2) {
uint tint_symbol_11 = 0u;
tint_symbol.GetDimensions(tint_symbol_11);
const uint tint_symbol_12 = (tint_symbol_11 / 4u);
const int tint_symbol_3 = 0;
const int tint_symbol_4 = 0;
const int tint_symbol_5 = 0;
const uint tint_symbol_6 = tint_symbol.Load((4u * min(tint_symbol_2, (tint_symbol_12 - 1u))));
}
[numthreads(1, 1, 1)]
void tint_symbol_1(tint_symbol_8 tint_symbol_7) {
tint_symbol_1_inner(tint_symbol_7.tint_symbol_2);
return;
}

View File

@@ -0,0 +1,21 @@
ByteAddressBuffer tint_symbol : register(t0, space0);
struct tint_symbol_8 {
uint tint_symbol_2 : SV_GroupIndex;
};
void tint_symbol_1_inner(uint tint_symbol_2) {
uint tint_symbol_11 = 0u;
tint_symbol.GetDimensions(tint_symbol_11);
const uint tint_symbol_12 = (tint_symbol_11 / 4u);
const int tint_symbol_3 = 0;
const int tint_symbol_4 = 0;
const int tint_symbol_5 = 0;
const uint tint_symbol_6 = tint_symbol.Load((4u * min(tint_symbol_2, (tint_symbol_12 - 1u))));
}
[numthreads(1, 1, 1)]
void tint_symbol_1(tint_symbol_8 tint_symbol_7) {
tint_symbol_1_inner(tint_symbol_7.tint_symbol_2);
return;
}

View File

@@ -0,0 +1,18 @@
#version 310 es
layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
uint inner[];
} tint_symbol;
void tint_symbol_1(uint tint_symbol_2) {
int tint_symbol_3 = 0;
int tint_symbol_4 = 0;
int tint_symbol_5 = 0;
uint tint_symbol_6 = tint_symbol.inner[min(tint_symbol_2, (uint(tint_symbol.inner.length()) - 1u))];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
tint_symbol_1(gl_LocalInvocationIndex);
return;
}

View File

@@ -0,0 +1,36 @@
#include <metal_stdlib>
using namespace metal;
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
struct tint_symbol_12 {
/* 0x0000 */ tint_array<uint, 1> arr;
};
struct tint_symbol_7 {
/* 0x0000 */ tint_array<uint4, 1> buffer_size;
};
void tint_symbol_1_inner(uint tint_symbol_2, const device tint_array<uint, 1>* const tint_symbol_9, const constant tint_symbol_7* const tint_symbol_10) {
int const tint_symbol_3 = 0;
int const tint_symbol_4 = 0;
int const tint_symbol_5 = 0;
uint const tint_symbol_6 = (*(tint_symbol_9))[min(tint_symbol_2, (((*(tint_symbol_10)).buffer_size[0u][0u] / 4u) - 1u))];
}
kernel void tint_symbol_1(const device tint_symbol_12* tint_symbol_11 [[buffer(0)]], const constant tint_symbol_7* tint_symbol_13 [[buffer(30)]], uint tint_symbol_2 [[thread_index_in_threadgroup]]) {
tint_symbol_1_inner(tint_symbol_2, &((*(tint_symbol_11)).arr), tint_symbol_13);
return;
}

View File

@@ -0,0 +1,55 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 29
; Schema: 0
OpCapability Shader
%17 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %tint_symbol_1 "tint_symbol_1" %tint_symbol_2_1
OpExecutionMode %tint_symbol_1 LocalSize 1 1 1
OpName %tint_symbol_2_1 "tint_symbol_2_1"
OpName %tint_symbol_block "tint_symbol_block"
OpMemberName %tint_symbol_block 0 "inner"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_1_inner "tint_symbol_1_inner"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol_1 "tint_symbol_1"
OpDecorate %tint_symbol_2_1 BuiltIn LocalInvocationIndex
OpDecorate %tint_symbol_block Block
OpMemberDecorate %tint_symbol_block 0 Offset 0
OpDecorate %_runtimearr_uint ArrayStride 4
OpDecorate %tint_symbol NonWritable
OpDecorate %tint_symbol DescriptorSet 0
OpDecorate %tint_symbol Binding 0
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol_2_1 = OpVariable %_ptr_Input_uint Input
%_runtimearr_uint = OpTypeRuntimeArray %uint
%tint_symbol_block = OpTypeStruct %_runtimearr_uint
%_ptr_StorageBuffer_tint_symbol_block = OpTypePointer StorageBuffer %tint_symbol_block
%tint_symbol = OpVariable %_ptr_StorageBuffer_tint_symbol_block StorageBuffer
%void = OpTypeVoid
%8 = OpTypeFunction %void %uint
%int = OpTypeInt 32 1
%14 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%24 = OpTypeFunction %void
%tint_symbol_1_inner = OpFunction %void None %8
%tint_symbol_2 = OpFunctionParameter %uint
%12 = OpLabel
%18 = OpArrayLength %uint %tint_symbol 0
%20 = OpISub %uint %18 %uint_1
%16 = OpExtInst %uint %17 UMin %tint_symbol_2 %20
%22 = OpAccessChain %_ptr_StorageBuffer_uint %tint_symbol %uint_0 %16
%23 = OpLoad %uint %22
OpReturn
OpFunctionEnd
%tint_symbol_1 = OpFunction %void None %24
%26 = OpLabel
%28 = OpLoad %uint %tint_symbol_2_1
%27 = OpFunctionCall %void %tint_symbol_1_inner %28
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,9 @@
@group(0) @binding(0) var<storage> tint_symbol : array<u32>;
@compute @workgroup_size(1)
fn tint_symbol_1(@builtin(local_invocation_index) tint_symbol_2 : u32) {
let tint_symbol_3 = 0;
let tint_symbol_4 = 0;
let tint_symbol_5 = 0;
let tint_symbol_6 = tint_symbol[min(tint_symbol_2, (arrayLength(&(tint_symbol)) - 1u))];
}