From 64e3e74556f27247d444bcde4bc5873b27d75aae Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sun, 4 Jun 2023 18:04:52 +0800 Subject: [PATCH] change max value size_t to use limits --- ggml-opencl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ggml-opencl.cpp b/ggml-opencl.cpp index c0253c5e6..70adaf757 100644 --- a/ggml-opencl.cpp +++ b/ggml-opencl.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #define CL_TARGET_OPENCL_VERSION 110 #include @@ -608,7 +609,7 @@ static cl_mem ggml_cl_pool_malloc(size_t size, size_t * actual_size, cl_mem_flag scoped_spin_lock lock(g_cl_pool_lock); cl_int err; - int best_i = -1, best_size = (size_t)-1; //smallest unused buffer that fits our needs + int best_i = -1, best_size = std::numeric_limits::max(); //smallest unused buffer that fits our needs int worst_i = -1, worst_size = 0; //largest unused buffer seen so far for (int i = 0; i < MAX_CL_BUFFERS; ++i) { cl_buffer &b = g_cl_buffer_pool[i];