aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordan sinclair <dsinclair@google.com>2019-12-11 20:27:52 -0500
committerGitHub <noreply@github.com>2019-12-11 20:27:52 -0500
commitdb781e54c27711e11166733ba3027b750d886005 (patch)
tree4dcbf4810d50ba21062d1bd753b28c90efc775ed /tests
parent52444a47eee93d229f527d7283422fb85845610c (diff)
downloadamber-db781e54c27711e11166733ba3027b750d886005.tar.gz
Add Float 16 Support (#751)
This CL adds the float16 data type into amber_script and the required plumbing to enable the feature. Fixes #485
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/float16.amber45
-rwxr-xr-xtests/run_tests.py8
2 files changed, 47 insertions, 6 deletions
diff --git a/tests/cases/float16.amber b/tests/cases/float16.amber
new file mode 100644
index 0000000..53671db
--- /dev/null
+++ b/tests/cases/float16.amber
@@ -0,0 +1,45 @@
+#!amber
+# Copyright 2019 The Amber Authors.
+#
+# 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
+#
+# https://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.
+
+INSTANCE_EXTENSION VK_KHR_get_physical_device_properties2
+DEVICE_EXTENSION VK_KHR_shader_float16_int8
+DEVICE_FEATURE Float16Int8Features.shaderFloat16
+
+SHADER compute f16 GLSL
+#version 450
+#extension GL_AMD_gpu_shader_half_float : enable
+
+layout(set=0, binding=0) buffer Buf {
+ float16_t h;
+} data;
+
+void main() {
+ data.h = data.h * 2.0hf;
+}
+END
+
+BUFFER buf DATA_TYPE float16 DATA
+2.4
+END
+
+PIPELINE compute pipeline
+ ATTACH f16
+
+ BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
+END
+
+RUN pipeline 1 1 1
+
+EXPECT buf IDX 0 TOLERANCE 0.1 EQ 4.8
diff --git a/tests/run_tests.py b/tests/run_tests.py
index a988b82..f461bff 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -36,8 +36,6 @@ SUPPRESSIONS = {
"compute_mat3x2.vkscript",
"compute_mat3x2float.vkscript",
"compute_mat3x2.amber",
- # https://github.com/KhronosGroup/SPIRV-Tools/issues/3072
- "compute_robust_buffer_access_ssbo.amber",
# Metal vertex shaders cannot simultaneously write to a buffer and return
# a value to the rasterizer rdar://48348476
# https://github.com/KhronosGroup/MoltenVK/issues/527
@@ -47,14 +45,10 @@ SUPPRESSIONS = {
"draw_triangle_list_hlsl.amber",
],
"Linux": [
- # https://github.com/KhronosGroup/SPIRV-Tools/issues/3072
- "compute_robust_buffer_access_ssbo.amber",
# DXC not currently building on bot
"draw_triangle_list_hlsl.amber",
],
"Win": [
- # https://github.com/KhronosGroup/SPIRV-Tools/issues/3072
- "compute_robust_buffer_access_ssbo.amber",
# DXC not currently building on bot
"draw_triangle_list_hlsl.amber",
]
@@ -76,6 +70,8 @@ SUPPRESSIONS_SWIFTSHADER = [
# Color attachment format is not supported
"draw_triangle_list_in_r16g16b16a16_snorm_color_frame.vkscript",
"draw_triangle_list_in_r8g8b8a8_snorm_color_frame.vkscript",
+ # No supporting device for Float16Int8Features
+ "float16.amber",
# SEGV: github.com/google/amber/issues/726
"matrices_uniform_draw.amber",
# SEGV: github.com/google/amber/issues/725