Skip to content

Commit 01c04c1

Browse files
authored
Merge branch 'ggml-org:master' into lovedheart-vulkan-mxfp4-optimization
2 parents ef32c83 + baa9255 commit 01c04c1

File tree

7 files changed

+125
-99
lines changed

7 files changed

+125
-99
lines changed

.devops/cuda.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ RUN apt-get update \
6060
git \
6161
python3 \
6262
python3-pip \
63+
&& pip install --upgrade pip setuptools wheel \
6364
&& pip install --break-system-packages -r requirements.txt \
6465
&& apt autoremove -y \
6566
&& apt clean -y \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LLM inference in C/C++
1717

1818
## Hot topics
1919

20+
- **[guide : running gpt-oss with llama.cpp](https://github.com/ggml-org/llama.cpp/discussions/15396)**
2021
- **[[FEEDBACK] Better packaging for llama.cpp to support downstream consumers 🤗](https://github.com/ggml-org/llama.cpp/discussions/15313)**
2122
- Support for the `gpt-oss` model with native MXFP4 format has been added | [PR](https://github.com/ggml-org/llama.cpp/pull/15091) | [Collaboration with NVIDIA](https://blogs.nvidia.com/blog/rtx-ai-garage-openai-oss) | [Comment](https://github.com/ggml-org/llama.cpp/discussions/15095)
2223
- Hot PRs: [All](https://github.com/ggml-org/llama.cpp/pulls?q=is%3Apr+label%3Ahot+) | [Open](https://github.com/ggml-org/llama.cpp/pulls?q=is%3Apr+label%3Ahot+is%3Aopen)

ggml/src/ggml-quants.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ static float make_q3_quants(int n, int nmax, const float * GGML_RESTRICT x, int8
566566
for (int i = 0; i < n; ++i) {
567567
L[i] += nmax;
568568
}
569-
return sumlx / suml2;
569+
return suml2 > 0.0f ? sumlx / suml2 : 0.0f;
570570
}
571571
for (int i = 0; i < n; ++i) {
572572
int l = nearest_int(iscale * x[i]);
@@ -901,7 +901,7 @@ static float make_qp_quants(int n, int nmax, const float * GGML_RESTRICT x, uint
901901
for (int i = 0; i < n; ++i) {
902902
max = MAX(max, x[i]);
903903
}
904-
if (!max) { // all zero
904+
if (max < GROUP_MAX_EPS) { // all zero
905905
for (int i = 0; i < n; ++i) { L[i] = 0; }
906906
return 0.f;
907907
}
@@ -966,7 +966,7 @@ static float make_qp_quants(int n, int nmax, const float * GGML_RESTRICT x, uint
966966
break;
967967
}
968968
}
969-
return sumlx/suml2;
969+
return suml2 > 0.0f ? sumlx / suml2 : 0.0f;
970970
}
971971

972972
static void quantize_row_q2_K_impl(const float * GGML_RESTRICT x, block_q2_K * GGML_RESTRICT y, int k, const float * GGML_RESTRICT quant_weights) {
@@ -4266,7 +4266,7 @@ static void quantize_row_iq1_s_impl(const float * GGML_RESTRICT x, void * GGML_R
42664266
sumw[j+1] = sumw[j] + weight[i];
42674267
}
42684268
}
4269-
float best_score = -FLT_MIN, scale = max;
4269+
float best_score = -FLT_MAX, scale = max;
42704270
int besti1 = -1, besti2 = -1, best_shift = 0;
42714271
for (int i1 = 0; i1 <= block_size; ++i1) {
42724272
for (int i2 = i1; i2 <= block_size; ++i2) {
@@ -4442,7 +4442,7 @@ static void quantize_row_iq1_m_impl(const float * GGML_RESTRICT x, void * GGML_R
44424442
idx[2*j] = j;
44434443
}
44444444
qsort(pairs, block_size, 2*sizeof(float), iq1_sort_helper);
4445-
float best_score = -FLT_MIN, scale = max;
4445+
float best_score = -FLT_MAX, scale = max;
44464446
int besti1 = -1, besti2 = -1, best_k = -1;
44474447
// 0: +, +
44484448
// 1: +, -

ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ void string_to_spv_func(const std::string& _name, const std::string& in_fname, c
223223
std::string target_env = (name.find("_cm2") != std::string::npos) ? "--target-env=vulkan1.3" : "--target-env=vulkan1.2";
224224

225225
// disable spirv-opt for coopmat shaders for https://github.com/ggerganov/llama.cpp/issues/10734
226-
std::string opt_level = coopmat ? "" : "-O";
226+
// disable spirv-opt for bf16 shaders for https://github.com/ggml-org/llama.cpp/issues/15344
227+
std::string opt_level = (coopmat || name.find("bf16") != std::string::npos) ? "" : "-O";
227228

228229
#ifdef _WIN32
229230
std::vector<std::string> cmd = {GLSLC, "-fshader-stage=compute", target_env, opt_level, "\"" + in_path + "\"", "-o", "\"" + out_fname + "\""};

0 commit comments

Comments
 (0)