yum-archive/TaSTT-Whisper
High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model
git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper
8c4603c
master
1// ggml_compute_forward_diag_mask_inf_f32 2RWBuffer < float > result :register ( u0 ); 3 4cbuffer Constants :register ( b0 ) 5{ 6uint4 elements :packoffset ( c0 ); 7uint4 strides :packoffset ( c1 ); 8uint n_past :packoffset ( c2 . x ); 9} 10 11static const float negativeInfinity = asfloat ( 0xff800000 ); 12 13[ numthreads ( 32 , 1 , 1 )] 14void main ( uint3 group : SV_GroupID , uint thread : SV_GroupIndex ) 15{ 16const uint k = group . y ; 17const uint j = group . x ; 18 19// Start of the row 20uint rdi = k * strides [ 2 ] + j * strides [ 1 ]; 21// End of the row 22const uint rdiEnd = rdi + elements [ 0 ] * strides [ 0 ]; 23// First index to write in this thread 24rdi += ( n_past + j + thread + 1 ) * strides [ 0 ]; 25// Index increment 26const uint rdiInc = 32 * strides [ 0 ]; 27 28for ( ; rdi < rdiEnd ; rdi += rdiInc ) 29result [ rdi ] = negativeInfinity ; 30}