glslang icon indicating copy to clipboard operation
glslang copied to clipboard

ToSpirv/HlslCompileTest.FromFile/hlsl_inf_vert failing on M2 MacBook

Open juan-lunarg opened this issue 8 months ago • 2 comments

Running on an M2 MacBook I currently get a single test failure: ToSpirv/HlslCompileTest.FromFile/hlsl_inf_vert

System Version: macOS 14.1.1 (23B81)
Apple clang version 15.0.0 (clang-1500.0.40.1)
[ctest] [ RUN      ] ToSpirv/HlslCompileTest.FromFile/hlsl_inf_vert
[ctest] /Users/juanramos/projects/glslang/gtests/TestFixture.h:149: Failure
[ctest] Expected equality of these values:
[ctest]   expected
[ctest]     Which is: "hlsl.inf.vert\nShader version: 500\n0:? Sequence\n0:2  Function Definition: @main( ( temp 4-component vector of float)\n0:2    Function Parameters: \n0:?     Sequence\n0:3      Sequence\n0:3        move second child to first child ( temp float)\n0:3          'f1' ( temp float)\n0:3          Constant:\n0:3            -1.#INF\n0:4      Sequence\n0:4        move second child to first child ( temp float)\n0:4          'f2' ( temp float)\n0:4          Constant:\n0:4            +1.#INF\n0:5      Sequence\n0:5        move second child to first child ( temp float)\n0:5          'f3' ( temp float)\n0:5          Constant:\n0:5            +1.#INF\n0:6      Sequence\n0:6        move second child to first child ( temp float)\n0:6          'f4' ( temp float)\n0:6          add ( temp float)\n0:6            component-wise multiply ( temp float)\n0:6              'f2' ( temp float)\n0:6              Constant:\n0:6                +1.#INF\n0:6            Constant:\n0:6              +1.#INF\n0:10      Branch: Return with expression\n0:10        Construct vec4 ( temp 4-component vector of float)\n0:10          add ( temp float)\n0:10            add ( temp float)\n0:10              add ( temp float)\n0:10                add ( temp float)\n0:10                  add ( temp float)\n0:10                    'f1' ( temp float)\n0:10                    'f2' ( temp float)\n0:10                  'f3' ( temp float)\n0:10                'f4' ( temp float)\n0:10              Constant:\n0:10                -1.#INF\n0:10            Constant:\n0:10              1.#IND\n0:2  Function Definition: main( ( temp void)\n0:2    Function Parameters: \n0:?     Sequence\n0:2      move second child to first child ( temp 4-component vector of float)\n0:?         '@entryPointOutput' ( out 4-component vector of float Position)\n0:2        Function Call: @main( ( temp 4-component vector of float)\n0:?   Linker Objects\n0:?     '@entryPointOutput' ( out 4-component vector of float Position)\n\n\nLinked vertex stage:\n\n\nShader version: 500\n0:? Sequence\n0:2  Function Definition: @main( ( temp 4-component vector of float)\n0:2    Function Parameters: \n0:?     Sequence\n0:3      Sequence\n0:3        move second child to first child ( temp float)\n0:3          'f1' ( temp float)\n0:3          Constant:\n0:3            -1.#INF\n0:4      Sequence\n0:4        move second child to first child ( temp float)\n0:4          'f2' ( temp float)\n0:4          Constant:\n0:4            +1.#INF\n0:5      Sequence\n0:5        move second child to first child ( temp float)\n0:5          'f3' ( temp float)\n0:5          Constant:\n0:5            +1.#INF\n0:6      Sequence\n0:6        move second child to first child ( temp float)\n0:6          'f4' ( temp float)\n0:6          add ( temp float)\n0:6            component-wise multiply ( temp float)\n0:6              'f2' ( temp float)\n0:6              Constant:\n0:6                +1.#INF\n0:6            Constant:\n0:6              +1.#INF\n0:10      Branch: Return with expression\n0:10        Construct vec4 ( temp 4-component vector of float)\n0:10          add ( temp float)\n0:10            add ( temp float)\n0:10              add ( temp float)\n0:10                add ( temp float)\n0:10                  add ( temp float)\n0:10                    'f1' ( temp float)\n0:10                    'f2' ( temp float)\n0:10                  'f3' ( temp float)\n0:10                'f4' ( temp float)\n0:10              Constant:\n0:10                -1.#INF\n0:10            Constant:\n0:10              1.#IND\n0:2  Function Definition: main( ( temp void)\n0:2    Function Parameters: \n0:?     Sequence\n0:2      move second child to first child ( temp 4-component vector of float)\n0:?         '@entryPointOutput' ( out 4-component vector of float Position)\n0:2        Function Call: @main( ( temp 4-component vector of float)\n0:?   Linker Objects\n0:?     '@entryPointOutput' ( out 4-component vector of float Position)\n\n// Module Version 10000\n// Generated by (magic number): 8000b\n// Id's are bound by 37\n\n                              Capability Shader\n               1:             ExtInstImport  \"GLSL.std.450\"\n                              MemoryModel Logical GLSL450\n                              EntryPoint Vertex 4  \"main\" 35\n                              Source HLSL 500\n                              Name 4  \"main\"\n                              Name 9  \"@main(\"\n                              Name 12  \"f1\"\n                              Name 14  \"f2\"\n                              Name 16  \"f3\"\n                              Name 17  \"f4\"\n                              Name 35  \"@entryPointOutput\"\n                              Decorate 35(@entryPointOutput) BuiltIn Position\n               2:             TypeVoid\n               3:             TypeFunction 2\n               6:             TypeFloat 32\n               7:             TypeVector 6(float) 4\n               8:             TypeFunction 7(fvec4)\n              11:             TypePointer Function 6(float)\n              13:    6(float) Constant 4286578688\n              15:    6(float) Constant 2139095040\n              29:    6(float) Constant 4290772992\n              34:             TypePointer Output 7(fvec4)\n35(@entryPointOutput):     34(ptr) Variable Output\n         4(main):           2 Function None 3\n               5:             Label\n              36:    7(fvec4) FunctionCall 9(@main()\n                              Store 35(@entryPointOutput) 36\n                              Return\n                              FunctionEnd\n       9(@main():    7(fvec4) Function None 8\n              10:             Label\n          12(f1):     11(ptr) Variable Function\n          14(f2):     11(ptr) Variable Function\n          16(f3):     11(ptr) Variable Function\n          17(f4):     11(ptr) Variable Function\n                              Store 12(f1) 13\n                              Store 14(f2) 15\n                              Store 16(f3) 15\n              18:    6(float) Load 14(f2)\n              19:    6(float) FMul 18 15\n              20:    6(float) FAdd 19 15\n                              Store 17(f4) 20\n              21:    6(float) Load 12(f1)\n              22:    6(float) Load 14(f2)\n              23:    6(float) FAdd 21 22\n              24:    6(float) Load 16(f3)\n              25:    6(float) FAdd 23 24\n              26:    6(float) Load 17(f4)\n              27:    6(float) FAdd 25 26\n              28:    6(float) FAdd 27 13\n              30:    6(float) FAdd 28 29\n              31:    7(fvec4) CompositeConstruct 30 30 30 30\n                              ReturnValue 31\n                              FunctionEnd\n"
[ctest]   real
[ctest]     Which is: "hlsl.inf.vert\nShader version: 500\n0:? Sequence\n0:2  Function Definition: @main( ( temp 4-component vector of float)\n0:2    Function Parameters: \n0:?     Sequence\n0:3      Sequence\n0:3        move second child to first child ( temp float)\n0:3          'f1' ( temp float)\n0:3          Constant:\n0:3            -1.#INF\n0:4      Sequence\n0:4        move second child to first child ( temp float)\n0:4          'f2' ( temp float)\n0:4          Constant:\n0:4            +1.#INF\n0:5      Sequence\n0:5        move second child to first child ( temp float)\n0:5          'f3' ( temp float)\n0:5          Constant:\n0:5            +1.#INF\n0:6      Sequence\n0:6        move second child to first child ( temp float)\n0:6          'f4' ( temp float)\n0:6          add ( temp float)\n0:6            component-wise multiply ( temp float)\n0:6              'f2' ( temp float)\n0:6              Constant:\n0:6                +1.#INF\n0:6            Constant:\n0:6              +1.#INF\n0:10      Branch: Return with expression\n0:10        Construct vec4 ( temp 4-component vector of float)\n0:10          add ( temp float)\n0:10            add ( temp float)\n0:10              add ( temp float)\n0:10                add ( temp float)\n0:10                  add ( temp float)\n0:10                    'f1' ( temp float)\n0:10                    'f2' ( temp float)\n0:10                  'f3' ( temp float)\n0:10                'f4' ( temp float)\n0:10              Constant:\n0:10                -1.#INF\n0:10            Constant:\n0:10              1.#IND\n0:2  Function Definition: main( ( temp void)\n0:2    Function Parameters: \n0:?     Sequence\n0:2      move second child to first child ( temp 4-component vector of float)\n0:?         '@entryPointOutput' ( out 4-component vector of float Position)\n0:2        Function Call: @main( ( temp 4-component vector of float)\n0:?   Linker Objects\n0:?     '@entryPointOutput' ( out 4-component vector of float Position)\n\n\nLinked vertex stage:\n\n\nShader version: 500\n0:? Sequence\n0:2  Function Definition: @main( ( temp 4-component vector of float)\n0:2    Function Parameters: \n0:?     Sequence\n0:3      Sequence\n0:3        move second child to first child ( temp float)\n0:3          'f1' ( temp float)\n0:3          Constant:\n0:3            -1.#INF\n0:4      Sequence\n0:4        move second child to first child ( temp float)\n0:4          'f2' ( temp float)\n0:4          Constant:\n0:4            +1.#INF\n0:5      Sequence\n0:5        move second child to first child ( temp float)\n0:5          'f3' ( temp float)\n0:5          Constant:\n0:5            +1.#INF\n0:6      Sequence\n0:6        move second child to first child ( temp float)\n0:6          'f4' ( temp float)\n0:6          add ( temp float)\n0:6            component-wise multiply ( temp float)\n0:6              'f2' ( temp float)\n0:6              Constant:\n0:6                +1.#INF\n0:6            Constant:\n0:6              +1.#INF\n0:10      Branch: Return with expression\n0:10        Construct vec4 ( temp 4-component vector of float)\n0:10          add ( temp float)\n0:10            add ( temp float)\n0:10              add ( temp float)\n0:10                add ( temp float)\n0:10                  add ( temp float)\n0:10                    'f1' ( temp float)\n0:10                    'f2' ( temp float)\n0:10                  'f3' ( temp float)\n0:10                'f4' ( temp float)\n0:10              Constant:\n0:10                -1.#INF\n0:10            Constant:\n0:10              1.#IND\n0:2  Function Definition: main( ( temp void)\n0:2    Function Parameters: \n0:?     Sequence\n0:2      move second child to first child ( temp 4-component vector of float)\n0:?         '@entryPointOutput' ( out 4-component vector of float Position)\n0:2        Function Call: @main( ( temp 4-component vector of float)\n0:?   Linker Objects\n0:?     '@entryPointOutput' ( out 4-component vector of float Position)\n\n// Module Version 10000\n// Generated by (magic number): 8000b\n// Id's are bound by 37\n\n                              Capability Shader\n               1:             ExtInstImport  \"GLSL.std.450\"\n                              MemoryModel Logical GLSL450\n                              EntryPoint Vertex 4  \"main\" 35\n                              Source HLSL 500\n                              Name 4  \"main\"\n                              Name 9  \"@main(\"\n                              Name 12  \"f1\"\n                              Name 14  \"f2\"\n                              Name 16  \"f3\"\n                              Name 17  \"f4\"\n                              Name 35  \"@entryPointOutput\"\n                              Decorate 35(@entryPointOutput) BuiltIn Position\n               2:             TypeVoid\n               3:             TypeFunction 2\n               6:             TypeFloat 32\n               7:             TypeVector 6(float) 4\n               8:             TypeFunction 7(fvec4)\n              11:             TypePointer Function 6(float)\n              13:    6(float) Constant 4286578688\n              15:    6(float) Constant 2139095040\n              29:    6(float) Constant 2143289344\n              34:             TypePointer Output 7(fvec4)\n35(@entryPointOutput):     34(ptr) Variable Output\n         4(main):           2 Function None 3\n               5:             Label\n              36:    7(fvec4) FunctionCall 9(@main()\n                              Store 35(@entryPointOutput) 36\n                              Return\n                              FunctionEnd\n       9(@main():    7(fvec4) Function None 8\n              10:             Label\n          12(f1):     11(ptr) Variable Function\n          14(f2):     11(ptr) Variable Function\n          16(f3):     11(ptr) Variable Function\n          17(f4):     11(ptr) Variable Function\n                              Store 12(f1) 13\n                              Store 14(f2) 15\n                              Store 16(f3) 15\n              18:    6(float) Load 14(f2)\n              19:    6(float) FMul 18 15\n              20:    6(float) FAdd 19 15\n                              Store 17(f4) 20\n              21:    6(float) Load 12(f1)\n              22:    6(float) Load 14(f2)\n              23:    6(float) FAdd 21 22\n              24:    6(float) Load 16(f3)\n              25:    6(float) FAdd 23 24\n              26:    6(float) Load 17(f4)\n              27:    6(float) FAdd 25 26\n              28:    6(float) FAdd 27 13\n              30:    6(float) FAdd 28 29\n              31:    7(fvec4) CompositeConstruct 30 30 30 30\n                              ReturnValue 31\n                              FunctionEnd\n"
[ctest] With diff:
[ctest] @@ -137,5 +137,5 @@
[ctest]                13:    6(float) Constant 4286578688
[ctest]                15:    6(float) Constant 2139095040
[ctest] -              29:    6(float) Constant 4290772992
[ctest] +              29:    6(float) Constant 2143289344
[ctest]                34:             TypePointer Output 7(fvec4)
[ctest]  35(@entryPointOutput):     34(ptr) Variable Output
[ctest] 
[ctest] The following warnings/errors occurred:
[ctest] 
[ctest] 
[ctest] [  FAILED  ] ToSpirv/HlslCompileTest.FromFile/hlsl_inf_vert, where GetParam() = 16-byte object <BA-23 8D-05 01-00 00-00 BF-19 8D-05 01-00 00-00> (4 ms)

[ FAILED ] ToSpirv/HlslCompileTest.FromFile/hlsl_inf_vert, where GetParam() = 16-byte object <BA-23 8D-05 01-00 00-00 BF-19 8D-05 01-00 00-00> (4 ms)

juan-lunarg avatar Nov 30 '23 18:11 juan-lunarg

NOTE: I'm using Apple clang version 15 while CI is currently using 14 so that could also be the cause of the issue and not ARM related at all.

juan-lunarg avatar Nov 30 '23 19:11 juan-lunarg

This feels like a real potential issue in some floating point edge case, but the value in question is just a different representation of NaN.

arcady-lunarg avatar Dec 05 '23 22:12 arcady-lunarg