Skip to content

Commit 068aff6

Browse files
committed
fix build on MSVC
1 parent 2fad388 commit 068aff6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#define _GNU_SOURCE // Defines CLOCK_MONOTONIC on Linux
22
#define _CRT_SECURE_NO_DEPRECATE // Disables ridiculous "unsafe" warnigns on Windows
3+
#define _USE_MATH_DEFINES // For M_PI on MSVC
34

45
#include "ggml.h"
56

@@ -12093,8 +12094,10 @@ static void ggml_compute_forward_clamp(
1209312094

1209412095
// ggml_compute_forward_rope
1209512096

12097+
#ifndef _MSC_VER
1209612098
// use -ffast-math so MIN and MAX are optimized to vminss and vmaxss
1209712099
__attribute__((optimize("-ffast-math"), always_inline))
12100+
#endif
1209812101
static inline float ggml_rope_ntkv2_ramp(const float low, const float high, const int i0) {
1209912102
const float y = (i0 / 2 - low) / MIN(0.001f, high - low);
1210012103
return 1 - MIN(1, MAX(0, y));

0 commit comments

Comments
 (0)