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

KonstantinVAD CPU performance, slightly better code generation99b8774

master
1.6 KiB43 linesraw
1#pragma once
2#define _USE_MATH_DEFINES
3#include <stdint.h>
4#include <assert.h>
5#include <array>
6#include <vector>
7#include <algorithm>
8#include <emmintrin.h>	// SSE 2
9#include <smmintrin.h>	// SSE 4.1
10
11#define WIN32_LEAN_AND_MEAN
12#define NOMINMAX
13// Setup Windows SDK to only enable features available since Windows 8.0
14#include <WinSDKVer.h>
15#define _WIN32_WINNT _WIN32_WINNT_WIN8
16#define NTDDI_VERSION NTDDI_WIN8
17#include <sdkddkver.h>
18
19#include <windows.h>
20
21#define _XM_SSE4_INTRINSICS_
22#include <d3d11.h>
23#include <DirectXMath.h>
24
25#include <atlcomcli.h>
26#include "Utils/Logger.h"
27#include "Utils/miscUtils.h"
28
29// Build both legacy and DirectCompute implementations
30#define BUILD_BOTH_VERSIONS 0
31
32// Build hybrid model which uses DirectCompute only for the encode step of the algorithm, and decodes on CPU, using AVX SIMD and the Windows' built-in thread pool.
33// Disabled because on all computers I have in this house that hybrid model performed worse than D3D11 GPGPU model
34#define BUILD_HYBRID_VERSION 0
35
36// Enable debug traces. Should be disabled in production, the feature comes with a huge performance overhead.
37// When enabled, while computing things it streams gigabytes of data into that binary file.
38// See Tools / compareTraces project for a command-line app to compare these traces.
39#define SAVE_DEBUG_TRACE 0
40
41// In addition to collecting total GPU times per compute shader, also collect and print performance data about individual invocations of some of the most expensive shaders
42// The feature is relatively cheap in terms of performance overhead, but pretty much useless in production, and clutters debug console with all these numbers
43#define PROFILER_COLLECT_TAGS 0