AnswerDotAI / gpu.cpp

A lightweight library for portable low-level GPU computation using WebGPU.
https://gpucpp.answer.ai
Apache License 2.0
3.75k stars 177 forks source link

Unable to catch exception in wgpuDeviceSetUncapturedErrorCallback #51

Open junjihashimoto opened 3 months ago

junjihashimoto commented 3 months ago

When calling dispatchKernel throws the runtime exception in wgpuDeviceSetUncapturedErrorCallback, try-catch around dispatchKernel does not catch the exception. https://github.com/AnswerDotAI/gpu.cpp/blob/main/gpu.h#L791

A thread other than the main thread may be throwing the exception. https://stackoverflow.com/questions/25282620/catching-exception-from-worker-thread-in-the-main-thread