diff options
| author | Konstantin <const@const.me> | 2023-01-18 21:10:40 +0100 |
|---|---|---|
| committer | Konstantin <const@const.me> | 2023-01-18 21:10:40 +0100 |
| commit | 670f889b7e3af360fbd66ae34bc74e7e393edbfe (patch) | |
| tree | 268707bf77309527d2e9cac02b8adf93c01d4d30 /Examples/WhisperDesktop/ModelAdvancedDlg.cpp | |
| parent | 11c399b70c7ad5664b6060b39632e6b9fa815350 (diff) | |
GUI to force specific version of the compute shaders
Diffstat (limited to 'Examples/WhisperDesktop/ModelAdvancedDlg.cpp')
| -rw-r--r-- | Examples/WhisperDesktop/ModelAdvancedDlg.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Examples/WhisperDesktop/ModelAdvancedDlg.cpp b/Examples/WhisperDesktop/ModelAdvancedDlg.cpp new file mode 100644 index 0000000..c72a838 --- /dev/null +++ b/Examples/WhisperDesktop/ModelAdvancedDlg.cpp @@ -0,0 +1,63 @@ +#include "stdafx.h" +#include "ModelAdvancedDlg.h" +using Whisper::eGpuModelFlags; + +LRESULT ModelAdvancedDlg::onInitDialog( UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) +{ + cbWave = GetDlgItem( IDC_WAVE ); + cbReshapedMatMul = GetDlgItem( IDC_RESHAPED_MAT_MUL ); + const uint32_t flags = appState.gpuFlagsLoad(); + + // Setup the "Compute shaders" combobox + cbWave.AddString( L"Wave64 shaders on AMD" ); + cbWave.AddString( L"Always use Wave32" ); + cbWave.AddString( L"Always use Wave64" ); + int i = 0; + if( 0 != ( flags & (uint32_t)eGpuModelFlags::Wave32 ) ) + i = 1; + else if( 0 != ( flags & (uint32_t)eGpuModelFlags::Wave64 ) ) + i = 2; + cbWave.SetCurSel( i ); + + // Setup the "reshaped multiply" combobox + cbReshapedMatMul.AddString( L"Reshape on AMD" ); + cbReshapedMatMul.AddString( L"Don’t reshape tensors" ); + cbReshapedMatMul.AddString( L"Reshape tensors" ); + i = 0; + if( 0 != ( flags & (uint32_t)eGpuModelFlags::NoReshapedMatMul ) ) + i = 1; + else if( 0 != ( flags & (uint32_t)eGpuModelFlags::UseReshapedMatMul ) ) + i = 2; + cbReshapedMatMul.SetCurSel( i ); + + return 0; +} + +bool ModelAdvancedDlg::show( HWND owner ) +{ + auto res = DoModal( owner ); + return res == IDOK; +} + +void ModelAdvancedDlg::onOk() +{ + // Gather values from these comboboxes + uint32_t flags = 0; + + int i = cbWave.GetCurSel(); + if( 1 == i ) + flags |= (uint32_t)eGpuModelFlags::Wave32; + else if( 2 == i ) + flags |= (uint32_t)eGpuModelFlags::Wave64; + + i = cbReshapedMatMul.GetCurSel(); + if( 1 == i ) + flags |= (uint32_t)eGpuModelFlags::NoReshapedMatMul; + else if( 2 == i ) + flags |= (uint32_t)eGpuModelFlags::UseReshapedMatMul; + + // Save to registry + appState.gpuFlagsStore( flags ); + + EndDialog( IDOK ); +}
\ No newline at end of file |
