blob: d03d9ab00e7b035de04909a0b4bfa7c32d9d340c [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 3x3 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
{
f16mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
f16mat3 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float16> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400161743164062 -2.900390625 -41
-0.419921875 0.00490188598632812 -0.016998291015625
-0.7001953125 0.00500106811523438 -0.00259971618652344
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32 1.80000007152557 -0.046000003814697
5 0.00500000035390258 -27
-4.0234375 1.2275390625 21.125
5.73828125 90.5625 -60.4375
-2.1484375 -1.27734375 -1.951171875
1.71191406 -6.6796875 3.72460938
4.828125 0.152832031 0.327636719
-0.126586914 1.70605469 0.860351562
24.171875 2.798828125 0.82958984375
-9.703125 1.1630859375 -17.46875
-1.3828125 -4.83984375 3.56640625
-1.615234375 5.9296875 1.181640625
1.7802734375 19.1875 4.7578125
52.8125 -1.1171875 1.1513671875
3.17578125 -2.3984375 4.12890625
1.3818359375 5.53125 1.8154296875
-16.40625 -1.8486328125 0.95263671875
1.615234375 0.62890625 2.73828125
-0.9716796875 -18.828125 3.509765625
-8.015625 3.5703125 5.98046875
END
BUFFER bufOut DATA_TYPE mat3x3<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 0.25 and 0.5: 0.000244140625
EXPECT bufOut IDX 0 TOLERANCE 0.000244140625 EQ -0.45947265625 0.10809326171875 0.310791015625 0.32421875 -0.1351318359375 -0.0135116577148438 -0.054046630859375 0.189208984375 -0.0810546875
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 24 TOLERANCE 0.00048828125 EQ 1.0 -1.0 0.0 -1.0 0.0 1.0 0.0 1.0 0.0
# Decimals between 256 and 512: 0.25
EXPECT bufOut IDX 48 TOLERANCE 0.25 EQ -0.000839710235595703 2.47265625 -2.908203125 -0.125732421875 333.75 -200.125 -0.0154953002929688 -23.609375 14.15625
# Decimals between 64 and 128: 0.25
EXPECT bufOut IDX 72 TOLERANCE 0.25 EQ -5.10546875 0.00291061401367188 0.07562255859375 -90.8125 0.607421875 1.3447265625 -0.96240234375 0.000651359558105469 -0.0227813720703125
# Decimals between 0.25 and 0.5: 0.000244140625
EXPECT bufOut IDX 96 TOLERANCE 0.000244140625 EQ -0.04931640625 -0.0047760009765625 -0.385986328125 0.0273895263672 0.0103378295898438 -0.023681640625 0.036346435546875 -0.00150966644287109 -0.07208251953125
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 120 TOLERANCE 0.00048828125 EQ -0.0073711 0.20852935 -0.04752852 -0.07230215 0.03351298 0.300247073 0.14224312 -0.03575948 0.560298204
# Decimals between 0.125 and 0.25: 0.000244140625
EXPECT bufOut IDX 144 TOLERANCE 0.000244140625 EQ 0.0462192446 0.00804401748 0.028658431 -0.03377546 -0.05020383 -0.2381591796875 -0.0279215015 -0.0650251061 -0.0317565352
# Decimals between 4 and 8: 0.00390625
EXPECT bufOut IDX 168 TOLERANCE 0.03125 EQ 0.117026463 -0.0347934514 0.0236943774 1.06405377 -0.274251282 0.0417966172 -4.3359375 1.32951331 -0.177455068
# Decimals between 0.125 and 0.25: 0.0001220703125
EXPECT bufOut IDX 192 TOLERANCE 0.0001220703125 EQ 0.0185089111 -0.0114746094 -0.0583496094 -0.0667114258 0.151855469 -0.000134825706 0.189208984 0.0969848633 0.0447998047
# Decimals between 0.125 and 0.25: 0.0001220703125
EXPECT bufOut IDX 216 TOLERANCE 0.0001220703125 EQ 0.19580078125 -0.00940704345703125 -0.08416748046875 0.034942626953125 -0.049468994140625 0.013031005859375 0.2415771484375 0.0169219970703125 0.046630859375