yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
f3a7f2c2
main
1#version 450 core 2#pragma use_vulkan_memory_model 3#extension GL_KHR_shader_subgroup_basic : enable 4#extension GL_EXT_scalar_block_layout : enable 5#extension GL_KHR_memory_scope_semantics : enable 6#extension GL_KHR_cooperative_matrix : enable 7#extension GL_EXT_buffer_reference : enable 8#extension GL_EXT_control_flow_attributes : enable 9#extension GL_KHR_shader_subgroup_basic : enable 10 11#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable 12#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable 13#extension GL_EXT_shader_explicit_arithmetic_types_int32 : enable 14#extension GL_EXT_shader_explicit_arithmetic_types_int8 : enable 15#extension GL_QCOM_cooperative_matrix_conversion : enable 16 17layout ( constant_id = 3 ) const uint TILE_M = 1 ; 18layout ( constant_id = 4 ) const uint TILE_N = 1 ; 19layout ( constant_id = 5 ) const uint TILE_N2 = 2 ; 20layout ( constant_id = 6 ) const uint TILE_N4 = 4 ; 21layout ( constant_id = 7 ) const uint TILE_K = 1 ; 22layout ( constant_id = 8 ) const uint TILE_K2 = 2 ; 23layout ( constant_id = 9 ) const uint TILE_K4 = 4 ; 24 25layout ( set = 0 , binding = 0 ) readonly buffer InputA { float x [] ; } inputA ; 26layout ( set = 0 , binding = 1 ) readonly buffer InputB { float x [] ; } inputB ; 27layout ( set = 0 , binding = 2 ) readonly buffer InputC { float x [] ; } inputC ; 28layout ( set = 0 , binding = 3 ) buffer Output { float x [] ; } outputO ; 29 30layout ( local_size_x = 64 , local_size_y = 2 , local_size_z = 2 ) in ; 31 32void main () 33{ 34uint32_t uvec8 [ 8 ] ; 35float vec8 [ 8 ] ; 36uint uvec64Acc [ 64 ] ; 37 38{ 39uint32_t uvecSC [ TILE_K ] ; 40float f32vecSC [ TILE_K ] ; 41bitcastQCOM ( uvec8 , f32vecSC ) ; 42bitcastQCOM ( uvecSC , vec8 ) ; 43bitcastQCOM ( uvecSC , f32vecSC ) ; 44 45uint32_t uvecSC2 [ TILE_K / 2 ] ; 46float f32vecSC2 [ TILE_K / 2 ] ; 47bitcastQCOM ( uvecSC2 , f32vecSC2 ) ; 48} 49 50// extractSubArrayQCOM 51{ 52uint32_t uvecSC [ TILE_K ] ; 53uint32_t uvec64AccSC [ TILE_N ] ; 54extractSubArrayQCOM ( uvec64Acc , 0 , uvecSC ) ; 55extractSubArrayQCOM ( uvec64AccSC , 4 , uvec8 ) ; 56extractSubArrayQCOM ( uvec64AccSC , 8 , uvecSC ) ; 57 58uint32_t uvecSC2 [ TILE_K / 2 ] ; 59uint32_t uvec64AccSC2 [ TILE_N / 2 ] ; 60extractSubArrayQCOM ( uvec64Acc , 2 , uvecSC2 ) ; 61extractSubArrayQCOM ( uvec64AccSC2 , 2 , uvec8 ) ; 62} 63 64// vectorToCoopmatQCOM gl_MatrixUseA 65{ 66coopmat < float , gl_ScopeSubgroup , TILE_M , 8 , gl_MatrixUseA > V2C_matA_f32_SC_M8 ; 67vectorToCoopmatQCOM ( uvec8 , V2C_matA_f32_SC_M8 ) ; 68 69uint32_t uvecSC_K11 [ TILE_K ] ; 70uint32_t uvecSC_K12 [ TILE_K2 ] ; 71coopmat < float , gl_ScopeSubgroup , TILE_M , TILE_K , gl_MatrixUseA > V2C_matA_f32_SC_MK ; 72coopmat < float , gl_ScopeSubgroup , 64 , TILE_K , gl_MatrixUseA > V2C_matA_f32_SC_64K ; 73coopmat < float , gl_ScopeSubgroup , 64 , 8 , gl_MatrixUseA > V2C_matA_f32_SC_64_8 ; 74vectorToCoopmatQCOM ( uvecSC_K11 , V2C_matA_f32_SC_MK ) ; 75vectorToCoopmatQCOM ( uvecSC_K12 , V2C_matA_f32_SC_64_8 ) ; 76 77coopmat < float16_t , gl_ScopeSubgroup , TILE_M , TILE_K2 , gl_MatrixUseA > V2C_matA_f16_SC_MK ; 78coopmat < int8_t , gl_ScopeSubgroup , 64 , TILE_K4 , gl_MatrixUseA > V2C_matA_i8_SC_64K ; 79coopmat < uint8_t , gl_ScopeSubgroup , 64 , TILE_K4 , gl_MatrixUseA > V2C_matA_u8_SC_64K ; 80 81vectorToCoopmatQCOM ( uvecSC_K11 , V2C_matA_f16_SC_MK ) ; 82vectorToCoopmatQCOM ( uvecSC_K11 , V2C_matA_i8_SC_64K ) ; 83vectorToCoopmatQCOM ( uvecSC_K11 , V2C_matA_u8_SC_64K ) ; 84} 85 86// vectorToCoopmatQCOM gl_MatrixUseB 87{ 88coopmat < float , gl_ScopeSubgroup , 8 , TILE_N , gl_MatrixUseB > V2C_matB_f32_SC_8N ; 89vectorToCoopmatQCOM ( uvec8 , V2C_matB_f32_SC_8N ) ; 90 91uint32_t uvecSC_K21 [ TILE_K ] ; 92uint32_t uvecSC_K22 [ TILE_K2 ] ; 93coopmat < float , gl_ScopeSubgroup , TILE_K , TILE_N , gl_MatrixUseB > V2C_matB_f32_SC_KN ; 94coopmat < float , gl_ScopeSubgroup , TILE_K , 64 , gl_MatrixUseB > V2C_matB_f32_SC_K64 ; 95coopmat < float , gl_ScopeSubgroup , 8 , 64 , gl_MatrixUseB > V2C_matB_f32_SC_8_64 ; 96vectorToCoopmatQCOM ( uvecSC_K21 , V2C_matB_f32_SC_KN ) ; 97vectorToCoopmatQCOM ( uvecSC_K22 , V2C_matB_f32_SC_8_64 ) ; 98 99coopmat < float16_t , gl_ScopeSubgroup , TILE_K2 , TILE_N , gl_MatrixUseB > V2C_matB_f16_SC_KN ; 100coopmat < int8_t , gl_ScopeSubgroup , TILE_K4 , 64 , gl_MatrixUseB > V2C_matB_i8_SC_K64 ; 101coopmat < uint8_t , gl_ScopeSubgroup , TILE_K4 , 64 , gl_MatrixUseB > V2C_matB_u8_SC_K64 ; 102coopmat < float , gl_ScopeSubgroup , TILE_K , 32 , gl_MatrixUseB > V2C_matB_f32_SC_K32 ; 103coopmat < float , gl_ScopeSubgroup , TILE_K , 16 , gl_MatrixUseB > V2C_matB_f32_SC_K16 ; 104 105vectorToCoopmatQCOM ( uvecSC_K21 , V2C_matB_f16_SC_KN ) ; 106vectorToCoopmatQCOM ( uvecSC_K21 , V2C_matB_i8_SC_K64 ) ; 107vectorToCoopmatQCOM ( uvecSC_K21 , V2C_matB_u8_SC_K64 ) ; 108vectorToCoopmatQCOM ( uvecSC_K21 , V2C_matB_f32_SC_K32 ) ; 109vectorToCoopmatQCOM ( uvecSC_K21 , V2C_matB_f32_SC_K16 ) ; 110} 111 112// vectorToCoopmatQCOM gl_MatrixUseAccumulator 113{ 114uint32_t uvecSC_N31 [ TILE_N ] ; 115uint32_t uvecSC_N32 [ TILE_N2 ] ; 116 117coopmat < float , gl_ScopeSubgroup , TILE_M , TILE_N , gl_MatrixUseAccumulator > V2C_matAcc_f32_SC_MN ; 118coopmat < float , gl_ScopeSubgroup , 64 , TILE_N , gl_MatrixUseAccumulator > V2C_matAcc_f32_SC_64N ; 119coopmat < float , gl_ScopeSubgroup , 64 , 64 , gl_MatrixUseAccumulator > V2C_matAcc_f32_SC_64_64 ; 120vectorToCoopmatQCOM ( uvecSC_N31 , V2C_matAcc_f32_SC_MN ) ; 121vectorToCoopmatQCOM ( uvecSC_N32 , V2C_matAcc_f32_SC_64_64 ) ; 122 123coopmat < float16_t , gl_ScopeSubgroup , TILE_M , TILE_N2 , gl_MatrixUseAccumulator > V2C_matAcc_f16_SC_MN ; 124coopmat < int32_t , gl_ScopeSubgroup , 64 , TILE_N4 , gl_MatrixUseAccumulator > V2C_matAcc_i32_SC_64N ; 125coopmat < uint32_t , gl_ScopeSubgroup , 64 , TILE_N4 , gl_MatrixUseAccumulator > V2C_matAcc_u32_SC_64N ; 126 127vectorToCoopmatQCOM ( uvecSC_N31 , V2C_matAcc_f16_SC_MN ) ; 128vectorToCoopmatQCOM ( uvecSC_N31 , V2C_matAcc_i32_SC_64N ) ; 129vectorToCoopmatQCOM ( uvecSC_N31 , V2C_matAcc_u32_SC_64N ) ; 130} 131 132// coopmatToVectorQCOM gl_MatrixUseA 133{ 134coopmat < float , gl_ScopeSubgroup , TILE_M , 8 , gl_MatrixUseA > C2V_matA_f32_SC_M8 ; 135coopmatToVectorQCOM ( C2V_matA_f32_SC_M8 , uvec8 ) ; 136 137uint32_t uvecSC_K11 [ TILE_K ] ; 138uint32_t uvecSC_K12 [ TILE_K2 ] ; 139coopmat < float , gl_ScopeSubgroup , TILE_M , TILE_K , gl_MatrixUseA > C2V_matA_f32_SC_MK ; 140coopmat < float , gl_ScopeSubgroup , 64 , TILE_K , gl_MatrixUseA > C2V_matA_f32_SC_64K ; 141coopmat < float , gl_ScopeSubgroup , 64 , 8 , gl_MatrixUseA > C2V_matA_f32_SC_64_8 ; 142coopmatToVectorQCOM ( C2V_matA_f32_SC_MK , uvecSC_K11 ) ; 143coopmatToVectorQCOM ( C2V_matA_f32_SC_64_8 , uvecSC_K12 ) ; 144 145coopmat < float16_t , gl_ScopeSubgroup , TILE_M , TILE_K2 , gl_MatrixUseA > C2V_matA_f16_SC_MK ; 146coopmat < int8_t , gl_ScopeSubgroup , 64 , TILE_K4 , gl_MatrixUseA > C2V_matA_i8_SC_64K ; 147coopmat < uint8_t , gl_ScopeSubgroup , 64 , TILE_K4 , gl_MatrixUseA > C2V_matA_u8_SC_64K ; 148 149coopmatToVectorQCOM ( C2V_matA_f16_SC_MK , uvecSC_K11 ) ; 150coopmatToVectorQCOM ( C2V_matA_i8_SC_64K , uvecSC_K11 ) ; 151coopmatToVectorQCOM ( C2V_matA_u8_SC_64K , uvecSC_K11 ) ; 152} 153 154// coopmatToVectorQCOM gl_MatrixUseB 155{ 156coopmat < float , gl_ScopeSubgroup , 8 , TILE_N , gl_MatrixUseB > C2V_matB_f32_SC_8N ; 157coopmatToVectorQCOM ( C2V_matB_f32_SC_8N , uvec8 ) ; 158 159uint32_t uvecSC_K21 [ TILE_K ] ; 160uint32_t uvecSC_K22 [ TILE_K2 ] ; 161coopmat < float , gl_ScopeSubgroup , TILE_K , TILE_N , gl_MatrixUseB > C2V_matB_f32_SC_KN ; 162coopmat < float , gl_ScopeSubgroup , TILE_K , 64 , gl_MatrixUseB > C2V_matB_f32_SC_K64 ; 163coopmat < float , gl_ScopeSubgroup , 8 , 64 , gl_MatrixUseB > C2V_matB_f32_SC_8_64 ; 164coopmatToVectorQCOM ( C2V_matB_f32_SC_KN , uvecSC_K21 ) ; 165coopmatToVectorQCOM ( C2V_matB_f32_SC_8_64 , uvecSC_K22 ) ; 166 167coopmat < float16_t , gl_ScopeSubgroup , TILE_K2 , TILE_N , gl_MatrixUseB > C2V_matB_f16_SC_KN ; 168coopmat < int8_t , gl_ScopeSubgroup , TILE_K4 , 64 , gl_MatrixUseB > C2V_matB_i8_SC_K64 ; 169coopmat < uint8_t , gl_ScopeSubgroup , TILE_K4 , 64 , gl_MatrixUseB > C2V_matB_u8_SC_K64 ; 170coopmat < float , gl_ScopeSubgroup , TILE_K , 32 , gl_MatrixUseB > C2V_matB_f32_SC_K32 ; 171coopmat < float , gl_ScopeSubgroup , TILE_K , 16 , gl_MatrixUseB > C2V_matB_f32_SC_K16 ; 172 173coopmatToVectorQCOM ( C2V_matB_f16_SC_KN , uvecSC_K21 ) ; 174coopmatToVectorQCOM ( C2V_matB_i8_SC_K64 , uvecSC_K21 ) ; 175coopmatToVectorQCOM ( C2V_matB_u8_SC_K64 , uvecSC_K21 ) ; 176coopmatToVectorQCOM ( C2V_matB_f32_SC_K32 , uvecSC_K21 ) ; 177coopmatToVectorQCOM ( C2V_matB_f32_SC_K16 , uvecSC_K21 ) ; 178} 179 180// coopmatToVectorQCOM gl_MatrixUseAccumulator 181{ 182uint32_t uvecSC_N31 [ TILE_N ] ; 183uint32_t uvecSC_N32 [ TILE_N2 ] ; 184 185coopmat < float , gl_ScopeSubgroup , TILE_M , TILE_N , gl_MatrixUseAccumulator > C2V_matAcc_f32_SC_MN ; 186coopmat < float , gl_ScopeSubgroup , 64 , TILE_N , gl_MatrixUseAccumulator > C2V_matAcc_f32_SC_64N ; 187coopmat < float , gl_ScopeSubgroup , 64 , 64 , gl_MatrixUseAccumulator > C2V_matAcc_f32_SC_64_64 ; 188coopmatToVectorQCOM ( C2V_matAcc_f32_SC_MN , uvecSC_N31 ) ; 189coopmatToVectorQCOM ( C2V_matAcc_f32_SC_64N , uvecSC_N31 ) ; 190coopmatToVectorQCOM ( C2V_matAcc_f32_SC_64_64 , uvecSC_N32 ) ; 191 192coopmat < float16_t , gl_ScopeSubgroup , TILE_M , TILE_N2 , gl_MatrixUseAccumulator > C2V_matAcc_f16_SC_MN ; 193coopmat < int32_t , gl_ScopeSubgroup , 64 , TILE_N4 , gl_MatrixUseAccumulator > C2V_matAcc_i32_SC_64N ; 194coopmat < uint32_t , gl_ScopeSubgroup , 64 , TILE_N4 , gl_MatrixUseAccumulator > C2V_matAcc_u32_SC_64N ; 195 196coopmatToVectorQCOM ( C2V_matAcc_f16_SC_MN , uvecSC_N31 ) ; 197coopmatToVectorQCOM ( C2V_matAcc_i32_SC_64N , uvecSC_N31 ) ; 198coopmatToVectorQCOM ( C2V_matAcc_u32_SC_64N , uvecSC_N31 ) ; 199} 200}