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
978 B39 linesraw
1// ggml_compute_forward_conv_1d_1s_f16_f32, prepare kernel data (src0)
2// Dispatch [ ne01, ne02, 1 ] thread groups
3Buffer<float> arg0: register( t0 );
4RWBuffer<float> result: register( u0 );
5
6cbuffer Constants: register( b0 )
7{
8	uint4 src0_elements: packoffset( c0 );
9	uint4 src0_strides: packoffset( c1 );
10}
11
12inline uint roundUp32( uint x )
13{
14	return ( x + 31 ) & ( ~31u );
15}
16
17[ numthreads( 32, 1, 1 ) ]
18void main( uint3 group: SV_GroupID, uint thread : SV_GroupIndex )
19{
20	const uint nb01 = src0_strides[ 1 ];
21	const uint nb02 = src0_strides[ 2 ];
22
23	const uint ne00 = src0_elements[ 0 ];
24	const uint ne01 = src0_elements[ 1 ];
25	const uint ew0 = roundUp32( ne01 );
26
27	const uint i02 = group.y;
28	const uint i01 = group.x;
29
30	uint rsi = i02 * nb02 + i01 * nb01;
31	const uint rsiEnd = rsi + ne00;
32	uint rdi = i02 * ew0 * ne00 + i01;
33	rsi += thread;
34	rdi += thread * ew0;
35	const uint rdiInc = 32 * ew0;
36
37	for( ; rsi < rsiEnd; rsi += 32, rdi += rdiInc )
38		result[ rdi ] = arg0[ rsi ];
39}