From: Borislav Stanimirov Date: Thu, 3 Aug 2023 08:03:24 +0000 (+0300) Subject: tests : fixed windows build (#426) X-Git-Tag: upstream/0.0.1642~1287 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=f6f55ff8252cd7ec09da49dec45de84b161634d2;p=pkg%2Fggml%2Fsources%2Fggml tests : fixed windows build (#426) --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f5d0160c..6a8ce8fe 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -194,6 +194,9 @@ set_property(TEST ${TEST_TARGET} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${TEST_ set(TEST_TARGET test-mul-mat0) add_executable(${TEST_TARGET} ${TEST_TARGET}.c) target_link_libraries(${TEST_TARGET} PRIVATE ggml ${GGML_EXTRA_LIBS}) +if (MSVC) + target_link_options(${TEST_TARGET} PRIVATE "/STACK: 8388608") # 8MB +endif() target_compile_options(${TEST_TARGET} PRIVATE ${GGML_EXTRA_FLAGS}) add_test(NAME ${TEST_TARGET} COMMAND $) set_property(TEST ${TEST_TARGET} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${TEST_TARGET}.profraw") @@ -274,6 +277,9 @@ set_property(TEST ${TEST_TARGET} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${TEST_ set(TEST_TARGET test-pool) add_executable(${TEST_TARGET} ${TEST_TARGET}.c) target_link_libraries(${TEST_TARGET} PRIVATE ggml) +if (MSVC) + target_link_options(${TEST_TARGET} PRIVATE "/STACK: 8388608") # 8MB +endif() add_test(NAME ${TEST_TARGET} COMMAND $) set_property(TEST ${TEST_TARGET} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${TEST_TARGET}.profraw") @@ -298,5 +304,8 @@ endif() set(TEST_TARGET test-customop) add_executable(${TEST_TARGET} ${TEST_TARGET}.c) target_link_libraries(${TEST_TARGET} PRIVATE ggml) +if (MSVC) + target_link_options(${TEST_TARGET} PRIVATE "/STACK: 8388608") # 8MB +endif() add_test(NAME ${TEST_TARGET} COMMAND $) set_property(TEST ${TEST_TARGET} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${TEST_TARGET}.profraw") diff --git a/tests/test-customop.c b/tests/test-customop.c index b4594751..ec261ec8 100644 --- a/tests/test-customop.c +++ b/tests/test-customop.c @@ -6,6 +6,7 @@ #if defined(_WIN32) #include +typedef volatile LONG atomic_int; static LONG atomic_fetch_add(atomic_int * ptr, LONG inc) { return InterlockedExchangeAdd(ptr, inc); } @@ -46,7 +47,7 @@ void custom1(struct ggml_tensor * dst , const struct ggml_tensor * a, int ith, i assert(ggml_is_contiguous(a)); // parallelize by elements - const int ne = ggml_nelements(dst); + const int ne = (int)ggml_nelements(dst); const int dr = (ne + nth - 1) / nth; const int ie0 = dr * ith; const int ie1 = MIN(ie0 + dr, ne); @@ -70,7 +71,7 @@ void custom2(struct ggml_tensor * dst , const struct ggml_tensor * a, const stru float * dst_data = ggml_get_data_f32(dst); // parallelize by rows - const int nr = ggml_nrows(dst); + const int nr = (int)ggml_nrows(dst); // number of rows per thread const int dr = (nr + nth - 1) / nth; // row range for this thread @@ -78,7 +79,7 @@ void custom2(struct ggml_tensor * dst , const struct ggml_tensor * a, const stru const int ir1 = MIN(ir0 + dr, nr); // number of columns - const int nc = dst->ne[0]; + const int nc = (int)dst->ne[0]; // this assumes that the tensors are contiguous assert(ggml_is_contiguous(dst)); @@ -112,7 +113,7 @@ void custom3(struct ggml_tensor * dst , const struct ggml_tensor * a, const stru assert(ith == 0); // number of elements - const int ne = ggml_nelements(dst); + const int ne = (int)ggml_nelements(dst); // this assumes that the tensors are contiguous assert(ggml_is_contiguous(dst));