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/0.0.1642~81 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=e9c4d9c71d91fa60721b4037278d0793ca5f77a3;p=pkg%2Fggml%2Fsources%2Fggml 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/src/ggml-vulkan/vulkan-shaders/tanh.comp b/src/ggml-vulkan/vulkan-shaders/tanh.comp index 74630dc7..495f966b 100644 --- a/src/ggml-vulkan/vulkan-shaders/tanh.comp +++ b/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.)); }