Spaces:
Running
Running
boolemancer commited on
Commit ·
0c17e51
1
Parent(s): 8551a30
Fix the Windows pthread_create shim
Browse filesThe current implementation doesn't actually set the out parameter,
and it returns 0 on failure instead of on success.
- CMakeLists.txt +2 -2
- ggml.c +8 -2
CMakeLists.txt
CHANGED
|
@@ -143,8 +143,8 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES
|
|
| 143 |
else()
|
| 144 |
message(STATUS "x86 detected")
|
| 145 |
if (MSVC)
|
| 146 |
-
set(
|
| 147 |
-
set(
|
| 148 |
else()
|
| 149 |
if (EMSCRIPTEN)
|
| 150 |
# we require support for WASM SIMD 128-bit
|
|
|
|
| 143 |
else()
|
| 144 |
message(STATUS "x86 detected")
|
| 145 |
if (MSVC)
|
| 146 |
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
|
| 147 |
+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:AVX2")
|
| 148 |
else()
|
| 149 |
if (EMSCRIPTEN)
|
| 150 |
# we require support for WASM SIMD 128-bit
|
ggml.c
CHANGED
|
@@ -37,8 +37,14 @@ typedef HANDLE pthread_t;
|
|
| 37 |
|
| 38 |
typedef DWORD thread_ret_t;
|
| 39 |
static int pthread_create(pthread_t* out, void* unused, thread_ret_t(*func)(void*), void* arg) {
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
static int pthread_join(pthread_t thread, void* unused) {
|
|
|
|
| 37 |
|
| 38 |
typedef DWORD thread_ret_t;
|
| 39 |
static int pthread_create(pthread_t* out, void* unused, thread_ret_t(*func)(void*), void* arg) {
|
| 40 |
+
HANDLE handle = CreateThread(NULL, 0, func, arg, 0, NULL);
|
| 41 |
+
if (handle == NULL)
|
| 42 |
+
{
|
| 43 |
+
return EAGAIN;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
*out = handle;
|
| 47 |
+
return 0;
|
| 48 |
}
|
| 49 |
|
| 50 |
static int pthread_join(pthread_t thread, void* unused) {
|