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

KonstantinSource codes8c4603c

master
806 B30 linesraw
1// ggml_compute_forward_diag_mask_inf_f32
2RWBuffer<float> result: register( u0 );
3
4cbuffer Constants: register( b0 )
5{
6	uint4 elements: packoffset( c0 );
7	uint4 strides: packoffset( c1 );
8	uint 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{
16	const uint k = group.y;
17	const uint j = group.x;
18
19	// Start of the row
20	uint rdi = k * strides[ 2 ] + j * strides[ 1 ];
21	// End of the row
22	const uint rdiEnd = rdi + elements[ 0 ] * strides[ 0 ];
23	// First index to write in this thread
24	rdi += ( n_past + j + thread + 1 ) * strides[ 0 ];
25	// Index increment
26	const uint rdiInc = 32 * strides[ 0 ];
27
28	for( ; rdi < rdiEnd; rdi += rdiInc )
29		result[ rdi ] = negativeInfinity;
30}