diff options
author | Herman Semenov <GermanAizek@yandex.ru> | 2024-05-20 07:33:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 10:33:21 +0300 |
commit | 213e90ed73f8ac3cd3026dc3f086beae0d414f96 (patch) | |
tree | 08fd8c354635baac81319b2d36816b7947351ab5 /ggml-opencl.cpp | |
parent | 65c58207ece92ad213f4bfd0f91dcb2dfb664f5b (diff) |
ggml-opencl, llama: using reserve() if count already known (#7272)
Diffstat (limited to 'ggml-opencl.cpp')
-rw-r--r-- | ggml-opencl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ggml-opencl.cpp b/ggml-opencl.cpp index 880a1495..922f2483 100644 --- a/ggml-opencl.cpp +++ b/ggml-opencl.cpp @@ -1,4 +1,4 @@ -#include "ggml.h" +#include "ggml.h" #include "ggml-opencl.h" #include "ggml-backend-impl.h" @@ -1835,7 +1835,10 @@ static void ggml_cl_mul_mat_q_f32(const ggml_tensor * src0, const ggml_tensor * CL_CHECK(clEnqueueNDRangeKernel(queue, *to_fp32_cl, 1, &offset, &global, local > 0 ? &local : NULL, events.size(), !events.empty() ? events.data() : NULL, NULL)); } - for (int64_t i12 = i02 * r2, e12 = i12 + r2; i12 < e12; i12++) { + int64_t i12 = i02 * r2; + int64_t e12 = i12 + r2; + events.reserve(e12 - i12); + for (; i12 < e12; i12++) { if (mul_mat_vec) { // specialized dequantize_mul_mat_vec kernel // copy src1 to device events.emplace_back(); |