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
1.4 KiB72 linesraw
1#include "stdafx.h"
2#include "renderDoc.h"
3#include "renderdoc_app.h"
4#include "../device.h"
5
6#define ENABLE_RENDERDOC_DEBUGGER 1
7
8#if ENABLE_RENDERDOC_DEBUGGER
9namespace
10{
11	static HMODULE hmRenderDoc = nullptr;
12	static RENDERDOC_API_1_6_0* api = nullptr;
13}
14
15bool DirectCompute::initializeRenderDoc()
16{
17	hmRenderDoc = GetModuleHandleW( L"renderdoc.dll" );
18	if( nullptr == hmRenderDoc )
19		return false;
20
21	pRENDERDOC_GetAPI getApi = (pRENDERDOC_GetAPI)GetProcAddress( hmRenderDoc, "RENDERDOC_GetAPI" );
22	if( nullptr == getApi )
23		return false;
24	if( 1 != getApi( eRENDERDOC_API_Version_1_6_0, (void**)&api ) )
25		return false;
26	if( nullptr == api )
27		return false;
28
29	return true;
30}
31
32namespace
33{
34	using namespace DirectCompute;
35	inline bool isKeyPressed( int vKey )
36	{
37		return 0 != ( GetAsyncKeyState( vKey ) & 0x8000 );
38	}
39}
40
41CaptureRaii::CaptureRaii() : capturing( false )
42{
43	if( nullptr == api )
44		return;
45	if( !isKeyPressed( VK_F12 ) )
46		return;
47	ID3D11Device* const dev = device();
48	if( nullptr == dev )
49		return;
50
51	api->StartFrameCapture( dev, nullptr );
52	capturing = true;
53}
54
55CaptureRaii::~CaptureRaii()
56{
57	if( !capturing )
58		return;
59	api->EndFrameCapture( device(), nullptr );
60}
61#else	// !ENABLE_RENDERDOC_DEBUGGER
62bool DirectCompute::initializeRenderDoc()
63{
64	return false;
65}
66DirectCompute::CaptureRaii::CaptureRaii() : capturing( false )
67{
68}
69DirectCompute::CaptureRaii::~CaptureRaii()
70{
71}
72#endif