Revert "HLSL: force FXC to never unroll loops"

This reverts commit 11d09f2fe7.

Reason for revert: Failing roll of Tint to Dawn: https://dawn-review.googlesource.com/c/dawn/+/70100

Original change's description:
> HLSL: force FXC to never unroll loops
>
> Emit the "[loop]" attribute on "for" and "while" so that FXC does not
> attempt to unroll them. This is to work around an FXC bug where it fails
> to unroll loops with gradient operations.
>
> FXC ostensibly unrolls such loops because gradient operations require
> uniform control flow, and loops that have varying iterations may
> possibly not be uniform. Tint will eventually validate that control flow
> is indeed uniform, so forcing FXC to avoid unrolling in these cases
> should be fine.
>
> Bug: tint:1112
> Change-Id: I10077f8b62fbbb230a0003f3864c75a8fe0e1d18
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69880
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Commit-Queue: Antonio Maiorano <amaiorano@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: tint:1112
Change-Id: I8e8f3c0abfa6e6bc5d0e67af9428a46ef867d5c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70540
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2021-11-22 19:31:56 +00:00 committed by Tint LUCI CQ
parent 7368e287dc
commit bc5d8f6bcf
49 changed files with 110 additions and 117 deletions

View File

@ -116,13 +116,6 @@ std::ostream& operator<<(std::ostream& s, const RegisterAndSpace& rs) {
return s;
}
const char* LoopAttribute() {
// Force loops not to be unrolled to work around FXC compilation issues when
// it attempts and fails to unroll loops when it contains gradient operations.
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-while
return "[loop] ";
}
} // namespace
SanitizedResult::SanitizedResult() = default;
@ -2834,7 +2827,7 @@ bool GeneratorImpl::EmitLoop(const ast::LoopStatement* stmt) {
};
TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing);
line() << LoopAttribute() << "while (true) {";
line() << "while (true) {";
{
ScopedIndent si(this);
if (!EmitStatements(stmt->body->statements)) {
@ -2904,7 +2897,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) {
};
TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing);
line() << LoopAttribute() << "while (true) {";
line() << "while (true) {";
increment_indent();
TINT_DEFER({
decrement_indent();
@ -2927,7 +2920,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) {
// For-loop can be generated.
{
auto out = line();
out << LoopAttribute() << "for";
out << "for";
{
ScopedParen sp(out);

View File

@ -30,7 +30,7 @@ TEST_F(HlslGeneratorImplTest_Continue, Emit_Continue) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(loop)) << gen.error();
EXPECT_EQ(gen.result(), R"( [loop] while (true) {
EXPECT_EQ(gen.result(), R"( while (true) {
continue;
}
)");

View File

@ -34,7 +34,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_Loop) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(l)) << gen.error();
EXPECT_EQ(gen.result(), R"( [loop] while (true) {
EXPECT_EQ(gen.result(), R"( while (true) {
discard;
}
)");
@ -54,7 +54,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithContinuing) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(l)) << gen.error();
EXPECT_EQ(gen.result(), R"( [loop] while (true) {
EXPECT_EQ(gen.result(), R"( while (true) {
discard;
{
a_statement();
@ -88,8 +88,8 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopNestedWithContinuing) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(outer)) << gen.error();
EXPECT_EQ(gen.result(), R"( [loop] while (true) {
[loop] while (true) {
EXPECT_EQ(gen.result(), R"( while (true) {
while (true) {
discard;
{
a_statement();
@ -142,7 +142,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithVarUsedInContinuing) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(outer)) << gen.error();
EXPECT_EQ(gen.result(), R"( [loop] while (true) {
EXPECT_EQ(gen.result(), R"( while (true) {
float lhs = 2.400000095f;
float other = 0.0f;
{
@ -169,7 +169,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoop) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] for(; ; ) {
for(; ; ) {
a_statement();
}
}
@ -193,7 +193,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithSimpleInit) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] for(int i = 0; ; ) {
for(int i = 0; ; ) {
a_statement();
}
}
@ -223,7 +223,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInit) {
tint_tmp = false;
}
bool b = (tint_tmp);
[loop] for(; ; ) {
for(; ; ) {
a_statement();
}
}
@ -246,7 +246,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithSimpleCond) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] for(; true; ) {
for(; true; ) {
a_statement();
}
}
@ -272,7 +272,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtCond) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] while (true) {
while (true) {
bool tint_tmp = true;
if (tint_tmp) {
tint_tmp = false;
@ -302,7 +302,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithSimpleCont) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] for(; ; i = (i + 1)) {
for(; ; i = (i + 1)) {
a_statement();
}
}
@ -329,7 +329,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtCont) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] while (true) {
while (true) {
a_statement();
bool tint_tmp = true;
if (tint_tmp) {
@ -358,7 +358,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithSimpleInitCondCont) {
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
[loop] for(int i = 0; true; i = (i + 1)) {
for(int i = 0; true; i = (i + 1)) {
a_statement();
}
}
@ -394,7 +394,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInitCondCont) {
tint_tmp = false;
}
bool i = (tint_tmp);
[loop] while (true) {
while (true) {
bool tint_tmp_1 = true;
if (tint_tmp_1) {
tint_tmp_1 = false;

View File

@ -32,7 +32,7 @@ typedef tint_padded_array_element tint_symbol_1_ret[4];
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@ -44,7 +44,7 @@ typedef tint_padded_array_element tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1].el = asint(buffer.Load((offset + (i_1 * 16u))));
}
}

View File

@ -34,7 +34,7 @@ typedef tint_padded_array_element tint_symbol_1_ret[4];
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@ -46,7 +46,7 @@ typedef tint_padded_array_element tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1].el = asint(buffer.Load((offset + (i_1 * 16u))));
}
}

View File

@ -33,7 +33,7 @@ S ret_struct_arr() {
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[4]) {
tint_padded_array_element array[4] = value;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
buffer.Store((offset + (i * 16u)), asuint(array[i].el));
}
}
@ -43,7 +43,7 @@ typedef tint_padded_array_element tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
const uint scalar_offset = ((offset + (i_1 * 16u))) / 4;
arr_1[i_1].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@ -55,7 +55,7 @@ typedef tint_padded_array_element tint_symbol_5_ret[4];
tint_symbol_5_ret tint_symbol_5(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
arr_2[i_2].el = asint(buffer.Load((offset + (i_2 * 16u))));
}
}
@ -65,7 +65,7 @@ tint_symbol_5_ret tint_symbol_5(RWByteAddressBuffer buffer, uint offset) {
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[2]) {
int array_3[2] = value;
{
[loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3]));
}
}
@ -74,7 +74,7 @@ void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[2]) {
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
int array_2[3][2] = value;
{
[loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
tint_symbol_9(buffer, (offset + (i_4 * 8u)), array_2[i_4]);
}
}
@ -83,7 +83,7 @@ void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
int array_1[4][3][2] = value;
{
[loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
tint_symbol_8(buffer, (offset + (i_5 * 24u)), array_1[i_5]);
}
}

View File

@ -34,7 +34,7 @@ typedef tint_padded_array_element tint_symbol_1_ret[4];
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@ -46,7 +46,7 @@ typedef tint_padded_array_element tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1].el = asint(buffer.Load((offset + (i_1 * 16u))));
}
}

View File

@ -16,7 +16,7 @@ typedef int4 tint_symbol_11_ret[4];
tint_symbol_11_ret tint_symbol_11(ByteAddressBuffer buffer, uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_1[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
}
}

View File

@ -18,7 +18,7 @@ void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, float3x2 value) {
void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
int4 array[4] = value;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
buffer.Store4((offset + (i_1 * 16u)), asuint(array[i_1]));
}
}

View File

@ -24,7 +24,7 @@ typedef tint_padded_array_element tint_symbol_10_ret[4];
tint_symbol_10_ret tint_symbol_10(ByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr[i_1].el = tint_symbol_9(buffer, (offset + (i_1 * 16u)));
}
}

View File

@ -25,7 +25,7 @@ void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, Inner value) {
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[4]) {
tint_padded_array_element array[4] = value;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
tint_symbol_9(buffer, (offset + (i_1 * 16u)), array[i_1].el);
}
}

View File

@ -26,7 +26,7 @@ typedef int4 tint_symbol_12_ret[4];
tint_symbol_12_ret tint_symbol_12(uint4 buffer[96], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
const uint scalar_offset_5 = ((offset + (i_1 * 16u))) / 4;
arr_1[i_1] = asint(buffer[scalar_offset_5 / 4]);
}

View File

@ -35,7 +35,7 @@ typedef tint_padded_array_element tint_symbol_11_ret[4];
tint_symbol_11_ret tint_symbol_11(uint4 buffer[13], uint offset) {
tint_padded_array_element arr[4] = (tint_padded_array_element[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr[i_1].el = tint_symbol_10(buffer, (offset + (i_1 * 16u)));
}
}

View File

@ -15,7 +15,7 @@ struct tint_symbol_2 {
void f_inner(uint local_invocation_index) {
{
[loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
const uint i = idx;
s.data[i] = 0;
}

View File

@ -15,7 +15,7 @@ struct tint_symbol_2 {
void f_inner(uint local_invocation_index) {
{
[loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
const uint i = idx;
s.data[i] = 0;
}

View File

@ -21,7 +21,7 @@ static bool2 v2b = bool2(false, false);
void foo() {
{
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_int3(v3i, i, 1);
set_uint4(v4u, i, 1u);
@ -33,7 +33,7 @@ void foo() {
[numthreads(1, 1, 1)]
void main() {
{
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
for(int i = 0; (i < 2); i = (i + 1)) {
foo();
}
}

View File

@ -30,7 +30,7 @@ void foo() {
[numthreads(1, 1, 1)]
void main() {
{
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
for(int i = 0; (i < 2); i = (i + 1)) {
foo();
}
}

View File

@ -61,7 +61,7 @@ void main() {
bool3 v3b = bool3(false, false, false);
bool4 v4b = bool4(false, false, false, false);
{
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_float3(v3f, i, 1.0f);
set_float4(v4f, i, 1.0f);

View File

@ -25,7 +25,7 @@ void main() {
bool2 v2b = bool2(false, false);
bool2 v2b_2 = bool2(false, false);
{
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_int3(v3i, i, 1);
set_uint4(v4u, i, 1u);

View File

@ -61,7 +61,7 @@ void main() {
bool3 v3b = bool3(false, false, false);
bool4 v4b = bool4(false, false, false, false);
{
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_int2(v2i, i, 1);
set_uint2(v2u, i, 1u);

View File

@ -1,5 +1,5 @@
void main() {
[loop] while (true) {
while (true) {
if (false) {
} else {
break;

View File

@ -22,7 +22,7 @@ struct tint_symbol_2 {
int main_inner(int3 x) {
int y = x.x;
[loop] while (true) {
while (true) {
const int r = f(y);
if ((r == 0)) {
break;

View File

@ -52,9 +52,9 @@ void main_inner(uint3 GlobalInvocationID) {
const int TILE_SIZE = 16;
const int TILE_COUNT_X = 2;
{
[loop] for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) {
for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) {
{
[loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
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) - float2((1.0f).xx));
float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - float2((1.0f).xx));
@ -66,7 +66,7 @@ void main_inner(uint3 GlobalInvocationID) {
frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord.y / viewNear), 0.0f);
float dp = 0.0f;
{
[loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) {
for(uint i = 0u; (i < 6u); i = (i + 1u)) {
float4 p = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((frustumPlanes[i].x > 0.0f)) {
p.x = boxMax.x;

View File

@ -3,7 +3,7 @@ RWByteAddressBuffer b : register(u0, space0);
[numthreads(1, 1, 1)]
void main() {
uint i = 0u;
[loop] while (true) {
while (true) {
if ((i >= b.Load(0u))) {
break;
}

View File

@ -32,7 +32,7 @@ void main_inner(uint3 GlobalInvocationID) {
uint4 srcColorBits = uint4(0u, 0u, 0u, 0u);
uint4 dstColorBits = uint4(dstColor);
{
[loop] for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) {
for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) {
set_uint4(srcColorBits, i, ConvertToFp16FloatValue(srcColor[i]));
bool tint_tmp_1 = success;
if (tint_tmp_1) {

View File

@ -15,7 +15,7 @@ void main_inner(uint3 global_id) {
const uint dimOutter = uniforms[1].y;
uint result = 0u;
{
[loop] for(uint i = 0u; (i < dimInner); i = (i + 1u)) {
for(uint i = 0u; (i < dimInner); i = (i + 1u)) {
const uint a = (i + (resultCell.x * dimInner));
const uint b = (resultCell.y + (i * dimOutter));
result = (result + (firstMatrix.Load((4u * a)) * secondMatrix.Load((4u * b))));

View File

@ -153,7 +153,7 @@ int performPartition_i1_i1_(inout int l, inout int h) {
const QuicksortObject tint_symbol_11 = {tint_symbol_10};
obj = tint_symbol_11;
obj = x_960;
[loop] while (true) {
while (true) {
const int x_961 = pivot;
pivot = 0;
pivot = x_961;
@ -453,7 +453,7 @@ void quicksort_() {
p = 0;
p = x_1027;
stack[x_100_save] = x_99;
[loop] while (true) {
while (true) {
const float3 x_566 = float3(x_563.x, x_563.x, x_563.x);
const int x_1028 = h_1;
h_1 = 0;

View File

@ -14,7 +14,7 @@ void main_inner(uint3 GlobalInvocationID) {
flatIndex = (flatIndex * 1u);
float4 texel = myTexture.Load(int4(int3(int2(GlobalInvocationID.xy), 0), 0));
{
[loop] for(uint i = 0u; (i < 1u); i = (i + 1u)) {
for(uint i = 0u; (i < 1u); i = (i + 1u)) {
result.Store((4u * (flatIndex + i)), asuint(texel.r));
}
}

View File

@ -4,7 +4,7 @@ typedef int tint_symbol_ret[6];
tint_symbol_ret tint_symbol(ByteAddressBuffer buffer, uint offset) {
int arr[6] = (int[6])0;
{
[loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) {
for(uint i = 0u; (i < 6u); i = (i + 1u)) {
arr[i] = asint(buffer.Load((offset + (i * 4u))));
}
}

View File

@ -56,7 +56,7 @@ struct tint_symbol_1 {
void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
{
[loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
const uint i = (idx / 64u);
const uint i_1 = (idx % 64u);
mm_Asub[i][i_1] = 0.0f;
@ -73,7 +73,7 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
float ACached = 0.0f;
float BCached[4] = (float[4])0;
{
[loop] for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
acc[index] = 0.0f;
}
}
@ -82,11 +82,11 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
const uint RowPerThreadB = (TileInner / 16u);
const uint tileRowB = (local_id.y * RowPerThreadB);
{
[loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRow + innerRow);
const uint inputCol = (tileColA + innerCol);
mm_Asub[inputRow][inputCol] = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
@ -95,9 +95,9 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
}
}
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRowB + innerRow);
const uint inputCol = (tileCol + innerCol);
mm_Bsub[innerCol][inputCol] = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
@ -107,17 +107,17 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
}
GroupMemoryBarrierWithGroupSync();
{
[loop] for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
{
[loop] for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
BCached[inner] = mm_Bsub[k][(tileCol + inner)];
}
}
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
ACached = mm_Asub[(tileRow + innerRow)][k];
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
@ -130,9 +130,9 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
}
}
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
}

View File

@ -18,7 +18,7 @@ struct tint_symbol_1 {
void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index) {
{
[loop] for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) {
for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) {
const uint i_1 = (idx / 256u);
const uint i_2 = (idx % 256u);
tile[i_1][i_2] = float3(0.0f, 0.0f, 0.0f);
@ -31,9 +31,9 @@ void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocatio
const int2 dims = tint_tmp.xy;
const int2 baseIndex = (int2(((WorkGroupID.xy * uint2(params[0].y, 4u)) + (LocalInvocationID.xy * uint2(4u, 1u)))) - int2(int(filterOffset), 0));
{
[loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) {
for(uint r = 0u; (r < 4u); r = (r + 1u)) {
{
[loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) {
for(uint c = 0u; (c < 4u); c = (c + 1u)) {
int2 loadIndex = (baseIndex + int2(int(c), int(r)));
if ((flip[0].x != 0u)) {
loadIndex = loadIndex.yx;
@ -45,9 +45,9 @@ void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocatio
}
GroupMemoryBarrierWithGroupSync();
{
[loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) {
for(uint r = 0u; (r < 4u); r = (r + 1u)) {
{
[loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) {
for(uint c = 0u; (c < 4u); c = (c + 1u)) {
int2 writeIndex = (baseIndex + int2(int(c), int(r)));
if ((flip[0].x != 0u)) {
writeIndex = writeIndex.yx;
@ -64,7 +64,7 @@ void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocatio
if ((tint_tmp_1)) {
float3 acc = float3(0.0f, 0.0f, 0.0f);
{
[loop] for(uint f = 0u; (f < params[0].x); f = (f + 1u)) {
for(uint f = 0u; (f < params[0].x); f = (f + 1u)) {
uint i = ((center + f) - filterOffset);
acc = (acc + ((1.0f / float(params[0].x)) * tile[r][i]));
}

View File

@ -186,10 +186,10 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
numTiles = (((x_152 - 1) / 64) + 1);
innerRow = 0;
{
[loop] for(; (innerRow < 1); innerRow = (innerRow + 1)) {
for(; (innerRow < 1); innerRow = (innerRow + 1)) {
innerCol = 0;
{
[loop] for(; (innerCol < 1); innerCol = (innerCol + 1)) {
for(; (innerCol < 1); innerCol = (innerCol + 1)) {
acc[innerRow][innerCol] = 0.0f;
}
}
@ -201,13 +201,13 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
tileRowB = (asint(x_192) * 1);
t = 0;
{
[loop] for(; (t < numTiles); t = (t + 1)) {
for(; (t < numTiles); t = (t + 1)) {
innerRow_1 = 0;
{
[loop] for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) {
for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) {
innerCol_1 = 0;
{
[loop] for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) {
for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) {
inputRow = (tileRow + innerRow_1);
inputCol = (tileColA + innerCol_1);
const int x_233 = inputRow;
@ -224,10 +224,10 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
}
innerRow_2 = 0;
{
[loop] for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) {
for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) {
innerCol_2 = 0;
{
[loop] for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) {
for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) {
inputRow_1 = (tileRowB + innerRow_2);
inputCol_1 = (tileCol + innerCol_2);
const int x_278 = inputRow_1;
@ -245,10 +245,10 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
GroupMemoryBarrierWithGroupSync();
k = 0;
{
[loop] for(; (k < 64); k = (k + 1)) {
for(; (k < 64); k = (k + 1)) {
inner = 0;
{
[loop] for(; (inner < 1); inner = (inner + 1)) {
for(; (inner < 1); inner = (inner + 1)) {
const int x_314 = inner;
const float x_320 = mm_Bsub[k][(tileCol + inner)];
BCached[x_314] = x_320;
@ -256,12 +256,12 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
}
innerRow_3 = 0;
{
[loop] for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) {
for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) {
const float x_338 = mm_Asub[(tileRow + innerRow_3)][k];
ACached = x_338;
innerCol_3 = 0;
{
[loop] for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) {
for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) {
const int x_347 = innerRow_3;
const int x_348 = innerCol_3;
const float x_349 = ACached;
@ -279,9 +279,9 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
}
innerRow_4 = 0;
{
[loop] for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) {
for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) {
innerCol_4 = 0;
[loop] while (true) {
while (true) {
bool x_393 = false;
bool x_394_phi = false;
if ((innerCol_4 < 1)) {
@ -352,7 +352,7 @@ void main_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvocationID_pa
mm_Bsub[i_1][i_2] = 0.0f;
}
{
[loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) {
for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) {
const uint i = (idx / 64u);
const uint i_1 = (idx % 64u);
mm_Asub[i][i_1] = 0.0f;

View File

@ -62,7 +62,7 @@ void main_1() {
stageUnits = (float2(1.0f, 1.0f) / x_111);
i = 0;
{
[loop] for(; (i < 2); i = (i + 1)) {
for(; (i < 2); i = (i + 1)) {
switch(i) {
case 1: {
const float2 x_150 = tileID;
@ -93,7 +93,7 @@ void main_1() {
mt = ((x_181 * x_184) % 1.0f);
f = 0.0f;
{
[loop] for(; (f < 8.0f); f = (f + 1.0f)) {
for(; (f < 8.0f); f = (f + 1.0f)) {
const float x_197 = animationData.y;
if ((x_197 > mt)) {
const float x_203 = animationData.x;

View File

@ -244,7 +244,7 @@ void main_1() {
currSampledHeight = 1.0f;
i = 0;
{
[loop] for(; (i < 15); i = (i + 1)) {
for(; (i < 15); i = (i + 1)) {
const float4 x_397 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + vCurrOffset));
currSampledHeight = x_397.w;
if ((currSampledHeight > currRayHeight)) {

View File

@ -6,7 +6,7 @@ void unused_entry_point() {
void f() {
int i = 0;
{
[loop] for(; ; ) {
for(; ; ) {
}
}
}

View File

@ -18,7 +18,7 @@ typedef tint_padded_array_element tint_symbol_ret[2];
tint_symbol_ret tint_symbol(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_1[2] = (tint_padded_array_element[2])0;
{
[loop] for(uint i = 0u; (i < 2u); i = (i + 1u)) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
arr_1[i].el = asfloat(buffer.Load2((offset + (i * 16u))));
}
}
@ -28,7 +28,7 @@ tint_symbol_ret tint_symbol(RWByteAddressBuffer buffer, uint offset) {
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[2]) {
tint_padded_array_element array[2] = value;
{
[loop] for(uint i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
for(uint i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
buffer.Store2((offset + (i_1 * 16u)), asuint(array[i_1].el));
}
}

View File

@ -5,7 +5,7 @@ void unused_entry_point() {
int f() {
int i = 0;
[loop] while (true) {
while (true) {
i = (i + 1);
if ((i > 4)) {
return i;

View File

@ -5,7 +5,7 @@ void unused_entry_point() {
int f() {
int i = 0;
[loop] while (true) {
while (true) {
if ((i > 4)) {
return i;
}

View File

@ -6,12 +6,12 @@ void unused_entry_point() {
int f() {
int i = 0;
int j = 0;
[loop] while (true) {
while (true) {
i = (i + 1);
if ((i > 4)) {
return 1;
}
[loop] while (true) {
while (true) {
j = (j + 1);
if ((j > 4)) {
return 2;

View File

@ -6,11 +6,11 @@ void unused_entry_point() {
int f() {
int i = 0;
int j = 0;
[loop] while (true) {
while (true) {
if ((i > 4)) {
return 1;
}
[loop] while (true) {
while (true) {
if ((j > 4)) {
return 2;
}

View File

@ -60,7 +60,7 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) {
float2 pos = float2(0.0f, 0.0f);
float2 vel = float2(0.0f, 0.0f);
{
[loop] for(uint i = 0u; (i < 5u); i = (i + 1u)) {
for(uint i = 0u; (i < 5u); i = (i + 1u)) {
if ((i == index)) {
continue;
}

View File

@ -8,7 +8,7 @@ void some_loop_body() {
void f() {
{
[loop] for(int i = 0; (i < 5); i = (i + 1)) {
for(int i = 0; (i < 5); i = (i + 1)) {
some_loop_body();
}
}

View File

@ -10,7 +10,7 @@ void f() {
int j = 0;
{
int i = 0;
[loop] while (true) {
while (true) {
bool tint_tmp = (i < 5);
if (tint_tmp) {
tint_tmp = (j < 10);

View File

@ -6,7 +6,7 @@ void unused_entry_point() {
void f() {
int i = 0;
{
[loop] for(; (i < 4); ) {
for(; (i < 4); ) {
}
}
}

View File

@ -6,7 +6,7 @@ void unused_entry_point() {
void f() {
int i = 0;
{
[loop] for(; ; i = (i + 1)) {
for(; ; i = (i + 1)) {
}
}
}

View File

@ -5,7 +5,7 @@ void unused_entry_point() {
void f() {
{
[loop] for(; ; ) {
for(; ; ) {
}
}
}

View File

@ -5,7 +5,7 @@ void unused_entry_point() {
void f() {
{
[loop] for(int i = 0; ; ) {
for(int i = 0; ; ) {
}
}
}

View File

@ -5,7 +5,7 @@ void unused_entry_point() {
void f() {
{
[loop] for(int must_not_collide = 0; ; ) {
for(int must_not_collide = 0; ; ) {
}
}
int must_not_collide = 0;

View File

@ -6,7 +6,7 @@ struct tint_symbol_1 {
void main_inner(uint local_invocation_index) {
{
[loop] for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) {
for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) {
const uint i = idx;
v[i] = 0;
}