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#ifndef THREADS 2#define THREADS 512 3#endif 4 5Buffer < float > arg0 :register ( t0 ); 6RWBuffer < float > result :register ( u0 ); 7 8cbuffer Constants :register ( b0 ) 9{ 10uint4 size :packoffset ( c0 ); 11uint4 strides :packoffset ( c1 ); 12uint4 argStrides :packoffset ( c3 ); 13} 14 15inline uint rowOffset ( uint3 idx , uint4 strides ) 16{ 17return idx [ 0 ] * strides [ 1 ] + idx [ 1 ] * strides [ 2 ] + idx [ 2 ] * strides [ 3 ]; 18} 19 20[ numthreads ( THREADS , 1 , 1 ) ] 21void main ( uint3 group : SV_GroupID , uint thread : SV_GroupIndex ) 22{ 23uint rdi = rowOffset ( group , strides ); 24uint rsi = rowOffset ( group , argStrides ); 25 26const uint rdiEnd = rdi + size [ 0 ] * strides [ 0 ]; 27rdi += thread * strides [ 0 ]; 28rsi += thread * argStrides [ 0 ]; 29 30const uint rdiInc = THREADS * strides [ 0 ]; 31const uint rsiInc = THREADS * argStrides [ 0 ]; 32 33for ( ; rdi < rdiEnd ; rdi += rdiInc , rsi += rsiInc ) 34{ 35float f = result [ rdi ]; 36f += arg0 [ rsi ]; 37result [ rdi ] = f ; 38} 39}