whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Crash on DLL unload when compiled with Vulkan but forcing CPU

Open SRHMorris opened this issue 1 year ago • 0 comments

I've built whisper.cpp from commit 9e3c5345cd46ea718209db53464e426c3fe7a25e as a dll with Vulkan support and using the base.en model.

This is on windows with MSVC (VS version 17.11.0).

My code loads this dll at runtime, so essentially looks like this:

auto ggml = LoadLibrary("ggml.dll");
auto whisper = LoadLibrary("whisper.dll");

// load necessary functions, e.g.
auto whisper_context_default_params = reinterpret_cast<decltype(&::whisper_context_default_params)>(GetProcAddress(whisper, "whisper_context_default_params");
...

auto ctxParams = whisper_context_default_params();
ctxParams.use_gpu = false;

auto wparams = whisper_full_default_params(whisper_sampling_strategy::WHISPER_SAMPLING_BEAM_SEARCH);

// other code follows the example at the top of whisper.h to successfully transcribe a file

FreeLibrary(ggml); // crash here
FreeLibrary(whisper);

If I set ctxParams.use_gpu to true so that it successfully uses Vulkan I don't get the crash. As I only force the CPU for debugging, this isn't too important.

I'm unsure if this is a bug in GGML or Whisper.cpp, but as it is triggered via the Whisper.cpp API I've logged it here.

SRHMorris avatar Aug 22 '24 11:08 SRHMorris