yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
5ed4003a
16.5.0
1#version 460 core 2 3#extension GL_ARM_tensors : enable 4#extension GL_EXT_shader_explicit_arithmetic_types : enable 5#extension GL_EXT_bfloat16 : enable 6#extension GL_EXT_float_e5m2 : enable 7#extension GL_EXT_float_e4m3 : enable 8#extension GL_ARM_tensors_bfloat16 : enable 9#extension GL_ARM_tensors_float_e5m2 : enable 10#extension GL_ARM_tensors_float_e4m3 : enable 11 12// Int types 13uniform tensorARM < int8_t , 1 > it8 ; 14uniform tensorARM < int16_t , 1 > it16 ; 15uniform tensorARM < int , 1 > it32 ; 16uniform tensorARM < int64_t , 1 > it64 ; 17 18// Uint types 19uniform tensorARM < uint8_t , 1 > ut8 ; 20uniform tensorARM < uint16_t , 1 > ut16 ; 21uniform tensorARM < uint , 1 > ut32 ; 22uniform tensorARM < uint64_t , 1 > ut64 ; 23 24// Float types 25uniform tensorARM < float16_t , 1 > ft16 ; 26uniform tensorARM < float , 1 > ft32 ; 27uniform tensorARM < float64_t , 1 > ft64 ; 28 29// bfloat16, e5m2 and e4m3 types 30uniform tensorARM < bfloat16_t , 1 > bft16 ; 31uniform tensorARM < floate5m2_t , 1 > fte5m2 ; 32uniform tensorARM < floate4m3_t , 1 > fte4m3 ; 33 34void main () { 35uint coords [] = { 0 } ; 36 37// Int types 38int8_t iw8 = int8_t ( 1 ) ; 39int16_t iw16 = 1 s ; 40int iw = 1 ; 41int64_t iw64 = 1l ; 42tensorWriteARM ( it8 , coords , iw8 ) ; 43tensorWriteARM ( it16 , coords , iw16 ) ; 44tensorWriteARM ( it32 , coords , iw ) ; 45tensorWriteARM ( it64 , coords , iw64 ) ; 46int iwv [ 4 ] = int []( 1 , 1 , 1 , 1 ) ; 47tensorWriteARM ( it32 , coords , iwv ) ; 48 49int8_t ir8 ; 50int16_t ir16 ; 51int ir ; 52int64_t ir64 ; 53tensorReadARM ( it8 , coords , ir8 ) ; 54tensorReadARM ( it16 , coords , ir16 ) ; 55tensorReadARM ( it32 , coords , ir ) ; 56tensorReadARM ( it64 , coords , ir64 ) ; 57int irv [ 4 ] ; 58tensorReadARM ( it32 , coords , irv ) ; 59 60// Uint types 61uint8_t uw8 = uint8_t ( 1 ) ; 62uint16_t uw16 = 1 s ; 63uint uw = 1 ; 64uint64_t uw64 = 1l ; 65tensorWriteARM ( ut8 , coords , uw8 ) ; 66tensorWriteARM ( ut16 , coords , uw16 ) ; 67tensorWriteARM ( ut32 , coords , uw ) ; 68tensorWriteARM ( ut64 , coords , uw64 ) ; 69uint uwv [ 4 ] = uint []( 1 , 1 , 1 , 1 ) ; 70tensorWriteARM ( ut32 , coords , uwv ) ; 71 72uint8_t ur8 ; 73uint16_t ur16 ; 74uint ur ; 75uint64_t ur64 ; 76tensorReadARM ( ut8 , coords , ur8 ) ; 77tensorReadARM ( ut16 , coords , ur16 ) ; 78tensorReadARM ( ut32 , coords , ur ) ; 79tensorReadARM ( ut64 , coords , ur64 ) ; 80uint urv [ 4 ] ; 81tensorReadARM ( ut32 , coords , urv ) ; 82 83// Float types 84float fw = 1.0 ; 85float16_t fw16 = 1.0 hf ; 86float64_t fw64 = 1.0 ; 87tensorWriteARM ( ft16 , coords , fw16 ) ; 88tensorWriteARM ( ft32 , coords , fw ) ; 89tensorWriteARM ( ft64 , coords , fw64 ) ; 90float fwv [ 4 ] = float []( 1.0 , 1.0 , 1.0 , 1.0 ) ; 91tensorWriteARM ( ft32 , coords , fwv ) ; 92 93float fr ; 94float16_t fr16 ; 95float64_t fr64 ; 96tensorReadARM ( ft16 , coords , fr16 ) ; 97tensorReadARM ( ft32 , coords , fr ) ; 98tensorReadARM ( ft64 , coords , fr64 ) ; 99float frv [ 4 ] ; 100tensorReadARM ( ft32 , coords , frv ) ; 101 102// bfloat16, e5m2 and e4m3 types 103bfloat16_t bf16w = bfloat16_t ( 1.0 ) ; 104floate5m2_t fe5m2w = floate5m2_t ( 1.0 ) ; 105floate4m3_t fe4m3w = floate4m3_t ( 1.0 ) ; 106tensorWriteARM ( bft16 , coords , bf16w ) ; 107tensorWriteARM ( fte5m2 , coords , fe5m2w ) ; 108tensorWriteARM ( fte4m3 , coords , fe4m3w ) ; 109 110const bfloat16_t bf16one = bfloat16_t ( 1.0 ) ; 111bfloat16_t bf16wv [ 4 ] = bfloat16_t []( bf16one , bf16one , bf16one , bf16one ) ; 112tensorWriteARM ( bft16 , coords , bf16wv ) ; 113 114const floate5m2_t fe5m2one = floate5m2_t ( 1.0 ) ; 115floate5m2_t fe5m2wv [ 4 ] = floate5m2_t []( fe5m2one , fe5m2one , fe5m2one , fe5m2one ) ; 116tensorWriteARM ( fte5m2 , coords , fe5m2wv ) ; 117 118floate4m3_t fe4m3one = floate4m3_t ( 1.0 ) ; 119floate4m3_t fe4m3wv [ 4 ] = floate4m3_t []( fe4m3one , fe4m3one , fe4m3one , fe4m3one ) ; 120tensorWriteARM ( fte4m3 , coords , fe4m3wv ) ; 121 122bfloat16_t bf16r ; 123floate5m2_t fe5m2r ; 124floate4m3_t fe4m3r ; 125tensorReadARM ( bft16 , coords , bf16r ) ; 126tensorReadARM ( fte5m2 , coords , fe5m2r ) ; 127tensorReadARM ( fte4m3 , coords , fe4m3r ) ; 128 129bfloat16_t bf16rv [ 4 ] ; 130floate5m2_t fe5m2rv [ 4 ] ; 131floate4m3_t fe4m3rv [ 4 ] ; 132tensorReadARM ( bft16 , coords , bf16rv ) ; 133tensorReadARM ( fte5m2 , coords , fe5m2rv ) ; 134tensorReadARM ( fte4m3 , coords , fe4m3rv ) ; 135}