Skip to content

Commit 5dd942d

Browse files
authored
metal : disable fast-math for some cpy kernels (#14460)
* metal : disable fast-math for some cpy kernels ggml-ci * cont : disable for q4_1 ggml-ci * cont : disable for iq4_nl ggml-ci
1 parent a7417f5 commit 5dd942d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml/src/ggml-metal/ggml-metal.metal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ void quantize_q4_0(device const float * src, device block_q4_0 & dst) {
138138
}
139139

140140
void quantize_q4_1(device const float * src, device block_q4_1 & dst) {
141+
#pragma METAL fp math_mode(safe)
141142
float min = FLT_MAX;
142143
float max = -FLT_MAX;
143144

@@ -203,6 +204,7 @@ void quantize_q5_0(device const float * src, device block_q5_0 & dst) {
203204
}
204205

205206
void quantize_q5_1(device const float * src, device block_q5_1 & dst) {
207+
#pragma METAL fp math_mode(safe)
206208
float max = src[0];
207209
float min = src[0];
208210

@@ -239,6 +241,7 @@ void quantize_q5_1(device const float * src, device block_q5_1 & dst) {
239241
}
240242

241243
void quantize_iq4_nl(device const float * src, device block_iq4_nl & dst) {
244+
#pragma METAL fp math_mode(safe)
242245
float amax = 0.0f; // absolute max
243246
float max = 0.0f;
244247

0 commit comments

Comments
 (0)