Diego Devesa commited on
Commit
b38cecf
·
1 Parent(s): a812efc

remove CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS (llama/10797)

Browse files
ggml/CMakeLists.txt CHANGED
@@ -32,6 +32,13 @@ else()
32
  endif()
33
  endif()
34
 
 
 
 
 
 
 
 
35
  option(BUILD_SHARED_LIBS "ggml: build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
36
  option(GGML_BACKEND_DL "ggml: build backends as dynamic libraries (requires BUILD_SHARED_LIBS)" OFF)
37
 
 
32
  endif()
33
  endif()
34
 
35
+ # remove the lib prefix on win32 mingw
36
+ if (WIN32)
37
+ set(CMAKE_STATIC_LIBRARY_PREFIX "")
38
+ set(CMAKE_SHARED_LIBRARY_PREFIX "")
39
+ set(CMAKE_SHARED_MODULE_PREFIX "")
40
+ endif()
41
+
42
  option(BUILD_SHARED_LIBS "ggml: build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
43
  option(GGML_BACKEND_DL "ggml: build backends as dynamic libraries (requires BUILD_SHARED_LIBS)" OFF)
44
 
ggml/src/CMakeLists.txt CHANGED
@@ -194,11 +194,6 @@ endif()
194
 
195
  if (WIN32)
196
  add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
197
-
198
- if (BUILD_SHARED_LIBS)
199
- # TODO: should not use this
200
- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
201
- endif()
202
  endif()
203
 
204
  # ggml
 
194
 
195
  if (WIN32)
196
  add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
 
 
 
 
 
197
  endif()
198
 
199
  # ggml
ggml/src/ggml-cpu/amx/amx.cpp CHANGED
@@ -122,7 +122,7 @@ static const char * ggml_backend_amx_buffer_type_get_name(ggml_backend_buffer_ty
122
  }
123
 
124
  static ggml_backend_buffer_t ggml_backend_amx_buffer_type_alloc_buffer(ggml_backend_buffer_type_t buft, size_t size) {
125
- void * data = aligned_alloc(TENSOR_ALIGNMENT, size);
126
  if (data == NULL) {
127
  fprintf(stderr, "%s: failed to allocate buffer of size %zu\n", __func__, size);
128
  return NULL;
 
122
  }
123
 
124
  static ggml_backend_buffer_t ggml_backend_amx_buffer_type_alloc_buffer(ggml_backend_buffer_type_t buft, size_t size) {
125
+ void * data = ggml_aligned_malloc(size);
126
  if (data == NULL) {
127
  fprintf(stderr, "%s: failed to allocate buffer of size %zu\n", __func__, size);
128
  return NULL;
ggml/src/ggml-cpu/ggml-cpu.c CHANGED
@@ -126,8 +126,7 @@ struct ggml_arm_arch_features_type {
126
  #endif
127
  #include <windows.h>
128
 
129
-
130
- #if !defined(__clang__)
131
  #define GGML_CACHE_ALIGN __declspec(align(GGML_CACHE_LINE))
132
 
133
  typedef volatile LONG atomic_int;
@@ -12945,7 +12944,7 @@ static thread_ret_t ggml_graph_compute_secondary_thread(void* data);
12945
  #include "windows.h"
12946
 
12947
  // TODO: support > 64 CPUs
12948
- bool ggml_thread_apply_affinity(bool * mask) {
12949
  HANDLE h = GetCurrentThread();
12950
  uint64_t bitmask = 0ULL;
12951
 
 
126
  #endif
127
  #include <windows.h>
128
 
129
+ #if defined(_MSC_VER) && !defined(__clang__)
 
130
  #define GGML_CACHE_ALIGN __declspec(align(GGML_CACHE_LINE))
131
 
132
  typedef volatile LONG atomic_int;
 
12944
  #include "windows.h"
12945
 
12946
  // TODO: support > 64 CPUs
12947
+ static bool ggml_thread_apply_affinity(bool * mask) {
12948
  HANDLE h = GetCurrentThread();
12949
  uint64_t bitmask = 0ULL;
12950
 
ggml/src/ggml-impl.h CHANGED
@@ -74,8 +74,8 @@ static inline int ggml_up(int n, int m) {
74
  //
75
 
76
  GGML_ATTRIBUTE_FORMAT(2, 3)
77
- void ggml_log_internal (enum ggml_log_level level, const char * format, ...);
78
- void ggml_log_callback_default(enum ggml_log_level level, const char * text, void * user_data);
79
 
80
  #define GGML_LOG(...) ggml_log_internal(GGML_LOG_LEVEL_NONE , __VA_ARGS__)
81
  #define GGML_LOG_INFO(...) ggml_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
@@ -304,8 +304,8 @@ struct ggml_cgraph ggml_graph_view(struct ggml_cgraph * cgraph, int i0, int i1);
304
 
305
  // Memory allocation
306
 
307
- void * ggml_aligned_malloc(size_t size);
308
- void ggml_aligned_free(void * ptr, size_t size);
309
 
310
  // FP16 to FP32 conversion
311
 
 
74
  //
75
 
76
  GGML_ATTRIBUTE_FORMAT(2, 3)
77
+ GGML_API void ggml_log_internal (enum ggml_log_level level, const char * format, ...);
78
+ GGML_API void ggml_log_callback_default(enum ggml_log_level level, const char * text, void * user_data);
79
 
80
  #define GGML_LOG(...) ggml_log_internal(GGML_LOG_LEVEL_NONE , __VA_ARGS__)
81
  #define GGML_LOG_INFO(...) ggml_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
 
304
 
305
  // Memory allocation
306
 
307
+ GGML_API void * ggml_aligned_malloc(size_t size);
308
+ GGML_API void ggml_aligned_free(void * ptr, size_t size);
309
 
310
  // FP16 to FP32 conversion
311
 
ggml/src/ggml-threading.h CHANGED
@@ -1,11 +1,13 @@
1
  #pragma once
2
 
 
 
3
  #ifdef __cplusplus
4
  extern "C" {
5
  #endif
6
 
7
- void ggml_critical_section_start(void);
8
- void ggml_critical_section_end(void);
9
 
10
  #ifdef __cplusplus
11
  }
 
1
  #pragma once
2
 
3
+ #include "ggml.h"
4
+
5
  #ifdef __cplusplus
6
  extern "C" {
7
  #endif
8
 
9
+ GGML_API void ggml_critical_section_start(void);
10
+ GGML_API void ggml_critical_section_end(void);
11
 
12
  #ifdef __cplusplus
13
  }