change max value size_t to use limits

This commit is contained in:
Concedo 2023-06-04 18:04:52 +08:00
parent 2b700749e5
commit 64e3e74556

View file

@ -4,6 +4,7 @@
#include <atomic> #include <atomic>
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <limits>
#define CL_TARGET_OPENCL_VERSION 110 #define CL_TARGET_OPENCL_VERSION 110
#include <clblast.h> #include <clblast.h>
@ -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); scoped_spin_lock lock(g_cl_pool_lock);
cl_int err; 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<size_t>::max(); //smallest unused buffer that fits our needs
int worst_i = -1, worst_size = 0; //largest unused buffer seen so far int worst_i = -1, worst_size = 0; //largest unused buffer seen so far
for (int i = 0; i < MAX_CL_BUFFERS; ++i) { for (int i = 0; i < MAX_CL_BUFFERS; ++i) {
cl_buffer &b = g_cl_buffer_pool[i]; cl_buffer &b = g_cl_buffer_pool[i];