#version 450 core #extension GL_KHR_memory_scope_semantics : enable #extension GL_KHR_cooperative_matrix : enable #extension GL_EXT_shader_explicit_arithmetic_types : enable #extension GL_EXT_buffer_reference : enable layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; const int X = 8; layout(constant_id = 0) const int Y = 2; const int Z = X*Y; coopmat mC; coopmat mC2[3]; layout(constant_id = 1) const float F = 3.0; const coopmat mD = coopmat(0.0); const coopmat mD2 = coopmat(1); struct S { int a; int b; int c; }; const S s = S(12, 23, 34); layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { float y[1024*1024]; float x[]; } block; layout(set = 0, binding = 0) coherent buffer Block16 { float16_t y[1024*1024]; float16_t x[]; Block b; } block16; coopmat f16(coopmat m) { return -m; } coopmat f32(coopmat m) { return -m; } layout(constant_id = 2) const int SC = 1; coopmat scm[SC][SC]; // sized for coopmat shared uvec4 shmatrix[16*16*2/16]; void main() { coopmat1?8:4), gl_MatrixUseAccumulator> m = coopmat1?8:4), gl_MatrixUseAccumulator>(0.0); m = m + m; m = m - m; m = -m; m = 2.0*m; m = m*2.0; coopmat m2 = coopmat(m); float x = m[1]; m[0] = x; coopMatLoad(m, block.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(m, block.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatLoad(m2, block16.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(m2, block16.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatLoad(m, block16.b.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(m, block16.b.x, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopmat A; coopmat B; coopmat C; coopmat D; D = coopMatMulAdd(A, B, C); int l = D.length(); coopmat E; coopmat F = coopmat(0.0); coopmat1?8:4), gl_MatrixUseAccumulator> a[5]; a[3][0] = 1.0; float md1 = mD[1]; md1 += (m += m)[1234]; mC2[1] = mC2[2]; coopMatLoad(m, block.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(m, block.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatLoad(m2, block16.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(m2, block16.y, 16, 128, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopmat p1; coopmat p2; p1 = f16(p1); p2 = f32(p2); p1 = coopmat(0.0); p2 = coopmat(0.0); p1 /= p1; p1 *= float16_t(2.0); p2 *= 4.0; coopmat ms; coopMatLoad(ms, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopMatStore(ms, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); coopmat ms8A; coopmat ms8B; coopmat ms8C; coopMatMulAdd(ms8A, ms8B, ms8C); coopMatMulAdd(ms8A, ms8B, ms8C, 0); coopMatMulAdd(ms8A, ms8B, ms8C, gl_MatrixOperandsSaturatingAccumulation); coopmat m16; coopMatStore(m16, shmatrix, 1, 2, gl_CooperativeMatrixLayoutRowBlockedInterleavedARM); }