From 1944e7c33e611400c39436245cbbf9336a764c76 Mon Sep 17 00:00:00 2001
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Date: Wed, 4 Jan 2023 23:00:30 -0500
Subject: [PATCH] whisper : document POWER VSX support

---
 README.md   | 1 +
 ggml.c      | 8 ++++++++
 ggml.h      | 1 +
 whisper.cpp | 1 +
 4 files changed, 11 insertions(+)

diff --git a/README.md b/README.md
index 7a61da7..3347638 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ High-performance inference of [OpenAI's Whisper](https://github.com/openai/whisp
 - Plain C/C++ implementation without dependencies
 - Apple silicon first-class citizen - optimized via Arm Neon and Accelerate framework
 - AVX intrinsics support for x86 architectures
+- VSX intrinsics support for POWER architectures
 - Mixed F16 / F32 precision
 - Low memory usage (Flash Attention + Flash Forward)
 - Zero memory allocations at runtime
diff --git a/ggml.c b/ggml.c
index 497e734..ac37b0b 100644
--- a/ggml.c
+++ b/ggml.c
@@ -8232,4 +8232,12 @@ int ggml_cpu_has_blas(void) {
 #endif
 }
 
+int ggml_cpu_has_vsx(void) {
+#if defined(__POWER9_VECTOR__)
+    return 1;
+#else
+    return 0;
+#endif
+}
+
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/ggml.h b/ggml.h
index a217d2d..d066db9 100644
--- a/ggml.h
+++ b/ggml.h
@@ -731,6 +731,7 @@ int ggml_cpu_has_f16c(void);
 int ggml_cpu_has_fp16_va(void);
 int ggml_cpu_has_wasm_simd(void);
 int ggml_cpu_has_blas(void);
+int ggml_cpu_has_vsx(void);
 
 #ifdef  __cplusplus
 }
diff --git a/whisper.cpp b/whisper.cpp
index e6d050a..b8c3acc 100644
--- a/whisper.cpp
+++ b/whisper.cpp
@@ -2582,6 +2582,7 @@ const char * whisper_print_system_info(void) {
     s += "FP16_VA = "   + std::to_string(ggml_cpu_has_fp16_va())   + " | ";
     s += "WASM_SIMD = " + std::to_string(ggml_cpu_has_wasm_simd()) + " | ";
     s += "BLAS = "      + std::to_string(ggml_cpu_has_blas())      + " | ";
+    s += "VSX = "       + std::to_string(ggml_cpu_has_vsx())       + " | ";
 
     return s.c_str();
 }