yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
3ceed991
vulkan-sdk-1.4.363.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#extension GL_NV_cooperative_matrix_decode_vector : enable 7#extension GL_EXT_buffer_reference : enable 8 9layout ( local_size_x = 64 , local_size_y = 1 , local_size_z = 1 ) in ; 10 11buffer BufType { 12float16_t x [] ; 13} Buf ; 14 15buffer BufType8 { 16uint8_t x [] ; 17} Buf8 ; 18 19layout ( buffer_reference , std430 , buffer_reference_align = 4 ) buffer dwordBuf { 20uint32_t d ; 21} ; 22 23float16_t decodeF16Scalar ( const in dwordBuf b , const in uint32_t blockCoords [ 2 ] , const in uint32_t coordInBlock [ 2 ]) 24{ 25return float16_t ( b . d ) ; 26} 27 28f16vec2 decodeF16x2 ( const in dwordBuf b , const in uint32_t blockCoords [ 2 ] , const in uint32_t coordInBlock [ 2 ]) 29{ 30return unpackFloat2x16 ( b . d ) ; 31} 32 33uint8_t decodeU8Scalar ( const in dwordBuf b , const in uint32_t blockCoords [ 2 ] , const in uint32_t coordInBlock [ 2 ]) 34{ 35return uint8_t ( b . d ) ; 36} 37 38u8vec4 decodeU8x4 ( const in dwordBuf b , const in uint32_t blockCoords [ 2 ] , const in uint32_t coordInBlock [ 2 ]) 39{ 40return u8vec4 ( uint8_t ( b . d ) , uint8_t ( b . d >> 8 ) , uint8_t ( b . d >> 16 ) , uint8_t ( b . d >> 24 )) ; 41} 42 43float16_t decodeF16Scalar3d ( const in dwordBuf b , const in uint32_t blockCoords [ 3 ] , const in uint32_t coordInBlock [ 3 ]) 44{ 45return float16_t ( b . d ) ; 46} 47 48f16vec2 decodeF16x2_3d ( const in dwordBuf b , const in uint32_t blockCoords [ 3 ] , const in uint32_t coordInBlock [ 3 ]) 49{ 50return unpackFloat2x16 ( b . d ) ; 51} 52 53void main () 54{ 55coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseB > B ; 56coopmat < uint8_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseB > Bu8 ; 57coopmat < float16_t , gl_ScopeWorkgroup , 64 , 32 , gl_MatrixUseAccumulator > Acc ; 58 59tensorLayoutNV < 2 > t = createTensorLayoutNV ( 2 ) ; 60 61// No restrictions on Use or TensorView with v2: every combination is a 62// valid load and the implementation chooses per call site whether to 63// invoke the vector function. Below: gl_MatrixUseB without a view, with 64// a transposing view, and with an identity view; gl_MatrixUseAccumulator; 65// and a 3D layout/view variant. 66 67// gl_MatrixUseB, no view. 68coopMatLoadTensorNV ( B , Buf . x , 0 , t , decodeF16Scalar , decodeF16x2 ) ; 69 70// gl_MatrixUseB, transposing view (swap of innermost two). 71tensorViewNV < 2 , false , 1 , 0 > vT2 = createTensorViewNV ( 2 , false , 1 , 0 ) ; 72coopMatLoadTensorNV ( B , Buf . x , 0 , t , vT2 , decodeF16Scalar , decodeF16x2 ) ; 73coopMatLoadTensorNV ( Bu8 , Buf8 . x , 0 , t , vT2 , decodeU8Scalar , decodeU8x4 ) ; 74 75// gl_MatrixUseB, identity view -- previously rejected, now accepted. 76tensorViewNV < 2 , false , 0 , 1 > vI2 = createTensorViewNV ( 2 , false , 0 , 1 ) ; 77coopMatLoadTensorNV ( B , Buf . x , 0 , t , vI2 , decodeF16Scalar , decodeF16x2 ) ; 78 79// gl_MatrixUseAccumulator -- previously rejected for vector decode, now 80// accepted. 81coopMatLoadTensorNV ( Acc , Buf . x , 0 , t , decodeF16Scalar , decodeF16x2 ) ; 82 83// 3D layout + identity-outer/swap-innermost view (still a valid shape). 84tensorLayoutNV < 3 > t3 = createTensorLayoutNV ( 3 ) ; 85tensorViewNV < 3 , false , 0 , 2 , 1 > vT3 = createTensorViewNV ( 3 , false , 0 , 2 , 1 ) ; 86coopMatLoadTensorNV ( B , Buf . x , 0 , t3 , vT3 , decodeF16Scalar3d , decodeF16x2_3d ) ; 87 88// 3D layout + arbitrary-permutation view -- previously rejected, now 89// accepted (the implementation simply will not invoke the vector 90// function at sites where it would not be profitable). 91tensorViewNV < 3 , false , 1 , 2 , 0 > vW3 = createTensorViewNV ( 3 , false , 1 , 2 , 0 ) ; 92coopMatLoadTensorNV ( B , Buf . x , 0 , t3 , vW3 , decodeF16Scalar3d , decodeF16x2_3d ) ; 93}