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
759 B37 linesraw
1#include <stdint.h>
2#include <immintrin.h>
3#include <stdio.h>
4#include <assert.h>
5#include "../source/ggml.h"
6
7__forceinline float _cvtsh_ss( uint16_t f16 )
8{
9	__m128i i = _mm_cvtsi32_si128( f16 );
10	__m128 f = _mm_cvtph_ps( i );
11	return _mm_cvtss_f32( f );
12}
13
14__forceinline uint16_t _cvtss_sh( float f, int rounding )
15{
16	assert( 0 == rounding );
17	__m128 v = _mm_set_ss( f );
18	__m128i i = _mm_cvtps_ph( v, 0 );
19	return (uint16_t)(uint32_t)_mm_cvtsi128_si32( i );
20}
21
22FILE* fopen_msvc( const char* filename, const char* mode )
23{
24	FILE* stream;
25	errno_t err = fopen_s( &stream, filename, mode );
26	if( err == 0 )
27		return stream;
28	return NULL;
29}
30
31#define fopen fopen_msvc
32
33#include "../ML/testUtilsC.h"
34
35#define __F16C__
36#define __FMA__
37#include "../source/ggml.c"