From 44ef87f07ad3362f2c24178163b48d86feee373c Mon Sep 17 00:00:00 2001 From: Saood Karim Date: Sun, 20 Apr 2025 22:08:03 -0500 Subject: [PATCH] Attempt fix 9 --- ggml/CMakeLists.txt | 3 +-- ggml/src/iqk/iqk_config.h | 7 +++++++ ggml/src/iqk/iqk_flash_attn.cpp | 4 ++-- ggml/src/iqk/iqk_mul_mat.cpp | 16 ++++++++-------- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ggml/CMakeLists.txt b/ggml/CMakeLists.txt index 9a238cf5..70e3bbf3 100644 --- a/ggml/CMakeLists.txt +++ b/ggml/CMakeLists.txt @@ -211,8 +211,7 @@ set(GGML_PUBLIC_HEADERS include/ggml-metal.h include/ggml-rpc.h include/ggml-sycl.h - include/ggml-vulkan.h - src/iqk/iqk_mul_mat.h) + include/ggml-vulkan.h) set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}") #if (GGML_METAL) diff --git a/ggml/src/iqk/iqk_config.h b/ggml/src/iqk/iqk_config.h index 29645f4e..08d10a08 100644 --- a/ggml/src/iqk/iqk_config.h +++ b/ggml/src/iqk/iqk_config.h @@ -14,6 +14,13 @@ #define IQK_IMPLEMENT #endif +#if defined(_WIN32) && !defined(__MINGW32__) +# define IQK_API __declspec(dllexport) +#endif +#else +# define IQK_API __attribute__ ((visibility ("default"))) +#endif + #ifdef _MSC_VER #define IQK_NOINLINE __declspec(noinline) #define IQK_ALWAYS_INLINE inline diff --git a/ggml/src/iqk/iqk_flash_attn.cpp b/ggml/src/iqk/iqk_flash_attn.cpp index a4fde8f8..02fe57fd 100644 --- a/ggml/src/iqk/iqk_flash_attn.cpp +++ b/ggml/src/iqk/iqk_flash_attn.cpp @@ -29,7 +29,7 @@ inline uint32_t simple_gcd(uint32_t a, uint32_t b) { // TODO: get the ggml_type enum here without polution // -extern "C" __attribute__ ((visibility ("default"))) bool iqk_flash_attn_noalibi(int type_q, int type_mask, float max_bias, +extern "C" IQK_API bool iqk_flash_attn_noalibi(int type_q, int type_mask, float max_bias, int neq3, int neq2, long nbq3, long nbq2, int nek3, int nek2, long nbk3, long nbk2, int nev3, int nev2, long nbv3, long nbv2, @@ -253,7 +253,7 @@ extern "C" __attribute__ ((visibility ("default"))) bool iqk_flash_attn_noalibi( #else -extern "C" __attribute__ ((visibility ("default"))) bool iqk_flash_attn_noalibi([[maybe_unused]] int type_q, [[maybe_unused]] int type_mask, [[maybe_unused]] float max_bias, +extern "C" IQK_API bool iqk_flash_attn_noalibi([[maybe_unused]] int type_q, [[maybe_unused]] int type_mask, [[maybe_unused]] float max_bias, [[maybe_unused]] int neq3, [[maybe_unused]] int neq2, [[maybe_unused]] long nbq3, [[maybe_unused]] long nbq2, [[maybe_unused]] int nek3, [[maybe_unused]] int nek2, [[maybe_unused]] long nbk3, [[maybe_unused]] long nbk2, [[maybe_unused]] int nev3, [[maybe_unused]] int nev2, [[maybe_unused]] long nbv3, [[maybe_unused]] long nbv2, diff --git a/ggml/src/iqk/iqk_mul_mat.cpp b/ggml/src/iqk/iqk_mul_mat.cpp index d8b4b2c9..29ae9d53 100644 --- a/ggml/src/iqk/iqk_mul_mat.cpp +++ b/ggml/src/iqk/iqk_mul_mat.cpp @@ -403,7 +403,7 @@ private: } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat(long Nx, long Ny, long ne00, +extern "C" IQK_API bool iqk_mul_mat(long Nx, long Ny, long ne00, int typeA, const void * A, long strideA, int typeB, const void * B, long strideB, float * C, long stride_C, int ith, int nth) { @@ -440,7 +440,7 @@ inline uint32_t simple_gcd(uint32_t a, uint32_t b) { } } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_4d(long Nx, long Ny, long ne00, +extern "C" IQK_API bool iqk_mul_mat_4d(long Nx, long Ny, long ne00, long ne02, long ne03, long ne12, long ne13, long nb02, long nb03, long nb12, long nb13, long nb2, long nb3, int typeA, const void * A, long strideA, @@ -545,7 +545,7 @@ extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_4d(long Nx, return true; } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_moe(long Nx, long Ny, long ne00, int ne11, +extern "C" IQK_API bool iqk_mul_mat_moe(long Nx, long Ny, long ne00, int ne11, int typeA, const void * A, long strideA, int typeB, const void * B, long strideB, float * C, long nb1, long nb2, const void * vrow_mapping, int ith, int nth) { @@ -571,7 +571,7 @@ extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_moe(long Nx return true; } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_moe_fused_up_gate(long Nx, long Ny, long ne00, int ne11, int unary_op, +extern "C" IQK_API bool iqk_moe_fused_up_gate(long Nx, long Ny, long ne00, int ne11, int unary_op, int typeA, const void * Aup, const void * Agate, long strideA, int typeB, const void * B, long strideB, float * C, long nb1, long nb2, const void * vrow_mapping, int ith, int nth) { @@ -17550,11 +17550,11 @@ bool iqk_flash_attn_impl(int int_type_k, // type of k #else // IQK_IMPLEMENT -extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat(int, long, long, long, int, const void *, long, int, const void *, long, float *, long, int, int) { +extern "C" IQK_API bool iqk_mul_mat(int, long, long, long, int, const void *, long, int, const void *, long, float *, long, int, int) { return false; } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_4d(long /*Nx*/, long /*Ny*/, long /*ne00*/, +extern "C" IQK_API bool iqk_mul_mat_4d(long /*Nx*/, long /*Ny*/, long /*ne00*/, long /*ne02*/, long /*ne03*/, long /*ne12*/, long /*ne13*/, long /*nb02*/, long /*nb03*/, long /*nb12*/, long /*nb13*/, long /*nb2*/, long /*nb3*/, int /*typeA*/, const void * /*A*/, long /*strideA*/, @@ -17563,12 +17563,12 @@ extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_4d(long /*N return false; } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_mul_mat_moe(long, long, long, int, int, const void *, long, int, const void *, long, float *, long, long, +extern "C" IQK_API bool iqk_mul_mat_moe(long, long, long, int, int, const void *, long, int, const void *, long, float *, long, long, const void *, int, int) { return false; } -extern "C" __attribute__ ((visibility ("default"))) bool iqk_moe_fused_up_gate(long /*Nx*/, long /*Ny*/, long /*ne00*/, int /*ne11*/, int /*unary_op*/, +extern "C" IQK_API bool iqk_moe_fused_up_gate(long /*Nx*/, long /*Ny*/, long /*ne00*/, int /*ne11*/, int /*unary_op*/, int /*typeA*/, const void * /*Aup*/, const void * /*Agate*/, long /*strideA*/, int /*typeB*/, const void * /*B*/, long /*strideB*/, float * /*C*/, long /*nb1*/, long /*nb2*/, const void * /*vrow_mapping*/, int /*ith*/, int /*nth*/) {