yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
d0e67c58
16.6.0
1#version 450 core 2#extension GL_KHR_memory_scope_semantics : enable 3#extension GL_KHR_cooperative_matrix : enable 4#extension GL_EXT_shader_explicit_arithmetic_types : enable 5#extension GL_NV_cooperative_matrix2 : enable 6 7layout ( local_size_x = 64 , local_size_y = 1 , local_size_z = 1 ) in ; 8 9buffer BufType { 10float16_t x [] ; 11} Buf ; 12 13uint32_t addr ( const in uint32_t x , const in uint32_t y ) { 14return y * 64 + x ; 15} 16 17uint32_t foo () { return 124 ; } 18 19float16_t relu ( const in uint32_t row , const in uint32_t col , const in float16_t x ) { return max ( x , float16_t ( 0 )) ; } 20 21float16_t add ( const in uint32_t row , const in uint32_t col , const in float16_t x , const in float16_t y ) { return x + y ; } 22 23float16_t combineSum ( const in float16_t a , const in float16_t b ) { return a + b ; } 24float16_t combineMax ( const in float16_t a , const in float16_t b ) { return max ( a , b ) ; } 25 26layout ( constant_id = 0 ) const uint32_t Dim = 32 ; 27 28void main () 29{ 30coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > A ; 31coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseB > B ; 32coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseAccumulator > Acc ; 33 34A = coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Acc ) ; 35B = coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseB > ( Acc ) ; 36 37coopmat < float16_t , gl_ScopeWorkgroup , 32 , 64 , gl_MatrixUseB > tr ; 38 39coopMatTransposeNV ( tr , Acc ) ; 40 41coopMatReduceNV ( Acc , Acc , gl_CooperativeMatrixReduceRowNV , combineSum ) ; 42coopMatReduceNV ( Acc , Acc , gl_CooperativeMatrixReduceColumnNV , combineSum ) ; 43coopMatReduceNV ( Acc , Acc , gl_CooperativeMatrixReduceRowAndColumnNV , combineSum ) ; 44 45coopmat < float16_t , gl_ScopeWorkgroup , 32 , 16 , gl_MatrixUseAccumulator > Acc2x2 ; 46coopMatReduceNV ( Acc2x2 , Acc , gl_CooperativeMatrixReduce2x2NV , combineMax ) ; 47 48//coopMatLoadTensorNV(A, Buf.x, foo(), addr); 49//coopMatStoreTensorNV(A, Buf.x, foo(), addr); 50 51coopMatPerElementNV ( Acc , Acc , relu ) ; 52coopMatPerElementNV ( Acc , Acc , add , float16_t ( 1.0 )) ; 53 54coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseAccumulator > Accf16 ; 55coopmat < float32_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseAccumulator > Accf32 ; 56coopmat < uint32_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseAccumulator > Accu32 ; 57coopmat < int32_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseAccumulator > Accs32 ; 58 59coopmat < uint8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accu32 ) ; 60coopmat < int8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accu32 ) ; 61coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accu32 ) ; 62 63coopmat < uint8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accs32 ) ; 64coopmat < int8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accs32 ) ; 65coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accs32 ) ; 66 67coopmat < uint8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accf16 ) ; 68coopmat < int8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accf16 ) ; 69coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accf16 ) ; 70 71coopmat < uint8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accf32 ) ; 72coopmat < int8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accf32 ) ; 73coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseA > ( Accf32 ) ; 74 75coopmat < float , gl_ScopeWorkgroup , Dim , Dim , gl_MatrixUseAccumulator > li , mijm1 ; 76mijm1 = coopmat < float , gl_ScopeWorkgroup , Dim , Dim , gl_MatrixUseAccumulator > ( - 1.0 / 0.0 ) ; 77}