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
1.1 KiB43 linesraw
1Buffer<float> arg0: register( t0 );
2Buffer<float> arg1: register( t1 );
3RWBuffer<float> result: register( u0 );
4
5cbuffer Constants: register( b0 )
6{
7	uint4 src0_elements: packoffset( c0 );
8	uint4 src0_strides: packoffset( c1 );
9	uint4 src1_elements: packoffset( c2 );
10	uint4 src1_strides: packoffset( c3 );
11	uint4 result_elements: packoffset( c4 );
12	uint4 result_strides: packoffset( c5 );
13}
14
15[ numthreads( 32, 1, 1 ) ]
16void main( uint3 group: SV_GroupID, uint thread : SV_GroupIndex )
17{
18	const uint j = group.x;
19	const uint nb1 = result_strides[ 1 ];
20	const uint nb01 = src0_strides[ 1 ];
21
22	const uint nb10 = src1_strides[ 0 ];
23	const uint nb11 = src1_strides[ 1 ];
24	const uint nc = src0_elements[ 0 ];
25
26	uint rsi0 = j * nb01;
27	uint rsi1 = j * nb11;
28	uint rdi = j * nb1;
29	const uint rsi0End = rsi0 + nc;
30
31	rsi0 += thread;
32	rsi1 += thread * nb10;
33	rdi += thread;
34
35	const uint rsi1Inc = 32 * nb10;
36	for( ; rsi0 < rsi0End; rsi0 += 32, rsi1 += rsi1Inc, rdi += 32 )
37	{
38		const float a = arg0[ rsi0 ];
39		const float b = arg1[ rsi1 ];
40		const float res = compute( a, b );
41		result[ rdi ] = res;
42	}
43}