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

KonstantinMinor, logging and UXe953396

master
1.7 KiB63 linesraw
1#include "stdafx.h"
2#include "ModelAdvancedDlg.h"
3using Whisper::eGpuModelFlags;
4
5LRESULT ModelAdvancedDlg::onInitDialog( UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
6{
7	cbWave = GetDlgItem( IDC_WAVE );
8	cbReshapedMatMul = GetDlgItem( IDC_RESHAPED_MAT_MUL );
9	const uint32_t flags = appState.gpuFlagsLoad();
10
11	// Setup the "Compute shaders" combobox
12	cbWave.AddString( L"Wave64 shaders on AMD" );
13	cbWave.AddString( L"Wave32, always" );
14	cbWave.AddString( L"Wave64, always" );
15	int i = 0;
16	if( 0 != ( flags & (uint32_t)eGpuModelFlags::Wave32 ) )
17		i = 1;
18	else if( 0 != ( flags & (uint32_t)eGpuModelFlags::Wave64 ) )
19		i = 2;
20	cbWave.SetCurSel( i );
21
22	// Setup the "Reshaped multiply" combobox
23	cbReshapedMatMul.AddString( L"Reshape on AMD" );
24	cbReshapedMatMul.AddString( L"Don’t reshape tensors" );
25	cbReshapedMatMul.AddString( L"Reshape some tensors" );
26	i = 0;
27	if( 0 != ( flags & (uint32_t)eGpuModelFlags::NoReshapedMatMul ) )
28		i = 1;
29	else if( 0 != ( flags & (uint32_t)eGpuModelFlags::UseReshapedMatMul ) )
30		i = 2;
31	cbReshapedMatMul.SetCurSel( i );
32
33	return 0;
34}
35
36bool ModelAdvancedDlg::show( HWND owner )
37{
38	auto res = DoModal( owner );
39	return res == IDOK;
40}
41
42void ModelAdvancedDlg::onOk()
43{
44	// Gather values from these comboboxes
45	uint32_t flags = 0;
46
47	int i = cbWave.GetCurSel();
48	if( 1 == i )
49		flags |= (uint32_t)eGpuModelFlags::Wave32;
50	else if( 2 == i )
51		flags |= (uint32_t)eGpuModelFlags::Wave64;
52
53	i = cbReshapedMatMul.GetCurSel();
54	if( 1 == i )
55		flags |= (uint32_t)eGpuModelFlags::NoReshapedMatMul;
56	else if( 2 == i )
57		flags |= (uint32_t)eGpuModelFlags::UseReshapedMatMul;
58
59	// Save to registry
60	appState.gpuFlagsStore( flags );
61
62	EndDialog( IDOK );
63}