File: spv.longVector.comp

package info (click to toggle)
glslang 16.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,720 kB
  • sloc: cpp: 92,305; yacc: 4,320; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (103 lines) | stat: -rw-r--r-- 2,407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#version 450 core
#extension GL_KHR_memory_scope_semantics : enable
#extension GL_EXT_long_vector : enable
#extension GL_EXT_shader_explicit_arithmetic_types : enable
#extension GL_EXT_buffer_reference : enable
#extension GL_EXT_nonuniform_qualifier : enable

layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;

layout(set = 0, binding = 0) buffer MatrixBuf {
    float16_t matrixData[];
} matrixBuf;

layout(set = 0, binding = 0) buffer MatrixBuf2 {
    int8_t matrixData[];
} matrixBuf2;

layout(constant_id = 0) const int matrixLayout = gl_CooperativeVectorMatrixLayoutColumnMajorNV;

void main()
{
    vector<float, 5> v = vector<float, 5>(0.0);

    vec3 x = vec3(1.0), y = vec3(2.0);
    vector<float, 5> v2 = vector<float, 5>(x, y);

    const vec3 x2 = vec3(1.0), y2 = vec3(2.0);
    vector<float, 5> v3 = vector<float, 5>(x2, y2);

    vec3 x3 = vec3(4, 5, 6), y3 = vec3(7, 8, 9);

    vector<float, 5> v4 = vector<float, 5>(x3.zyx, y3.zzy);

    vector<float16_t, 5> v5 = vector<float16_t, 5>(v4);

    vector<float, 5> v6;

    v6 = v + v2;
    v6 = v - v2;
    v6 = v * v2;
    v6 = v / v2;

    v6 += v;
    v6 -= v;
    v6 *= v;
    v6 /= v;

    float f;
    v6 *= f;
    v6 *= 5.0;

    int len = v6.length();

    v6[0] = f;
    v6[4] = 5.0;

    f += (v += v)[4];
    v6 = v;

    vector<float, 20> v7;
    vector<float16_t, 2> f162 = vector<float16_t, 2>(v7.length());

    float16_t f16;
    vector<float16_t, 1> f161 = vector<float16_t, 1>(f16);

    vector<float16_t, 7> v11, v12, v13;

    v11 = max(v11, v12);
    v11 = min(v11, v12);
    v11 = step(v11, v12);
    v11 = clamp(v11, v12, v13);
    v11 = exp(v11);
    v11 = log(v11);
    v11 = tanh(v11);
    v11 = atan(v11);
    v11 = fma(v11, v12, v13);

    f += (v += v)[len];

    v13 = vector<float16_t, 7>(v13);
    f16 = float16_t(v13);
    vector<float16_t, 2> vecA;
    vecA = exp(vecA * vector<float16_t, 2>(0.0625));

}

vector<float16_t, 1> foo(vector<float16_t, 1> x) { return x; }
vector<float16_t, 2> foo(vector<float16_t, 2> x) { return x; }

vec4 funcvec4(vec4 a) { return a; }
vector<float, 4> funcvector4(vector<float, 4> a) { return a; }

void testfuncs()
{
    vec4 a;
    vector<float, 4> b;
    a = b;
    b = a;
    funcvec4(b);
    funcvector4(a);
    vector<float16_t, 1> x;
    x = foo(x);
}