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
1020 B43 linesraw
1// ggml_compute_forward_conv_1d_1s_f16_f32, prepare source data (src1)
2// Dispatch [ ne11, 1, 1 ] thread groups
3Buffer<float> arg1: register( t0 );
4RWBuffer<float> result: register( u0 );
5
6cbuffer Constants: register( b0 )
7{
8	uint4 src0_elements: packoffset( c0 );
9	uint4 src1_elements: packoffset( c2 );
10	uint4 src1_strides: packoffset( c3 );
11}
12
13#include "miscUtils.hlsli"
14
15[ numthreads( 32, 1, 1 ) ]
16void main( uint3 group: SV_GroupID, uint thread : SV_GroupIndex )
17{
18	const uint i11 = group.x;
19
20	const uint ne00 = src0_elements[ 0 ];
21	const uint ne01 = src0_elements[ 1 ];
22	const uint ne10 = src1_elements[ 0 ];
23	const uint nb11 = src1_strides[ 1 ];
24
25	const uint nk = ne00;
26	const uint nh = nk / 2;
27	const int ew0 = roundUp32( ne01 );
28
29	uint rsi = i11 * nb11;
30	uint rdi = nh * ew0 + i11;
31	const uint rdiInc = ew0 * 32;
32	const uint rsiEnd = rsi + ne10;
33
34	rsi += thread;
35	rdi += thread * ew0;
36
37	for( ; rsi < rsiEnd; rsi += 32, rdi += rdiInc )
38	{
39		float f = arg1[ rsi ];
40		f = adjustFp16( f );
41		result[ rdi ] = f;
42	}
43}