1#version 450 core
2#extension GL_KHR_memory_scope_semantics : enable
3#extension GL_NV_cooperative_matrix : enable
4#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
5
6layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
7
8float<16> ftemplate16;
9
10fcoopmatNV fnoparams;
11
12fcoopmatNV<8, gl_ScopeSubgroup, 8, 8> fbadbits;
13
14fcoopmatNV<16, gl_ScopeSubgroup, 8> fbadnumparams;
15
16int X = 8;
17
18fcoopmatNV<16, gl_ScopeSubgroup, 8, X> fbadparam;
19
20layout(constant_id = 0) int Y = 1;
21
22shared fcoopmatNV<16, gl_ScopeSubgroup, 16, 16> sharedmat;
23
24layout(set = 0, binding = 0) buffer InvBlock {
25    fcoopmatNV<16, gl_ScopeSubgroup, 16, 16> bufmat;
26} invblock;
27
28void main()
29{
30    fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> f32_16_8;
31    fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> f16_16_8;
32
33    // invalid implicit conversions
34    f32_16_8 = f16_16_8;
35    f32_16_8 = f16_16_8 + f16_16_8;
36
37    fcoopmatNV<16, gl_ScopeSubgroup, 8, 8> f16_8_8;
38
39    // mismatching dimensions
40    f16_16_8 = f16_8_8;
41
42    fcoopmatNV<16, gl_ScopeSubgroup, 8, Y> f16_8_Y;
43    fcoopmatNV<16, gl_ScopeSubgroup, 8, (Y+1)> f16_8_Y1;
44
45    // mismatching dimensions with specialization constants
46    f16_8_Y = f16_8_Y1;
47
48    // wrong arguments for constructor
49    f16_8_8 = fcoopmatNV<16, gl_ScopeSubgroup, 8, 8>(1, 1);
50
51    // can't construct from a builtin type
52    mat4 m4;
53    fcoopmatNV<32, gl_ScopeSubgroup, 4, 4> f32_4_4 = fcoopmatNV<32, gl_ScopeSubgroup, 4, 4>(m4);
54
55    // only support a single array subscript
56    f16_16_8[0][0];
57
58    // don't support scalar component selection
59    f16_16_8.x;
60
61    f16_16_8 * f16_16_8;
62
63    f16_16_8 + 1.0;
64    f16_16_8 - 1.0;
65    f16_16_8 / 1.0;
66    f16_16_8 += 1.0;
67    f16_16_8 -= 1.0;
68    f16_16_8 /= 1.0;
69
70    f16_16_8*2.0;
71    2.0*f16_16_8;
72    f32_16_8*float16_t(2.0);
73    float16_t(2.0)*f32_16_8;
74
75    transpose(f16_8_8);
76}
77