yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
3ceed991
main
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 { 12 float16_t x[]; 13} Buf; 14 15layout(buffer_reference, std430, buffer_reference_align = 4) buffer dwordBuf { 16 uint32_t d; 17}; 18 19float16_t decodeF16Scalar(const in dwordBuf b, const in uint32_t blockCoords[2], const in uint32_t coordInBlock[2]) 20{ 21 return float16_t(b.d); 22} 23 24f16vec2 decodeF16x2(const in dwordBuf b, const in uint32_t blockCoords[2], const in uint32_t coordInBlock[2]) 25{ 26 return unpackFloat2x16(b.d); 27} 28 29// Vector return with V == 3, not in {2, 4, 8}. 30f16vec3 decodeF16x3_badLength(const in dwordBuf b, const in uint32_t blockCoords[2], const in uint32_t coordInBlock[2]) 31{ 32 return f16vec3(0); 33} 34 35// Vector return whose component type doesn't match the matrix type. 36vec2 decodeF32x2_badType(const in dwordBuf b, const in uint32_t blockCoords[2], const in uint32_t coordInBlock[2]) 37{ 38 return vec2(0); 39} 40 41void main() 42{ 43 coopmat<float16_t, gl_ScopeWorkgroup, 64, 32, gl_MatrixUseA> A; 44 45 tensorLayoutNV<2> t = createTensorLayoutNV(2); 46 47 // Single-arg form must be scalar; a vector return is only legal in 48 // the second function position now. 49 coopMatLoadTensorNV(A, Buf.x, 0, t, decodeF16x2); 50 51 // V == 3, not in {2, 4, 8}. 52 coopMatLoadTensorNV(A, Buf.x, 0, t, decodeF16Scalar, decodeF16x3_badLength); 53 54 // Vector component type doesn't match the matrix component type. 55 coopMatLoadTensorNV(A, Buf.x, 0, t, decodeF16Scalar, decodeF32x2_badType); 56}