yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
24ae85ba
main-tot
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_EXT_cooperative_matrix_maintenance1 : enable 6#extension GL_EXT_float_e5m2 : enable 7 8layout ( local_size_x = 64 , local_size_y = 1 , local_size_z = 1 ) in ; 9 10float16_t combine ( const in float16_t a , const in float16_t b ) { return a + b ; } 11f16vec2 vectorCombine ( const in f16vec2 a , const in f16vec2 b ) { return a + b ; } 12float16_t elem ( const in uint32_t row , const in uint32_t col , const in float16_t x ) { return x ; } 13float16_t badCoordElem ( const in uvec2 row , const in uint32_t col , const in float16_t x ) { return x ; } 14f16vec2 vectorElem ( const in uint32_t row , const in uint32_t col , const in f16vec2 x ) { return x ; } 15float16_t optionalElem ( const in uint32_t row , const in uint32_t col , const in float16_t x , 16const in float16_t y ) { return x + y ; } 17float16_t badMatrixOptionalElem ( const in uint32_t row , const in uint32_t col , const in float16_t x , 18const in f16vec2 y ) { return x + y . x ; } 19 20layout ( constant_id = 0 ) const int SpecRows = 16 ; 21layout ( constant_id = 1 ) const int SpecCols = 8 ; 22layout ( constant_id = 2 ) const int SpecScope = gl_ScopeWorkgroup ; 23const int SpecScopeAlias = SpecScope * 1 ; 24const int SpecRowResultRows = SpecRows * 1 ; 25const int SpecRowResultCols = SpecCols * 3 ; 26const int SpecColumnResultRows = SpecRows * 3 ; 27const int SpecColumnResultCols = SpecCols * 1 ; 28const int SpecTransposeRows = SpecCols * 1 ; 29const int SpecTransposeCols = SpecRows * 1 ; 30 31void main () 32{ 33coopmat < float16_t , gl_ScopeWorkgroup , 16 , 16 , gl_MatrixUseA > A ; 34coopmat < float16_t , gl_ScopeWorkgroup , 16 , 16 , gl_MatrixUseB > B ; 35coopmat < float16_t , gl_ScopeWorkgroup , 16 , 16 , gl_MatrixUseAccumulator > Acc ; 36 37coopMatTransposeEXT ( A , Acc ) ; // ok 38coopMatTransposeEXT ( B , Acc ) ; // ok 39coopMatTransposeEXT ( Acc , A ) ; // error 40coopMatTransposeEXT ( Acc , B ) ; // error 41 42coopmat < float16_t , gl_ScopeSubgroup , 16 , 16 , gl_MatrixUseAccumulator > AccSubgroup ; 43coopmat < float32_t , gl_ScopeWorkgroup , 16 , 16 , gl_MatrixUseAccumulator > AccFloat ; 44coopmat < float16_t , gl_ScopeWorkgroup , 8 , 8 , gl_MatrixUseAccumulator > Acc8x8 ; 45coopmat < float16_t , gl_ScopeWorkgroup , 8 , 16 , gl_MatrixUseAccumulator > Acc8x16 ; 46coopmat < float16_t , gl_ScopeWorkgroup , 16 , 8 , gl_MatrixUseAccumulator > Acc16x8 ; 47 48int dynamicMask = gl_CooperativeMatrixReduceRowEXT ; 49coopMatReduceEXT ( Acc , Acc , dynamicMask , combine ) ; // error: mask is not constant 50coopMatReduceEXT ( Acc , Acc , 5 , combine ) ; // error: invalid mask 51coopMatReduceEXT ( AccFloat , Acc , gl_CooperativeMatrixReduceRowEXT , combine ) ; // error: component type 52coopMatReduceEXT ( AccSubgroup , Acc , gl_CooperativeMatrixReduceRowEXT , combine ) ; // error: scope 53coopMatReduceEXT ( A , Acc , gl_CooperativeMatrixReduceRowEXT , combine ) ; // error: result Use 54coopMatReduceEXT ( Acc , A , gl_CooperativeMatrixReduceRowEXT , combine ) ; // error: input Use 55coopMatReduceEXT ( Acc , Acc , gl_CooperativeMatrixReduce2x2EXT , combine ) ; // error: 2x2 dimensions 56coopMatReduceEXT ( Acc8x16 , Acc , gl_CooperativeMatrixReduceRowEXT , combine ) ; // error: row count 57coopMatReduceEXT ( Acc16x8 , Acc , gl_CooperativeMatrixReduceColumnEXT , combine ) ; // error: column count 58coopMatReduceEXT ( Acc , Acc , gl_CooperativeMatrixReduceRowEXT , vectorCombine ) ; // error: callback types 59 60const int constantMask = gl_CooperativeMatrixReduceRowEXT ; 61coopMatReduceEXT ( Acc , Acc , constantMask , combine ) ; // ok 62coopMatReduceEXT ( Acc16x8 , Acc , gl_CooperativeMatrixReduceRowEXT , combine ) ; // ok 63coopMatReduceEXT ( Acc8x16 , Acc , gl_CooperativeMatrixReduceColumnEXT , combine ) ; // ok 64coopMatReduceEXT ( Acc8x8 , Acc , gl_CooperativeMatrixReduceRowAndColumnEXT , combine ) ; // ok 65 66coopmat < float16_t , SpecScope , SpecRows , SpecCols , gl_MatrixUseAccumulator > SpecAcc ; 67coopmat < float16_t , SpecScopeAlias , SpecRowResultRows , SpecRowResultCols , 68gl_MatrixUseAccumulator > SpecRowResult ; 69coopmat < float16_t , SpecScopeAlias , SpecColumnResultRows , SpecColumnResultCols , 70gl_MatrixUseAccumulator > SpecColumnResult ; 71coopmat < float16_t , SpecScopeAlias , SpecTransposeRows , SpecTransposeCols , 72gl_MatrixUseB > SpecTransposeResult ; 73coopMatReduceEXT ( SpecRowResult , SpecAcc , gl_CooperativeMatrixReduceRowEXT , combine ) ; // ok 74coopMatReduceEXT ( SpecColumnResult , SpecAcc , gl_CooperativeMatrixReduceColumnEXT , combine ) ; // ok 75coopMatTransposeEXT ( SpecTransposeResult , SpecAcc ) ; // ok 76 77coopMatPerElementEXT ( Acc8x8 , Acc , elem ) ; // error: result type 78coopMatPerElementEXT ( Acc , Acc , badCoordElem ) ; // error: coordinate type 79coopMatPerElementEXT ( Acc , Acc , vectorElem ) ; // error: component and return types 80coopMatPerElementEXT ( Acc , Acc , optionalElem , Acc8x8 ) ; // error: optional matrix type 81coopMatPerElementEXT ( Acc , Acc , optionalElem , f16vec2 ( 1.0 )) ; // error: optional value type 82coopMatPerElementEXT ( Acc , Acc , badMatrixOptionalElem , Acc ) ; // error: optional callback parameter type 83coopMatPerElementEXT ( Acc , Acc , optionalElem , Acc ) ; // ok 84 85coopmat < float16_t , gl_ScopeWorkgroup , 16 , 8 , gl_MatrixUseAccumulator > AccRect ; 86coopmat < float16_t , gl_ScopeWorkgroup , 16 , 8 , gl_MatrixUseB > BadTransposeShape ; 87coopmat < float16_t , gl_ScopeSubgroup , 8 , 16 , gl_MatrixUseB > BadTransposeScope ; 88coopMatTransposeEXT ( BadTransposeShape , AccRect ) ; // error: dimensions 89coopMatTransposeEXT ( BadTransposeScope , AccRect ) ; // error: scope 90}