blob: 79628a46975ff04152049e9393b137b5a38ba14c [file] [log] [blame]
#!amber
# Copyright 2021 Google LLC.
# Copyright 2021 The Khronos Group Inc.
#
# 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.
# Matrix 4x4 inverse precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f16mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
f16mat4 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat4 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float16> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.08837890625 0.1569824219 0.001299858093 0.2451171875
0.0380859375 0.7124023438 -0.003200531006 0.9111328125
0.07598876953 0.09777832031 -1.060546875 1.904296875
-0.4968261719 1.595703125 0.01309967041 -2.6953125
0.55322265625 -2.6953125 -12.75 -0.381103515625
-0.473876953125 -0.014030456543 -4.9140625 -9.59375
-1.083984375 0.62841796875 0.067443847656 -4.7734375
-0.062286376953 -0.58935546875 -0.143798828125 0.4453125
1.4853515625 -2.931640625 1.3818359375 -0.9482421875
2.982421875 -1.16796875 7.4765625 20.65625
-0.56103515625 -7.1171875 -0.58251953125 1.0693359375
-1.5810546875 -1.5830078125 -1.8076171875 1.96484375
-1.4775390625 1.4267578125 1.8896484375 2.62890625
-1.8427734375 0.7919921875 -1.4306640625 -12.484375
1.6396484375 0.90087890625 2.03515625 -3.99609375
2.546875 -1.283203125 2.072265625 4.1953125
2.005859375 -2.0625 0.92626953125 3.67578125
2.537109375 1.9208984375 -2.193359375 -1.509765625
-1.798828125 2.2578125 -1.5361328125 1.109375
-3.798828125 0.85205078125 1.3095703125 -1.6298828125
0.033935546875 0.0477600097656 -0.0791015625 0.40380859375
0.0431823730469 0.0899047851563 0.033966064453 -0.00238609313965
0.10986328125 -0.4140625 0.184326171875 -0.00595855712891
-7.19921875 0.0353088378906 -0.020690917969 -0.02047729492188
-0.802734375 -0.587402344 -1.73046875 -2.11523438
-3.34765625 -1.0625 0.406738281 -0.0211181641
-4.3359375 -0.0816650391 -0.0436706543 -0.794921875
-0.424560547 27.515625 2.55273438 -6.546875
0.014717102051 1.111328125 -0.36279296875 0.826171875
0.47705078125 0.251220703125 -0.47119140625 2.8125
-33.34375 -0.074096679688 0.215087890625 -3.392578125
0.32373046875 -0.166748046875 0.0095901489258 0.428955078125
END
BUFFER bufOut DATA_TYPE mat4x4<float16> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 2 and 4: 0.001953125
EXPECT bufOut IDX 0 TOLERANCE 0.001953125 EQ 2.15234375 1.153320312 -3.19140625 1.345703125 -0.3845214844 -0.3845214844 0.73046875 -0.1153564453 1.69140625 0.6923828125 -2.115234375 0.8076171875 -1.615234375 -0.615234375 2.26953125 -0.884277343
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 32 TOLERANCE 0.00048828125 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0
# Decimals between 8 and 16: 0.015625
EXPECT bufOut IDX 64 TOLERANCE 0.015625 EQ -9.75 2.373046875 -0.02033996582 -0.09899902344 -1.012695312 1.044921875 -0.001180648804 0.2600097656 1.372070312 0.5961914062 -0.947265625 -0.3430175781 1.205078125 0.1840820312 -0.001552581787 -0.2004394531
# Decimals between 1 and 2: 0.0009765625
EXPECT bufOut IDX 96 TOLERANCE 0.00390625 EQ -0.25830078125 0.65869140625 -1.328125 -0.25 0.1091918945312 -0.223876953125 0.263427734375 -1.9091796875 -0.114807128906 0.081237792969 -0.117004394531 0.39819335938 0.071411132813 -0.17797851563 0.125 -0.188720703125
# Decimals between 2 and 4: 0.03125
EXPECT bufOut IDX 128 TOLERANCE 0.03125 EQ 2.904296875 -0.028793334961 -1.787109375 2.67578125 0.0009551048279 0.002325057983 -0.154663085938 0.06018066406 -2.150390625 0.057708740234 1.4150390625 -2.4140625 0.359619140625 0.031829833984 -0.262451171875 0.490966796875
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 160 TOLERANCE 0.001953125 EQ -0.3486328125 -0.2998046875 0.40576171875 -0.287841796875 -0.1229248046875 -0.4833984375 0.58935546875 -0.80029296875 0.343505859375 0.265380859375 -0.114685058594 0.46508789063 0.004291534424 -0.096862792969 -0.009376525879 -0.061584472656
# Decimals between 1 and 2: 0.00390625
EXPECT bufOut IDX 192 TOLERANCE 0.00390625 EQ 0.363037109375 0.443603515625 -0.158935546875 0.2998046875 0.76513671875 0.86279296875 0.046173095703 0.9580078125 0.89794921875 0.78125 -0.26708984375 1.123046875 0.276611328125 0.045043945313 0.179931640625 0.09088134765625
# Decimals between 8 and 16: 0.0078125
EXPECT bufOut IDX 224 TOLERANCE 0.0078125 EQ -0.007389068603516 -0.015106201172 -0.0160217285156 -0.1392822265625 0.0204010009766 6.03515625 -1.1005859375 0.01950073242 0.130981445313 13.6171875 2.984375 0.12780761719 2.5 1.955078125 0.7158203125 0.034423828125
# Decimals between 4 and 8: 0.00390625
EXPECT bufOut IDX 256 TOLERANCE 0.015625 EQ 0.185058594 0.563476563 -0.702148438 0.023651123 -0.302001953 -1.12011719 0.921875 -0.0106582642 0.680664063 4.0078125 -3.23632813 0.159667969 -1.015625 -3.1796875 2.65625 -0.13659668
# Decimals between 16 and 32: 0.250
EXPECT bufOut IDX 288 TOLERANCE 0.250 EQ -0.04522705078125 0.0146484375 -0.0323791503906 -0.264892578125 2.169921875 -1.52734375 0.0387878417969 6.15234375 5.609375 -5.765625 0.197387695313 28.546875 0.75244140625 -0.47607421875 0.035095214844 4.28125