• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2# Copyright 2019 The Amber Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16INSTANCE_EXTENSION VK_KHR_get_physical_device_properties2
17DEVICE_EXTENSION VK_KHR_shader_float16_int8
18DEVICE_FEATURE Float16Int8Features.shaderFloat16
19
20SHADER compute f16 GLSL
21#version 450
22#extension GL_AMD_gpu_shader_half_float : enable
23
24layout(set=0, binding=0) buffer Buf {
25  float16_t h[3];
26} data;
27
28void main() {
29  int idx = int(gl_GlobalInvocationID.x);
30  data.h[idx] = data.h[idx] * 2.0hf;
31}
32END
33
34BUFFER buf DATA_TYPE float16 DATA
35-0.0
362.4
37-2.4
38END
39
40PIPELINE compute pipeline
41  ATTACH f16
42
43  BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
44END
45
46RUN pipeline 3 1 1
47
48EXPECT buf IDX 0 TOLERANCE 0.1 EQ 0.0
49EXPECT buf IDX 2 TOLERANCE 0.1 EQ 4.8
50EXPECT buf IDX 4 TOLERANCE 0.1 EQ -4.8
51