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
898 B40 linesraw
1#pragma once
2#include <stdint.h>
3#include <assert.h>
4
5#define WIN32_LEAN_AND_MEAN
6#define NOMINMAX
7#include <windows.h>
8#include <atlstr.h>
9#include <d3d11.h>
10
11#include <vector>
12#include <array>
13#include <emmintrin.h>
14#include <smmintrin.h>
15
16#define CHECK( hr ) { const HRESULT __hr = ( hr ); if( FAILED( __hr ) ) return __hr; }
17
18inline __m128i load16( const int* rsi )
19{
20	return _mm_loadu_si128( ( const __m128i* )rsi );
21}
22inline __m128i load16( const uint32_t* rsi )
23{
24	return _mm_loadu_si128( ( const __m128i* )rsi );
25}
26inline __m128i load( const std::array<uint32_t, 4>& arr )
27{
28	return load16( arr.data() );
29}
30
31inline bool vectorEqual( __m128i a, __m128i b )
32{
33	__m128i xx = _mm_xor_si128( a, b );
34	return (bool)_mm_testz_si128( xx, xx );
35}
36
37void printError( HRESULT hr );
38
39inline const char* cstr( const CStringA& s ) { return s; }
40inline const wchar_t* cstr( const CString& s ) { return s; }