Skip to content

Commit 42e21c6

Browse files
authored
cuda : fix conflict with std::swap (#6186)
1 parent 1c51f98 commit 42e21c6

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ggml-cuda.cu

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ struct ggml_cuda_pool {
370370

371371
virtual void * alloc(size_t size, size_t * actual_size) = 0;
372372
virtual void free(void * ptr, size_t size) = 0;
373-
374-
ggml_cuda_pool() = default;
375-
ggml_cuda_pool(const ggml_cuda_pool &) = delete;
376-
ggml_cuda_pool(ggml_cuda_pool &&) = delete;
377-
ggml_cuda_pool& operator=(const ggml_cuda_pool &) = delete;
378-
ggml_cuda_pool& operator=(ggml_cuda_pool &&) = delete;
379373
};
380374

381375
struct ggml_cuda_pool_leg : public ggml_cuda_pool {
@@ -6969,7 +6963,7 @@ static __global__ void k_sum_rows_f32(const float * x, float * dst, const int nc
69696963
}
69706964

69716965
template<typename T>
6972-
static inline __device__ void swap(T & a, T & b) {
6966+
static inline __device__ void ggml_cuda_swap(T & a, T & b) {
69736967
T tmp = a;
69746968
a = b;
69756969
b = tmp;
@@ -6998,11 +6992,11 @@ static __global__ void k_argsort_f32_i32(const float * x, int * dst, const int n
69986992
if (ixj > col) {
69996993
if ((col & k) == 0) {
70006994
if (order == GGML_SORT_ORDER_ASC ? x_row[dst_row[col]] > x_row[dst_row[ixj]] : x_row[dst_row[col]] < x_row[dst_row[ixj]]) {
7001-
swap(dst_row[col], dst_row[ixj]);
6995+
ggml_cuda_swap(dst_row[col], dst_row[ixj]);
70026996
}
70036997
} else {
70046998
if (order == GGML_SORT_ORDER_ASC ? x_row[dst_row[col]] < x_row[dst_row[ixj]] : x_row[dst_row[col]] > x_row[dst_row[ixj]]) {
7005-
swap(dst_row[col], dst_row[ixj]);
6999+
ggml_cuda_swap(dst_row[col], dst_row[ixj]);
70067000
}
70077001
}
70087002
}

0 commit comments

Comments
 (0)