dEQP-VK.graphicsfuzz.mat-mul-in-loop
authorAlastair Donaldson <afdx@google.com>
Wed, 4 Dec 2019 17:44:23 +0000 (17:44 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 17 Dec 2019 10:13:52 +0000 (05:13 -0500)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.mat-mul-in-loop

Change-Id: Iac5112a7bb0f8abfb02da029348427986c79ebf0

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber [new file with mode: 0644]
external/vulkancts/mustpass/master/vk-default-no-waivers.txt
external/vulkancts/mustpass/master/vk-default.txt

index 47beacb..0585e24 100644 (file)
@@ -559906,6 +559906,7 @@ dEQP-VK.graphicsfuzz.loops-breaks-returns
 dEQP-VK.graphicsfuzz.loops-ifs-continues-call
 dEQP-VK.graphicsfuzz.mat-array-deep-control-flow
 dEQP-VK.graphicsfuzz.mat-array-distance
+dEQP-VK.graphicsfuzz.mat-mul-in-loop
 dEQP-VK.graphicsfuzz.matrices-and-return-in-loop
 dEQP-VK.graphicsfuzz.max-mix-conditional-discard
 dEQP-VK.graphicsfuzz.mix-floor-add
index be7efa8..94b4d95 100644 (file)
@@ -35,6 +35,7 @@
 {      "loops-ifs-continues-call.amber",                               "loops-ifs-continues-call",                             "A fragment shader with nested control flow and a call"                                                                 },
 {      "mat-array-deep-control-flow.amber",                    "mat-array-deep-control-flow",                  "A fragment shader that uses an array of matrices and has deep control flow"                    },
 {      "mat-array-distance.amber",                                             "mat-array-distance",                                   "A fragment shader that uses an array of matrices and distance"                                                 },
+{      "mat-mul-in-loop.amber",                                                "mat-mul-in-loop",                                              "Shader with matrix multiplication in loop"                                                                                             },
 {      "matrices-and-return-in-loop.amber",                    "matrices-and-return-in-loop",                  "A fragment shader with matrices and a return in a loop"                                                                },
 {      "max-mix-conditional-discard.amber",                    "max-mix-conditional-discard",                  "A fragment shader with an expression used in two discard guards"                                               },
 {      "mix-floor-add.amber",                                                  "mix-floor-add",                                                "A fragment shader with mix, uintBitsToFloat, and floor"                                                                },
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber
new file mode 100644 (file)
index 0000000..304a305
--- /dev/null
@@ -0,0 +1,175 @@
+#!amber
+
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by GraphicsFuzz.
+
+# Short description: Shader with matrix multiplication in loop
+
+# The test passes because 'm1' is the identity matrix, so that 'm2' is also the identity matrix, meaning that 'v' gets set to '(1.0, 0.0)'.  As a result, the colour that is written is guaranteed to be red
+
+# Optimized using spirv-opt with the following arguments:
+# '--simplify-instructions'
+# '--combine-access-chains'
+# '--eliminate-dead-branches'
+# '--merge-return'
+# '--combine-access-chains'
+# '--eliminate-dead-code-aggressive'
+# '--reduce-load-size'
+# '--eliminate-local-single-block'
+# '--private-to-local'
+# '--inline-entry-points-exhaustive'
+# '--copy-propagate-arrays'
+# '--eliminate-local-multi-store'
+# '--scalar-replacement=100'
+# '--eliminate-dead-branches'
+# '--eliminate-local-single-store'
+# spirv-opt commit hash: f1e5cd73f658abcc23ee96d78f2dc27c4b7028c1
+
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+# variant_fragment_shader is derived from the following GLSL:
+# #version 310 es
+# precision highp float;
+#
+# precision highp int;
+#
+# layout(location = 0) out vec4 _GLF_color;
+#
+# void main(void)
+# {
+#  vec2 v;
+#  mat2 m1 = mat2(1.0, 0.0, 0.0, 1.0);
+#  for(
+#      int i = 0;
+#      i < 1;
+#      i++
+#  )
+#   {
+#    do
+#     {
+#      mat2 m2;
+#      m2 = m1 * m1;
+#      v = m2 * vec2(1.0, 0.0);
+#     }
+#    while(false);
+#   }
+#   _GLF_color = vec4(v, 0.0, 1.0);
+# }
+SHADER fragment variant_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 8
+; Bound: 56
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %46
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %10 "m1"
+               OpName %18 "i"
+               OpName %33 "m2"
+               OpName %38 "v"
+               OpName %46 "_GLF_color"
+               OpDecorate %46 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypeMatrix %7 2
+          %9 = OpTypePointer Function %8
+         %11 = OpConstant %6 1
+         %12 = OpConstant %6 0
+         %13 = OpConstantComposite %7 %11 %12
+         %14 = OpConstantComposite %7 %12 %11
+         %15 = OpConstantComposite %8 %13 %14
+         %16 = OpTypeInt 32 1
+         %17 = OpTypePointer Function %16
+         %19 = OpConstant %16 0
+         %26 = OpConstant %16 1
+         %27 = OpTypeBool
+         %37 = OpTypePointer Function %7
+         %41 = OpConstantFalse %27
+         %44 = OpTypeVector %6 4
+         %45 = OpTypePointer Output %44
+         %46 = OpVariable %45 Output
+         %53 = OpUndef %7
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %10 = OpVariable %9 Function
+         %18 = OpVariable %17 Function
+         %33 = OpVariable %9 Function
+         %38 = OpVariable %37 Function
+               OpStore %10 %15
+               OpStore %18 %19
+               OpBranch %20
+         %20 = OpLabel
+         %55 = OpPhi %8 %15 %5 %55 %23
+         %52 = OpPhi %7 %53 %5 %40 %23
+         %51 = OpPhi %16 %19 %5 %43 %23
+               OpLoopMerge %22 %23 None
+               OpBranch %24
+         %24 = OpLabel
+         %28 = OpSLessThan %27 %51 %26
+               OpBranchConditional %28 %21 %22
+         %21 = OpLabel
+               OpBranch %29
+         %29 = OpLabel
+               OpLoopMerge %31 %32 None
+               OpBranch %30
+         %30 = OpLabel
+         %36 = OpMatrixTimesMatrix %8 %55 %55
+               OpStore %33 %36
+         %40 = OpMatrixTimesVector %7 %36 %13
+               OpStore %38 %40
+               OpBranch %32
+         %32 = OpLabel
+               OpBranchConditional %41 %29 %31
+         %31 = OpLabel
+               OpBranch %23
+         %23 = OpLabel
+         %43 = OpIAdd %16 %51 %26
+               OpStore %18 %43
+               OpBranch %20
+         %22 = OpLabel
+         %48 = OpCompositeExtract %6 %52 0
+         %49 = OpCompositeExtract %6 %52 1
+         %50 = OpCompositeConstruct %44 %48 %49 %12 %11
+               OpStore %46 %50
+               OpReturn
+               OpFunctionEnd
+END
+
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+  ATTACH variant_vertex_shader
+  ATTACH variant_fragment_shader
+  FRAMEBUFFER_SIZE 256 256
+  BIND BUFFER variant_framebuffer AS color LOCATION 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
index 191b869..bafd388 100644 (file)
@@ -562263,6 +562263,7 @@ dEQP-VK.graphicsfuzz.loops-breaks-returns
 dEQP-VK.graphicsfuzz.loops-ifs-continues-call
 dEQP-VK.graphicsfuzz.mat-array-deep-control-flow
 dEQP-VK.graphicsfuzz.mat-array-distance
+dEQP-VK.graphicsfuzz.mat-mul-in-loop
 dEQP-VK.graphicsfuzz.matrices-and-return-in-loop
 dEQP-VK.graphicsfuzz.max-mix-conditional-discard
 dEQP-VK.graphicsfuzz.mix-floor-add
index e909044..33f2742 100644 (file)
@@ -562110,6 +562110,7 @@ dEQP-VK.graphicsfuzz.loops-breaks-returns
 dEQP-VK.graphicsfuzz.loops-ifs-continues-call
 dEQP-VK.graphicsfuzz.mat-array-deep-control-flow
 dEQP-VK.graphicsfuzz.mat-array-distance
+dEQP-VK.graphicsfuzz.mat-mul-in-loop
 dEQP-VK.graphicsfuzz.matrices-and-return-in-loop
 dEQP-VK.graphicsfuzz.max-mix-conditional-discard
 dEQP-VK.graphicsfuzz.mix-floor-add