Crashes and precise test updates (#2081)

Adds crash tests for bugs #2077, and #2061.
Removes crash test for closed bug #1882.
Adds a bunch of tests for "precise" attribute, whose effects I just learned about. Lead to filing bugs #2078, #2079 and #2080 due to divergences in behavior with FXC.
This commit is contained in:
Tristan Labelle 2019-04-30 10:50:43 -07:00 коммит произвёл GitHub
Родитель 6264641b94
Коммит 28f0fe4701
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 179 добавлений и 17 удалений

Просмотреть файл

@ -0,0 +1,13 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise modifier on an array has an effect.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float main(float f : IN) : OUT
{
precise float a[1] = { f * f };
return a[0];
}

Просмотреть файл

@ -0,0 +1,13 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise applies to the initializer of the variable.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float main(float f : IN) : OUT
{
precise float result = f * f;
return result;
}

Просмотреть файл

@ -0,0 +1,19 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s | XFail GitHub #2080
// Test that precise modifier on a matrix has an effect.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float2x2 main(float2x2 m : IN) : OUT
{
precise float2x2 result = m * m;
return result;
}

Просмотреть файл

@ -1,11 +0,0 @@
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
// Make sure no fast on fadd
// CHECK: fadd float
float x : register(b0);
float main(float4 col : COLOR) : SV_Target {
precise float result = x + col;
return result;
}

Просмотреть файл

@ -0,0 +1,13 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s | XFail GitHub #2079
// Test that precise propagates to operations consuming the value.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float main(float f : IN) : OUT
{
precise float pf = f;
return pf * pf;
}

Просмотреть файл

@ -0,0 +1,14 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise applies to instructions producing the value.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float main(float f : IN) : OUT
{
float square = f * f;
precise float result = square;
return result;
}

Просмотреть файл

@ -0,0 +1,22 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise applies retroactively to instructions
// producing a given value, interprocedurally.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float square(float f) { return f * f; }
float make_precise(float f)
{
precise float pf = f;
return f;
}
float main(float f : IN) : OUT
{
float result = square(f);
return make_precise(result);
}

Просмотреть файл

@ -0,0 +1,14 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s | XFail GitHub #2078
// Test that the precise modifier applies to static variables.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
static precise float g;
float main(float f : IN) : OUT
{
g = f * f;
return g;
}

Просмотреть файл

@ -0,0 +1,13 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise modifier on a struct field has an effect.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float main(float f : IN) : OUT
{
struct { precise float f; } s = { f * f };
return s.f;
}

Просмотреть файл

@ -0,0 +1,15 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise applies to the value producers
// after the initial assignment.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float main(float f : IN) : OUT
{
precise float result = 0;
result = f * f;
return result;
}

Просмотреть файл

@ -0,0 +1,15 @@
// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
// Test that precise modifier on a vector has an effect.
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
// CHECK: fmul float
// CHECK-NOT: fmul fast float
float2 main(float2 v : IN) : OUT
{
precise float2 result = v * v;
return result;
}

Просмотреть файл

@ -1,6 +0,0 @@
// RUN: %dxc -E main -T vs_6_2 %s | FileCheck %s
// Repro of GitHub #1882
AppendStructuredBuffer<bool> buf;
void main() { buf.Append(true); }

Просмотреть файл

@ -0,0 +1,21 @@
// RUN: %dxc -E main -T vs_6_2 %s | FileCheck %s
// Repro of GitHub #2077
groupshared uint gs_uint;
groupshared int gs_int;
groupshared bool gs_bool;
groupshared float gs_float;
groupshared int16_t gs_int16;
groupshared int64_t gs_int64;
void main()
{
InterlockedAdd(gs_uint, 1);
InterlockedAdd(gs_int, 1);
// All the below crash
InterlockedAdd(gs_bool, 1);
InterlockedAdd(gs_float, 1);
InterlockedAdd(gs_int16, 1);
InterlockedAdd(gs_int64, 1);
}

Просмотреть файл

@ -0,0 +1,7 @@
// RUN: %dxc -E main -T vs_6_2 %s | FileCheck %s
// Repro of GitHub #2061
Buffer buf;
static Buffer bufs[1];
void main() { bufs[0] = buf; }