From: stduhpf Date: Sun, 8 Dec 2024 18:19:19 +0000 (+0100) Subject: Vulkan: fix NaN in tanh.comp with AMD proprietary driver on Windows (llama/10723) X-Git-Tag: upstream/1.7.4~77 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=9ffbd3d969e4cc21a92a920a064279a5f2976111;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp Vulkan: fix NaN in tanh.comp with AMD proprietary driver on Windows (llama/10723) * Vulkan: fix NaN in tanh.comp * Faster NaN-free tanh --- diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp b/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp index 74630dc7..495f966b 100644 --- a/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp +++ b/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp @@ -16,6 +16,5 @@ void main() { if (i >= p.KX) { return; } - - data_d[i] = D_TYPE(tanh(data_a[i])); + data_d[i] = D_TYPE(1. - 2. / (exp(2.*data_a[i]) + 1.)); }