#version 460
#if defined(GL_AMD_gpu_shader_half_float)
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16)
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
#else
#error No extension available for FP16.
#endif
#extension GL_EXT_shader_16bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require
#extension GL_EXT_shader_8bit_storage : require
#extension GL_KHR_cooperative_matrix : require
#extension GL_KHR_memory_scope_semantics : require
layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;

layout(set = 0, binding = 0, std430) restrict readonly buffer SSBO
{
    uint8_t _m0[];
} _21;

layout(set = 0, binding = 0, std430) writeonly buffer _23_25
{
    uint8_t _m0[];
} _25;

void main()
{
    coopmat<float16_t, gl_ScopeSubgroup, 16u, 16u, gl_MatrixUseA> _30;
    coopMatLoad(_30, _21._m0, 0u, 32u, gl_CooperativeMatrixLayoutRowMajor);
    coopmat<float16_t, gl_ScopeSubgroup, 16u, 16u, gl_MatrixUseB> _33;
    coopMatLoad(_33, _21._m0, 512u, 32u, gl_CooperativeMatrixLayoutRowMajor);
    coopmat<float, gl_ScopeSubgroup, 16u, 16u, gl_MatrixUseAccumulator> _37;
    coopMatLoad(_37, _21._m0, 1024u, 64u, gl_CooperativeMatrixLayoutColumnMajor);
    coopMatStore(coopmat<float16_t, gl_ScopeSubgroup, 16u, 16u, gl_MatrixUseAccumulator>(coopMatMulAdd(_30, _33, _37, 0)), _25._m0, 0u, 32u, gl_CooperativeMatrixLayoutRowMajor);
}


#if 0
// SPIR-V disassembly
// WaveSize(32)
; SPIR-V
; Version: 1.6
; Generator: Unknown(30017); 21022
; Bound: 43
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability Int8
OpCapability StorageBuffer8BitAccess
OpCapability DenormPreserve
OpCapability VulkanMemoryModel
OpCapability CooperativeMatrixKHR
OpExtension "SPV_KHR_8bit_storage"
OpExtension "SPV_KHR_cooperative_matrix"
OpExtension "SPV_KHR_float_controls"
OpMemoryModel Logical Vulkan
OpEntryPoint GLCompute %15 "main" %21 %25
OpExecutionMode %15 LocalSize 32 1 1
OpExecutionMode %15 DenormPreserve 16
OpName %15 "main"
OpName %19 "SSBO"
OpName %23 "SSBO"
OpDecorate %18 ArrayStride 1
OpMemberDecorate %19 0 Offset 0
OpDecorate %19 Block
OpDecorate %21 DescriptorSet 0
OpDecorate %21 Binding 0
OpDecorate %21 NonWritable
OpDecorate %21 Restrict
OpDecorate %22 ArrayStride 1
OpMemberDecorate %23 0 Offset 0
OpDecorate %23 Block
OpDecorate %25 DescriptorSet 0
OpDecorate %25 Binding 0
OpDecorate %25 NonReadable
%1 = OpTypeFloat 16
%2 = OpTypeInt 32 0
%3 = OpConstant %2 0
%4 = OpConstant %2 16
%6 = OpConstant %2 3
%5 = OpTypeCooperativeMatrixKHR %1 %6 %4 %4 %3
%7 = OpConstant %2 1
%8 = OpTypeCooperativeMatrixKHR %1 %6 %4 %4 %7
%9 = OpTypeFloat 32
%10 = OpConstant %2 2
%11 = OpTypeCooperativeMatrixKHR %9 %6 %4 %4 %10
%12 = OpTypeCooperativeMatrixKHR %1 %6 %4 %4 %10
%13 = OpTypeVoid
%14 = OpTypeFunction %13
%17 = OpTypeInt 8 0
%18 = OpTypeRuntimeArray %17
%19 = OpTypeStruct %18
%20 = OpTypePointer StorageBuffer %19
%21 = OpVariable %20 StorageBuffer
%22 = OpTypeRuntimeArray %17
%23 = OpTypeStruct %22
%24 = OpTypePointer StorageBuffer %23
%25 = OpVariable %24 StorageBuffer
%27 = OpTypePointer StorageBuffer %17
%29 = OpConstant %2 32
%32 = OpConstant %2 512
%35 = OpConstant %2 1024
%36 = OpConstant %2 64
%15 = OpFunction %13 None %14
%16 = OpLabel
OpBranch %41
%41 = OpLabel
%28 = OpAccessChain %27 %21 %3 %3
%30 = OpCooperativeMatrixLoadKHR %5 %28 %3 %29 NonPrivatePointer
%31 = OpAccessChain %27 %21 %3 %32
%33 = OpCooperativeMatrixLoadKHR %8 %31 %3 %29 NonPrivatePointer
%34 = OpAccessChain %27 %21 %3 %35
%37 = OpCooperativeMatrixLoadKHR %11 %34 %7 %36 NonPrivatePointer
%38 = OpCooperativeMatrixMulAddKHR %11 %30 %33 %37
%39 = OpFConvert %12 %38
%40 = OpAccessChain %27 %25 %3 %3
OpCooperativeMatrixStoreKHR %40 %39 %3 %29 NonPrivatePointer
OpReturn
OpFunctionEnd
#endif
